directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r639888 - in /directory/studio/branches/1.1.0: connection-ui/META-INF/ connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ connection-ui/src/main/java/org/apache/directory/studio/utils/ ldapbrowser-common/src/main...
Date Fri, 21 Mar 2008 22:18:12 GMT
Author: seelmann
Date: Fri Mar 21 15:18:09 2008
New Revision: 639888

URL: http://svn.apache.org/viewvc?rev=639888&view=rev
Log:
Fix for DIRSTUDIO-231: Changed the way to activate and deactivate the action handlers

Added:
    directory/studio/branches/1.1.0/connection-ui/src/main/java/org/apache/directory/studio/utils/
    directory/studio/branches/1.1.0/connection-ui/src/main/java/org/apache/directory/studio/utils/ActionUtils.java
Modified:
    directory/studio/branches/1.1.0/connection-ui/META-INF/MANIFEST.MF
    directory/studio/branches/1.1.0/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionActionGroup.java
    directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserActionGroup.java
    directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroup.java
    directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroupWithAttribute.java
    directory/studio/branches/1.1.0/ldapbrowser-core/META-INF/MANIFEST.MF
    directory/studio/branches/1.1.0/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java
    directory/studio/branches/1.1.0/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorActionGroup.java
    directory/studio/branches/1.1.0/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewActionGroup.java
    directory/studio/branches/1.1.0/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java
    directory/studio/branches/1.1.0/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java
    directory/studio/branches/1.1.0/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/actions/EditLdifRecordAction.java

Modified: directory/studio/branches/1.1.0/connection-ui/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/directory/studio/branches/1.1.0/connection-ui/META-INF/MANIFEST.MF?rev=639888&r1=639887&r2=639888&view=diff
==============================================================================
--- directory/studio/branches/1.1.0/connection-ui/META-INF/MANIFEST.MF (original)
+++ directory/studio/branches/1.1.0/connection-ui/META-INF/MANIFEST.MF Fri Mar 21 15:18:09 2008
@@ -18,5 +18,6 @@
  org.apache.directory.studio.connection.ui.dnd,
  org.apache.directory.studio.connection.ui.properties,
  org.apache.directory.studio.connection.ui.widgets,
- org.apache.directory.studio.connection.ui.wizards
+ org.apache.directory.studio.connection.ui.wizards,
+ org.apache.directory.studio.utils
 Bundle-ClassPath: .

Modified: directory/studio/branches/1.1.0/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionActionGroup.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/1.1.0/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionActionGroup.java?rev=639888&r1=639887&r2=639888&view=diff
==============================================================================
--- directory/studio/branches/1.1.0/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionActionGroup.java (original)
+++ directory/studio/branches/1.1.0/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionActionGroup.java Fri Mar 21 15:18:09 2008
@@ -40,20 +40,18 @@
 import org.apache.directory.studio.connection.ui.dnd.ConnectionTransfer;
 import org.apache.directory.studio.connection.ui.dnd.DragConnectionListener;
 import org.apache.directory.studio.connection.ui.dnd.DropConnectionListener;
+import org.apache.directory.studio.utils.ActionUtils;
 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.Separator;
-import org.eclipse.jface.commands.ActionHandler;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.swt.dnd.DND;
 import org.eclipse.swt.dnd.Transfer;
 import org.eclipse.ui.IActionBars;
 import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.commands.ICommandService;
 
 
 /**
@@ -273,9 +271,6 @@
      */
     public void activateGlobalActionHandlers()
     {
-        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
-            ICommandService.class );
-
         if ( actionBars != null )
         {
             actionBars.setGlobalActionHandler( ActionFactory.COPY.getId(), ( IAction ) connectionActionMap
@@ -292,25 +287,21 @@
         }
         else
         {
-            if ( commandService != null )
-            {
-                IAction ca = ( IAction ) connectionActionMap.get( copyConnectionAction );
-                ca.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.copy" );
-                commandService.getCommand( ca.getActionDefinitionId() ).setHandler( new ActionHandler( ca ) );
-
-                IAction pa = ( IAction ) connectionActionMap.get( pasteConnectionAction );
-                pa.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.paste" );
-                commandService.getCommand( pa.getActionDefinitionId() ).setHandler( new ActionHandler( pa ) );
-
-                IAction da = ( IAction ) connectionActionMap.get( deleteConnectionAction );
-                da.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.delete" );
-                commandService.getCommand( da.getActionDefinitionId() ).setHandler( new ActionHandler( da ) );
-
-                IAction pda = ( IAction ) connectionActionMap.get( propertyDialogAction );
-                pda.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.properties" );
-                commandService.getCommand( pda.getActionDefinitionId() ).setHandler( new ActionHandler( pda ) );
-
-            }
+            IAction ca = ( IAction ) connectionActionMap.get( copyConnectionAction );
+            ca.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.copy" );
+            ActionUtils.activateActionHandler( ca );
+
+            IAction pa = ( IAction ) connectionActionMap.get( pasteConnectionAction );
+            pa.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.paste" );
+            ActionUtils.activateActionHandler( pa );
+
+            IAction da = ( IAction ) connectionActionMap.get( deleteConnectionAction );
+            da.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.delete" );
+            ActionUtils.activateActionHandler( da );
+
+            IAction pda = ( IAction ) connectionActionMap.get( propertyDialogAction );
+            pda.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.properties" );
+            ActionUtils.activateActionHandler( pda );
         }
     }
 
@@ -320,9 +311,6 @@
      */
     public void deactivateGlobalActionHandlers()
     {
-        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
-            ICommandService.class );
-
         if ( actionBars != null )
         {
             actionBars.setGlobalActionHandler( ActionFactory.COPY.getId(), null );
@@ -334,21 +322,14 @@
         }
         else
         {
-            if ( commandService != null )
-            {
-                IAction ca = ( IAction ) connectionActionMap.get( copyConnectionAction );
-                commandService.getCommand( ca.getActionDefinitionId() ).setHandler( null );
-
-                IAction pa = ( IAction ) connectionActionMap.get( pasteConnectionAction );
-                commandService.getCommand( pa.getActionDefinitionId() ).setHandler( null );
-
-                IAction da = ( IAction ) connectionActionMap.get( deleteConnectionAction );
-                commandService.getCommand( da.getActionDefinitionId() ).setHandler( null );
-
-                IAction pda = ( IAction ) connectionActionMap.get( propertyDialogAction );
-                commandService.getCommand( pda.getActionDefinitionId() ).setHandler( null );
-
-            }
+            IAction ca = ( IAction ) connectionActionMap.get( copyConnectionAction );
+            ActionUtils.deactivateActionHandler( ca );
+            IAction pa = ( IAction ) connectionActionMap.get( pasteConnectionAction );
+            ActionUtils.deactivateActionHandler( pa );
+            IAction da = ( IAction ) connectionActionMap.get( deleteConnectionAction );
+            ActionUtils.deactivateActionHandler( da );
+            IAction pda = ( IAction ) connectionActionMap.get( propertyDialogAction );
+            ActionUtils.deactivateActionHandler( pda );
         }
     }
 

Added: directory/studio/branches/1.1.0/connection-ui/src/main/java/org/apache/directory/studio/utils/ActionUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/1.1.0/connection-ui/src/main/java/org/apache/directory/studio/utils/ActionUtils.java?rev=639888&view=auto
==============================================================================
--- directory/studio/branches/1.1.0/connection-ui/src/main/java/org/apache/directory/studio/utils/ActionUtils.java (added)
+++ directory/studio/branches/1.1.0/connection-ui/src/main/java/org/apache/directory/studio/utils/ActionUtils.java Fri Mar 21 15:18:09 2008
@@ -0,0 +1,85 @@
+/*
+ *  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.studio.utils;
+
+
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.commands.ActionHandler;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+
+
+/**
+ * Utils for Eclipse IAction objects.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ActionUtils
+{
+
+    /**
+     * Deactivates the action handler, if the handler's action is equal to 
+     * the given action.
+     * 
+     * @param action the action
+     */
+    public static void deactivateActionHandler( IAction action )
+    {
+        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
+            ICommandService.class );
+        if ( commandService != null )
+        {
+            IHandler handler = commandService.getCommand( action.getActionDefinitionId() ).getHandler();
+            if ( handler instanceof ActionHandler )
+            {
+                ActionHandler actionHandler = ( ActionHandler ) handler;
+                if ( actionHandler != null && actionHandler.getAction() == action )
+                {
+                    commandService.getCommand( action.getActionDefinitionId() ).setHandler( null );
+                }
+            }
+            else if ( handler != null )
+            {
+                commandService.getCommand( action.getActionDefinitionId() ).setHandler( null );
+            }
+        }
+    }
+
+
+    /**
+     * Activates the action handler
+     * 
+     * @param action the action
+     */
+    public static void activateActionHandler( IAction action )
+    {
+        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
+            ICommandService.class );
+        if ( commandService != null )
+        {
+            ActionHandler actionHandler = new ActionHandler( action );
+            commandService.getCommand( action.getActionDefinitionId() ).setHandler( actionHandler );
+        }
+    }
+
+}

Modified: directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserActionGroup.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserActionGroup.java?rev=639888&r1=639887&r2=639888&view=diff
==============================================================================
--- directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserActionGroup.java (original)
+++ directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserActionGroup.java Fri Mar 21 15:18:09 2008
@@ -34,17 +34,15 @@
 import org.apache.directory.studio.ldapbrowser.common.actions.proxy.ActionHandlerManager;
 import org.apache.directory.studio.ldapbrowser.common.actions.proxy.BrowserViewActionProxy;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.utils.ActionUtils;
 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.Separator;
-import org.eclipse.jface.commands.ActionHandler;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.commands.ICommandService;
 
 
 /**
@@ -149,7 +147,7 @@
     public void enableGlobalActionHandlers( IActionBars actionBars )
     {
         this.actionBars = actionBars;
-        activateGlobalActionHandlers();
+//        activateGlobalActionHandlers();
     }
 
 
@@ -226,9 +224,6 @@
      */
     public void activateGlobalActionHandlers()
     {
-        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
-            ICommandService.class );
-
         if ( actionBars != null )
         {
             actionBars.setGlobalActionHandler( ActionFactory.REFRESH.getId(), ( IAction ) browserActionMap
@@ -239,22 +234,16 @@
         }
         else
         {
-            if ( commandService != null )
-            {
-                IAction pda = ( IAction ) browserActionMap.get( propertyDialogAction );
-                pda.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.properties" );
-                commandService.getCommand( pda.getActionDefinitionId() ).setHandler( new ActionHandler( pda ) );
+            IAction pda = ( IAction ) browserActionMap.get( propertyDialogAction );
+            pda.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.properties" );
+            ActionUtils.activateActionHandler( pda );
 
-                IAction ra = ( IAction ) browserActionMap.get( refreshAction );
-                commandService.getCommand( ra.getActionDefinitionId() ).setHandler( new ActionHandler( ra ) );
-            }
+            IAction ra = ( IAction ) browserActionMap.get( refreshAction );
+            ActionUtils.activateActionHandler( ra );
         }
 
-        if ( commandService != null )
-        {
-            IAction ua = ( IAction ) browserActionMap.get( upAction );
-            commandService.getCommand( ua.getActionDefinitionId() ).setHandler( new ActionHandler( ua ) );
-        }
+        IAction ua = ( IAction ) browserActionMap.get( upAction );
+        ActionUtils.activateActionHandler( ua );
     }
 
 
@@ -263,10 +252,6 @@
      */
     public void deactivateGlobalActionHandlers()
     {
-
-        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
-            ICommandService.class );
-
         if ( actionBars != null )
         {
             actionBars.setGlobalActionHandler( ActionFactory.REFRESH.getId(), null );
@@ -275,22 +260,15 @@
         }
         else
         {
-            if ( commandService != null )
-            {
-                IAction pda = ( IAction ) browserActionMap.get( propertyDialogAction );
-                commandService.getCommand( pda.getActionDefinitionId() ).setHandler( null );
-
-                IAction ra = ( IAction ) browserActionMap.get( refreshAction );
-                commandService.getCommand( ra.getActionDefinitionId() ).setHandler( null );
-            }
-        }
-
-        if ( commandService != null )
-        {
-            IAction ua = ( IAction ) browserActionMap.get( upAction );
-            commandService.getCommand( ua.getActionDefinitionId() ).setHandler( null );
+            IAction ra = ( IAction ) browserActionMap.get( refreshAction );
+            ActionUtils.deactivateActionHandler( ra );
+            
+            IAction pda = ( IAction ) browserActionMap.get( propertyDialogAction );
+            ActionUtils.deactivateActionHandler( pda );
         }
 
+        IAction ua = ( IAction ) browserActionMap.get( upAction );
+        ActionUtils.deactivateActionHandler( ua );
     }
 
 

Modified: directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroup.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroup.java?rev=639888&r1=639887&r2=639888&view=diff
==============================================================================
--- directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroup.java (original)
+++ directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroup.java Fri Mar 21 15:18:09 2008
@@ -37,6 +37,7 @@
 import org.apache.directory.studio.ldapbrowser.common.actions.proxy.ActionHandlerManager;
 import org.apache.directory.studio.ldapbrowser.common.actions.proxy.BrowserActionProxy;
 import org.apache.directory.studio.ldapbrowser.common.actions.proxy.EntryEditorActionProxy;
+import org.apache.directory.studio.utils.ActionUtils;
 import org.apache.directory.studio.valueeditors.IValueEditor;
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.action.IMenuListener;
@@ -44,12 +45,9 @@
 import org.eclipse.jface.action.IToolBarManager;
 import org.eclipse.jface.action.MenuManager;
 import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.commands.ActionHandler;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.commands.ICommandService;
 
 
 /**
@@ -195,7 +193,7 @@
     public void enableGlobalActionHandlers( IActionBars actionBars )
     {
         this.actionBars = actionBars;
-        activateGlobalActionHandlers();
+//        activateGlobalActionHandlers();
     }
 
 
@@ -206,9 +204,9 @@
      */
     public void fillToolBar( IToolBarManager toolBarManager )
     {
-        toolBarManager.add( ( IAction ) entryEditorActionMap.get( newValueAction ) );
+        toolBarManager.add( entryEditorActionMap.get( newValueAction ) );
         toolBarManager.add( new Separator() );
-        toolBarManager.add( ( IAction ) entryEditorActionMap.get( deleteAction ) );
+        toolBarManager.add( entryEditorActionMap.get( deleteAction ) );
         toolBarManager.add( new Separator() );
         toolBarManager.add( showQuickFilterAction );
         toolBarManager.update( true );
@@ -262,14 +260,14 @@
     protected void contextMenuAboutToShow( IMenuManager menuManager )
     {
         // new
-        menuManager.add( ( IAction ) entryEditorActionMap.get( newValueAction ) );
+        menuManager.add( entryEditorActionMap.get( newValueAction ) );
         menuManager.add( new Separator() );
 
         // copy, paste, delete
-        menuManager.add( ( IAction ) entryEditorActionMap.get( copyAction ) );
-        menuManager.add( ( IAction ) entryEditorActionMap.get( pasteAction ) );
-        menuManager.add( ( IAction ) entryEditorActionMap.get( deleteAction ) );
-        menuManager.add( ( IAction ) entryEditorActionMap.get( selectAllAction ) );
+        menuManager.add( entryEditorActionMap.get( copyAction ) );
+        menuManager.add( entryEditorActionMap.get( pasteAction ) );
+        menuManager.add( entryEditorActionMap.get( deleteAction ) );
+        menuManager.add( entryEditorActionMap.get( selectAllAction ) );
         menuManager.add( new Separator() );
 
         // edit
@@ -277,7 +275,7 @@
         menuManager.add( new Separator() );
 
         // properties
-        menuManager.add( ( IAction ) entryEditorActionMap.get( propertyDialogAction ) );
+        menuManager.add( entryEditorActionMap.get( propertyDialogAction ) );
     }
 
 
@@ -315,20 +313,17 @@
      */
     public void activateGlobalActionHandlers()
     {
-        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
-            ICommandService.class );
-
         if ( actionBars != null )
         {
-            actionBars.setGlobalActionHandler( ActionFactory.COPY.getId(), ( IAction ) entryEditorActionMap
+            actionBars.setGlobalActionHandler( ActionFactory.COPY.getId(), entryEditorActionMap
                 .get( copyAction ) );
-            actionBars.setGlobalActionHandler( ActionFactory.PASTE.getId(), ( IAction ) entryEditorActionMap
+            actionBars.setGlobalActionHandler( ActionFactory.PASTE.getId(), entryEditorActionMap
                 .get( pasteAction ) );
-            actionBars.setGlobalActionHandler( ActionFactory.DELETE.getId(), ( IAction ) entryEditorActionMap
+            actionBars.setGlobalActionHandler( ActionFactory.DELETE.getId(), entryEditorActionMap
                 .get( deleteAction ) );
-            actionBars.setGlobalActionHandler( ActionFactory.SELECT_ALL.getId(), ( IAction ) entryEditorActionMap
+            actionBars.setGlobalActionHandler( ActionFactory.SELECT_ALL.getId(), entryEditorActionMap
                 .get( selectAllAction ) );
-            actionBars.setGlobalActionHandler( ActionFactory.PROPERTIES.getId(), ( IAction ) entryEditorActionMap
+            actionBars.setGlobalActionHandler( ActionFactory.PROPERTIES.getId(), entryEditorActionMap
                 .get( propertyDialogAction ) );
             actionBars.setGlobalActionHandler( ActionFactory.FIND.getId(), showQuickFilterAction ); // IWorkbenchActionDefinitionIds.FIND_REPLACE
 
@@ -336,37 +331,29 @@
         }
         else
         {
-            if ( commandService != null )
-            {
-                IAction da = ( IAction ) entryEditorActionMap.get( deleteAction );
-                da.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.delete" );
-                commandService.getCommand( da.getActionDefinitionId() ).setHandler( new ActionHandler( da ) );
-
-                IAction ca = ( IAction ) entryEditorActionMap.get( copyAction );
-                ca.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.copy" );
-                commandService.getCommand( ca.getActionDefinitionId() ).setHandler( new ActionHandler( ca ) );
-
-                IAction pa = ( IAction ) entryEditorActionMap.get( pasteAction );
-                pa.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.paste" );
-                commandService.getCommand( pa.getActionDefinitionId() ).setHandler( new ActionHandler( pa ) );
-
-                showQuickFilterAction.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.find" );
-                commandService.getCommand( showQuickFilterAction.getActionDefinitionId() ).setHandler(
-                    new ActionHandler( showQuickFilterAction ) );
-
-                IAction pda = ( IAction ) entryEditorActionMap.get( propertyDialogAction );
-                pda.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.properties" );
-                commandService.getCommand( pda.getActionDefinitionId() ).setHandler( new ActionHandler( pda ) );
-            }
+            IAction da = entryEditorActionMap.get( deleteAction );
+            da.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.delete" );
+            ActionUtils.activateActionHandler( da );
+
+            IAction ca = entryEditorActionMap.get( copyAction );
+            ca.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.copy" );
+            ActionUtils.activateActionHandler( ca );
+
+            IAction pa = entryEditorActionMap.get( pasteAction );
+            pa.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.paste" );
+            ActionUtils.activateActionHandler( pa );
+
+            showQuickFilterAction.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.find" );
+            ActionUtils.activateActionHandler( showQuickFilterAction );
+
+            IAction pda = entryEditorActionMap.get( propertyDialogAction );
+            pda.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.properties" );
+            ActionUtils.activateActionHandler( pda );
         }
 
-        if ( commandService != null )
-        {
-            IAction nva = ( IAction ) entryEditorActionMap.get( newValueAction );
-            commandService.getCommand( nva.getActionDefinitionId() ).setHandler( new ActionHandler( nva ) );
-            commandService.getCommand( openDefaultValueEditorActionProxy.getActionDefinitionId() ).setHandler(
-                new ActionHandler( openDefaultValueEditorActionProxy ) );
-        }
+        IAction nva = entryEditorActionMap.get( newValueAction );
+        ActionUtils.activateActionHandler( nva );
+        ActionUtils.activateActionHandler( openDefaultValueEditorActionProxy );
     }
 
 
@@ -375,9 +362,6 @@
      */
     public void deactivateGlobalActionHandlers()
     {
-        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
-            ICommandService.class );
-
         if ( actionBars != null )
         {
             actionBars.setGlobalActionHandler( ActionFactory.COPY.getId(), null );
@@ -391,30 +375,20 @@
         }
         else
         {
-            if ( commandService != null )
-            {
-                IAction da = ( IAction ) entryEditorActionMap.get( deleteAction );
-                commandService.getCommand( da.getActionDefinitionId() ).setHandler( null );
-
-                IAction ca = ( IAction ) entryEditorActionMap.get( copyAction );
-                commandService.getCommand( ca.getActionDefinitionId() ).setHandler( null );
-
-                IAction pa = ( IAction ) entryEditorActionMap.get( pasteAction );
-                commandService.getCommand( pa.getActionDefinitionId() ).setHandler( null );
-
-                commandService.getCommand( showQuickFilterAction.getActionDefinitionId() ).setHandler( null );
-
-                IAction pda = ( IAction ) entryEditorActionMap.get( propertyDialogAction );
-                commandService.getCommand( pda.getActionDefinitionId() ).setHandler( null );
-            }
+            IAction ca = entryEditorActionMap.get( copyAction );
+            ActionUtils.deactivateActionHandler( ca );
+            IAction pa = entryEditorActionMap.get( pasteAction );
+            ActionUtils.deactivateActionHandler( pa );
+            IAction da = entryEditorActionMap.get( deleteAction );
+            ActionUtils.deactivateActionHandler( da );
+            ActionUtils.deactivateActionHandler( showQuickFilterAction );
+            IAction pda = entryEditorActionMap.get( propertyDialogAction );
+            ActionUtils.deactivateActionHandler( pda );
         }
 
-        if ( commandService != null )
-        {
-            IAction nva = ( IAction ) entryEditorActionMap.get( newValueAction );
-            commandService.getCommand( nva.getActionDefinitionId() ).setHandler( null );
-            commandService.getCommand( openDefaultValueEditorActionProxy.getActionDefinitionId() ).setHandler( null );
-        }
+        IAction nva = entryEditorActionMap.get( newValueAction );
+        ActionUtils.deactivateActionHandler( nva );
+        ActionUtils.deactivateActionHandler( openDefaultValueEditorActionProxy );
     }
 
 

Modified: directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroupWithAttribute.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroupWithAttribute.java?rev=639888&r1=639887&r2=639888&view=diff
==============================================================================
--- directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroupWithAttribute.java (original)
+++ directory/studio/branches/1.1.0/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroupWithAttribute.java Fri Mar 21 15:18:09 2008
@@ -24,15 +24,13 @@
 import org.apache.directory.studio.ldapbrowser.common.actions.DeleteAllValuesAction;
 import org.apache.directory.studio.ldapbrowser.common.actions.NewAttributeAction;
 import org.apache.directory.studio.ldapbrowser.common.actions.proxy.EntryEditorActionProxy;
+import org.apache.directory.studio.utils.ActionUtils;
 import org.eclipse.jface.action.IAction;
 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.commands.ActionHandler;
 import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ICommandService;
 
 
 /**
@@ -128,15 +126,10 @@
     {
         super.activateGlobalActionHandlers();
 
-        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
-            ICommandService.class );
-        if ( commandService != null )
-        {
-            IAction naa = ( IAction ) entryEditorActionMap.get( newAttributeAction );
-            commandService.getCommand( naa.getActionDefinitionId() ).setHandler( new ActionHandler( naa ) );
-            IAction eada = ( IAction ) entryEditorActionMap.get( editAttributeDescriptionAction );
-            commandService.getCommand( eada.getActionDefinitionId() ).setHandler( new ActionHandler( eada ) );
-        }
+        IAction naa = ( IAction ) entryEditorActionMap.get( newAttributeAction );
+        ActionUtils.activateActionHandler( naa );
+        IAction eada = ( IAction ) entryEditorActionMap.get( editAttributeDescriptionAction );
+        ActionUtils.activateActionHandler( eada );
     }
 
 
@@ -147,15 +140,10 @@
     {
         super.deactivateGlobalActionHandlers();
 
-        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
-            ICommandService.class );
-        if ( commandService != null )
-        {
-            IAction naa = ( IAction ) entryEditorActionMap.get( newAttributeAction );
-            commandService.getCommand( naa.getActionDefinitionId() ).setHandler( null );
-            IAction eada = ( IAction ) entryEditorActionMap.get( editAttributeDescriptionAction );
-            commandService.getCommand( eada.getActionDefinitionId() ).setHandler( null );
-        }
+        IAction naa = ( IAction ) entryEditorActionMap.get( newAttributeAction );
+        ActionUtils.deactivateActionHandler( naa );
+        IAction eada = ( IAction ) entryEditorActionMap.get( editAttributeDescriptionAction );
+        ActionUtils.deactivateActionHandler( eada );
     }
 
 }

Modified: directory/studio/branches/1.1.0/ldapbrowser-core/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/directory/studio/branches/1.1.0/ldapbrowser-core/META-INF/MANIFEST.MF?rev=639888&r1=639887&r2=639888&view=diff
==============================================================================
--- directory/studio/branches/1.1.0/ldapbrowser-core/META-INF/MANIFEST.MF (original)
+++ directory/studio/branches/1.1.0/ldapbrowser-core/META-INF/MANIFEST.MF Fri Mar 21 15:18:09 2008
@@ -25,6 +25,6 @@
  org.apache.directory.studio.ldapbrowser.core.propertypageproviders,
  org.apache.directory.studio.ldapbrowser.core.utils
 Bundle-ClassPath: .,
- lib/commons-io-1.3.1.jar,
  lib/commons-codec-1.3.jar,
+ lib/commons-io-1.3.1.jar,
  lib/poi-3.0.1-FINAL.jar

Modified: directory/studio/branches/1.1.0/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/1.1.0/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java?rev=639888&r1=639887&r2=639888&view=diff
==============================================================================
--- directory/studio/branches/1.1.0/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java (original)
+++ directory/studio/branches/1.1.0/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java Fri Mar 21 15:18:09 2008
@@ -42,19 +42,18 @@
 import org.apache.directory.studio.ldapbrowser.ui.actions.NewBatchOperationAction;
 import org.apache.directory.studio.ldapbrowser.ui.actions.NewSearchAction;
 import org.apache.directory.studio.ldapbrowser.ui.actions.OpenSchemaBrowserAction;
+import org.apache.directory.studio.utils.ActionUtils;
 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.commands.ActionHandler;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.ui.IWorkbenchActionConstants;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.actions.ActionFactory;
 import org.eclipse.ui.actions.ContributionItemFactory;
-import org.eclipse.ui.commands.ICommandService;
 
 
 /**
@@ -249,13 +248,13 @@
     public void fillToolBar( IToolBarManager toolBarManager )
     {
         toolBarManager.add( new Separator() );
-        toolBarManager.add( ( IAction ) entryEditorActionMap.get( newValueAction ) );
-        toolBarManager.add( ( IAction ) entryEditorActionMap.get( newAttributeAction ) );
+        toolBarManager.add( entryEditorActionMap.get( newValueAction ) );
+        toolBarManager.add( entryEditorActionMap.get( newAttributeAction ) );
         toolBarManager.add( new Separator() );
-        toolBarManager.add( ( IAction ) entryEditorActionMap.get( deleteAction ) );
-        toolBarManager.add( ( IAction ) entryEditorActionMap.get( deleteAllValuesAction ) );
+        toolBarManager.add( entryEditorActionMap.get( deleteAction ) );
+        toolBarManager.add( entryEditorActionMap.get( deleteAllValuesAction ) );
         toolBarManager.add( new Separator() );
-        toolBarManager.add( ( IAction ) entryEditorActionMap.get( refreshAttributesAction ) );
+        toolBarManager.add( entryEditorActionMap.get( refreshAttributesAction ) );
         toolBarManager.add( new Separator() );
         toolBarManager.add( expandAllAction );
         toolBarManager.add( collapseAllAction );
@@ -296,21 +295,21 @@
     protected void contextMenuAboutToShow( IMenuManager menuManager )
     {
         // new
-        menuManager.add( ( IAction ) entryEditorActionMap.get( newAttributeAction ) );
-        menuManager.add( ( IAction ) entryEditorActionMap.get( newValueAction ) );
-        menuManager.add( ( IAction ) entryEditorActionMap.get( newSearchAction ) );
-        menuManager.add( ( IAction ) entryEditorActionMap.get( newBatchOperationAction ) );
+        menuManager.add( entryEditorActionMap.get( newAttributeAction ) );
+        menuManager.add( entryEditorActionMap.get( newValueAction ) );
+        menuManager.add( entryEditorActionMap.get( newSearchAction ) );
+        menuManager.add( entryEditorActionMap.get( newBatchOperationAction ) );
         menuManager.add( new Separator() );
 
         // navigation
-        menuManager.add( ( IAction ) entryEditorActionMap.get( locateDnInDitAction ) );
+        menuManager.add( entryEditorActionMap.get( locateDnInDitAction ) );
         MenuManager schemaMenuManager = new MenuManager( "Open Schema Browser" );
-        schemaMenuManager.add( ( IAction ) entryEditorActionMap.get( showOcdAction ) );
-        schemaMenuManager.add( ( IAction ) entryEditorActionMap.get( showAtdAction ) );
-        schemaMenuManager.add( ( IAction ) entryEditorActionMap.get( showEqualityMrdAction ) );
-        schemaMenuManager.add( ( IAction ) entryEditorActionMap.get( showSubstringMrdAction ) );
-        schemaMenuManager.add( ( IAction ) entryEditorActionMap.get( showOrderingMrdAction ) );
-        schemaMenuManager.add( ( IAction ) entryEditorActionMap.get( showLsdAction ) );
+        schemaMenuManager.add( entryEditorActionMap.get( showOcdAction ) );
+        schemaMenuManager.add( entryEditorActionMap.get( showAtdAction ) );
+        schemaMenuManager.add( entryEditorActionMap.get( showEqualityMrdAction ) );
+        schemaMenuManager.add( entryEditorActionMap.get( showSubstringMrdAction ) );
+        schemaMenuManager.add( entryEditorActionMap.get( showOrderingMrdAction ) );
+        schemaMenuManager.add( entryEditorActionMap.get( showLsdAction ) );
         menuManager.add( schemaMenuManager );
         MenuManager showInSubMenu = new MenuManager( "Show In" );
         showInSubMenu.add( ContributionItemFactory.VIEWS_SHOW_IN.create( PlatformUI.getWorkbench()
@@ -320,45 +319,45 @@
         menuManager.add( new Separator() );
 
         // copy, paste, delete
-        menuManager.add( ( IAction ) entryEditorActionMap.get( copyAction ) );
-        menuManager.add( ( IAction ) entryEditorActionMap.get( pasteAction ) );
-        menuManager.add( ( IAction ) entryEditorActionMap.get( deleteAction ) );
-        menuManager.add( ( IAction ) entryEditorActionMap.get( selectAllAction ) );
+        menuManager.add( entryEditorActionMap.get( copyAction ) );
+        menuManager.add( entryEditorActionMap.get( pasteAction ) );
+        menuManager.add( entryEditorActionMap.get( deleteAction ) );
+        menuManager.add( entryEditorActionMap.get( selectAllAction ) );
         MenuManager advancedMenuManager = new MenuManager( "Advanced" );
-        advancedMenuManager.add( ( IAction ) entryEditorActionMap.get( copyDnAction ) );
-        advancedMenuManager.add( ( IAction ) entryEditorActionMap.get( copyUrlAction ) );
+        advancedMenuManager.add( entryEditorActionMap.get( copyDnAction ) );
+        advancedMenuManager.add( entryEditorActionMap.get( copyUrlAction ) );
         advancedMenuManager.add( new Separator() );
-        advancedMenuManager.add( ( IAction ) entryEditorActionMap.get( copyAttriuteDescriptionAction ) );
+        advancedMenuManager.add( entryEditorActionMap.get( copyAttriuteDescriptionAction ) );
         advancedMenuManager.add( new Separator() );
-        advancedMenuManager.add( ( IAction ) entryEditorActionMap.get( copyValueUtf8Action ) );
-        advancedMenuManager.add( ( IAction ) entryEditorActionMap.get( copyValueBase64Action ) );
-        advancedMenuManager.add( ( IAction ) entryEditorActionMap.get( copyValueHexAction ) );
+        advancedMenuManager.add( entryEditorActionMap.get( copyValueUtf8Action ) );
+        advancedMenuManager.add( entryEditorActionMap.get( copyValueBase64Action ) );
+        advancedMenuManager.add( entryEditorActionMap.get( copyValueHexAction ) );
         advancedMenuManager.add( new Separator() );
-        advancedMenuManager.add( ( IAction ) entryEditorActionMap.get( copyValueAsLdifAction ) );
+        advancedMenuManager.add( entryEditorActionMap.get( copyValueAsLdifAction ) );
         advancedMenuManager.add( new Separator() );
-        advancedMenuManager.add( ( IAction ) entryEditorActionMap.get( copySearchFilterAction ) );
-        advancedMenuManager.add( ( IAction ) entryEditorActionMap.get( copyNotSearchFilterAction ) );
-        advancedMenuManager.add( ( IAction ) entryEditorActionMap.get( copyAndSearchFilterAction ) );
-        advancedMenuManager.add( ( IAction ) entryEditorActionMap.get( copyOrSearchFilterAction ) );
+        advancedMenuManager.add( entryEditorActionMap.get( copySearchFilterAction ) );
+        advancedMenuManager.add( entryEditorActionMap.get( copyNotSearchFilterAction ) );
+        advancedMenuManager.add( entryEditorActionMap.get( copyAndSearchFilterAction ) );
+        advancedMenuManager.add( entryEditorActionMap.get( copyOrSearchFilterAction ) );
         advancedMenuManager.add( new Separator() );
-        advancedMenuManager.add( ( IAction ) entryEditorActionMap.get( deleteAllValuesAction ) );
+        advancedMenuManager.add( entryEditorActionMap.get( deleteAllValuesAction ) );
         menuManager.add( advancedMenuManager );
         menuManager.add( new Separator() );
 
         // edit
-        menuManager.add( ( IAction ) entryEditorActionMap.get( editAttributeDescriptionAction ) );
+        menuManager.add( entryEditorActionMap.get( editAttributeDescriptionAction ) );
         super.addEditMenu( menuManager );
         menuManager.add( new Separator() );
 
         // refresh
-        menuManager.add( ( IAction ) entryEditorActionMap.get( refreshAttributesAction ) );
+        menuManager.add( entryEditorActionMap.get( refreshAttributesAction ) );
         menuManager.add( new Separator() );
 
         // additions
         menuManager.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
 
         // properties
-        menuManager.add( ( IAction ) entryEditorActionMap.get( propertyDialogAction ) );
+        menuManager.add( entryEditorActionMap.get( propertyDialogAction ) );
     }
 
 
@@ -369,23 +368,18 @@
     {
         if ( actionBars != null )
         {
-            actionBars.setGlobalActionHandler( ActionFactory.REFRESH.getId(), ( IAction ) entryEditorActionMap
+            actionBars.setGlobalActionHandler( ActionFactory.REFRESH.getId(), entryEditorActionMap
                 .get( refreshAttributesAction ) );
         }
 
         super.activateGlobalActionHandlers();
 
-        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
-            ICommandService.class );
-        if ( commandService != null )
-        {
-            IAction naa = ( IAction ) entryEditorActionMap.get( newAttributeAction );
-            commandService.getCommand( naa.getActionDefinitionId() ).setHandler( new ActionHandler( naa ) );
-            IAction lid = ( IAction ) entryEditorActionMap.get( locateDnInDitAction );
-            commandService.getCommand( lid.getActionDefinitionId() ).setHandler( new ActionHandler( lid ) );
-            IAction eada = ( IAction ) entryEditorActionMap.get( editAttributeDescriptionAction );
-            commandService.getCommand( eada.getActionDefinitionId() ).setHandler( new ActionHandler( eada ) );
-        }
+        IAction naa = entryEditorActionMap.get( newAttributeAction );
+        ActionUtils.activateActionHandler( naa );
+        IAction lid = entryEditorActionMap.get( locateDnInDitAction );
+        ActionUtils.activateActionHandler( lid );
+        IAction eada = entryEditorActionMap.get( editAttributeDescriptionAction );
+        ActionUtils.activateActionHandler( eada );
     }
 
 
@@ -401,17 +395,12 @@
 
         super.deactivateGlobalActionHandlers();
 
-        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
-            ICommandService.class );
-        if ( commandService != null )
-        {
-            IAction naa = ( IAction ) entryEditorActionMap.get( newAttributeAction );
-            commandService.getCommand( naa.getActionDefinitionId() ).setHandler( null );
-            IAction lid = ( IAction ) entryEditorActionMap.get( locateDnInDitAction );
-            commandService.getCommand( lid.getActionDefinitionId() ).setHandler( null );
-            IAction eada = ( IAction ) entryEditorActionMap.get( editAttributeDescriptionAction );
-            commandService.getCommand( eada.getActionDefinitionId() ).setHandler( null );
-        }
+        IAction naa = entryEditorActionMap.get( newAttributeAction );
+        ActionUtils.deactivateActionHandler( naa );
+        IAction lid = entryEditorActionMap.get( locateDnInDitAction );
+        ActionUtils.deactivateActionHandler( lid );
+        IAction eada = entryEditorActionMap.get( editAttributeDescriptionAction );
+        ActionUtils.deactivateActionHandler( eada );
     }
 
 

Modified: directory/studio/branches/1.1.0/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorActionGroup.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/1.1.0/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorActionGroup.java?rev=639888&r1=639887&r2=639888&view=diff
==============================================================================
--- directory/studio/branches/1.1.0/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorActionGroup.java (original)
+++ directory/studio/branches/1.1.0/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorActionGroup.java Fri Mar 21 15:18:09 2008
@@ -48,6 +48,7 @@
 import org.apache.directory.studio.ldapbrowser.ui.actions.OpenSchemaBrowserAction;
 import org.apache.directory.studio.ldapbrowser.ui.actions.OpenSearchResultAction;
 import org.apache.directory.studio.ldapbrowser.ui.actions.proxy.SearchResultEditorActionProxy;
+import org.apache.directory.studio.utils.ActionUtils;
 import org.apache.directory.studio.valueeditors.IValueEditor;
 import org.apache.directory.studio.valueeditors.ValueEditorManager;
 import org.eclipse.jface.action.IAction;
@@ -56,14 +57,12 @@
 import org.eclipse.jface.action.IToolBarManager;
 import org.eclipse.jface.action.MenuManager;
 import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.commands.ActionHandler;
 import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.ui.IActionBars;
 import org.eclipse.ui.IWorkbenchActionConstants;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.actions.ActionFactory;
 import org.eclipse.ui.actions.ContributionItemFactory;
-import org.eclipse.ui.commands.ICommandService;
 
 
 public class SearchResultEditorActionGroup implements ActionHandlerManager, IMenuListener
@@ -330,7 +329,7 @@
     public void enableGlobalActionHandlers( IActionBars actionBars )
     {
         this.actionBars = actionBars;
-        this.activateGlobalActionHandlers();
+//        this.activateGlobalActionHandlers();
     }
 
 
@@ -441,19 +440,13 @@
             actionBars.updateActionBars();
         }
 
-        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
-            ICommandService.class );
-        if ( commandService != null )
-        {
-            IAction nva = ( IAction ) this.searchResultEditorActionMap.get( newValueAction );
-            commandService.getCommand( nva.getActionDefinitionId() ).setHandler( new ActionHandler( nva ) );
-            IAction lid = ( IAction ) this.searchResultEditorActionMap.get( locateDnInDitAction );
-            commandService.getCommand( lid.getActionDefinitionId() ).setHandler( new ActionHandler( lid ) );
-            IAction osr = ( IAction ) this.searchResultEditorActionMap.get( openSearchResultAction );
-            commandService.getCommand( osr.getActionDefinitionId() ).setHandler( new ActionHandler( osr ) );
-            commandService.getCommand( openDefaultValueEditorActionProxy.getActionDefinitionId() ).setHandler(
-                new ActionHandler( openDefaultValueEditorActionProxy ) );
-        }
+        IAction nva = ( IAction ) this.searchResultEditorActionMap.get( newValueAction );
+        ActionUtils.activateActionHandler( nva );
+        IAction lid = ( IAction ) this.searchResultEditorActionMap.get( locateDnInDitAction );
+        ActionUtils.activateActionHandler( lid );
+        IAction osr = ( IAction ) this.searchResultEditorActionMap.get( openSearchResultAction );
+        ActionUtils.activateActionHandler( osr );
+        ActionUtils.activateActionHandler( openDefaultValueEditorActionProxy );
     }
 
 
@@ -470,18 +463,13 @@
             actionBars.updateActionBars();
         }
 
-        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
-            ICommandService.class );
-        if ( commandService != null )
-        {
-            IAction nva = ( IAction ) this.searchResultEditorActionMap.get( newValueAction );
-            commandService.getCommand( nva.getActionDefinitionId() ).setHandler( null );
-            IAction lid = ( IAction ) this.searchResultEditorActionMap.get( locateDnInDitAction );
-            commandService.getCommand( lid.getActionDefinitionId() ).setHandler( null );
-            IAction osr = ( IAction ) this.searchResultEditorActionMap.get( openSearchResultAction );
-            commandService.getCommand( osr.getActionDefinitionId() ).setHandler( null );
-            commandService.getCommand( openDefaultValueEditorActionProxy.getActionDefinitionId() ).setHandler( null );
-        }
+        IAction nva = ( IAction ) this.searchResultEditorActionMap.get( newValueAction );
+        ActionUtils.deactivateActionHandler( nva );
+        IAction lid = ( IAction ) this.searchResultEditorActionMap.get( locateDnInDitAction );
+        ActionUtils.deactivateActionHandler( lid );
+        IAction osr = ( IAction ) this.searchResultEditorActionMap.get( openSearchResultAction );
+        ActionUtils.deactivateActionHandler( osr );
+        ActionUtils.deactivateActionHandler( openDefaultValueEditorActionProxy );
     }
 
 

Modified: directory/studio/branches/1.1.0/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewActionGroup.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/1.1.0/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewActionGroup.java?rev=639888&r1=639887&r2=639888&view=diff
==============================================================================
--- directory/studio/branches/1.1.0/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewActionGroup.java (original)
+++ directory/studio/branches/1.1.0/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewActionGroup.java Fri Mar 21 15:18:09 2008
@@ -39,17 +39,15 @@
 import org.apache.directory.studio.ldapbrowser.ui.actions.NewBookmarkAction;
 import org.apache.directory.studio.ldapbrowser.ui.actions.NewEntryAction;
 import org.apache.directory.studio.ldapbrowser.ui.actions.NewSearchAction;
+import org.apache.directory.studio.utils.ActionUtils;
 import org.eclipse.jface.action.IAction;
 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.commands.ActionHandler;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.commands.ICommandService;
 
 
 /**
@@ -369,7 +367,6 @@
      */
     public void activateGlobalActionHandlers()
     {
-
         if ( actionBars != null )
         {
             actionBars.setGlobalActionHandler( ActionFactory.COPY.getId(), ( IAction ) browserActionMap
@@ -386,14 +383,8 @@
 
         super.activateGlobalActionHandlers();
 
-        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
-            ICommandService.class );
-        if ( commandService != null )
-        {
-            IAction leid = ( IAction ) browserActionMap.get( locateEntryInDitAction );
-            commandService.getCommand( leid.getActionDefinitionId() ).setHandler( new ActionHandler( leid ) );
-        }
-
+        IAction leid = ( IAction ) browserActionMap.get( locateEntryInDitAction );
+        ActionUtils.activateActionHandler( leid );
     }
 
 
@@ -402,7 +393,6 @@
      */
     public void deactivateGlobalActionHandlers()
     {
-
         if ( actionBars != null )
         {
             actionBars.setGlobalActionHandler( ActionFactory.COPY.getId(), null );
@@ -414,14 +404,8 @@
 
         super.deactivateGlobalActionHandlers();
 
-        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
-            ICommandService.class );
-        if ( commandService != null )
-        {
-            IAction leid = ( IAction ) browserActionMap.get( locateEntryInDitAction );
-            commandService.getCommand( leid.getActionDefinitionId() ).setHandler( null );
-        }
-
+        IAction leid = ( IAction ) browserActionMap.get( locateEntryInDitAction );
+        ActionUtils.deactivateActionHandler( leid );
     }
 
 }

Modified: directory/studio/branches/1.1.0/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/1.1.0/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java?rev=639888&r1=639887&r2=639888&view=diff
==============================================================================
--- directory/studio/branches/1.1.0/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java (original)
+++ directory/studio/branches/1.1.0/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java Fri Mar 21 15:18:09 2008
@@ -41,6 +41,8 @@
 import org.apache.directory.studio.ldifparser.model.container.LdifRecord;
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
@@ -139,7 +141,7 @@
     public void create()
     {
         super.create();
-        // this.actionGroup.activateGlobalActionHandlers();
+        //this.actionGroup.activateGlobalActionHandlers();
     }
 
 
@@ -181,34 +183,42 @@
 
     protected Control createDialogArea( Composite parent )
     {
-
         Composite composite = ( Composite ) super.createDialogArea( parent );
 
         // create configuration
-        this.configuration = new EntryEditorWidgetConfiguration();
+        configuration = new EntryEditorWidgetConfiguration();
 
         // create main widget
-        this.mainWidget = new EntryEditorWidget( this.configuration );
-        this.mainWidget.createWidget( composite );
-        this.mainWidget.getViewer().getTree().setFocus();
+        mainWidget = new EntryEditorWidget( configuration );
+        mainWidget.createWidget( composite );
+        mainWidget.getViewer().getTree().setFocus();
 
         // create actions
-        this.actionGroup = new EntryEditorWidgetActionGroupWithAttribute( this.mainWidget, this.configuration );
-        this.actionGroup.fillToolBar( this.mainWidget.getToolBarManager() );
-        this.actionGroup.fillMenu( this.mainWidget.getMenuManager() );
-        this.actionGroup.fillContextMenu( this.mainWidget.getContextMenuManager() );
+        actionGroup = new EntryEditorWidgetActionGroupWithAttribute( mainWidget, configuration );
+        actionGroup.fillToolBar( mainWidget.getToolBarManager() );
+        actionGroup.fillMenu( mainWidget.getMenuManager() );
+        actionGroup.fillContextMenu( mainWidget.getContextMenuManager() );
         IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
             IContextService.class );
         contextActivation = contextService.activateContext( BrowserCommonConstants.CONTEXT_DIALOGS );
-        actionGroup.activateGlobalActionHandlers(); 
+        actionGroup.activateGlobalActionHandlers();
+
+        // hack to activate the action handlers when changing the selection 
+        mainWidget.getViewer().addSelectionChangedListener( new ISelectionChangedListener()
+        {
+            public void selectionChanged( SelectionChangedEvent event )
+            {
+                actionGroup.deactivateGlobalActionHandlers();
+                actionGroup.activateGlobalActionHandlers();
+            }
+        } );
 
         // create the listener
-        this.universalListener = new EntryEditorWidgetUniversalListener( this.mainWidget.getViewer(), this.actionGroup
+        universalListener = new EntryEditorWidgetUniversalListener( mainWidget.getViewer(), actionGroup
             .getOpenDefaultEditorAction() );
 
         try
         {
-
             if ( ldifRecord instanceof LdifContentRecord )
             {
                 entry = ModelConverter.ldifContentRecordToEntry( ( LdifContentRecord ) ldifRecord, connection );
@@ -220,7 +230,7 @@
 
             if ( entry != null )
             {
-                this.mainWidget.getViewer().setInput( entry );
+                mainWidget.getViewer().setInput( entry );
             }
 
         }

Modified: directory/studio/branches/1.1.0/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/1.1.0/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java?rev=639888&r1=639887&r2=639888&view=diff
==============================================================================
--- directory/studio/branches/1.1.0/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java (original)
+++ directory/studio/branches/1.1.0/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java Fri Mar 21 15:18:09 2008
@@ -48,6 +48,7 @@
 import org.apache.directory.studio.ldifeditor.editor.actions.OpenValueEditorAction;
 import org.apache.directory.studio.ldifeditor.editor.text.LdifPartitionScanner;
 import org.apache.directory.studio.ldifparser.model.LdifFile;
+import org.apache.directory.studio.utils.ActionUtils;
 import org.apache.directory.studio.valueeditors.AbstractDialogValueEditor;
 import org.apache.directory.studio.valueeditors.IValueEditor;
 import org.apache.directory.studio.valueeditors.ValueEditorManager;
@@ -64,7 +65,6 @@
 import org.eclipse.jface.action.MenuManager;
 import org.eclipse.jface.action.Separator;
 import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.commands.ActionHandler;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.preference.IPreferenceStore;
@@ -95,7 +95,6 @@
 import org.eclipse.ui.IWorkbenchPartReference;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ICommandService;
 import org.eclipse.ui.contexts.IContextActivation;
 import org.eclipse.ui.contexts.IContextService;
 import org.eclipse.ui.editors.text.EditorsUI;
@@ -854,17 +853,12 @@
      */
     public void activateGlobalActionHandlers()
     {
-        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
-            ICommandService.class );
-        if ( commandService != null )
-        {
-            IAction elaa = getAction( EditLdifAttributeAction.class.getName() );
-            commandService.getCommand( elaa.getActionDefinitionId() ).setHandler( new ActionHandler( elaa ) );
-            IAction elva = getAction( OpenDefaultValueEditorAction.class.getName() );
-            commandService.getCommand( elva.getActionDefinitionId() ).setHandler( new ActionHandler( elva ) );
-            IAction elra = getAction( EditLdifRecordAction.class.getName() );
-            commandService.getCommand( elra.getActionDefinitionId() ).setHandler( new ActionHandler( elra ) );
-        }
+        IAction elaa = getAction( EditLdifAttributeAction.class.getName() );
+        ActionUtils.activateActionHandler( elaa );
+        IAction elva = getAction( OpenDefaultValueEditorAction.class.getName() );
+        ActionUtils.activateActionHandler( elva );
+        IAction elra = getAction( EditLdifRecordAction.class.getName() );
+        ActionUtils.activateActionHandler( elra );
     }
 
 
@@ -873,17 +867,12 @@
      */
     public void deactivateGlobalActionHandlers()
     {
-        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
-            ICommandService.class );
-        if ( commandService != null )
-        {
-            IAction elaa = getAction( EditLdifAttributeAction.class.getName() );
-            commandService.getCommand( elaa.getActionDefinitionId() ).setHandler( null );
-            IAction elva = getAction( OpenDefaultValueEditorAction.class.getName() );
-            commandService.getCommand( elva.getActionDefinitionId() ).setHandler( null );
-            IAction elra = getAction( EditLdifRecordAction.class.getName() );
-            commandService.getCommand( elra.getActionDefinitionId() ).setHandler( null );
-        }
+        IAction elaa = getAction( EditLdifAttributeAction.class.getName() );
+        ActionUtils.deactivateActionHandler( elaa );
+        IAction elva = getAction( OpenDefaultValueEditorAction.class.getName() );
+        ActionUtils.deactivateActionHandler( elva );
+        IAction elra = getAction( EditLdifRecordAction.class.getName() );
+        ActionUtils.deactivateActionHandler( elra );
     }
 
 

Modified: directory/studio/branches/1.1.0/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/actions/EditLdifRecordAction.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/1.1.0/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/actions/EditLdifRecordAction.java?rev=639888&r1=639887&r2=639888&view=diff
==============================================================================
--- directory/studio/branches/1.1.0/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/actions/EditLdifRecordAction.java (original)
+++ directory/studio/branches/1.1.0/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/actions/EditLdifRecordAction.java Fri Mar 21 15:18:09 2008
@@ -44,7 +44,6 @@
 
     protected void doRun()
     {
-
         LdifContainer[] containers = getSelectedLdifContainers();
         if ( containers.length == 1
             && ( containers[0] instanceof LdifContentRecord || containers[0] instanceof LdifChangeAddRecord ) )



Mime
View raw message