directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r552367 - in /directory/studio/trunk: studio-ldapbrowser-common/ studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/ studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/...
Date Sun, 01 Jul 2007 22:12:53 GMT
Author: seelmann
Date: Sun Jul  1 15:12:50 2007
New Revision: 552367

URL: http://svn.apache.org/viewvc?view=rev&rev=552367
Log:
DIRSTUDIO-96: Added context and improved key binding handling.

Modified:
    directory/studio/trunk/studio-ldapbrowser-common/plugin.xml
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MultivaluedDialog.java
    directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorUniversalListener.java
    directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorUniversalListener.java
    directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java
    directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryAttributesWizardPage.java
    directory/studio/trunk/studio-ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java
    directory/studio/trunk/studio-ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java

Modified: directory/studio/trunk/studio-ldapbrowser-common/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/plugin.xml?view=diff&rev=552367&r1=552366&r2=552367
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/plugin.xml (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/plugin.xml Sun Jul  1 15:12:50 2007
@@ -123,74 +123,84 @@
        point="org.eclipse.ui.bindings">
     <key
           commandId="org.apache.directory.studio.ldapbrowser.action.addValue"
-          contextId="org.eclipse.ui.contexts.dialogAndWindow"
+          contextId="org.apache.directory.studio.ldapbrowser.contexts.window"
           schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
           sequence="M1++"/>
     <key
           commandId="org.apache.directory.studio.ldapbrowser.action.addAttribute"
-          contextId="org.eclipse.ui.contexts.dialogAndWindow"
+          contextId="org.apache.directory.studio.ldapbrowser.contexts.window"
           schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
           sequence="M1+M2++"/>
     <key
           commandId="org.apache.directory.studio.ldapbrowser.action.editAttributeDescription"
-          contextId="org.apache.directory.studio.ldapbrowser.action.context"
+          contextId="org.apache.directory.studio.ldapbrowser.contexts.window"
           schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
           sequence="F6"/>  
     <key
-          commandId="org.apache.directory.studio.ldapbrowser.action.editAttributeDescription"
-          contextId="org.eclipse.ui.contexts.dialog"
-          schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
-          sequence="F6"/>
-    <key
           commandId="org.apache.directory.studio.ldapbrowser.action.editValue"
-          contextId="org.apache.directory.studio.ldapbrowser.action.context"
+          contextId="org.apache.directory.studio.ldapbrowser.contexts.window"
           schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
           sequence="F7"/>  
     <key
-          commandId="org.apache.directory.studio.ldapbrowser.action.editValue"
-          contextId="org.eclipse.ui.contexts.dialog"
-          schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
-          sequence="F7"/>
-    <key
           commandId="org.apache.directory.studio.ldapbrowser.action.editRecord"
-          contextId="org.apache.directory.studio.ldapbrowser.action.context"
+          contextId="org.apache.directory.studio.ldapbrowser.contexts.window"
           schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
           sequence="F8"/>
     <key
+          commandId="org.apache.directory.studio.ldapbrowser.action.locateInDit"
+          contextId="org.apache.directory.studio.ldapbrowser.contexts.window"
+          schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+          sequence="F3"/>
+    <key
+          commandId="org.apache.directory.studio.ldapbrowser.action.openSearchResult"
+          contextId="org.apache.directory.studio.ldapbrowser.contexts.window"
+          schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+          sequence="F4"/>
+    <key
           commandId="org.apache.directory.studio.ldapbrowser.action.delete"
-          contextId="org.eclipse.ui.contexts.dialog"
+          contextId="org.apache.directory.studio.ldapbrowser.contexts.dialog"
           schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
           sequence="DEL"/>
     <key
           commandId="org.apache.directory.studio.ldapbrowser.action.copy"
-          contextId="org.eclipse.ui.contexts.dialog"
+          contextId="org.apache.directory.studio.ldapbrowser.contexts.dialog"
           schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
           sequence="CTRL+C"/>
     <key
           commandId="org.apache.directory.studio.ldapbrowser.action.paste"
-          contextId="org.eclipse.ui.contexts.dialog"
+          contextId="org.apache.directory.studio.ldapbrowser.contexts.dialog"
           schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
           sequence="CTRL+V"/>
     <key
           commandId="org.apache.directory.studio.ldapbrowser.action.find"
-          contextId="org.eclipse.ui.contexts.dialog"
+          contextId="org.apache.directory.studio.ldapbrowser.contexts.dialog"
           schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
           sequence="CTRL+F"/>
     <key
           commandId="org.apache.directory.studio.ldapbrowser.action.properties"
-          contextId="org.eclipse.ui.contexts.dialog"
+          contextId="org.apache.directory.studio.ldapbrowser.contexts.dialog"
           schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
           sequence="ALT+RETURN"/>
     <key
-          commandId="org.apache.directory.studio.ldapbrowser.action.locateInDit"
-          contextId="org.apache.directory.studio.ldapbrowser.action.context"
+          commandId="org.apache.directory.studio.ldapbrowser.action.addValue"
+          contextId="org.apache.directory.studio.ldapbrowser.contexts.dialog"
           schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
-          sequence="F3"/>
+          sequence="M1++"/>
     <key
-          commandId="org.apache.directory.studio.ldapbrowser.action.openSearchResult"
-          contextId="org.apache.directory.studio.ldapbrowser.action.context"
+          commandId="org.apache.directory.studio.ldapbrowser.action.addAttribute"
+          contextId="org.apache.directory.studio.ldapbrowser.contexts.dialog"
           schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
-          sequence="F4"/>
+          sequence="M1+M2++"/>
+    <key
+          commandId="org.apache.directory.studio.ldapbrowser.action.editAttributeDescription"
+          contextId="org.apache.directory.studio.ldapbrowser.contexts.dialog"
+          schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+          sequence="F6"/>  
+    <key
+          commandId="org.apache.directory.studio.ldapbrowser.action.editValue"
+          contextId="org.apache.directory.studio.ldapbrowser.contexts.dialog"
+          schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+          sequence="F7"/>            
  </extension>
 
  <extension
@@ -264,11 +274,16 @@
  <extension
        point="org.eclipse.ui.contexts">
        <context
-		name="LDAP Browser"
-		description="LDAP Browser"
-		id="org.apache.directory.studio.ldapbrowser.action.context"
-		parentId="org.eclipse.ui.contexts.window">
+             description="In LDAP Browser Windows"
+             id="org.apache.directory.studio.ldapbrowser.contexts.window"
+             name="In LDAP Browser Windows"
+             parentId="org.eclipse.ui.contexts.window">
 	</context>
+       <context
+             description="In LDAP Browser Dialogs"
+             id="org.apache.directory.studio.ldapbrowser.contexts.dialog"
+             name="In LDAP Browser Dialogs"
+             parentId="org.eclipse.ui.contexts.dialog"/>
  </extension>
  
 </plugin>

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java?view=diff&rev=552367&r1=552366&r2=552367
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
Sun Jul  1 15:12:50 2007
@@ -6,7 +6,10 @@
 
     public static final int HISTORYSIZE = 20;
 
-    
+
+    public static final String CONTEXT_WINDOWS = "org.apache.directory.studio.ldapbrowser.contexts.window";
+
+    public static final String CONTEXT_DIALOGS = "org.apache.directory.studio.ldapbrowser.contexts.dialog";
     
     public static final String ACTION_ID_EDIT_VALUE = "org.apache.directory.studio.ldapbrowser.action.editValue";
 

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MultivaluedDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MultivaluedDialog.java?view=diff&rev=552367&r1=552366&r2=552367
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MultivaluedDialog.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MultivaluedDialog.java
Sun Jul  1 15:12:50 2007
@@ -52,6 +52,9 @@
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.contexts.IContextActivation;
+import org.eclipse.ui.contexts.IContextService;
 
 
 public class MultivaluedDialog extends Dialog
@@ -73,6 +76,9 @@
 
     private MultiValuedEntryEditorUniversalListener universalListener;
 
+    /** Token used to activate and deactivate shortcuts in the editor */
+    private IContextActivation contextActivation;
+
 
     public MultivaluedDialog( Shell parentShell, AttributeHierarchy attributeHierarchie )
     {
@@ -144,6 +150,14 @@
             this.actionGroup = null;
             this.configuration.dispose();
             this.configuration = null;
+
+            if ( contextActivation != null )
+            {
+                IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
+                    IContextService.class );
+                contextService.deactivateContext( contextActivation );
+                contextActivation = null;
+            }
         }
     }
 
@@ -167,7 +181,10 @@
         this.actionGroup.fillToolBar( this.mainWidget.getToolBarManager() );
         this.actionGroup.fillMenu( this.mainWidget.getMenuManager() );
         this.actionGroup.fillContextMenu( this.mainWidget.getContextMenuManager() );
-        this.actionGroup.activateGlobalActionHandlers();
+        IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
+            IContextService.class );
+        contextActivation = contextService.activateContext( BrowserCommonConstants.CONTEXT_DIALOGS
);
+        actionGroup.activateGlobalActionHandlers();        
 
         // create the listener
         this.universalListener = new MultiValuedEntryEditorUniversalListener( this.mainWidget.getViewer(),

Modified: directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorUniversalListener.java?view=diff&rev=552367&r1=552366&r2=552367
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorUniversalListener.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorUniversalListener.java
Sun Jul  1 15:12:50 2007
@@ -21,6 +21,7 @@
 package org.apache.directory.studio.ldapbrowser.ui.editors.entry;
 
 
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.apache.directory.studio.ldapbrowser.common.actions.SelectionUtils;
 import org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor.EntryEditorWidgetUniversalListener;
 import org.apache.directory.studio.ldapbrowser.core.events.EntryModificationEvent;
@@ -132,7 +133,7 @@
                 IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
                     IContextService.class );
                 contextActivation = contextService
-                    .activateContext( "org.apache.directory.studio.ldapbrowser.action.context"
);
+                    .activateContext( BrowserCommonConstants.CONTEXT_WINDOWS );
                 // org.eclipse.ui.contexts.dialogAndWindow
                 // org.eclipse.ui.contexts.window
                 // org.eclipse.ui.text_editor_context

Modified: directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorUniversalListener.java?view=diff&rev=552367&r1=552366&r2=552367
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorUniversalListener.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorUniversalListener.java
Sun Jul  1 15:12:50 2007
@@ -28,6 +28,7 @@
  * @version $Rev$, $Date$
  */
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.apache.directory.studio.ldapbrowser.common.actions.SelectionUtils;
 import org.apache.directory.studio.ldapbrowser.core.events.EmptyValueAddedEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.EntryModificationEvent;
@@ -146,7 +147,6 @@
         {
             if ( partRef.getPart( false ) == editor && contextActivation != null
)
             {
-
                 editor.getActionGroup().deactivateGlobalActionHandlers();
 
                 IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
@@ -166,14 +166,10 @@
         {
             if ( partRef.getPart( false ) == editor )
             {
-
                 IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
                     IContextService.class );
                 contextActivation = contextService
-                    .activateContext( "org.apache.directory.studio.ldapbrowser.action.context"
);
-                // org.eclipse.ui.contexts.dialogAndWindow
-                // org.eclipse.ui.contexts.window
-                // org.eclipse.ui.text_editor_context
+                    .activateContext( BrowserCommonConstants.CONTEXT_WINDOWS );
 
                 editor.getActionGroup().activateGlobalActionHandlers();
             }

Modified: directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java?view=diff&rev=552367&r1=552366&r2=552367
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/browser/BrowserViewUniversalListener.java
Sun Jul  1 15:12:50 2007
@@ -26,6 +26,7 @@
 import java.util.Map;
 
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.apache.directory.studio.ldapbrowser.common.actions.SelectionUtils;
 import org.apache.directory.studio.ldapbrowser.common.widgets.browser.BrowserUniversalListener;
 import org.apache.directory.studio.ldapbrowser.core.events.AttributesInitializedEvent;
@@ -152,7 +153,7 @@
                 IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
                     IContextService.class );
                 contextActivation = contextService
-                    .activateContext( "org.apache.directory.studio.ldapbrowser.action.context"
);
+                    .activateContext( BrowserCommonConstants.CONTEXT_WINDOWS );
                 // org.eclipse.ui.contexts.dialogAndWindow
                 // org.eclipse.ui.contexts.window
                 // org.eclipse.ui.text_editor_context

Modified: directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryAttributesWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryAttributesWizardPage.java?view=diff&rev=552367&r1=552366&r2=552367
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryAttributesWizardPage.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryAttributesWizardPage.java
Sun Jul  1 15:12:50 2007
@@ -22,6 +22,7 @@
 
 
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor.EntryEditorWidget;
 import org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor.EntryEditorWidgetActionGroup;
 import org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor.EntryEditorWidgetActionGroupWithAttribute;
@@ -44,6 +45,9 @@
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.contexts.IContextActivation;
+import org.eclipse.ui.contexts.IContextService;
 
 
 /**
@@ -71,6 +75,9 @@
     /** The universal listener. */
     private EntryEditorWidgetUniversalListener universalListener;
 
+    /** Token used to activate and deactivate shortcuts in the editor */
+    private IContextActivation contextActivation;
+
 
     /**
      * Creates a new instance of NewEntryAttributesWizardPage.
@@ -106,6 +113,14 @@
             actionGroup = null;
             configuration.dispose();
             configuration = null;
+
+            if ( contextActivation != null )
+            {
+                IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
+                    IContextService.class );
+                contextService.deactivateContext( contextActivation );
+                contextActivation = null;
+            }
         }
         super.dispose();
     }
@@ -248,6 +263,10 @@
         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();
 
         // create the listener
         universalListener = new EntryEditorWidgetUniversalListener( mainWidget.getViewer(),
actionGroup

Modified: directory/studio/trunk/studio-ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java?view=diff&rev=552367&r1=552366&r2=552367
==============================================================================
--- directory/studio/trunk/studio-ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java
(original)
+++ directory/studio/trunk/studio-ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java
Sun Jul  1 15:12:50 2007
@@ -21,6 +21,7 @@
 package org.apache.directory.studio.ldifeditor.dialogs;
 
 
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor.EntryEditorWidget;
 import org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor.EntryEditorWidgetActionGroup;
 import org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor.EntryEditorWidgetActionGroupWithAttribute;
@@ -44,6 +45,9 @@
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.contexts.IContextActivation;
+import org.eclipse.ui.contexts.IContextService;
 
 
 public class LdifEntryEditorDialog extends Dialog
@@ -69,6 +73,9 @@
 
     private EntryEditorWidgetUniversalListener universalListener;
 
+    /** Token used to activate and deactivate shortcuts in the editor */
+    private IContextActivation contextActivation;
+
 
     public LdifEntryEditorDialog( Shell parentShell, IConnection connection, LdifContentRecord
ldifRecord )
     {
@@ -161,6 +168,14 @@
             this.actionGroup = null;
             this.configuration.dispose();
             this.configuration = null;
+
+            if ( contextActivation != null )
+            {
+                IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
+                    IContextService.class );
+                contextService.deactivateContext( contextActivation );
+                contextActivation = null;
+            }
         }
     }
 
@@ -183,7 +198,10 @@
         this.actionGroup.fillToolBar( this.mainWidget.getToolBarManager() );
         this.actionGroup.fillMenu( this.mainWidget.getMenuManager() );
         this.actionGroup.fillContextMenu( this.mainWidget.getContextMenuManager() );
-        this.actionGroup.activateGlobalActionHandlers();
+        IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
+            IContextService.class );
+        contextActivation = contextService.activateContext( BrowserCommonConstants.CONTEXT_DIALOGS
);
+        actionGroup.activateGlobalActionHandlers(); 
 
         // create the listener
         this.universalListener = new EntryEditorWidgetUniversalListener( this.mainWidget.getViewer(),
this.actionGroup

Modified: directory/studio/trunk/studio-ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java?view=diff&rev=552367&r1=552366&r2=552367
==============================================================================
--- directory/studio/trunk/studio-ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java
(original)
+++ directory/studio/trunk/studio-ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java
Sun Jul  1 15:12:50 2007
@@ -25,6 +25,7 @@
 import java.util.ResourceBundle;
 
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.apache.directory.studio.ldapbrowser.common.actions.ValueEditorPreferencesAction;
 import org.apache.directory.studio.ldapbrowser.common.widgets.BaseWidgetUtils;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
@@ -738,7 +739,6 @@
     {
         if ( partRef.getPart( false ) == this && contextActivation != null )
         {
-
             this.deactivateGlobalActionHandlers();
 
             IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
@@ -756,11 +756,10 @@
     {
         if ( partRef.getPart( false ) == this )
         {
-
             IContextService contextService = ( IContextService ) PlatformUI.getWorkbench().getAdapter(
                 IContextService.class );
             contextActivation = contextService
-                .activateContext( "org.apache.directory.studio.ldapbrowser.action.context"
);
+                .activateContext( BrowserCommonConstants.CONTEXT_WINDOWS );
 
             this.activateGlobalActionHandlers();
         }



Mime
View raw message