Class StructureRootNode
java.lang.Object
org.eclipse.compare.structuremergeviewer.DocumentRangeNode
org.eclipse.compare.structuremergeviewer.StructureRootNode
- All Implemented Interfaces:
- IDocumentRange,- IEditableContent,- IEditableContentExtension,- IEncodedStreamContentAccessor,- IStreamContentAccessor,- ITypedElement,- IStructureComparator,- IAdaptable,- IDisposable
A node that acts as the root of the tree returned from a
 
StructureCreator. This node performs the following tasks tasks:
 - It adapts to an ISharedDocumentAdapterthat provides the proper document key (seegetAdapter(Class)).
- It invokes IStructureCreator.save(IStructureComparator, Object)whennodeChanged(DocumentRangeNode)is called.
- It disposes of the IDisposableprovided in the constructor whendispose()is called.
This class may be subclassed by clients.
- Since:
- 3.3
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringThe string constant (value"root") that is used as the id of the root node.static final intThe integer constant (value0) that is used as the type code of the root node.Fields inherited from interface org.eclipse.compare.contentmergeviewer.IDocumentRangeRANGE_CATEGORYFields inherited from interface org.eclipse.compare.ITypedElementFOLDER_TYPE, TEXT_TYPE, UNKNOWN_TYPE
- 
Constructor SummaryConstructorsConstructorDescriptionStructureRootNode(IDocument document, Object input, StructureCreator creator, ISharedDocumentAdapter adapter) Create the structure root node.
- 
Method SummaryModifier and TypeMethodDescriptionvoiddispose()Disposes of this service.<T> TgetAdapter(Class<T> adapter) OverrideIAdaptable.getAdapter(Class)in order to provide anISharedDocumentAdapterthat provides the proper look up key based on the input from which this structure node was created.getImage()Returns an image for this object.getName()Returns the name of this object.getType()Returns the type of this object.booleanReturn whether the typed element being displayed is read-only. a read-only element will require a call to validateEdit before the element can be modified on disk.protected voidnodeChanged(DocumentRangeNode node) Override in order to invokeIStructureCreator.save(IStructureComparator, Object)when the contents of a node have changed.replace(ITypedElement child, ITypedElement other) This method is called on a parent to add or remove a child, or to copy the contents of a child.validateEdit(Shell shell) If the element is read-only, this method should be called to attempt to make it writable.Methods inherited from class org.eclipse.compare.structuremergeviewer.DocumentRangeNodeaddChild, equals, getAppendPosition, getCharset, getChildren, getContents, getDocument, getId, getParentNode, getRange, getTypeCode, hashCode, internalSetContents, isEditable, setAppendPosition, setContent, setId, setLength
- 
Field Details- 
ROOT_TYPEpublic static final int ROOT_TYPEThe integer constant (value0) that is used as the type code of the root node.- See Also:
 
- 
ROOT_IDThe string constant (value"root") that is used as the id of the root node.- See Also:
 
 
- 
- 
Constructor Details
- 
Method Details- 
disposepublic void dispose()Description copied from interface:IDisposableDisposes of this service. All resources must be freed. All listeners must be detached. Dispose will only be called once during the life cycle of a service.- Specified by:
- disposein interface- IDisposable
 
- 
getAdapterOverrideIAdaptable.getAdapter(Class)in order to provide anISharedDocumentAdapterthat provides the proper look up key based on the input from which this structure node was created.- Specified by:
- getAdapterin interface- IAdaptable
- Overrides:
- getAdapterin class- DocumentRangeNode
- Type Parameters:
- T- the class type
- Parameters:
- adapter- the adapter class to look up
- Returns:
- the object adapted to the given class or null
- See Also:
 
- 
nodeChangedOverride in order to invokeIStructureCreator.save(IStructureComparator, Object)when the contents of a node have changed.- Overrides:
- nodeChangedin class- DocumentRangeNode
- Parameters:
- node- the changed node
 
- 
replaceDescription copied from interface:IEditableContentThis method is called on a parent to add or remove a child, or to copy the contents of a child. What to do is encoded in the two arguments as follows:add: dest == null src != null remove: dest != null src == null copy: dest != null src != null - Specified by:
- replacein interface- IEditableContent
- Overrides:
- replacein class- DocumentRangeNode
- Parameters:
- child- the existing child of this object to be replaced; if- nulla new child can be added.
- other- the new child to be added or replaced; if- nullan existing child can be removed.
- Returns:
- the argument dest
 
- 
getImageDescription copied from interface:ITypedElementReturns an image for this object. This image is used when displaying this object in the UI.- Specified by:
- getImagein interface- ITypedElement
- Returns:
- the image of this object or nullif this type of input has no image
 
- 
getNameDescription copied from interface:ITypedElementReturns the name of this object. The name is used when displaying this object in the UI.- Specified by:
- getNamein interface- ITypedElement
- Returns:
- the name of this object
 
- 
getTypeDescription copied from interface:ITypedElementReturns the type of this object. For objects with a file name this is typically the file extension. For folders its the constantFOLDER_TYPE. The type is used for determining a suitable viewer for this object.- Specified by:
- getTypein interface- ITypedElement
- Returns:
- the type of this object
 
- 
isReadOnlypublic boolean isReadOnly()Description copied from interface:IEditableContentExtensionReturn whether the typed element being displayed is read-only. a read-only element will require a call to validateEdit before the element can be modified on disk.- Specified by:
- isReadOnlyin interface- IEditableContentExtension
- Overrides:
- isReadOnlyin class- DocumentRangeNode
- Returns:
- whether the typed element is read-only
 
- 
validateEditDescription copied from interface:IEditableContentExtensionIf the element is read-only, this method should be called to attempt to make it writable.- Specified by:
- validateEditin interface- IEditableContentExtension
- Overrides:
- validateEditin class- DocumentRangeNode
- Parameters:
- shell- a shell used to prompt the user if required.
- Returns:
- a status object that is OKif things are fine, otherwise a status describing reasons why modifying the given files is not reasonable. A status with a severity ofCANCELis returned if the validation was canceled, indicating the edit should not proceed.
 
 
-