Interface IStructureCreator
- All Known Subinterfaces:
- IStructureCreator2
- All Known Implementing Classes:
- StructureCreator,- ZipFileStructureCreator
IStructureComparators for a given input object.
 In addition, it provides methods for locating a path in the hierarchical structure
 and to map a node of this structure back to the corresponding input object.
 Structure creators are used in the following contexts:
- 
 the StructureDiffVieweruses anIStructureCreatorto build two (or three) tree structures of its input elements (methodgetStructure). These trees are then compared with each other by means of the differencing engine and displayed with theDiffTreeViewer,
- 
 the ReplaceWithEditionDialoguses anIStructureCreatorto map a path back to a range of characters in the textual representation.
 A IStructureCreator provides methods for rewriting the tree produced by the differencing
 engine to support "smart" structural differencing. E.g. certain patterns of pairs of "addition"
 and "deletion" nodes can be detected as renames and merged into a single node.
 
Clients may implement this interface; there is no standard implementation.
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptiongetContents(Object node, 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.voidsave(IStructureComparator node, Object input) Called whenever a copy operation has been performed on a tree node.
- 
Method Details- 
getNameString getName()Returns a descriptive name which can be used in the UI of theStructureDiffViewer.- Returns:
- a descriptive name for this IStructureCreator
 
- 
getStructureCreates 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.- Parameters:
- input- the object from which to create the tree of- IStructureComparator
- Returns:
- the root node of the structure or nullin case of error
 
- 
locateCreates 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.- Parameters:
- path- specifies a sub object within the input object
- input- the object from which to create the- IStructureComparator
- Returns:
- the single node specified by pathornull
 
- 
getContentsReturns 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.- Parameters:
- node- 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
 
- 
saveCalled whenever a copy operation has been performed on a tree node.- Parameters:
- node- the node for which to save the new content
- input- the object from which the structure tree was created in- getStructure
 
 
-