public class StructureRootNode extends DocumentRangeNode implements IDisposable, ITypedElement
StructureCreator.
This node performs the following tasks tasks:
ISharedDocumentAdapter that provides the proper
document key (@see getAdapter(Class)).IStructureCreator.save(IStructureComparator, Object)
when nodeChanged(DocumentRangeNode) is called.IDisposable provided in the constructor when
dispose() is called.This class may be subclassed by clients.
| Modifier and Type | Field and Description |
|---|---|
static String |
ROOT_ID
The string constant (value
"root") that is used as the id of the root node. |
static int |
ROOT_TYPE
The integer constant (value
0) that is used as the type code of the root node. |
FOLDER_TYPE, TEXT_TYPE, UNKNOWN_TYPERANGE_CATEGORY| Constructor and Description |
|---|
StructureRootNode(IDocument document,
Object input,
StructureCreator creator,
ISharedDocumentAdapter adapter)
Create the structure root node.
|
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Disposes of this service.
|
Object |
getAdapter(Class adapter)
Override
IAdaptable.getAdapter(Class) in order to provide
an ISharedDocumentAdapter that provides the proper look up key based
on the input from which this structure node was created. |
Image |
getImage()
Returns an image for this object.
|
String |
getName()
Returns the name of this object.
|
String |
getType()
Returns the type of this object.
|
boolean |
isReadOnly()
Return 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 void |
nodeChanged(DocumentRangeNode node)
Override in order to invoke
IStructureCreator.save(IStructureComparator, Object) when the
contents of a node have changed. |
ITypedElement |
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.
|
IStatus |
validateEdit(Shell shell)
If the element is read-only, this method should be called
to attempt to make it writable.
|
addChild, equals, getAppendPosition, getCharset, getChildren, getContents, getDocument, getId, getParentNode, getRange, getTypeCode, hashCode, internalSetContents, isEditable, setAppendPosition, setContent, setId, setLengthpublic static final int ROOT_TYPE
0) that is used as the type code of the root node.public static final String ROOT_ID
"root") that is used as the id of the root node.public StructureRootNode(IDocument document, Object input, StructureCreator creator, ISharedDocumentAdapter adapter)
document - the documentinput - the input associated with the documentcreator - the structure creator that is creating the nodeadapter - the shared document adapter from which the document was obtained or null
if the document was not obtained from an ISharedDocumentAdapterpublic void dispose()
IDisposabledispose in interface IDisposablepublic Object getAdapter(Class adapter)
IAdaptable.getAdapter(Class) in order to provide
an ISharedDocumentAdapter that provides the proper look up key based
on the input from which this structure node was created.getAdapter in interface IAdaptablegetAdapter in class DocumentRangeNodeadapter - the adapter class to look upnullIAdaptable.getAdapter(Class)protected void nodeChanged(DocumentRangeNode node)
IStructureCreator.save(IStructureComparator, Object) when the
contents of a node have changed.nodeChanged in class DocumentRangeNodenode - the changed nodepublic ITypedElement replace(ITypedElement child, ITypedElement other)
IEditableContent| add: | dest == null | src != null |
| remove: | dest != null | src == null |
| copy: | dest != null | src != null |
replace in interface IEditableContentreplace in class DocumentRangeNodechild - the existing child of this object to be replaced; if null a new child can be added.other - the new child to be added or replaced; if null an existing child can be removed.destpublic Image getImage()
ITypedElementgetImage in interface ITypedElementnull if this type of input has no imagepublic String getName()
ITypedElementgetName in interface ITypedElementpublic String getType()
ITypedElementFOLDER_TYPE.
The type is used for determining a suitable viewer for this object.getType in interface ITypedElementpublic boolean isReadOnly()
IEditableContentExtensionisReadOnly in interface IEditableContentExtensionisReadOnly in class DocumentRangeNodepublic IStatus validateEdit(Shell shell)
IEditableContentExtensionvalidateEdit in interface IEditableContentExtensionvalidateEdit in class DocumentRangeNodeshell - a shell used to prompt the user if required.OK if things are fine,
otherwise a status describing reasons why modifying the given files is not
reasonable. A status with a severity of CANCEL is returned
if the validation was canceled, indicating the edit should not proceed.
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.