Package org.apache.directory.ldapstudio.schemas.view.viewers.wrappers

Examples of org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement


     *      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 );

            schemasView.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 = schemasView.getViewer().testFindItem( wrapper );
        if ( foundItem != null ) // The node we are looking for is already loaded in the TreeViewer
        {
            schemasView.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 = schemasView.findElementInTree( wrapper );

            if ( foundElement != null )
            {
                expandFromTopToBottom( foundElement );
                schemasView.getViewer().setSelection( structuredSelection );
View Full Code Here


     *      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 );
View Full Code Here

     * @return
     *      the element if it has been found, null if has not been found
     */
    public DisplayableTreeElement findElementInTree( DisplayableTreeElement element )
    {
        DisplayableTreeElement input = ( DisplayableTreeElement ) getViewer().getInput();

        return findElementInTree( element, input );
    }
View Full Code Here

        {
            Object[] children = contentProvider.getChildren( current );

            for ( int i = 0; i < children.length; i++ )
            {
                DisplayableTreeElement item = ( DisplayableTreeElement ) children[i];
                DisplayableTreeElement foundElement = findElementInTree( element, item );
                if ( foundElement != null )
                {
                    return foundElement;
                }
            }
View Full Code Here

     * @return
     *      the element if it has been found, null if has not been found
     */
    public DisplayableTreeElement findElementInTree( DisplayableTreeElement element )
    {
        DisplayableTreeElement input = ( DisplayableTreeElement ) getViewer().getInput();

        return findElementInTree( element, input );
    }
View Full Code Here

        {
            Object[] children = contentProvider.getChildren( current );

            for ( int i = 0; i < children.length; i++ )
            {
                DisplayableTreeElement item = ( DisplayableTreeElement ) children[i];
                DisplayableTreeElement foundElement = findElementInTree( element, item );
                if ( foundElement != null )
                {
                    return foundElement;
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.