* the id of the editor
*/
private void linkViewWithEditor( String editorName, String editorID )
{
StructuredSelection structuredSelection = null;
DisplayableTreeElement wrapper = null;
// Only editors for attribute types and object class are accepted
if ( editorID.equals( AttributeTypeFormEditor.ID ) )
{
AttributeType at = SchemaPool.getInstance().getAttributeType( editorName );
wrapper = new AttributeTypeWrapper( at, null );
structuredSelection = new StructuredSelection( wrapper );
hierarchyView.getViewer().setSelection( structuredSelection, true );
}
else if ( editorID.equals( ObjectClassFormEditor.ID ) )
{
ObjectClass oc = SchemaPool.getInstance().getObjectClass( editorName );
wrapper = new ObjectClassWrapper( oc, null );
structuredSelection = new StructuredSelection( wrapper );
}
else
{
// If the editor isn't an attribute type editor or object class editor, we return
return;
}
Object foundItem = hierarchyView.getViewer().testFindItem( wrapper );
if ( foundItem != null ) // The node we are looking for is already loaded in the TreeViewer
{
hierarchyView.getViewer().setSelection( structuredSelection, true );
}
else
// The node we are looking for is not yet loaded in the TreeViewer, we have to find and load it.
{
DisplayableTreeElement foundElement = hierarchyView.findElementInTree( wrapper );
if ( foundElement != null )
{
expandFromTopToBottom( foundElement );
hierarchyView.getViewer().setSelection( structuredSelection );