directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r501083 - in /directory/ldapstudio/trunk/ldapstudio-schemas-plugin: ./ src/main/java/org/apache/directory/ldapstudio/schemas/controller/ src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/ src/main/java/org/apache/dire...
Date Mon, 29 Jan 2007 15:46:00 GMT
Author: pamarcelot
Date: Mon Jan 29 07:45:59 2007
New Revision: 501083

URL: http://svn.apache.org/viewvc?view=rev&rev=501083
Log:
Fixed DIRSTUDIO-35 (Disable action icons of the Schemas view when actions are not available)

Modified:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/plugin.xml
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PoolManagerController.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewAttributeTypeAction.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewObjectClassAction.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewSchemaAction.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/DeleteAction.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenLocalFileAction.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/RemoveSchemaAction.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManager.java

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/plugin.xml
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/plugin.xml?view=diff&rev=501083&r1=501082&r2=501083
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/plugin.xml (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/plugin.xml Mon Jan 29 07:45:59 2007
@@ -199,88 +199,4 @@
          point="org.eclipse.core.runtime.preferences">
       <initializer class="org.apache.directory.ldapstudio.schemas.controller.PreferenceInitializer"/>
    </extension>
-   <extension
-         point="org.eclipse.ui.actionSets">
-      <actionSet
-            id="org.apache.directory.ldapstudio.schemas.actionSet"
-            label="%ldapstudio-schemas-plugin.actionsets.actionset.label"
-            visible="false">
-         <menu
-               id="org.apache.directory.ldapstudio.schemas.schemas.menu"
-               label="%ldapstudio-schemas-plugin.actionsets.menu.schemas.label">
-         </menu>
-         <action
-               class="org.apache.directory.ldapstudio.schemas.controller.actions.RemoveSchemaAction"
-               icon="ressources/icons/schema_remove.png"
-               id="org.apache.directory.ldapstudio.schemas.actions.removeschema"
-               label="%ldapstudio-schemas-plugin.actionsets.action.removeselectedschema.label"
-               menubarPath="org.apache.directory.ldapstudio.schemas.schemas.menu/ManagePoolGroup"
-               toolbarPath="org.apache.directory.ldapstudio.schemas.schemas.toolbar"
-               tooltip="%ldapstudio-schemas-plugin.actionsets.action.removeselectedschema.tooltip"/>
-         <action
-               class="org.apache.directory.ldapstudio.schemas.controller.actions.CreateANewSchemaAction"
-               icon="ressources/icons/schema_new.png"
-               id="org.apache.directory.ldapstudio.schemas.actions.createanewschema"
-               label="%ldapstudio-schemas-plugin.actionsets.action.createanewschema.label"
-               menubarPath="org.apache.directory.ldapstudio.schemas.schemas.menu/ManagePoolGroup"
-               toolbarPath="org.apache.directory.ldapstudio.schemas.schemas.toolbar"
-               tooltip="%ldapstudio-schemas-plugin.actionsets.action.createanewschema.tooltip"/>
-         <action
-               class="org.apache.directory.ldapstudio.schemas.controller.actions.OpenLocalFileAction"
-               icon="ressources/icons/open.png"
-               id="org.apache.directory.ldapstudio.schemas.actions.SampleAction"
-               label="%ldapstudio-schemas-plugin.actionsets.action.openaschemafile.label"
-               menubarPath="org.apache.directory.ldapstudio.schemas.schemas.menu/ManagePoolGroup"
-               toolbarPath="org.apache.directory.ldapstudio.schemas.schemas.toolbar"
-               tooltip="%ldapstudio-schemas-plugin.actionsets.action.openaschemafile.tooltip"/>
-          <action
-                class="org.apache.directory.ldapstudio.schemas.controller.actions.SaveAllAction"
-                icon="ressources/icons/save_all.png"
-                id="org.apache.directory.ldapstudio.schemas.actions.SampleAction"
-                label="%ldapstudio-schemas-plugin.actionsets.action.saveallschemas.label"
-                menubarPath="org.apache.directory.ldapstudio.schemas.schemas.menu/ManageSaveGroup"
-                toolbarPath="org.apache.directory.ldapstudio.schemas.schemas.toolbar"
-                tooltip="Saves all the schemas"/>
-          <action
-                class="org.apache.directory.ldapstudio.schemas.controller.actions.SaveAsAction"
-                icon="ressources/icons/save_as.png"
-                id="org.apache.directory.ldapstudio.schemas.actions.SampleAction"
-                label="%ldapstudio-schemas-plugin.actionsets.action.saveschemaas.label"
-                menubarPath="org.apache.directory.ldapstudio.schemas.schemas.menu/ManageSaveGroup"
-                toolbarPath="org.apache.directory.ldapstudio.schemas.schemas.toolbar"
-                tooltip="%ldapstudio-schemas-plugin.actionsets.action.saveschemaas.tooltip"/>
-          <action
-                class="org.apache.directory.ldapstudio.schemas.controller.actions.SaveAction"
-                icon="ressources/icons/save.gif"
-                id="org.apache.directory.ldapstudio.schemas.actions.SampleAction"
-                label="%ldapstudio-schemas-plugin.actionsets.action.saveschema.label"
-                menubarPath="org.apache.directory.ldapstudio.schemas.schemas.menu/ManageSaveGroup"
-                toolbarPath="org.apache.directory.ldapstudio.schemas.schemas.toolbar"
-                tooltip="%ldapstudio-schemas-plugin.actionsets.action.saveschema.tooltip"/>
-          <action
-                class="org.apache.directory.ldapstudio.schemas.controller.actions.DeleteAction"
-                icon="ressources/icons/delete.gif"
-                id="org.apache.directory.ldapstudio.schemas.actions.SampleAction"
-                label="%ldapstudio-schemas-plugin.actionsets.action.deleteselecteditem.label"
-                menubarPath="org.apache.directory.ldapstudio.schemas.schemas.menu/ManageSchemaGroup"
-                toolbarPath="org.apache.directory.ldapstudio.schemas.schemas.toolbar"
-                tooltip="%ldapstudio-schemas-plugin.actionsets.action.deleteselecteditem.tooltip"/>
-          <action
-                class="org.apache.directory.ldapstudio.schemas.controller.actions.CreateANewAttributeTypeAction"
-                icon="ressources/icons/attribute_type_new.gif"
-                id="org.apache.directory.ldapstudio.schemas.actions.SampleAction"
-                label="%ldapstudio-schemas-plugin.actionsets.action.createanewattributetype.label"
-                menubarPath="org.apache.directory.ldapstudio.schemas.schemas.menu/ManageSchemaGroup"
-                toolbarPath="org.apache.directory.ldapstudio.schemas.schemas.toolbar"
-                tooltip="%ldapstudio-schemas-plugin.actionsets.action.createanewattributetype.tooltip"/>
-          <action
-                class="org.apache.directory.ldapstudio.schemas.controller.actions.CreateANewObjectClassAction"
-                icon="ressources/icons/object_class_new.gif"
-                id="org.apache.directory.ldapstudio.schemas.actions.SampleAction"
-                label="%ldapstudio-schemas-plugin.actionsets.action.createanewobjectclass.label"
-                menubarPath="org.apache.directory.ldapstudio.schemas.schemas.menu/ManageSchemaGroup"
-                toolbarPath="org.apache.directory.ldapstudio.schemas.schemas.toolbar"
-                tooltip="%ldapstudio-schemas-plugin.actionsets.action.createanewobjectclass.tooltip"/>
-      </actionSet>
-   </extension>
 </plugin>

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PoolManagerController.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PoolManagerController.java?view=diff&rev=501083&r1=501082&r2=501083
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PoolManagerController.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/PoolManagerController.java Mon Jan 29 07:45:59 2007
@@ -21,14 +21,18 @@
 package org.apache.directory.ldapstudio.schemas.controller;
 
 
+import org.apache.directory.ldapstudio.schemas.controller.actions.CollapseAllAction;
 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.LinkWithEditorSchemasView;
+import org.apache.directory.ldapstudio.schemas.controller.actions.OpenLocalFileAction;
 import org.apache.directory.ldapstudio.schemas.controller.actions.OpenSchemaSourceCode;
 import org.apache.directory.ldapstudio.schemas.controller.actions.RemoveSchemaAction;
 import org.apache.directory.ldapstudio.schemas.controller.actions.SaveAction;
 import org.apache.directory.ldapstudio.schemas.controller.actions.SaveAsAction;
+import org.apache.directory.ldapstudio.schemas.controller.actions.SortPoolManagerAction;
 import org.apache.directory.ldapstudio.schemas.model.Schema;
 import org.apache.directory.ldapstudio.schemas.model.SchemaCreationException;
 import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
@@ -37,250 +41,499 @@
 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.directory.ldapstudio.schemas.view.viewers.Messages;
 import org.apache.directory.ldapstudio.schemas.view.viewers.PoolManager;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.AttributeTypeWrapper;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.IntermediateNode;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.SchemaWrapper;
+import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.IntermediateNode.IntermediateNodeType;
 import org.apache.log4j.Logger;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.action.IMenuListener;
 import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
 import org.eclipse.jface.action.Separator;
 import org.eclipse.jface.viewers.DoubleClickEvent;
 import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TreeSelection;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTarget;
 import org.eclipse.swt.dnd.DropTargetEvent;
 import org.eclipse.swt.dnd.DropTargetListener;
 import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.Transfer;
 import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.ISelectionListener;
 import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
 
 
-public class PoolManagerController implements IMenuListener, IDoubleClickListener, DropTargetListener
+/**
+ * This class implements the Controller for the Schemas View
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class PoolManagerController
 {
+    /** The logger */
     private static Logger logger = Logger.getLogger( PoolManagerController.class );
-    private static final PoolManagerController instance_;
+
+    /** The associated view */
+    private PoolManager view;
+
+    /** The Drag'n'Drop FileTransfer Object */
     private final static FileTransfer fileTransfer = FileTransfer.getInstance();
 
-    //Static thread-safe singleton initializer
-    static
+    /** The Context Menu */
+    private MenuManager contextMenu;
+
+    // The Actions
+    private Action openLocalFile;
+    private Action createANewSchema;
+    private Action removeSchema;
+    private Action createANewObjectClass;
+    private Action createANewAttributeType;
+    private Action deleteAction;
+    private Action sortAlphabetical;
+    private Action sortUnAlphabetical;
+    private Action collapseAll;
+    private Action linkWithEditor;
+    private Action openSchemaSourceCode;
+    private Action save;
+    private Action saveAs;
+
+
+    /**
+     * Creates a new instance of PoolManagerController.
+     *
+     * @param view
+     *      the associated view
+     */
+    public PoolManagerController( PoolManager view )
     {
-        try
-        {
-            instance_ = new PoolManagerController();
-        }
-        catch ( Throwable e )
-        {
-            throw new RuntimeException( e.getMessage() );
-        }
+        this.view = view;
+
+        initActions();
+        initToolbar();
+        initContextMenu();
+        initDragAndDrop();
+        initDoubleClickListener();
+        registerUpdateActions();
     }
 
 
     /**
-     * Use this method to get the singleton instance of the controller
-     * @return
+     * Initializes the Actions.
      */
-    public static PoolManagerController getInstance()
+    private void initActions()
     {
-        return instance_;
+        openLocalFile = new OpenLocalFileAction();
+        createANewSchema = new CreateANewSchemaAction();
+        removeSchema = new RemoveSchemaAction();
+        createANewObjectClass = new CreateANewObjectClassAction();
+        createANewAttributeType = new CreateANewAttributeTypeAction();
+        deleteAction = new DeleteAction();
+        sortAlphabetical = new SortPoolManagerAction( PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
+            SortPoolManagerAction.SortType.alphabetical, Messages.getString( "PoolManager.Sort_alphabetically" ) ); //$NON-NLS-1$
+        sortUnAlphabetical = new SortPoolManagerAction( PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
+            SortPoolManagerAction.SortType.unalphabetical, Messages.getString( "PoolManager.Sort_unalphabetically" ) ); //$NON-NLS-1$
+        collapseAll = new CollapseAllAction( view.getViewer() );
+        linkWithEditor = new LinkWithEditorSchemasView( view );
+        openSchemaSourceCode = new OpenSchemaSourceCode( PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
+            "View source code" );
+        save = new SaveAction();
+        saveAs = new SaveAsAction();
     }
 
 
-    /* (non-Javadoc)
-     * @see org.eclipse.jface.action.IMenuListener#menuAboutToShow(org.eclipse.jface.action.IMenuManager)
+    /**
+     * Initializes the Toolbar.
      */
-    public void menuAboutToShow( IMenuManager manager )
+    private void initToolbar()
     {
-        CreateANewSchemaAction createANewSchemaAction = new CreateANewSchemaAction();
-        CreateANewObjectClassAction createANewObjectClassAction = new CreateANewObjectClassAction();
-        CreateANewAttributeTypeAction createANewAttributeTypeAction = new CreateANewAttributeTypeAction();
-        DeleteAction deleteAction = new DeleteAction();
-        OpenSchemaSourceCode openSchemaSourceCode = new OpenSchemaSourceCode( PlatformUI.getWorkbench()
-            .getActiveWorkbenchWindow(), "View source code" ); //$NON-NLS-1$
-        SaveAction saveAction = new SaveAction();
-        SaveAsAction saveAsAction = new SaveAsAction();
-        RemoveSchemaAction removeSchemaAction = new RemoveSchemaAction();
+        IToolBarManager toolbar = view.getViewSite().getActionBars().getToolBarManager();
+        toolbar.add( openLocalFile );
+        toolbar.add( createANewSchema );
+        toolbar.add( removeSchema );
+        toolbar.add( new Separator() );
+        toolbar.add( createANewObjectClass );
+        toolbar.add( createANewAttributeType );
+        toolbar.add( ( IAction ) deleteAction );
+        toolbar.add( new Separator() );
+        toolbar.add( sortAlphabetical );
+        toolbar.add( sortUnAlphabetical );
+        toolbar.add( new Separator() );
+        toolbar.add( collapseAll );
+        toolbar.add( linkWithEditor );
+    }
 
-        PoolManager view = ( PoolManager ) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
-            .findView( Application.PLUGIN_ID + ".view.PoolManager" ); //$NON-NLS-1$
 
-        Object selection = ( ( TreeSelection ) view.getViewer().getSelection() ).getFirstElement();
+    /**
+     * Initializes the ContextMenu.
+     */
+    private void initContextMenu()
+    {
+        TreeViewer viewer = view.getViewer();
 
-        if ( selection instanceof SchemaWrapper )
-        {
-            Schema schema = ( ( SchemaWrapper ) selection ).getMySchema();
-            if ( schema.type == SchemaType.coreSchema )
-            {
-                manager.add( saveAsAction );
-                manager.add( new Separator() );
-                manager.add( openSchemaSourceCode );
-            }
-            else if ( schema.type == SchemaType.userSchema )
-            {
-                manager.add( createANewObjectClassAction );
-                manager.add( createANewAttributeTypeAction );
-                manager.add( new Separator() );
-                manager.add( saveAction );
-                manager.add( saveAsAction );
-                manager.add( removeSchemaAction );
-                manager.add( new Separator() );
-                manager.add( openSchemaSourceCode );
-            }
-        }
-        else if ( selection instanceof IntermediateNode )
-        {
-            if ( ( ( IntermediateNode ) selection ).getDisplayName().equals( "Attribute Types" ) ) { //$NON-NLS-1$
-                manager.add( createANewAttributeTypeAction );
-            }
-            else if ( ( ( IntermediateNode ) selection ).getDisplayName().equals( "Object Classes" ) ) { //$NON-NLS-1$
-                manager.add( createANewObjectClassAction );
-            }
-        }
-        else if ( ( selection instanceof AttributeTypeWrapper ) )
-        {
-            manager.add( deleteAction );
-            manager.add( new Separator() );
-            manager.add( createANewAttributeTypeAction );
-        }
-        else if ( ( selection instanceof ObjectClassWrapper ) )
-        {
-            manager.add( deleteAction );
-            manager.add( new Separator() );
-            manager.add( createANewObjectClassAction );
-        }
-        else
+        contextMenu = new MenuManager( "" ); //$NON-NLS-1$
+        contextMenu.setRemoveAllWhenShown( true );
+
+        contextMenu.addMenuListener( new IMenuListener()
         {
-            // Nothing is selected
-            if ( selection == null )
+            /**
+             * {@inheritDoc}
+             */
+            public void menuAboutToShow( IMenuManager manager )
             {
-                manager.add( createANewSchemaAction );
+                Object selection = ( ( TreeSelection ) view.getViewer().getSelection() ).getFirstElement();
+
+                if ( selection instanceof SchemaWrapper )
+                {
+                    Schema schema = ( ( SchemaWrapper ) selection ).getMySchema();
+                    if ( schema.type == SchemaType.coreSchema )
+                    {
+                        manager.add( saveAs );
+                        manager.add( new Separator() );
+                        manager.add( openSchemaSourceCode );
+                    }
+                    else if ( schema.type == SchemaType.userSchema )
+                    {
+                        manager.add( createANewObjectClass );
+                        manager.add( createANewAttributeType );
+                        manager.add( new Separator() );
+                        manager.add( save );
+                        manager.add( saveAs );
+                        manager.add( removeSchema );
+                        manager.add( new Separator() );
+                        manager.add( openSchemaSourceCode );
+                    }
+                }
+                else if ( selection instanceof IntermediateNode )
+                {
+                    if ( ( ( IntermediateNode ) selection ).getType() == IntermediateNodeType.ATTRIBUTE_TYPE_FOLDER )
+                    {
+                        manager.add( createANewAttributeType );
+                    }
+                    else if ( ( ( IntermediateNode ) selection ).getType() == IntermediateNodeType.OBJECT_CLASS_FOLDER )
+                    {
+                        manager.add( createANewObjectClass );
+                    }
+                }
+                else if ( ( selection instanceof AttributeTypeWrapper ) )
+                {
+                    manager.add( deleteAction );
+                    manager.add( new Separator() );
+                    manager.add( createANewAttributeType );
+                }
+                else if ( ( selection instanceof ObjectClassWrapper ) )
+                {
+                    manager.add( deleteAction );
+                    manager.add( new Separator() );
+                    manager.add( createANewObjectClass );
+                }
+                else
+                {
+                    // Nothing is selected
+                    if ( selection == null )
+                    {
+                        manager.add( createANewSchema );
+                    }
+                }
             }
-        }
+        } );
+
+        // set the context menu to the table viewer
+        viewer.getControl().setMenu( contextMenu.createContextMenu( viewer.getControl() ) );
+        // register the context menu to enable extension actions
+        view.getSite().registerContextMenu( contextMenu, viewer );
     }
 
 
-    /* (non-Javadoc)
-     * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
+    /**
+     * Initializes the DragNDrop support
      */
-    public void doubleClick( DoubleClickEvent event )
+    private void initDragAndDrop()
     {
-        // TODO : /!\ Essayer de factoriser le code commun � la fenetre de vue hierarchique dans une classe abstraite
-
-        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+        DropTarget target = new DropTarget( view.getViewer().getControl(), DND.DROP_COPY );
+        //we only support file dropping on the viewer
+        Transfer[] types = new Transfer[]
+            { FileTransfer.getInstance() };
+        target.setTransfer( types );
+        target.addDropListener( new DropTargetListener()
+        {
+            /**
+             * {@inheritDoc}
+             */
+            public void dragEnter( DropTargetEvent event )
+            {
+                if ( ( event.operations & DND.DROP_COPY ) != 0 )
+                {
+                    event.detail = DND.DROP_COPY;
+                }
+                else
+                {
+                    event.detail = DND.DROP_NONE;
+                }
 
-        PoolManager view = ( PoolManager ) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
-            .findView( PoolManager.ID );
-        TreeViewer viewer = view.getViewer();
+                //we only want files
+                for ( int i = 0; i < event.dataTypes.length; i++ )
+                {
+                    if ( fileTransfer.isSupportedType( event.dataTypes[i] ) )
+                    {
+                        event.currentDataType = event.dataTypes[i];
+                        break;
+                    }
+                }
+            }
 
-        // What we get from the treeViewer is a StructuredSelection
-        StructuredSelection selection = ( StructuredSelection ) event.getSelection();
+            /**
+             * {@inheritDoc}
+             */
+            public void dragOver( DropTargetEvent event )
+            {
+            }
 
-        // Here's the real object (an AttributeTypeWrapper, ObjectClassWrapper or IntermediateNode)
-        Object objectSelection = selection.getFirstElement();
-        IEditorInput input = null;
-        String editorId = null;
+            /**
+             * {@inheritDoc}
+             */
+            public void dragOperationChanged( DropTargetEvent event )
+            {
+            }
 
-        // Selecting the right editor and input
-        if ( objectSelection instanceof AttributeTypeWrapper )
-        {
-            input = new AttributeTypeFormEditorInput( ( ( AttributeTypeWrapper ) objectSelection ).getMyAttributeType() );
-            editorId = AttributeTypeFormEditor.ID;
-        }
-        else if ( objectSelection instanceof ObjectClassWrapper )
-        {
-            input = new ObjectClassFormEditorInput( ( ( ObjectClassWrapper ) objectSelection ).getMyObjectClass() );
-            editorId = ObjectClassFormEditor.ID;
-        }
-        else if ( ( objectSelection instanceof IntermediateNode ) || ( objectSelection instanceof SchemaWrapper ) )
-        {
-            // Here we don't open an editor, we just expand the node.
-            viewer.setExpandedState( objectSelection, !viewer.getExpandedState( objectSelection ) );
-        }
+            /**
+             * {@inheritDoc}
+             */
+            public void dragLeave( DropTargetEvent event )
+            {
+            }
 
-        // Let's open the editor
-        if ( input != null )
-        {
-            try
+            /**
+             * {@inheritDoc}
+             */
+            public void dropAccept( DropTargetEvent event )
             {
-                page.openEditor( input, editorId );
             }
-            catch ( PartInitException e )
+
+            /**
+             * {@inheritDoc}
+             */
+            public void drop( DropTargetEvent event )
             {
-                logger.debug( "error when opening the editor" ); //$NON-NLS-1$
+                if ( fileTransfer.isSupportedType( event.currentDataType ) )
+                {
+                    SchemaPool pool = SchemaPool.getInstance();
+                    String[] files = ( String[] ) event.data;
+                    for ( int i = 0; i < files.length; i++ )
+                    {
+                        try
+                        {
+                            pool.addAlreadyExistingSchema( files[i], SchemaType.userSchema );
+                        }
+                        catch ( SchemaCreationException e )
+                        {
+                            logger.debug( "error when initializing new schema after drag&drop: " + files[i] ); //$NON-NLS-1$
+                        }
+                    }
+                }
             }
-        }
-    }
+        } );
 
+    }
 
-    /******************************************
-     *         DropTargetListener Impl        *
-     ******************************************/
 
-    public void dragEnter( DropTargetEvent event )
+    /**
+     * Initializes the DoubleClickListener
+     */
+    private void initDoubleClickListener()
     {
-        if ( ( event.operations & DND.DROP_COPY ) != 0 )
+        view.getViewer().addDoubleClickListener( new IDoubleClickListener()
         {
-            event.detail = DND.DROP_COPY;
-        }
-        else
-        {
-            event.detail = DND.DROP_NONE;
-        }
-
-        //we only want files
-        for ( int i = 0; i < event.dataTypes.length; i++ )
-        {
-            if ( fileTransfer.isSupportedType( event.dataTypes[i] ) )
+            /**
+             * {@inheritDoc}
+             */
+            public void doubleClick( DoubleClickEvent event )
             {
-                event.currentDataType = event.dataTypes[i];
-                break;
-            }
-        }
-    }
+                // TODO : /!\ Essayer de factoriser le code commun � la fenetre de vue hierarchique dans une classe abstraite
 
+                IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
 
-    public void dragOver( DropTargetEvent event )
-    {
-    }
-
+                PoolManager view = ( PoolManager ) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+                    .findView( PoolManager.ID );
+                TreeViewer viewer = view.getViewer();
 
-    public void dragOperationChanged( DropTargetEvent event )
-    {
-    }
+                // What we get from the treeViewer is a StructuredSelection
+                StructuredSelection selection = ( StructuredSelection ) event.getSelection();
 
+                // Here's the real object (an AttributeTypeWrapper, ObjectClassWrapper or IntermediateNode)
+                Object objectSelection = selection.getFirstElement();
+                IEditorInput input = null;
+                String editorId = null;
 
-    public void dragLeave( DropTargetEvent event )
-    {
-    }
+                // Selecting the right editor and input
+                if ( objectSelection instanceof AttributeTypeWrapper )
+                {
+                    input = new AttributeTypeFormEditorInput( ( ( AttributeTypeWrapper ) objectSelection )
+                        .getMyAttributeType() );
+                    editorId = AttributeTypeFormEditor.ID;
+                }
+                else if ( objectSelection instanceof ObjectClassWrapper )
+                {
+                    input = new ObjectClassFormEditorInput( ( ( ObjectClassWrapper ) objectSelection )
+                        .getMyObjectClass() );
+                    editorId = ObjectClassFormEditor.ID;
+                }
+                else if ( ( objectSelection instanceof IntermediateNode )
+                    || ( objectSelection instanceof SchemaWrapper ) )
+                {
+                    // Here we don't open an editor, we just expand the node.
+                    viewer.setExpandedState( objectSelection, !viewer.getExpandedState( objectSelection ) );
+                }
 
+                // Let's open the editor
+                if ( input != null )
+                {
+                    try
+                    {
+                        page.openEditor( input, editorId );
+                    }
+                    catch ( PartInitException e )
+                    {
+                        logger.debug( "error when opening the editor" ); //$NON-NLS-1$
+                    }
+                }
+            }
+        } );
 
-    public void dropAccept( DropTargetEvent event )
-    {
     }
 
 
-    public void drop( DropTargetEvent event )
+    /**
+     * Registers a Listener on the Schemas View and enable/disable the
+     * Actions according to the selection
+     */
+    private void registerUpdateActions()
     {
-        if ( fileTransfer.isSupportedType( event.currentDataType ) )
+        // Handling selection of the Browser View to enable/disable the Actions
+        view.getSite().getPage().addSelectionListener( PoolManager.ID, new ISelectionListener()
         {
-            SchemaPool pool = SchemaPool.getInstance();
-            String[] files = ( String[] ) event.data;
-            for ( int i = 0; i < files.length; i++ )
+            /**
+             * {@inheritDoc}
+             */
+            public void selectionChanged( IWorkbenchPart part, ISelection selection )
             {
-                try
+                TreeSelection treeSelection = ( TreeSelection ) selection;
+
+                Object selectedObject = ( ( TreeSelection ) selection ).getFirstElement();
+
+                if ( treeSelection.size() != 1 || selectedObject == null )
+                {
+                    removeSchema.setEnabled( false );
+                    createANewObjectClass.setEnabled( false );
+                    createANewAttributeType.setEnabled( false );
+                    deleteAction.setEnabled( false );
+                }
+                else if ( selectedObject instanceof SchemaWrapper )
+                {
+                    SchemaWrapper schemaWrapper = ( SchemaWrapper ) selectedObject;
+
+                    if ( schemaWrapper.getMySchema().type == SchemaType.coreSchema )
+                    {
+                        removeSchema.setEnabled( false );
+                        createANewObjectClass.setEnabled( false );
+                        createANewAttributeType.setEnabled( false );
+                        deleteAction.setEnabled( false );
+                    }
+                    else
+                    {
+                        removeSchema.setEnabled( true );
+                        createANewObjectClass.setEnabled( true );
+                        createANewAttributeType.setEnabled( true );
+                        deleteAction.setEnabled( false );
+                    }
+                }
+                else if ( selectedObject instanceof AttributeTypeWrapper )
+                {
+                    AttributeTypeWrapper attributeTypeWrapper = ( AttributeTypeWrapper ) selectedObject;
+                    deleteAction.setText( "Delete Attribute Type" + " '" + attributeTypeWrapper.getName() + "'" );
+
+                    if ( attributeTypeWrapper.getMyAttributeType().getOriginatingSchema().type == SchemaType.coreSchema )
+                    {
+                        createANewObjectClass.setEnabled( false );
+                        createANewAttributeType.setEnabled( false );
+                        deleteAction.setEnabled( false );
+                    }
+                    else
+                    {
+                        createANewObjectClass.setEnabled( false );
+                        createANewAttributeType.setEnabled( true );
+                        deleteAction.setEnabled( true );
+                    }
+                }
+                else if ( selectedObject instanceof ObjectClassWrapper )
                 {
-                    pool.addAlreadyExistingSchema( files[i], SchemaType.userSchema );
+                    ObjectClassWrapper objectClassWrapper = ( ObjectClassWrapper ) selectedObject;
+                    deleteAction.setText( "Delete Object Class" + " '" + objectClassWrapper.getNames()[0] + "'" );
+
+                    if ( objectClassWrapper.getMyObjectClass().getOriginatingSchema().type == SchemaType.coreSchema )
+                    {
+                        createANewObjectClass.setEnabled( false );
+                        createANewAttributeType.setEnabled( false );
+                        deleteAction.setEnabled( false );
+                    }
+                    else
+                    {
+                        createANewObjectClass.setEnabled( true );
+                        createANewAttributeType.setEnabled( false );
+                        deleteAction.setEnabled( true );
+                    }
                 }
-                catch ( SchemaCreationException e )
+                else if ( selectedObject instanceof IntermediateNode )
                 {
-                    logger.debug( "error when initializing new schema after drag&drop: " + files[i] ); //$NON-NLS-1$
+                    IntermediateNode intermediateNode = ( IntermediateNode ) selectedObject;
+                    SchemaWrapper schemaWrapper = ( SchemaWrapper ) intermediateNode.getParent();
+
+                    if ( schemaWrapper.getMySchema().type == SchemaType.coreSchema )
+                    {
+                        removeSchema.setEnabled( false );
+                        createANewObjectClass.setEnabled( false );
+                        createANewAttributeType.setEnabled( false );
+                        deleteAction.setEnabled( false );
+                    }
+                    else
+                    {
+                        if ( intermediateNode.getType() == IntermediateNodeType.OBJECT_CLASS_FOLDER )
+                        {
+                            removeSchema.setEnabled( true );
+                            createANewObjectClass.setEnabled( true );
+                            createANewAttributeType.setEnabled( false );
+                            deleteAction.setEnabled( false );
+                        }
+                        else if ( intermediateNode.getType() == IntermediateNodeType.ATTRIBUTE_TYPE_FOLDER )
+                        {
+                            removeSchema.setEnabled( true );
+                            createANewObjectClass.setEnabled( false );
+                            createANewAttributeType.setEnabled( true );
+                            deleteAction.setEnabled( false );
+                        }
+                        else
+                        {
+                            removeSchema.setEnabled( true );
+                            createANewObjectClass.setEnabled( false );
+                            createANewAttributeType.setEnabled( false );
+                            deleteAction.setEnabled( false );
+                        }
+                    }
                 }
             }
-        }
+        } );
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewAttributeTypeAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewAttributeTypeAction.java?view=diff&rev=501083&r1=501082&r2=501083
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewAttributeTypeAction.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewAttributeTypeAction.java Mon Jan 29 07:45:59 2007
@@ -33,17 +33,11 @@
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.SchemaWrapper;
 import org.apache.directory.ldapstudio.schemas.view.wizards.CreateANewAttributeTypeWizard;
 import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TreeSelection;
 import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 
@@ -51,8 +45,7 @@
 /**
  * This class implements the Action for creating a new attribute type
  */
-public class CreateANewAttributeTypeAction extends Action implements IWorkbenchWindowActionDelegate,
-    IViewActionDelegate
+public class CreateANewAttributeTypeAction extends Action
 {
 
     /**
@@ -72,8 +65,8 @@
     }
 
 
-    /* (non-Javadoc)
-     * @see org.eclipse.jface.action.Action#run()
+    /**
+     * {@inheritDoc}
      */
     public void run()
     {
@@ -138,31 +131,5 @@
                 dialog.open();
             }
         }
-    }
-
-
-    public void dispose()
-    {
-    }
-
-
-    public void init( IWorkbenchWindow window )
-    {
-    }
-
-
-    public void run( IAction action )
-    {
-        this.run();
-    }
-
-
-    public void selectionChanged( IAction action, ISelection selection )
-    {
-    }
-
-
-    public void init( IViewPart view )
-    {
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewObjectClassAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewObjectClassAction.java?view=diff&rev=501083&r1=501082&r2=501083
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewObjectClassAction.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewObjectClassAction.java Mon Jan 29 07:45:59 2007
@@ -33,17 +33,11 @@
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.SchemaWrapper;
 import org.apache.directory.ldapstudio.schemas.view.wizards.CreateANewObjectClassWizard;
 import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TreeSelection;
 import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 
@@ -51,7 +45,7 @@
 /**
  * This class implements the Action for creating a new object class
  */
-public class CreateANewObjectClassAction extends Action implements IWorkbenchWindowActionDelegate, IViewActionDelegate
+public class CreateANewObjectClassAction extends Action
 {
 
     /**
@@ -71,8 +65,8 @@
     }
 
 
-    /* (non-Javadoc)
-     * @see org.eclipse.jface.action.Action#run()
+    /**
+     * {@inheritDoc}
      */
     public void run()
     {
@@ -137,31 +131,5 @@
                 dialog.open();
             }
         }
-    }
-
-
-    public void run( IAction action )
-    {
-        this.run();
-    }
-
-
-    public void dispose()
-    {
-    }
-
-
-    public void init( IWorkbenchWindow window )
-    {
-    }
-
-
-    public void selectionChanged( IAction action, ISelection selection )
-    {
-    }
-
-
-    public void init( IViewPart view )
-    {
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewSchemaAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewSchemaAction.java?view=diff&rev=501083&r1=501082&r2=501083
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewSchemaAction.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/CreateANewSchemaAction.java Mon Jan 29 07:45:59 2007
@@ -26,14 +26,8 @@
 import org.apache.directory.ldapstudio.schemas.view.IImageKeys;
 import org.apache.directory.ldapstudio.schemas.view.wizards.CreateANewSchemaWizard;
 import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 
@@ -42,7 +36,7 @@
  * This class implements the Action for creating a new schema
  */
 
-public class CreateANewSchemaAction extends Action implements IWorkbenchWindowActionDelegate, IViewActionDelegate
+public class CreateANewSchemaAction extends Action
 {
     /**
      * Default constructor
@@ -61,15 +55,9 @@
     }
 
 
-    /* (non-Javadoc)
-     * @see org.eclipse.jface.action.Action#run()
+    /**
+     * {@inheritDoc}
      */
-    public void run( IAction action )
-    {
-        this.run();
-    }
-
-
     public void run()
     {
         // Instantiates and initializes the wizard
@@ -79,25 +67,5 @@
         WizardDialog dialog = new WizardDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard );
         dialog.create();
         dialog.open();
-    }
-
-
-    public void dispose()
-    {
-    }
-
-
-    public void init( IWorkbenchWindow window )
-    {
-    }
-
-
-    public void selectionChanged( IAction action, ISelection selection )
-    {
-    }
-
-
-    public void init( IViewPart view )
-    {
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/DeleteAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/DeleteAction.java?view=diff&rev=501083&r1=501082&r2=501083
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/DeleteAction.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/DeleteAction.java Mon Jan 29 07:45:59 2007
@@ -35,17 +35,11 @@
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.SchemaWrapper;
 import org.apache.log4j.Logger;
 import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.TreeSelection;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.MessageBox;
 import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
 import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -54,7 +48,7 @@
 /**
  * This class implements the Action for deleting an element (object class or attribute type)
  */
-public class DeleteAction extends Action implements IWorkbenchWindowActionDelegate, IViewActionDelegate
+public class DeleteAction extends Action
 {
     private static Logger logger = Logger.getLogger( DeleteAction.class );
 
@@ -81,8 +75,8 @@
     }
 
 
-    /* (non-Javadoc)
-     * @see org.eclipse.jface.action.Action#run()
+    /**
+     * {@inheritDoc}
      */
     public void run()
     {
@@ -183,31 +177,5 @@
                 }
             }
         }
-    }
-
-
-    public void dispose()
-    {
-    }
-
-
-    public void init( IWorkbenchWindow window )
-    {
-    }
-
-
-    public void run( IAction action )
-    {
-        this.run();
-    }
-
-
-    public void selectionChanged( IAction action, ISelection selection )
-    {
-    }
-
-
-    public void init( IViewPart view )
-    {
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenLocalFileAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenLocalFileAction.java?view=diff&rev=501083&r1=501082&r2=501083
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenLocalFileAction.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/OpenLocalFileAction.java Mon Jan 29 07:45:59 2007
@@ -31,14 +31,8 @@
 import org.eclipse.core.runtime.preferences.ConfigurationScope;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
 import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 
@@ -46,11 +40,14 @@
 /**
  * This class implements the Action for opening a local file schema
  */
-public class OpenLocalFileAction extends Action implements IWorkbenchWindowActionDelegate, IViewActionDelegate
+public class OpenLocalFileAction extends Action
 {
     private static Logger logger = Logger.getLogger( OpenLocalFileAction.class );
 
 
+    /**
+     * Creates a new instance of OpenLocalFileAction.
+     */
     public OpenLocalFileAction()
     {
         setText( Messages.getString( "OpenLocalFileAction.Open_a_schema_file" ) ); //$NON-NLS-1$
@@ -62,12 +59,9 @@
     }
 
 
-    public void run( IAction action )
-    {
-        this.run();
-    }
-
-
+    /**
+     * {@inheritDoc}
+     */
     public void run()
     {
         FileDialog fd = new FileDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OPEN );
@@ -94,25 +88,5 @@
             }
         }
 
-    }
-
-
-    public void dispose()
-    {
-    }
-
-
-    public void init( IWorkbenchWindow window )
-    {
-    }
-
-
-    public void selectionChanged( IAction action, ISelection selection )
-    {
-    }
-
-
-    public void init( IViewPart view )
-    {
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/RemoveSchemaAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/RemoveSchemaAction.java?view=diff&rev=501083&r1=501082&r2=501083
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/RemoveSchemaAction.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/RemoveSchemaAction.java Mon Jan 29 07:45:59 2007
@@ -31,15 +31,9 @@
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.ObjectClassWrapper;
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.SchemaWrapper;
 import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.TreeSelection;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 
@@ -47,7 +41,7 @@
 /**
  * This class implements the Action for removing a schema from the pool
  */
-public class RemoveSchemaAction extends Action implements IWorkbenchWindowActionDelegate, IViewActionDelegate
+public class RemoveSchemaAction extends Action
 {
 
     /**
@@ -67,8 +61,8 @@
     }
 
 
-    /* (non-Javadoc)
-     * @see org.eclipse.jface.action.Action#run()
+    /**
+     * {@inheritDoc}
      */
     public void run()
     {
@@ -125,31 +119,5 @@
             else
                 pool.removeSchema( schema );
         }
-    }
-
-
-    public void dispose()
-    {
-    }
-
-
-    public void init( IWorkbenchWindow window )
-    {
-    }
-
-
-    public void run( IAction action )
-    {
-        this.run();
-    }
-
-
-    public void selectionChanged( IAction action, ISelection selection )
-    {
-    }
-
-
-    public void init( IViewPart view )
-    {
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManager.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManager.java?view=diff&rev=501083&r1=501082&r2=501083
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManager.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/PoolManager.java Mon Jan 29 07:45:59 2007
@@ -25,15 +25,6 @@
 
 import org.apache.directory.ldapstudio.schemas.controller.Application;
 import org.apache.directory.ldapstudio.schemas.controller.PoolManagerController;
-import org.apache.directory.ldapstudio.schemas.controller.actions.CollapseAllAction;
-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.LinkWithEditorSchemasView;
-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;
@@ -41,21 +32,19 @@
 import org.apache.directory.ldapstudio.schemas.view.viewers.wrappers.DisplayableTreeElement;
 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;
 
 
+/**
+ * This class implements the Schemas View
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class PoolManager extends ViewPart implements PoolListener, ISaveablePart2
 {
     public static final String ID = Application.PLUGIN_ID + ".view.PoolManager"; //$NON-NLS-1$
@@ -66,91 +55,46 @@
     private PoolManagerContentProvider contentProvider;
 
 
-    /* (non-Javadoc)
-     * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+    /**
+     * {@inheritDoc}
      */
-    @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$
-        toolbar.add( new Separator() );
-        toolbar.add( new CollapseAllAction( getViewer() ) );
-        toolbar.add( new LinkWithEditorSchemasView( this ) );
-
-        // ContextMenu Creation
-        createContextMenu();
 
         // Registering the Viewer, so other views can be notified when the viewer selection changes
         getSite().setSelectionProvider( viewer );
-    }
 
+        SchemaPool pool = SchemaPool.getInstance();
+        //we want to be notified if the pool has been modified
+        pool.addListener( this );
 
-    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;
+        // Adding the controller
+        new PoolManagerController( this );
     }
 
 
+    /**
+     * Initializes the Viewer
+     */
     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()
+    /**
+     * {@inheritDoc}
      */
-    @Override
     public void setFocus()
     {
         viewer.getControl().setFocus();
     }
 
 
-    /******************************************
-     *                 Logic                  *
-     ******************************************/
-
     /**
      * Refresh the entire view
      */
@@ -181,10 +125,6 @@
     }
 
 
-    /******************************************
-     *            Pool Listener Impl          *
-     ******************************************/
-
     /**
      * We refresh the view only if the pool has been modified
      */
@@ -196,7 +136,10 @@
 
 
     /**
-     * @return the internal tree viewer
+     * Gets the TreeViewer
+     *
+     * @return
+     *      the TreeViewer
      */
     public TreeViewer getViewer()
     {
@@ -204,13 +147,18 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public int promptToSaveOnClose()
     {
-        // TODO Auto-generated method stub
         return ISaveablePart2.YES;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void doSave( IProgressMonitor monitor )
     {
         // save schemas on disk
@@ -239,16 +187,19 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void doSaveAs()
     {
-        // TODO Auto-generated method stub
-
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isDirty()
     {
-        // TODO Auto-generated method stub
         Schema[] schemas = SchemaPool.getInstance().getSchemas();
         for ( int i = 0; i < schemas.length; i++ )
         {
@@ -261,21 +212,26 @@
                 }
             }
         }
+
         // Default value
         return false;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isSaveAsAllowed()
     {
-        // TODO Auto-generated method stub
         return false;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isSaveOnCloseNeeded()
     {
-        // TODO Auto-generated method stub
         return true;
     }
 



Mime
View raw message