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

Examples of org.apache.directory.ldapstudio.schemas.view.views.wrappers.AttributeTypeWrapper


        StructuredSelection structuredSelection = null;
        ITreeNode wrapper = null;

        if ( schemaElement instanceof AttributeType )
        {
            wrapper = new AttributeTypeWrapper( ( AttributeType ) schemaElement, null );
            structuredSelection = new StructuredSelection( wrapper );

            view.getViewer().setSelection( structuredSelection, true );
        }
        else if ( schemaElement instanceof ObjectClass )
View Full Code Here


            expandFromTopToBottom( objectClassWrapper.getParent() );
            view.getViewer().setExpandedState( objectClassWrapper, true );
        }
        else if ( element instanceof AttributeTypeWrapper )
        {
            AttributeTypeWrapper attributeTypeWrapper = ( AttributeTypeWrapper ) element;
            expandFromTopToBottom( attributeTypeWrapper.getParent() );
            view.getViewer().setExpandedState( attributeTypeWrapper, true );
        }
        else if ( element instanceof IntermediateNode )
        {
            IntermediateNode intermediateNode = ( IntermediateNode ) element;
View Full Code Here

            {
                // ATTRIBUTE TYPES
                List<AttributeType> attributeTypes = schemaPool.getAttributeTypes();
                for ( AttributeType attributeType : attributeTypes )
                {
                    root.addChild( new AttributeTypeWrapper( attributeType, root ) );
                }

                // OBJECT CLASSES
                List<ObjectClass> objectClasses = schemaPool.getObjectClasses();
                for ( ObjectClass objectClass : objectClasses )
View Full Code Here

        // ATTRIBUTE TYPES
        AttributeType[] attributeTypes = schema.getAttributeTypesAsArray();
        for ( AttributeType attributeType : attributeTypes )
        {
            root.addChild( new AttributeTypeWrapper( attributeType, root ) );
        }

        // OBJECT CLASSES
        ObjectClass[] objectClasses = schema.getObjectClassesAsArray();
        for ( ObjectClass objectClass : objectClasses )
View Full Code Here

        SchemaElementsViewRoot root = ( SchemaElementsViewRoot ) viewer.getInput();
        Object element = e.getNewValue();

        if ( element instanceof AttributeType )
        {
            root.addChild( new AttributeTypeWrapper( ( AttributeType ) element, root ) );
        }
        else if ( element instanceof ObjectClass )
        {
            root.addChild( new ObjectClassWrapper( ( ObjectClass ) element, root ) );
        }
View Full Code Here

        }
        else if ( parentElement instanceof AttributeType )
        {
            AttributeType at = ( AttributeType ) parentElement;

            AttributeTypeWrapper atw = new AttributeTypeWrapper( at, null );
            children = new ArrayList<ITreeNode>();
            children.add( atw );
        }
        else if ( parentElement instanceof ObjectClassWrapper )
        {
            ObjectClassWrapper ocw = ( ObjectClassWrapper ) parentElement;
            ObjectClass oc = ocw.getMyObjectClass();

            if ( mode == PluginConstants.PREFS_HIERARCHY_VIEW_MODE_SUPERTYPE )
            {
                String[] superiors = oc.getSuperiors();
                for ( String superior : superiors )
                {
                    if ( superior != null || "".equals( superior ) ) //$NON-NLS-1$
                    {
                        ObjectClass supOC = schemaPool.getObjectClass( superior );
                        if ( supOC != null )
                        {
                            ObjectClassWrapper supOCW = new ObjectClassWrapper( supOC, ocw );
                            ocw.addChild( supOCW );
                        }
                    }
                }
            }
            else if ( mode == PluginConstants.PREFS_HIERARCHY_VIEW_MODE_SUBTYPE )
            {
                for ( ObjectClass objectClass : objectClasses )
                {
                    String[] superiors = objectClass.getSuperiors();
                    for ( String superior : superiors )
                    {
                        if ( superior != null || "".equals( superior ) ) //$NON-NLS-1$
                        {
                            ObjectClass supOC = schemaPool.getObjectClass( superior );
                            if ( supOC != null && oc.equals( supOC ) )
                            {
                                ObjectClassWrapper supOCW = new ObjectClassWrapper( objectClass, ocw );
                                ocw.addChild( supOCW );
                            }
                        }
                    }
                }
            }

            children = ocw.getChildren();
        }
        else if ( parentElement instanceof AttributeTypeWrapper )
        {
            AttributeTypeWrapper atw = ( AttributeTypeWrapper ) parentElement;
            AttributeType at = atw.getMyAttributeType();

            if ( mode == PluginConstants.PREFS_HIERARCHY_VIEW_MODE_SUPERTYPE )
            {
                String superior = at.getSuperior();
                if ( superior != null || "".equals( superior ) ) //$NON-NLS-1$
                {
                    AttributeType supAT = schemaPool.getAttributeType( superior );
                    if ( supAT != null )
                    {
                        AttributeTypeWrapper supATW = new AttributeTypeWrapper( supAT, atw );
                        atw.addChild( supATW );
                    }
                }
            }
            else if ( mode == PluginConstants.PREFS_HIERARCHY_VIEW_MODE_SUBTYPE )
            {
                for ( AttributeType attributeType : attributeTypes )
                {
                    String superior = attributeType.getSuperior();
                    if ( superior != null && !"".equals( superior ) ) //$NON-NLS-1$
                    {
                        AttributeType supAT = schemaPool.getAttributeType( superior );
                        if ( supAT != null && at.equals( supAT ) )
                        {
                            AttributeTypeWrapper supATW = new AttributeTypeWrapper( attributeType, atw );
                            atw.addChild( supATW );
                        }
                    }
                }
            }
View Full Code Here

        StructuredSelection structuredSelection = null;
        ITreeNode wrapper = null;

        if ( o instanceof AttributeType )
        {
            wrapper = new AttributeTypeWrapper( ( AttributeType ) o, null );
            structuredSelection = new StructuredSelection( wrapper );
        }
        else if ( o instanceof ObjectClass )
        {
            wrapper = new ObjectClassWrapper( ( ObjectClass ) o, null );
View Full Code Here

            expandFromTopToBottom( objectClassWrapper.getParent() );
            schemasView.getViewer().setExpandedState( objectClassWrapper, true );
        }
        else if ( element instanceof AttributeTypeWrapper )
        {
            AttributeTypeWrapper attributeTypeWrapper = ( AttributeTypeWrapper ) element;
            expandFromTopToBottom( attributeTypeWrapper.getParent() );
            schemasView.getViewer().setExpandedState( attributeTypeWrapper, true );
        }
        else if ( element instanceof IntermediateNode )
        {
            IntermediateNode intermediateNode = ( IntermediateNode ) element;
View Full Code Here

                    Schema schema = ( ( SchemaWrapper ) intermediate.getParent() ).getMySchema();

                    AttributeType[] ats = schema.getAttributeTypesAsArray();
                    for ( AttributeType at : ats )
                    {
                        intermediate.addChild( new AttributeTypeWrapper( at, intermediate ) );
                    }
                }
                else if ( intermediate.getType().equals( IntermediateNodeType.OBJECT_CLASS_FOLDER ) )
                {
                    Schema schema = ( ( SchemaWrapper ) intermediate.getParent() ).getMySchema();

                    ObjectClass[] ocs = schema.getObjectClassesAsArray();
                    for ( ObjectClass oc : ocs )
                    {
                        intermediate.addChild( new ObjectClassWrapper( oc, intermediate ) );
                    }
                }
            }

            children = intermediate.getChildren();

            // Sort by
            if ( sortBy == PluginConstants.PREFS_SCHEMAS_VIEW_SORTING_BY_FIRSTNAME )
            {
                Collections.sort( children, firstNameSorter );
            }
            else if ( sortBy == PluginConstants.PREFS_SCHEMAS_VIEW_SORTING_BY_OID )
            {
                Collections.sort( children, oidSorter );
            }

            // Sort order
            if ( sortOrder == PluginConstants.PREFS_SCHEMAS_VIEW_SORTING_ORDER_DESCENDING )
            {
                Collections.reverse( children );
            }
        }
        else if ( parentElement instanceof SchemaWrapper )
        {
            SchemaWrapper schemaWrapper = ( SchemaWrapper ) parentElement;

            if ( group == PluginConstants.PREFS_SCHEMAS_VIEW_GROUPING_FOLDERS )
            {
                if ( schemaWrapper.getChildren().isEmpty() )
                {
                    IntermediateNode attributeTypes = new IntermediateNode(
                        "Attribute Types", ( SchemaWrapper ) parentElement, IntermediateNodeType.ATTRIBUTE_TYPE_FOLDER ); //$NON-NLS-1$
                    IntermediateNode objectClasses = new IntermediateNode(
                        "Object Classes", ( SchemaWrapper ) parentElement, IntermediateNodeType.OBJECT_CLASS_FOLDER ); //$NON-NLS-1$
                    schemaWrapper.addChild( attributeTypes );
                    schemaWrapper.addChild( objectClasses );
                }

                children = schemaWrapper.getChildren();
            }
            else if ( group == PluginConstants.PREFS_SCHEMAS_VIEW_GROUPING_MIXED )
            {
                if ( schemaWrapper.getChildren().isEmpty() )
                {
                    Schema schema = schemaWrapper.getMySchema();

                    AttributeType[] ats = schema.getAttributeTypesAsArray();
                    for ( AttributeType at : ats )
                    {
                        schemaWrapper.addChild( new AttributeTypeWrapper( at, schemaWrapper ) );
                    }

                    ObjectClass[] ocs = schema.getObjectClassesAsArray();
                    for ( ObjectClass oc : ocs )
                    {
View Full Code Here

        // Creating and adding the new element
        ITreeNode newElement = null;
        if ( element instanceof AttributeType )
        {
            newElement = new AttributeTypeWrapper( ( AttributeType ) element, parentNode );
        }
        else if ( element instanceof ObjectClass )
        {
            newElement = new ObjectClassWrapper( ( ObjectClass ) element, parentNode );
        }
View Full Code Here

TOP

Related Classes of org.apache.directory.ldapstudio.schemas.view.views.wrappers.AttributeTypeWrapper

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.