Package org.eclipse.compare
Class ZipFileStructureCreator
java.lang.Object
org.eclipse.compare.ZipFileStructureCreator
- All Implemented Interfaces:
- IStructureCreator
This implementation of the 
IStructureCreator interface
 makes the contents of a zip archive available as a
 hierarchical structure of IStructureComparators.
 It is used when comparing the internal structure of a zip archive.
- Since:
- 2.0
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a new ZipFileStructureCreator.ZipFileStructureCreator(String title) Create a new ZipFileStructureCreator with the given title.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanReturnsfalsesince thisIStructureCreatorcannot rewrite the diff tree in order to fold certain combinations of additions and deletions.booleancanSave()Returnsfalsesince we cannot update a zip archive.getContents(Object o, boolean ignoreWhitespace) Returns the contents of the given node as a string for the purpose of performing a content comparison only (that is the string will not be visible in the UI).getName()Returns a descriptive name which can be used in the UI of theStructureDiffViewer.getStructure(Object input) Creates a tree structure consisting ofIStructureComparators from the given object and returns its root object.Creates the single node specified by path from the given input object.voidrewriteTree(Differencer differencer, IDiffContainer root) Empty implementation since thisIStructureCreatorcannot rewrite the diff tree in order to fold certain combinations of additions and deletions.voidsave(IStructureComparator structure, Object input) Called whenever a copy operation has been performed on a tree node.
- 
Constructor Details- 
ZipFileStructureCreatorpublic ZipFileStructureCreator()Create a new ZipFileStructureCreator.
- 
ZipFileStructureCreatorCreate a new ZipFileStructureCreator with the given title. The title is returned by the methodgetName().- Parameters:
- title- the title of this structure creator
 
 
- 
- 
Method Details- 
getNameDescription copied from interface:IStructureCreatorReturns a descriptive name which can be used in the UI of theStructureDiffViewer.- Specified by:
- getNamein interface- IStructureCreator
- Returns:
- a descriptive name for this IStructureCreator
 
- 
getStructureDescription copied from interface:IStructureCreatorCreates a tree structure consisting ofIStructureComparators from the given object and returns its root object. Implementing this method typically involves parsing the input object. In case of an error (e.g. a parsing error) the valuenullis returned.- Specified by:
- getStructurein interface- IStructureCreator
- Parameters:
- input- the object from which to create the tree of- IStructureComparator
- Returns:
- the root node of the structure or nullin case of error
 
- 
getContentsDescription copied from interface:IStructureCreatorReturns the contents of the given node as a string for the purpose of performing a content comparison only (that is the string will not be visible in the UI). IfignoreWhitespaceistrueall character sequences considered whitespace should be removed from the returned string.- Specified by:
- getContentsin interface- IStructureCreator
- Parameters:
- o- the node for which to return a string representation
- ignoreWhitespace- if- truethe returned string should not contain whitespace
- Returns:
- the string contents of the given node
 
- 
canSavepublic boolean canSave()Returnsfalsesince we cannot update a zip archive.- Returns:
- false
 
- 
saveCalled whenever a copy operation has been performed on a tree node. This implementation throws anAssertionFailedExceptionsince we cannot update a zip archive.- Specified by:
- savein interface- IStructureCreator
- Parameters:
- structure- the node for which to save the new content
- input- the object from which the structure tree was created in- getStructure
 
- 
locateDescription copied from interface:IStructureCreatorCreates the single node specified by path from the given input object. In case of an error (e.g. a parsing error) the valuenullis returned. This method is similar togetStructurebut in contrast togetStructureonly a single node without any children must be returned. This method is used in theReplaceWithEditionDialogto locate a sub element (e.g. a method) within an input object (e.g. a file containing source code).One (not optimized) approach to implement this method is calling getStructure(input)to build the full tree, and then finding that node within the tree that is specified bypath.The syntax of pathis not specified, because it is treated by the compare subsystem as an opaque entity and is not further interpreted. Clients using this functionality will pass a value ofpathto theselectEditionmethod ofReplaceWithEditionDialogand will receive this value unchanged as an argument tolocate.- Specified by:
- locatein interface- IStructureCreator
- Parameters:
- path- specifies a sub object within the input object
- source- the object from which to create the- IStructureComparator
- Returns:
- the single node specified by pathornull
 
- 
canRewriteTreepublic boolean canRewriteTree()Returnsfalsesince thisIStructureCreatorcannot rewrite the diff tree in order to fold certain combinations of additions and deletions.Note: this method is for internal use only. Clients should not call this method. - Returns:
- false
 
- 
rewriteTreeEmpty implementation since thisIStructureCreatorcannot rewrite the diff tree in order to fold certain combinations of additions and deletions.Note: this method is for internal use only. Clients should not call this method. - Parameters:
- differencer- the differencer used to rewrite
- root- the root to rewrite
 
 
-