Previous topic  Top  Next topic  Print this Topic
 

Schema of ExtandableTreeProvider

 

<!ELEMENT extension (provider*)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED>

 

point - a fully qualified identifier of the target extension point
id - an optional identifier of the extension instance
name - an optional name of the extension instance

 

 <!ELEMENT provider (viewContribution*)>

<!ATTLIST provider

id              CDATA #REQUIRED

class           CDATA #REQUIRED

sub-provider-of CDATA #IMPLIED>

 

id - a unique identifier used to reference this content provider.
class - the fully qualified name of the class that implements org.neontoolkit.gui.navigator.ITreeDataProvider.
sub-provider-of - The unique identifier of the parent provider in the provider hierarchy. This attribute is optional, providers located on the root level of the tree have no parent providers.

 

 <!ELEMENT viewContribution >

<!ATTLIST viewContribution

id    CDATA #IMPLIED

id - a unique identifier used to reference the component which should display the contents of this extension.

 

The interface of ITreeDataProvider must be implemented and provides the following methods:

Method

Descripton

void dispose()

This method is invoked, when the object is disposed. Clean up operations can be done here

int getChildCount(ITreeElement parentElement)

The number of child elements depending on the passed parent element parentElement should be returned

ITreeElement[] getChildren(ITreeElement parentElement, int topIndex, int amount)

Should return the subset of amount children of parentElement, beginning at index topIndex.

ITreeElement[] getElements(ITreeElement parentElement, int topIndex, int amount)

This method should return the given amount of root elements of this provider beginning at index topIndex. The passed parentElement is an element of the parent provider or null if none

String getId()

Returns the id of this provider.

Image getImage(ITreeElement element)

Should return the image of the tree element (which was provided by this provider) to be displayed in the UI.

TreeElementPath[] getPathElements(ITreeElement element)

This method is required for searching in the tree. If the passed element is provided by this provider or by a subprovider of this provider, this method should return a TreeElementPath containing only the elements of the path from the element to the root of the tree which are provided by this provider. If elements appear multiple times in the tree, multiple paths are possible, so an array has to be returned.

String getText(ITreeElement element)

Should return the text of the tree element (which was provided by this provider) to be displayed in the UI.

void setId(String id)

Sets the identifier of this provider. This method is invoked from the framework to set the id specified in the plugin.xml.

void setViewer(ComplexTreeViewer viewer)

Passes the reference to the TreeViewer that displays the content of this provider. The reference is used to perform refresh operations

boolean isDragSupported()

The developer can define the general behavior of the elements provided by this provider. If true is returned, the elements can generally be dragged, if a handler for this kind of drag is registered. If false is returned, these elements cannot be dragged at all.

boolean isDropSupported()

The developer can define the general drop policy on elements provided by this provider. If true is returned, it is possible to drop elements on the elements of this provider (if a dropHandler is registered for this kind of drop). If false is returned, these elements do not support any drop operation at all.