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

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


     */
    public Object[] getChildren( Object parentElement )
    {
        if ( parentElement instanceof SchemaElementsViewRoot )
        {
            SchemaElementsViewRoot root = ( SchemaElementsViewRoot ) parentElement;

            List<ITreeNode> children = new ArrayList<ITreeNode>();

            int group = store.getInt( PluginConstants.PREFS_SCHEMA_ELEMENTS_VIEW_GROUPING );
            int sortBy = store.getInt( PluginConstants.PREFS_SCHEMA_ELEMENTS_VIEW_SORTING_BY );
            int sortOrder = store.getInt( PluginConstants.PREFS_SCHEMA_ELEMENTS_VIEW_SORTING_ORDER );
            boolean hideAttributeTypes = Activator.getDefault().getDialogSettings().getBoolean(
                HideAttributeTypesAction.HIDE_ATTRIBUTE_TYPES_DS_KEY );
            boolean hideObjectClasses = Activator.getDefault().getDialogSettings().getBoolean(
                HideObjectClassesAction.HIDE_OBJECT_CLASSES_DS_KEY );

            if ( root.getChildren().isEmpty() )
            {
                // 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 )
                {
                    root.addChild( new ObjectClassWrapper( objectClass, root ) );
                }
            }

            List<AttributeTypeWrapper> atList = new ArrayList<AttributeTypeWrapper>();
            List<ObjectClassWrapper> ocList = new ArrayList<ObjectClassWrapper>();

            if ( !hideAttributeTypes )
            {
                atList = root.getAttributeTypes();
            }
            if ( !hideObjectClasses )
            {
                ocList = root.getObjectClasses();
            }

            if ( group == PluginConstants.PREFS_SCHEMA_ELEMENTS_VIEW_GROUPING_ATFIRST )
            {
                // Sort by
View Full Code Here


            case OCRemoved:
                aTOrOCRemoved( p, e );
                break;

            case PoolReloaded:
                viewer.setInput( new SchemaElementsViewRoot() );
                break;

            default:
                break;
        }
View Full Code Here

     * @param e
     *      the event
     */
    private void schemaAdded( SchemaPool p, LDAPModelEvent e )
    {
        SchemaElementsViewRoot root = ( SchemaElementsViewRoot ) viewer.getInput();
        Schema schema = ( Schema ) e.getNewValue();

        // 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 )
        {
            root.addChild( new ObjectClassWrapper( objectClass, root ) );
        }

        viewer.refresh();
    }
View Full Code Here

     * @param e
     *      the event
     */
    private void aTOrOCAdded( SchemaPool p, LDAPModelEvent e )
    {
        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 ) );
        }

        viewer.refresh();
    }
View Full Code Here

     * @return
     *      the associated wrapper, null if no wrapper is found
     */
    private ITreeNode getWrapper( SchemaElement schemaElement )
    {
        SchemaElementsViewRoot root = ( SchemaElementsViewRoot ) viewer.getInput();

        if ( schemaElement instanceof AttributeType )
        {
            List<AttributeTypeWrapper> atws = root.getAttributeTypes();
            for ( AttributeTypeWrapper atw : atws )
            {
                if ( atw.getMyAttributeType().equals( schemaElement ) )
                {
                    return atw;
                }
            }
        }
        else if ( schemaElement instanceof ObjectClass )
        {
            List<ObjectClassWrapper> ocws = root.getObjectClasses();
            for ( ObjectClassWrapper ocw : ocws )
            {
                if ( ocw.getMyObjectClass().equals( schemaElement ) )
                {
                    return ocw;
View Full Code Here

        viewer = new TreeViewer( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
        contentProvider = new SchemaElementsViewContentProvider( viewer );
        viewer.setContentProvider( contentProvider );
        viewer.setLabelProvider( new DecoratingLabelProvider( new SchemaElementsViewLabelProvider(), Activator
            .getDefault().getWorkbench().getDecoratorManager().getLabelDecorator() ) );
        viewer.setInput( new SchemaElementsViewRoot() );
    }
View Full Code Here

TOP

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

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.