directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r475786 [11/13] - in /directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin: ./ META-INF/ icons/ ressources/ ressources/help/ ressources/help/html/ ressources/help/html/concepts/ ressources/help/html/concepts/images/ ressources/...
Date Thu, 16 Nov 2006 16:05:29 GMT
Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchicalViewer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchicalViewer.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchicalViewer.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchicalViewer.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,145 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.view.viewers;
+
+
+import java.util.Comparator;
+
+import org.apache.directory.ldapstudio.schemas.controller.Application;
+import org.apache.directory.ldapstudio.schemas.controller.HierarchicalViewerController;
+import org.apache.directory.ldapstudio.schemas.controller.actions.SortHierarchicalViewAction;
+import org.apache.directory.ldapstudio.schemas.model.LDAPModelEvent;
+import org.apache.directory.ldapstudio.schemas.model.PoolListener;
+import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+
+
+public class HierarchicalViewer extends ViewPart implements PoolListener
+{
+    public static final String ID = Application.PLUGIN_ID + ".view.HierarchicalViewer"; //$NON-NLS-1$
+    private TreeViewer viewer;
+    private Composite parent;
+    private HierarchicalContentProvider contentProvider;
+
+
+    /**
+     * @return the internal tree viewer
+     */
+    public TreeViewer getViewer()
+    {
+        return viewer;
+    }
+
+
+    /******************************************
+     *        Interfaces Implementation       *
+     ******************************************/
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+     */
+    public void createPartControl( Composite parent )
+    {
+        this.parent = parent;
+        initViewer();
+        IToolBarManager toolbar = getViewSite().getActionBars().getToolBarManager();
+        toolbar.add( new SortHierarchicalViewAction( PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
+            SortHierarchicalViewAction.SortType.alphabetical, Messages
+                .getString( "HierarchicalViewer.Sort_alphabetically" ) ) ); //$NON-NLS-1$
+        toolbar.add( new SortHierarchicalViewAction( PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
+            SortHierarchicalViewAction.SortType.unalphabetical, Messages
+                .getString( "HierarchicalViewer.Sort_unalphabetically" ) ) ); //$NON-NLS-1$
+    }
+
+
+    private void initViewer()
+    {
+        SchemaPool pool = SchemaPool.getInstance();
+        //we want to be notified if the pool has been modified
+        pool.addListener( this );
+
+        viewer = new TreeViewer( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
+        contentProvider = new HierarchicalContentProvider( pool );
+        contentProvider.bindToTreeViewer( viewer );
+        viewer.addDoubleClickListener( HierarchicalViewerController.getInstance() );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+     */
+    public void setFocus()
+    {
+        viewer.getControl().setFocus();
+    }
+
+
+    /******************************************
+     *                 Logic                  *
+     ******************************************/
+
+    /**
+     * Refresh the entire view
+     */
+    public void refresh()
+    {
+        //it seems there is a bug with the default element expanding system
+        Object[] exp = viewer.getExpandedElements();
+
+        //refresh the tree viewer
+        viewer.refresh();
+
+        //expand all the previsouly expanded elements
+        for ( Object object : exp )
+        {
+            viewer.setExpandedState( object, true );
+        }
+    }
+
+
+    /**
+     * Specify the comparator that will be used to sort the elements in that viewer
+     * @param order the comparator
+     */
+    public void setOrder( Comparator order )
+    {
+        contentProvider.setOrder( order );
+        refresh();
+    }
+
+
+    /******************************************
+     *            Pool Listener Impl          *
+     ******************************************/
+
+    /**
+     * refresh the view if the pool has been modified
+     */
+    public void poolChanged( SchemaPool p, LDAPModelEvent e )
+    {
+        refresh();
+    }
+}
\ No newline at end of file

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/Messages.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/Messages.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/Messages.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/Messages.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.view.viewers;
+
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+
+public class Messages
+{
+    private static final String BUNDLE_NAME = "org.apache.directory.ldapstudio.schemas.view.viewers.messages"; //$NON-NLS-1$
+
+    private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
+
+
+    private Messages()
+    {
+    }
+
+
+    public static String getString( String key )
+    {
+        try
+        {
+            return RESOURCE_BUNDLE.getString( key );
+        }
+        catch ( MissingResourceException e )
+        {
+            return '!' + key + '!';
+        }
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManager.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManager.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManager.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManager.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,273 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.view.viewers;
+
+
+import java.util.Comparator;
+
+import org.apache.directory.ldapstudio.schemas.controller.Application;
+import org.apache.directory.ldapstudio.schemas.controller.PoolManagerController;
+import org.apache.directory.ldapstudio.schemas.controller.actions.CreateANewAttributeTypeAction;
+import org.apache.directory.ldapstudio.schemas.controller.actions.CreateANewObjectClassAction;
+import org.apache.directory.ldapstudio.schemas.controller.actions.CreateANewSchemaAction;
+import org.apache.directory.ldapstudio.schemas.controller.actions.DeleteAction;
+import org.apache.directory.ldapstudio.schemas.controller.actions.OpenLocalFileAction;
+import org.apache.directory.ldapstudio.schemas.controller.actions.RemoveSchemaAction;
+import org.apache.directory.ldapstudio.schemas.controller.actions.SortPoolManagerAction;
+import org.apache.directory.ldapstudio.schemas.model.LDAPModelEvent;
+import org.apache.directory.ldapstudio.schemas.model.PoolListener;
+import org.apache.directory.ldapstudio.schemas.model.Schema;
+import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
+import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTarget;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.ISaveablePart2;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+
+
+public class PoolManager extends ViewPart implements PoolListener, ISaveablePart2
+{
+    public static final String ID = Application.PLUGIN_ID + ".view.PoolManager"; //$NON-NLS-1$
+
+    private static Logger logger = Logger.getLogger( PoolManager.class );
+    private TreeViewer viewer;
+    private Composite parent;
+    private PoolManagerContentProvider contentProvider;
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+     */
+    @Override
+    public void createPartControl( Composite parent )
+    {
+        this.parent = parent;
+        initViewer();
+        IToolBarManager toolbar = getViewSite().getActionBars().getToolBarManager();
+        toolbar.add( new OpenLocalFileAction() );
+        toolbar.add( new CreateANewSchemaAction() );
+        toolbar.add( new RemoveSchemaAction() );
+        toolbar.add( new Separator() );
+        toolbar.add( new CreateANewObjectClassAction() );
+        toolbar.add( new CreateANewAttributeTypeAction() );
+        toolbar.add( new DeleteAction() );
+        toolbar.add( new Separator() );
+        toolbar.add( new SortPoolManagerAction( PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
+            SortPoolManagerAction.SortType.alphabetical, Messages.getString( "PoolManager.Sort_alphabetically" ) ) ); //$NON-NLS-1$
+        toolbar.add( new SortPoolManagerAction( PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
+            SortPoolManagerAction.SortType.unalphabetical, Messages.getString( "PoolManager.Sort_unalphabetically" ) ) ); //$NON-NLS-1$
+
+        // ContextMenu Creation
+        createContextMenu();
+    }
+
+
+    private MenuManager createContextMenu()
+    {
+        MenuManager menu = new MenuManager( "" ); //$NON-NLS-1$
+        menu.setRemoveAllWhenShown( true );
+        //contextual-menu handling via the singleton controller instance
+        menu.addMenuListener( PoolManagerController.getInstance() );
+        // set the context menu to the table viewer
+        viewer.getControl().setMenu( menu.createContextMenu( viewer.getControl() ) );
+        // register the context menu to enable extension actions
+        getSite().registerContextMenu( menu, viewer );
+        return menu;
+    }
+
+
+    private void initViewer()
+    {
+        SchemaPool pool = SchemaPool.getInstance();
+        //we want to be notified if the pool has been modified
+        pool.addListener( this );
+
+        viewer = new TreeViewer( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
+        contentProvider = new PoolManagerContentProvider();
+        contentProvider.bindToTreeViewer( viewer );
+
+        //double-click handling via the singleton controller instance
+        viewer.addDoubleClickListener( PoolManagerController.getInstance() );
+
+        //drag&drop handling via the singleton controller instance
+        int operations = DND.DROP_COPY;
+        DropTarget target = new DropTarget( viewer.getControl(), operations );
+        //we only support file dropping on the viewer
+        Transfer[] types = new Transfer[]
+            { FileTransfer.getInstance() };
+        target.setTransfer( types );
+        target.addDropListener( PoolManagerController.getInstance() );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+     */
+    @Override
+    public void setFocus()
+    {
+        viewer.getControl().setFocus();
+    }
+
+
+    /******************************************
+     *                 Logic                  *
+     ******************************************/
+
+    /**
+     * Refresh the entire view
+     */
+    public void refresh()
+    {
+        //it seems there is a bug with the default element expanding system
+        Object[] exp = viewer.getExpandedElements();
+
+        //refresh the tree viewer
+        viewer.refresh();
+
+        //expand all the previsouly expanded elements
+        for ( Object object : exp )
+        {
+            viewer.setExpandedState( object, true );
+        }
+    }
+
+
+    /**
+     * Specify the comparator that will be used to sort the elements in that viewer
+     * @param order the comparator
+     */
+    public void setOrder( Comparator order )
+    {
+        contentProvider.setOrder( order );
+        refresh();
+    }
+
+
+    /******************************************
+     *            Pool Listener Impl          *
+     ******************************************/
+
+    /**
+     * We refresh the view only if the pool has been modified
+     */
+    public void poolChanged( SchemaPool p, LDAPModelEvent e )
+    {
+        //refresh the tree viewer
+        viewer.refresh();
+    }
+
+
+    /**
+     * @return the internal tree viewer
+     */
+    public TreeViewer getViewer()
+    {
+        return viewer;
+    }
+
+
+    public int promptToSaveOnClose()
+    {
+        // TODO Auto-generated method stub
+        return ISaveablePart2.YES;
+    }
+
+
+    public void doSave( IProgressMonitor monitor )
+    {
+        // save schemas on disk
+        try
+        {
+            SchemaPool.getInstance().saveAll( true );
+        }
+        catch ( Exception e )
+        {
+            logger.debug( "error when saving schemas on disk after asking for confirmation" ); //$NON-NLS-1$
+        }
+        //		
+        //		IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+        //		IEditorPart[] editors = page.getDirtyEditors();
+        //		for (IEditorPart part : editors) {
+        //			if(part instanceof AttributeTypeFormEditor) {
+        //				AttributeTypeFormEditor editor = (AttributeTypeFormEditor) part;
+        //				editor.setDirty(false);
+        //			}
+        //			else if (part instanceof ObjectClassFormEditor) {
+        //				ObjectClassFormEditor editor = (ObjectClassFormEditor) part;
+        //				editor.setDirty(false);
+        //			}
+        //		}
+
+    }
+
+
+    public void doSaveAs()
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+
+    public boolean isDirty()
+    {
+        // TODO Auto-generated method stub
+        Schema[] schemas = SchemaPool.getInstance().getSchemas();
+        for ( int i = 0; i < schemas.length; i++ )
+        {
+            Schema schema = schemas[i];
+            if ( schema.type == Schema.SchemaType.userSchema )
+            {
+                if ( schema.hasBeenModified() || schema.hasPendingModification() )
+                {
+                    return true;
+                }
+            }
+        }
+        // Default value
+        return false;
+    }
+
+
+    public boolean isSaveAsAllowed()
+    {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+
+    public boolean isSaveOnCloseNeeded()
+    {
+        // TODO Auto-generated method stub
+        return true;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManagerContentProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManagerContentProvider.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManagerContentProvider.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManagerContentProvider.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,220 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.view.viewers;
+
+
+import java.util.Comparator;
+
+import org.apache.directory.ldapstudio.schemas.model.AttributeType;
+import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
+import org.apache.directory.ldapstudio.schemas.model.Schema;
+import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AlphabeticalOrderComparator;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.IntermediateNode;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.PoolManagerAttributeTypeWrapper;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.PoolManagerObjectClassWrapper;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.SchemaWrapper;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+
+
+/**
+ * Content provider for the schema-pool manager
+ *
+ */
+public class PoolManagerContentProvider implements SortableContentProvider, IStructuredContentProvider,
+    ITreeContentProvider
+{
+
+    private SchemaPool pool;
+    private Comparator order = new AlphabeticalOrderComparator();
+
+
+    /**
+     * Default constructor
+     */
+    public PoolManagerContentProvider()
+    {
+        pool = SchemaPool.getInstance();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+     */
+    public Object[] getElements( Object inputElement )
+    {
+        return getChildren( inputElement );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+     */
+    public void dispose()
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+     */
+    public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+     */
+    public Object[] getChildren( Object parentElement )
+    {
+        if ( parentElement instanceof IntermediateNode )
+        {
+            IntermediateNode intermediate = ( IntermediateNode ) parentElement;
+
+            if ( intermediate.getName().equals( "**Primary Node**" ) ) { //$NON-NLS-1$
+                // clear the primary node (because it's always the same instance we need to
+                //refresh it manually)
+                intermediate.clearChildrens();
+
+                Schema[] schemas = this.pool.getSchemas();
+                for ( int i = 0; i < schemas.length; i++ )
+                {
+                    Schema schema = schemas[i];
+                    SchemaWrapper schemaWrapper = new SchemaWrapper( schema, ( IntermediateNode ) parentElement );
+                    intermediate.addElement( schemaWrapper );
+                }
+            }
+
+            Object[] temp = intermediate.getChildren();
+            return temp;
+        }
+
+        else if ( parentElement instanceof SchemaWrapper )
+        {
+            //we are looking for the childrens of the contained objectClass
+            Schema schema = ( Schema ) ( ( ( SchemaWrapper ) parentElement ).getMySchema() );
+
+            IntermediateNode attributeTypes = new IntermediateNode(
+                "Attribute Types", ( SchemaWrapper ) parentElement, this ); //$NON-NLS-1$
+            IntermediateNode objectClasses = new IntermediateNode(
+                "Object Classes", ( SchemaWrapper ) parentElement, this ); //$NON-NLS-1$
+
+            // Let's get all Attribute Types defined in the schema
+            AttributeType[] attributeTypeList = schema.getAttributeTypesAsArray();
+            for ( int i = 0; i < attributeTypeList.length; i++ )
+            {
+                AttributeType attributeType = attributeTypeList[i];
+                attributeTypes.addElement( new PoolManagerAttributeTypeWrapper( attributeType, attributeTypes ) );
+            }
+
+            // Let's get all Object Classes defined in the schema
+            ObjectClass[] objectClassList = schema.getObjectClassesAsArray();
+            for ( int i = 0; i < objectClassList.length; i++ )
+            {
+                ObjectClass objectClass = objectClassList[i];
+                objectClasses.addElement( new PoolManagerObjectClassWrapper( objectClass, objectClasses ) );
+            }
+
+            return new Object[]
+                { attributeTypes, objectClasses };
+        }
+
+        return new Object[0];
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+     */
+    public Object getParent( Object element )
+    {
+        if ( element instanceof SchemaWrapper )
+        {
+            return ( ( SchemaWrapper ) element ).getParent();
+        }
+        else if ( element instanceof IntermediateNode )
+        {
+            return ( ( IntermediateNode ) element ).getParent();
+        }
+        return null;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+     */
+    public boolean hasChildren( Object element )
+    {
+        if ( element instanceof IntermediateNode )
+        {
+            if ( ( ( IntermediateNode ) element ).getChildren().length > 0 )
+                return true;
+        }
+        else if ( element instanceof SchemaWrapper )
+        {
+            return true;
+        }
+        return false;
+    }
+
+
+    /******************************************
+     *                 Logic                  *
+     ******************************************/
+
+    /**
+     * Specify the comparator that will be used to sort the elements in the view
+     * @param order the comparator
+     */
+    public void setOrder( Comparator order )
+    {
+        this.order = order;
+    }
+
+
+    /**
+     * Returns the comparator used to sort the elements in the view
+     * @return
+     */
+    public Comparator getOrder()
+    {
+        return order;
+    }
+
+
+    /**
+     * Initialize a tree viewer to display the information provided by the specified content
+     * provider
+     * @param viewer the tree viewer
+     */
+    public void bindToTreeViewer( TreeViewer viewer )
+    {
+        viewer.setContentProvider( this );
+        viewer.setLabelProvider( new HierarchicalLabelProvider() );
+
+        IntermediateNode invisibleNode = new IntermediateNode( "**Primary Node**", null, this ); //$NON-NLS-1$
+        viewer.setInput( invisibleNode );
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManagerLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManagerLabelProvider.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManagerLabelProvider.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManagerLabelProvider.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,63 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.view.viewers;
+
+
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * Label provider for the schema-pool manager
+ *
+ */
+public class PoolManagerLabelProvider extends LabelProvider
+{
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+     */
+    public String getText( Object obj )
+    {
+        if ( obj instanceof DisplayableTreeElement )
+            return ( ( DisplayableTreeElement ) obj ).getDisplayName();
+
+        //default
+        return obj.toString();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+     */
+    public Image getImage( Object obj )
+    {
+        if ( obj instanceof DisplayableTreeElement )
+            return ( ( DisplayableTreeElement ) obj ).getDisplayImage();
+
+        //default
+        return PlatformUI.getWorkbench().getSharedImages().getImage( ISharedImages.IMG_OBJS_WARN_TSK );
+
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchContentProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchContentProvider.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchContentProvider.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchContentProvider.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,198 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.view.viewers;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.directory.ldapstudio.schemas.model.AttributeType;
+import org.apache.directory.ldapstudio.schemas.model.LDAPModelEvent;
+import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
+import org.apache.directory.ldapstudio.schemas.model.PoolListener;
+import org.apache.directory.ldapstudio.schemas.model.SchemaElement;
+import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * Content provider for the search view
+ *
+ */
+public class SearchContentProvider implements IStructuredContentProvider, PoolListener
+{
+    private SchemaPool schemaPool;
+    private Hashtable<String, ObjectClass> objectClassTable;
+    private Hashtable<String, AttributeType> attributeTypeTable;
+
+
+    /**
+     * Default constructor
+     */
+    public SearchContentProvider()
+    {
+        this.schemaPool = SchemaPool.getInstance();
+        schemaPool.addListener( this );
+
+        objectClassTable = schemaPool.getObjectClassesAsHashTableByName();
+
+        attributeTypeTable = schemaPool.getAttributeTypesAsHashTableByName();
+    }
+
+
+    /**
+     * returns the matched elements as an array of objects
+     */
+    @SuppressWarnings("unchecked")//$NON-NLS-1$
+    public Object[] getElements( Object parent )
+    {
+        if ( parent instanceof String )
+        {
+            String searchText = ( String ) parent;
+
+            //reset the view title
+            SearchViewer view = ( SearchViewer ) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+                .findView( SearchViewer.ID );
+            view.setPartName( Messages.getString( "SearchContentProvider.Search" ) ); //$NON-NLS-1$
+
+            if ( searchText.length() > 0 )
+            {
+                String searchRegexp = searchText + ".*"; //$NON-NLS-1$
+                Pattern pattern = Pattern.compile( searchRegexp, Pattern.CASE_INSENSITIVE );
+                ArrayList resultsList = new ArrayList();
+
+                Collection<ObjectClass> OCs = objectClassTable.values();
+                Collection<AttributeType> ATs = attributeTypeTable.values();
+
+                ArrayList<SchemaElement> allList = new ArrayList<SchemaElement>();
+                allList.addAll( OCs );
+                allList.addAll( ATs );
+
+                //search for all matching elements
+                for ( SchemaElement element : allList )
+                {
+
+                    if ( SearchViewer.searchType.equals( SearchViewer.SEARCH_NAME )
+                        || SearchViewer.searchType.equals( SearchViewer.SEARCH_ALL ) )
+                    {
+                        String[] names = element.getNames();
+                        for ( String name : names )
+                        {
+                            Matcher m = pattern.matcher( name );
+                            if ( m.matches() )
+                            {
+                                if ( !resultsList.contains( element ) )
+                                {
+                                    resultsList.add( element );
+                                }
+                                break;
+                            }
+                        }
+                    }
+
+                    if ( SearchViewer.searchType.equals( SearchViewer.SEARCH_OID )
+                        || SearchViewer.searchType.equals( SearchViewer.SEARCH_ALL ) )
+                    {
+                        String oid = element.getOid();
+                        Matcher m = pattern.matcher( oid );
+                        if ( m.matches() )
+                        {
+                            if ( !resultsList.contains( element ) )
+                            {
+                                resultsList.add( element );
+                            }
+
+                        }
+                    }
+
+                    if ( SearchViewer.searchType.equals( SearchViewer.SEARCH_DESC )
+                        || SearchViewer.searchType.equals( SearchViewer.SEARCH_ALL ) )
+                    {
+                        String desc = element.getDescription();
+                        if ( desc == null )
+                            continue;
+                        Matcher m = pattern.matcher( desc );
+                        if ( m.matches() )
+                        {
+                            if ( !resultsList.contains( element ) )
+                            {
+                                resultsList.add( element );
+                            }
+                        }
+                    }
+                }
+
+                //change the number of results in the view
+                view
+                    .setPartName( Messages.getString( "SearchContentProvider.Search_(" ) + resultsList.size() + Messages.getString( "SearchContentProvider.Results)" ) ); //$NON-NLS-1$ //$NON-NLS-2$
+
+                //returns the result list
+                return resultsList.toArray();
+            }
+        }
+
+        return new Object[0];
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+     */
+    public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+     */
+    public void dispose()
+    {
+        schemaPool.removeListener( this );
+    }
+
+
+    /**
+     * Pool listener method
+     */
+    public void poolChanged( SchemaPool p, LDAPModelEvent e )
+    {
+        refresh();
+    }
+
+
+    /**
+     * Refresh the content of the provider
+     * (you can trigger it manually or it will be called when the pool has changed)
+     */
+    public void refresh()
+    {
+        objectClassTable = schemaPool.getObjectClassesAsHashTableByName();
+
+        attributeTypeTable = schemaPool.getAttributeTypesAsHashTableByName();
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchLabelProvider.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchLabelProvider.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchLabelProvider.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,92 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.view.viewers;
+
+
+import org.apache.directory.ldapstudio.schemas.controller.Application;
+import org.apache.directory.ldapstudio.schemas.model.AttributeType;
+import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
+import org.apache.directory.ldapstudio.schemas.model.SchemaElement;
+import org.apache.directory.ldapstudio.schemas.view.IImageKeys;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * Label provider for the search view
+ *
+ */
+public class SearchLabelProvider extends LabelProvider implements ITableLabelProvider
+{
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+     */
+    public Image getColumnImage( Object element, int columnIndex )
+    {
+        if ( columnIndex == 0 )
+        {
+            if ( element instanceof ObjectClass )
+            {
+                return AbstractUIPlugin.imageDescriptorFromPlugin( Application.PLUGIN_ID, IImageKeys.OBJECT_CLASS )
+                    .createImage();
+            }
+
+            if ( element instanceof AttributeType )
+            {
+                return AbstractUIPlugin.imageDescriptorFromPlugin( Application.PLUGIN_ID, IImageKeys.ATTRIBUTE_TYPE )
+                    .createImage();
+            }
+        }
+
+        return null;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+     */
+    public String getColumnText( Object element, int columnIndex )
+    {
+        String result = ""; //$NON-NLS-1$
+        if ( element instanceof SchemaElement )
+        {
+            SchemaElement schemaElement = ( SchemaElement ) element;
+            switch ( columnIndex )
+            {
+                case 0: // COMPLETED_COLUMN
+                    break;
+                case 1:
+                    result = schemaElement.getNames()[0];
+                    break;
+                case 2:
+                    result = schemaElement.getOriginatingSchema().getName();
+                    break;
+                default:
+                    break;
+            }
+        }
+        return result;
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchViewer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchViewer.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchViewer.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SearchViewer.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,307 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.view.viewers;
+
+
+import org.apache.directory.ldapstudio.schemas.controller.Application;
+import org.apache.directory.ldapstudio.schemas.controller.PoolManagerController;
+import org.apache.directory.ldapstudio.schemas.model.AttributeType;
+import org.apache.directory.ldapstudio.schemas.model.LDAPModelEvent;
+import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
+import org.apache.directory.ldapstudio.schemas.model.PoolListener;
+import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
+import org.apache.directory.ldapstudio.schemas.view.editors.AttributeTypeFormEditor;
+import org.apache.directory.ldapstudio.schemas.view.editors.AttributeTypeFormEditorInput;
+import org.apache.directory.ldapstudio.schemas.view.editors.ObjectClassFormEditor;
+import org.apache.directory.ldapstudio.schemas.view.editors.ObjectClassFormEditorInput;
+import org.apache.log4j.Logger;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+
+
+/**
+ * This is the main class for the LDAP Studio Search Tool.
+ *
+ */
+public class SearchViewer extends ViewPart implements PoolListener
+{
+    public static final String ID = Application.PLUGIN_ID + ".view.SearchViewer"; //$NON-NLS-1$
+    private SchemaPool pool;
+    private Composite top;
+    private Table table;
+    private TableViewer tableViewer;
+    private Text searchField;
+    private Combo typeCombo;
+    private SearchContentProvider searchContentProvider;
+
+    //Set the table column property names
+    private final String TYPE_COLUMN = Messages.getString( "SearchViewer.Type_Column" ); //$NON-NLS-1$
+    private final String NAME_COLUMN = Messages.getString( "SearchViewer.Name_Column" ); //$NON-NLS-1$
+    private final String SCHEMA_COLUMN = Messages.getString( "SearchViewer.Schema_Column" ); //$NON-NLS-1$
+
+    // Set column names
+    private String[] columnNames = new String[]
+        { TYPE_COLUMN, NAME_COLUMN, SCHEMA_COLUMN, };
+
+    //search types
+    public static final String SEARCH_ALL = Messages.getString( "SearchViewer.Search_All_metadata" ); //$NON-NLS-1$
+    public static final String SEARCH_NAME = Messages.getString( "SearchViewer.Search_Name" ); //$NON-NLS-1$
+    public static final String SEARCH_OID = Messages.getString( "SearchViewer.Search_OID" ); //$NON-NLS-1$
+    public static final String SEARCH_DESC = Messages.getString( "SearchViewer.Search_Description" ); //$NON-NLS-1$
+
+    //current search type
+    public static String searchType = SEARCH_ALL;
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+     */
+    @Override
+    public void createPartControl( Composite parent )
+    {
+        this.pool = SchemaPool.getInstance();
+        //we want to be notified if the pool has been modified
+        pool.addListener( this );
+
+        //top container
+        this.top = new Composite( parent, SWT.NONE );
+
+        GridLayout layout = new GridLayout();
+        layout.marginWidth = 0;
+        layout.marginHeight = 0;
+        layout.numColumns = 2;
+        layout.horizontalSpacing = 0;
+        layout.verticalSpacing = 0;
+        top.setLayout( layout );
+
+        //search field
+        searchField = new Text( top, SWT.BORDER );
+        GridData gridData = new GridData( GridData.FILL, 0, true, false );
+        gridData.heightHint = searchField.getLineHeight();
+        gridData.verticalAlignment = SWT.CENTER;
+        searchField.setLayoutData( gridData );
+        searchField.addModifyListener( new ModifyListener()
+        {
+
+            public void modifyText( ModifyEvent e )
+            {
+                tableViewer.setInput( searchField.getText() );
+            }
+
+        } );
+
+        //search type combo
+        typeCombo = new Combo( top, SWT.READ_ONLY | SWT.SINGLE );
+
+        gridData = new GridData( SWT.FILL, 0, false, false );
+        gridData.verticalAlignment = SWT.CENTER;
+        typeCombo.setLayoutData( gridData );
+        typeCombo.addSelectionListener( new SelectionListener()
+        {
+            public void widgetDefaultSelected( SelectionEvent e )
+            {
+            }
+
+
+            public void widgetSelected( SelectionEvent e )
+            {
+                searchType = typeCombo.getItem( typeCombo.getSelectionIndex() );
+                tableViewer.refresh();
+            }
+        } );
+        typeCombo.add( SEARCH_ALL, 0 );
+        typeCombo.add( SEARCH_NAME, 1 );
+        typeCombo.add( SEARCH_OID, 2 );
+        typeCombo.add( SEARCH_DESC, 3 );
+        typeCombo.select( 0 );
+
+        // Create the table 
+        createTable( top );
+        createTableViewer();
+        this.searchContentProvider = new SearchContentProvider();
+        tableViewer.setContentProvider( searchContentProvider );
+        tableViewer.setLabelProvider( new SearchLabelProvider() );
+    }
+
+
+    /**
+     * Creates the Table
+     */
+    private void createTable( Composite parent )
+    {
+        int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.HIDE_SELECTION;
+
+        table = new Table( parent, style );
+
+        GridData gridData = new GridData( GridData.FILL, GridData.FILL, true, true, 2, 1 );
+        //gridData.horizontalSpan = 3;
+        table.setLayoutData( gridData );
+
+        table.setLinesVisible( false );
+        table.setHeaderVisible( true );
+
+        // 1st column with image - NOTE: The SWT.CENTER has no effect!!
+        TableColumn column = new TableColumn( table, SWT.CENTER, 0 );
+        column.setText( columnNames[0] );
+        column.setWidth( 40 );
+
+        // 2nd column with name
+        column = new TableColumn( table, SWT.LEFT, 1 );
+        column.setText( columnNames[1] );
+        column.setWidth( 400 );
+        // Add listener to column so tasks are sorted by name
+        column.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                //tableViewer.setSorter(new ExampleTaskSorter(ExampleTaskSorter.DESCRIPTION));
+            }
+        } );
+
+        //3rd column with element defining schema
+        column = new TableColumn( table, SWT.LEFT, 2 );
+        column.setText( columnNames[2] );
+        column.setWidth( 100 );
+        // Add listener to column so tasks are sorted by schema
+        column.addSelectionListener( new SelectionAdapter()
+        {
+
+            public void widgetSelected( SelectionEvent e )
+            {
+                //tableViewer.setSorter(new ExampleTaskSorter(ExampleTaskSorter.OWNER));
+            }
+        } );
+        table.addMouseListener( new MouseListener()
+        {
+            public void mouseDoubleClick( MouseEvent e )
+            {
+                IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+                // Getting the source Table of the double click
+                Table sourceTable = ( Table ) e.getSource();
+
+                IEditorInput input = null;
+                String editorId = null;
+
+                // Here is the double clicked item
+                Object item = sourceTable.getSelection()[0].getData();
+                if ( item instanceof AttributeType )
+                {
+                    input = new AttributeTypeFormEditorInput( ( AttributeType ) item );
+                    editorId = AttributeTypeFormEditor.ID;
+                }
+                else if ( item instanceof ObjectClass )
+                {
+                    input = new ObjectClassFormEditorInput( ( ObjectClass ) item );
+                    editorId = ObjectClassFormEditor.ID;
+                }
+
+                // Let's open the editor
+                if ( input != null )
+                {
+                    try
+                    {
+                        page.openEditor( input, editorId );
+                    }
+                    catch ( PartInitException exception )
+                    {
+                        Logger.getLogger( PoolManagerController.class ).debug( "error when opening the editor" ); //$NON-NLS-1$
+                    }
+                }
+            }
+
+
+            public void mouseDown( MouseEvent e )
+            {
+            }
+
+
+            public void mouseUp( MouseEvent e )
+            {
+            }
+        } );
+    }
+
+
+    /**
+     * Creates the TableViewer 
+     */
+    private void createTableViewer()
+    {
+
+        tableViewer = new TableViewer( table );
+        tableViewer.setUseHashlookup( true );
+
+        tableViewer.setColumnProperties( columnNames );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+     */
+    @Override
+    public void setFocus()
+    {
+        if ( searchField != null && !searchField.isDisposed() )
+        {
+            searchField.setFocus();
+        }
+
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.safhaus.ldapstudio.model.PoolListener#poolChanged(org.safhaus.ldapstudio.model.SchemaPool, org.safhaus.ldapstudio.model.LDAPModelEvent)
+     */
+    public void poolChanged( SchemaPool p, LDAPModelEvent e )
+    {
+        searchContentProvider.refresh();
+        tableViewer.refresh();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.ViewPart#setPartName(java.lang.String)
+     */
+    public void setPartName( String partName )
+    {
+        super.setPartName( partName );
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SortableContentProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SortableContentProvider.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SortableContentProvider.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SortableContentProvider.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,55 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.view.viewers;
+
+
+import java.util.Comparator;
+
+import org.eclipse.jface.viewers.TreeViewer;
+
+
+/**
+ * Common interface for sortable content providers
+ *
+ */
+public interface SortableContentProvider
+{
+    /**
+     * Specify the comparator that will be used to sort the elements in the view
+     * @param order the comparator
+     */
+    public void setOrder( Comparator order );
+
+
+    /**
+     * Returns the comparator used to sort the elements in the view
+     * @return
+     */
+    public Comparator getOrder();
+
+
+    /**
+     * Initialize a tree viewer to display the information provided by the specified content
+     * provider
+     * @param viewer the tree viewer
+     */
+    public void bindToTreeViewer( TreeViewer viewer );
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/AlphabeticalOrderComparator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/AlphabeticalOrderComparator.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/AlphabeticalOrderComparator.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/AlphabeticalOrderComparator.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.view.viewers.wrappers;
+
+
+import java.util.Comparator;
+
+
+/**
+ * This class is used to compare in alphabetical order two DisplayableTreeElement
+ */
+public class AlphabeticalOrderComparator implements Comparator
+{
+    /* (non-Javadoc)
+     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+     */
+    public int compare( Object o1, Object o2 )
+    {
+        DisplayableTreeElement one = ( DisplayableTreeElement ) o1;
+        DisplayableTreeElement two = ( DisplayableTreeElement ) o2;
+
+        String oneName = one.getDisplayName();
+        String twoName = two.getDisplayName();
+        return oneName.compareTo( twoName );
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/AttributeTypeWrapper.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/AttributeTypeWrapper.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/AttributeTypeWrapper.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/AttributeTypeWrapper.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,138 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.view.viewers.wrappers;
+
+
+import org.apache.directory.ldapstudio.schemas.controller.Application;
+import org.apache.directory.ldapstudio.schemas.model.AttributeType;
+import org.apache.directory.ldapstudio.schemas.view.IImageKeys;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * Nasty trick to display object-classes attributes in the tree-viewer
+ */
+public class AttributeTypeWrapper implements DisplayableTreeElement
+{
+    /******************************************
+     *               Fields                   *
+     ******************************************/
+
+    private IntermediateNode parent;
+    private AttributeType myAttributeType;
+
+
+    /******************************************
+     *              Constructors              *
+     ******************************************/
+
+    /**
+     * Default constructor
+     * @param myAttributeType
+     * @param parent
+     */
+    public AttributeTypeWrapper( AttributeType myAttributeType, IntermediateNode parent )
+    {
+        this.myAttributeType = myAttributeType;
+        this.parent = parent;
+    }
+
+
+    /******************************************
+     *             Wrapper Methods            *
+     ******************************************/
+
+    /**
+     * @return the name of the wrapped attribute type
+     */
+    public String getName()
+    {
+        return myAttributeType.getNames()[0];
+    }
+
+
+    /**
+     * @return the OID of the wrapped attribute type
+     */
+    public String getOid()
+    {
+        return myAttributeType.getOid();
+    }
+
+
+    /******************************************
+     *               Accessors                *
+     ******************************************/
+
+    /**
+     * @return the wrapped attribute type
+     */
+    public AttributeType getMyAttributeType()
+    {
+        return myAttributeType;
+    }
+
+
+    /**
+     * @return the parent element
+     */
+    public IntermediateNode getParent()
+    {
+        return parent;
+    }
+
+
+    /******************************************
+     *       DisplayableTreeElement Impl.     *
+     ******************************************/
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement#getDisplayImage()
+     */
+    public Image getDisplayImage()
+    {
+        return AbstractUIPlugin.imageDescriptorFromPlugin( Application.PLUGIN_ID, IImageKeys.ATTRIBUTE_TYPE )
+            .createImage();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement#getDisplayName()
+     */
+    public String getDisplayName()
+    {
+        return getName() + "  [" + myAttributeType.getOriginatingSchema().getName() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+
+    /******************************************
+     *           Object Redefinition          *
+     ******************************************/
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        return myAttributeType + " wrapper"; //$NON-NLS-1$
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/DisplayableTreeElement.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/DisplayableTreeElement.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/DisplayableTreeElement.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/DisplayableTreeElement.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,49 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.view.viewers.wrappers;
+
+
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * All objects that want to be displayed in the tree view must implement
+ * this interface.
+ * Note: implementation of E.Lecharny suggestion after the 04/06/06 briefing
+ *
+ */
+public interface DisplayableTreeElement
+{
+    /**
+     * Use this method to get the image that should be displayed in
+     * the tree view.
+     * @return the display image
+     */
+    public Image getDisplayImage();
+
+
+    /**
+     * Use this method to get the name that should be displayed in
+     * the tree view.
+     * @return the display name
+     */
+    public String getDisplayName();
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/IntermediateNode.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/IntermediateNode.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/IntermediateNode.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/IntermediateNode.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,240 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.view.viewers.wrappers;
+
+
+import java.util.ArrayList;
+import java.util.Collections;
+
+import org.apache.directory.ldapstudio.schemas.view.viewers.SortableContentProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * Class used to display intermediate folder (like 'Optionnal Attributes',
+ * 'Mandatory Attributes' and so on...) in the tree view of the schema.
+ * Instances of the class may contain any kind of displayable objects like
+ * AttributeTypeLiterals or ObjectClassLiterals.
+ *
+ */
+public class IntermediateNode implements DisplayableTreeElement
+{
+
+    /******************************************
+     *               Fields                   *
+     ******************************************/
+    private SortableContentProvider contentProvider;
+    private String name;
+    private DisplayableTreeElement parent;
+    private ArrayList<DisplayableTreeElement> elements;
+
+
+    /******************************************
+     *              Constructors              *
+     ******************************************/
+
+    /**
+     * Default constructor
+     * @param name the name that will be displayed in the tree viewer
+     * @param parent the parent DisplayableTreeElement in the schema relationship
+     * hierarchy
+     */
+    public IntermediateNode( String name, DisplayableTreeElement parent, SortableContentProvider contentProvider )
+    {
+        this.name = name;
+        this.parent = parent;
+        this.contentProvider = contentProvider;
+        elements = new ArrayList<DisplayableTreeElement>();
+    }
+
+
+    /******************************************
+     *               Accessors                *
+     ******************************************/
+
+    /**
+     * @return the name of the intermediate node
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+
+    /**
+     * @return the parent of the intermediate node
+     */
+    public DisplayableTreeElement getParent()
+    {
+        return parent;
+    }
+
+
+    /******************************************
+     *                 Logic                  *
+     ******************************************/
+
+    /**
+     * Adds a 'child' element to the node only if it's not already under the node.
+     * @param o usually AttributeTypeWrappers, SchemaWrapper or ObjectClassWrappers.
+     */
+    public void addElement( DisplayableTreeElement o )
+    {
+        if ( o instanceof AttributeTypeWrapper )
+        {
+            //initial case
+            if ( elements.size() == 0 )
+                elements.add( o );
+
+            AttributeTypeWrapper toAdd = ( AttributeTypeWrapper ) o;
+            for ( DisplayableTreeElement element : elements )
+            {
+                if ( element instanceof AttributeTypeWrapper )
+                {
+                    AttributeTypeWrapper alreadyThere = ( AttributeTypeWrapper ) element;
+                    //check if the attributeType instance has already been added
+                    if ( toAdd.getMyAttributeType().equals( alreadyThere.getMyAttributeType() ) )
+                        return;
+                }
+            }
+            elements.add( o );
+        }
+        else if ( o instanceof ObjectClassWrapper )
+        {
+            //initial case
+            if ( elements.size() == 0 )
+                elements.add( o );
+
+            ObjectClassWrapper toAdd = ( ObjectClassWrapper ) o;
+            for ( DisplayableTreeElement element : elements )
+            {
+                if ( element instanceof ObjectClassWrapper )
+                {
+                    ObjectClassWrapper alreadyThere = ( ObjectClassWrapper ) element;
+
+                    //check if the objectClass instance has already been added
+                    if ( toAdd.getMyObjectClass().equals( alreadyThere.getMyObjectClass() ) )
+                        return;
+                }
+            }
+            elements.add( o );
+        }
+        else if ( o instanceof SchemaWrapper )
+        {
+            //initial case
+            if ( elements.size() == 0 )
+                elements.add( o );
+
+            SchemaWrapper toAdd = ( SchemaWrapper ) o;
+            for ( DisplayableTreeElement element : elements )
+            {
+                if ( element instanceof SchemaWrapper )
+                {
+                    SchemaWrapper alreadyThere = ( SchemaWrapper ) element;
+
+                    if ( toAdd.getMySchema().getName().equals( alreadyThere.getMySchema().getName() ) )
+                        return;
+                }
+            }
+            elements.add( o );
+        }
+    }
+
+
+    /**
+     * Clears the list of childrens from the intermediate nodes
+     */
+    public void clearChildrens()
+    {
+        elements = new ArrayList<DisplayableTreeElement>();
+    }
+
+
+    /**
+     * Returns the child elements in the form of an array of objects
+     * @return
+     */
+    @SuppressWarnings("unchecked")//$NON-NLS-1$
+    public Object[] getChildren()
+    {
+        Collections.sort( elements, contentProvider.getOrder() );
+        return elements.toArray( new Object[]
+            {} );
+    }
+
+
+    /******************************************
+     *       DisplayableTreeElement Impl.     *
+     ******************************************/
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement#getDisplayName()
+     */
+    public String getDisplayName()
+    {
+        return getName();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement#getDisplayImage()
+     */
+    public Image getDisplayImage()
+    {
+        String imageKey = ISharedImages.IMG_OBJ_FOLDER;
+        return PlatformUI.getWorkbench().getSharedImages().getImage( imageKey );
+    }
+
+
+    /******************************************
+     *           Object Redefinition          *
+     ******************************************/
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        return name;
+    }
+
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals( Object obj )
+    {
+        if ( obj instanceof IntermediateNode )
+        {
+            IntermediateNode compared = ( IntermediateNode ) obj;
+            if ( compared.getName().equals( this.getName() ) )
+            {
+                if ( ( compared.getParent() == null ) || ( this.getParent() == null ) )
+                    return true;
+                if ( compared.getParent().equals( this.getParent() ) )
+                    return true;
+            }
+        }
+        return false;
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/ObjectClassWrapper.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/ObjectClassWrapper.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/ObjectClassWrapper.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/ObjectClassWrapper.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,188 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.view.viewers.wrappers;
+
+
+import org.apache.directory.ldapstudio.schemas.controller.Application;
+import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
+import org.apache.directory.ldapstudio.schemas.view.IImageKeys;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * Nasty trick to display object class in the tree-viewer
+ */
+public class ObjectClassWrapper implements DisplayableTreeElement
+{
+    /******************************************
+     *               Fields                   *
+     ******************************************/
+    public enum State
+    {
+        resolved, unResolved
+    };
+
+    private State state;
+    private IntermediateNode parent;
+    private ObjectClass myObjectClass;
+
+
+    /******************************************
+     *              Constructors              *
+     ******************************************/
+
+    /**
+     * Default constructor
+     * @param parent
+     * @param myObjectClass
+     */
+    public ObjectClassWrapper( ObjectClass myObjectClass, IntermediateNode parent )
+    {
+        this.parent = parent;
+        this.myObjectClass = myObjectClass;
+        this.state = State.resolved;
+    }
+
+
+    /******************************************
+     *             Wrapper Methods            *
+     ******************************************/
+
+    /**
+     * @return the names of the wrapped object class
+     */
+    public String[] getNames()
+    {
+        return myObjectClass.getNames();
+    }
+
+
+    /**
+     * @return the oid of the wrapped object class
+     */
+    public String getOid()
+    {
+        return myObjectClass.getOid();
+    }
+
+
+    /******************************************
+     *               Accessors                *
+     ******************************************/
+
+    /**
+     * @return the wrapped object class
+     */
+    public ObjectClass getMyObjectClass()
+    {
+        return myObjectClass;
+    }
+
+
+    /**
+     * @return the parent element
+     */
+    public IntermediateNode getParent()
+    {
+        return parent;
+    }
+
+
+    /**
+     * @return the state of the wrapped object class
+     */
+    public State getState()
+    {
+        return state;
+    }
+
+
+    /**
+     * Sets the state of the wrapped object class
+     * @param state
+     */
+    public void setState( State state )
+    {
+        this.state = state;
+    }
+
+
+    /******************************************
+     *       DisplayableTreeElement Impl.     *
+     ******************************************/
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement#getDisplayImage()
+     */
+    public Image getDisplayImage()
+    {
+        String imageKey = ISharedImages.IMG_OBJS_WARN_TSK;
+
+        if ( state == State.resolved )
+            return AbstractUIPlugin.imageDescriptorFromPlugin( Application.PLUGIN_ID, IImageKeys.OBJECT_CLASS )
+                .createImage();
+        else if ( state == State.unResolved )
+            return AbstractUIPlugin.imageDescriptorFromPlugin( Application.PLUGIN_ID, IImageKeys.OBJECT_CLASS_WARNING )
+                .createImage();
+
+        return PlatformUI.getWorkbench().getSharedImages().getImage( imageKey );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement#getDisplayName()
+     */
+    public String getDisplayName()
+    {
+        return getNames()[0] + "  [" + myObjectClass.getOriginatingSchema().getName() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+
+    /******************************************
+     *           Object Redefinition          *
+     ******************************************/
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals( Object obj )
+    {
+        if ( obj instanceof ObjectClassWrapper )
+        {
+            ObjectClassWrapper compared = ( ObjectClassWrapper ) obj;
+            return compared.getOid().equals( this.getOid() );
+        }
+        return false;
+    }
+
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        return myObjectClass + " wrapper"; //$NON-NLS-1$
+    }
+
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/PoolManagerAttributeTypeWrapper.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/PoolManagerAttributeTypeWrapper.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/PoolManagerAttributeTypeWrapper.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/PoolManagerAttributeTypeWrapper.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.view.viewers.wrappers;
+
+
+import org.apache.directory.ldapstudio.schemas.model.AttributeType;
+
+
+/**
+ * Specific Attribute Type Wrapper for the Schemas View
+ */
+public class PoolManagerAttributeTypeWrapper extends AttributeTypeWrapper
+{
+
+    /**
+     * Default constructor
+     * @param myAttributeType
+     * @param parent
+     */
+    public PoolManagerAttributeTypeWrapper( AttributeType myAttributeType, IntermediateNode parent )
+    {
+        super( myAttributeType, parent );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AttributeTypeWrapper#getDisplayName()
+     */
+    public String getDisplayName()
+    {
+        return getName();
+    }
+}

Added: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/PoolManagerObjectClassWrapper.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/PoolManagerObjectClassWrapper.java?view=auto&rev=475786
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/PoolManagerObjectClassWrapper.java (added)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/wrappers/PoolManagerObjectClassWrapper.java Thu Nov 16 08:05:20 2006
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.schemas.view.viewers.wrappers;
+
+
+import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
+
+
+/**
+ * Specific Object Class Wrapper for the Schemas View
+ */
+public class PoolManagerObjectClassWrapper extends ObjectClassWrapper
+{
+
+    /**
+     * Default constructor
+     * @param myObjectClass
+     * @param parent
+     */
+    public PoolManagerObjectClassWrapper( ObjectClass myObjectClass, IntermediateNode parent )
+    {
+        super( myObjectClass, parent );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper#getDisplayName()
+     */
+    public String getDisplayName()
+    {
+        return getNames()[0];
+    }
+}



Mime
View raw message