directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r691748 - in /directory/studio/trunk: ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/ ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/ ldapbrowser-...
Date Wed, 03 Sep 2008 19:44:52 GMT
Author: seelmann
Date: Wed Sep  3 12:44:51 2008
New Revision: 691748

URL: http://svn.apache.org/viewvc?rev=691748&view=rev
Log:
Fixed update of actions in the entry editor widget, now they are updated when setting the
input of the widget

Modified:
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MultivaluedDialog.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroup.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetUniversalListener.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryAttributesWizardPage.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorUniversalListener.java
    directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MultivaluedDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MultivaluedDialog.java?rev=691748&r1=691747&r2=691748&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MultivaluedDialog.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/MultivaluedDialog.java
Wed Sep  3 12:44:51 2008
@@ -232,7 +232,6 @@
         // create main widget
         mainWidget = new EntryEditorWidget( configuration );
         mainWidget.createWidget( composite );
-        mainWidget.getViewer().setInput( attributeHierarchie );
         mainWidget.getViewer().getTree().setFocus();
 
         // create actions
@@ -246,8 +245,9 @@
         actionGroup.activateGlobalActionHandlers();
 
         // create the listener
-        universalListener = new MultiValuedEntryEditorUniversalListener( mainWidget.getViewer(),
actionGroup
-            .getOpenDefaultEditorAction() );
+        universalListener = new MultiValuedEntryEditorUniversalListener( mainWidget.getViewer(),
configuration,
+            actionGroup, actionGroup.getOpenDefaultEditorAction() );
+        universalListener.setInput( attributeHierarchie );
 
         // start edit mode if an empty value exists
         for ( Iterator<IAttribute> it = attributeHierarchie.iterator(); it.hasNext();
)
@@ -282,12 +282,16 @@
         /**
          * Creates a new instance of MultiValuedEntryEditorUniversalListener.
          * 
-         * @param startEditAction the start edit action
          * @param treeViewer the tree viewer
+         * @param configuration the configuration
+         * @param actionGroup the action group
+         * @param startEditAction the start edit action
          */
-        public MultiValuedEntryEditorUniversalListener( TreeViewer treeViewer, OpenDefaultEditorAction
startEditAction )
+        public MultiValuedEntryEditorUniversalListener( TreeViewer treeViewer,
+            EntryEditorWidgetConfiguration configuration, EntryEditorWidgetActionGroup actionGroup,
+            OpenDefaultEditorAction startEditAction )
         {
-            super( treeViewer, startEditAction );
+            super( treeViewer, configuration, actionGroup, startEditAction );
         }
 
 

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroup.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroup.java?rev=691748&r1=691747&r2=691748&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroup.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroup.java
Wed Sep  3 12:44:51 2008
@@ -37,6 +37,8 @@
 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.ldapbrowser.core.model.AttributeHierarchy;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 import org.apache.directory.studio.utils.ActionUtils;
 import org.apache.directory.studio.valueeditors.IValueEditor;
 import org.eclipse.jface.action.IAction;
@@ -399,4 +401,32 @@
         return ( OpenDefaultEditorAction ) openDefaultValueEditorActionProxy.getAction();
     }
 
+
+    /**
+     * Sets the input.
+     * 
+     * @param entry the input
+     */
+    public void setInput( IEntry entry )
+    {
+        for ( EntryEditorActionProxy action : entryEditorActionMap.values() )
+        {
+            action.inputChanged( entry );
+        }
+    }
+
+
+    /**
+     * Sets the input.
+     * 
+     * @param attributeHierarchy the attribute hierarchy
+     */
+    public void setInput( AttributeHierarchy attributeHierarchy )
+    {
+        for ( EntryEditorActionProxy action : entryEditorActionMap.values() )
+        {
+            action.inputChanged( attributeHierarchy );
+        }
+    }
+
 }

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetUniversalListener.java?rev=691748&r1=691747&r2=691748&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetUniversalListener.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetUniversalListener.java
Wed Sep  3 12:44:51 2008
@@ -34,7 +34,9 @@
 import org.apache.directory.studio.ldapbrowser.core.events.ValueDeletedEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.ValueModifiedEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.ValueRenamedEvent;
+import org.apache.directory.studio.ldapbrowser.core.model.AttributeHierarchy;
 import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.IValue;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TreeViewer;
@@ -58,6 +60,12 @@
     /** The tree viewer */
     protected TreeViewer viewer;
 
+    /** The configuration. */
+    protected EntryEditorWidgetConfiguration configuration;
+
+    /** The action group. */
+    protected EntryEditorWidgetActionGroup actionGroup;
+
     /** The action used to start the default value editor */
     protected OpenDefaultEditorAction startEditAction;
 
@@ -111,6 +119,7 @@
             }
         }
 
+
         /**
          * {@inheritDoc}
          */
@@ -118,6 +127,7 @@
         {
         }
 
+
         /**
          * {@inheritDoc}
          */
@@ -129,18 +139,23 @@
 
     /**
      * Creates a new instance of EntryEditorWidgetUniversalListener.
-     *
+     * 
      * @param treeViewer the tree viewer
+     * @param configuration the configuration
+     * @param actionGroup the action group
      * @param startEditAction the action used to start the default value editor
      */
-    public EntryEditorWidgetUniversalListener( TreeViewer treeViewer, OpenDefaultEditorAction
startEditAction )
+    public EntryEditorWidgetUniversalListener( TreeViewer treeViewer, EntryEditorWidgetConfiguration
configuration,
+        EntryEditorWidgetActionGroup actionGroup, OpenDefaultEditorAction startEditAction
)
     {
         this.startEditAction = startEditAction;
         this.viewer = treeViewer;
+        this.configuration = configuration;
+        this.actionGroup = actionGroup;
 
         // register listeners
-        viewer.getTree().addSelectionListener( viewerSelectionListener  );
-        viewer.getTree().addMouseListener( viewerMouseListener  );
+        viewer.getTree().addSelectionListener( viewerSelectionListener );
+        viewer.getTree().addMouseListener( viewerMouseListener );
         EventRegistry.addEntryUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner()
);
     }
 
@@ -156,6 +171,8 @@
 
             startEditAction = null;
             viewer = null;
+            configuration = null;
+            actionGroup = null;
         }
     }
 
@@ -206,10 +223,9 @@
             EmptyValueAddedEvent evaEvent = ( EmptyValueAddedEvent ) event;
 
             // show operational attributes if an operational attribute was added
-            if ( evaEvent.getAddedValue().getAttribute().isOperationalAttribute() &&

-                !BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean(
-                    BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES
)
-                )
+            if ( evaEvent.getAddedValue().getAttribute().isOperationalAttribute()
+                && !BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean(
+                    BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES
) )
             {
                 BrowserCommonActivator.getDefault().getPreferenceStore().setValue(
                     BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES,
true );
@@ -246,4 +262,50 @@
         }
     }
 
+
+    /**
+     * Sets the input to the viewer.
+     *
+     * @param entry the entry input
+     */
+    public void setInput( IEntry entry )
+    {
+        if ( entry != viewer.getInput() )
+        {
+            viewer.setInput( entry );
+            actionGroup.setInput( entry );
+            expandFoldedAttributes();
+        }
+
+    }
+
+
+    /**
+     * Sets the input to the viewer.
+     * 
+     * @param attributeHierarchy the attribute hierarchy
+     */
+    public void setInput( AttributeHierarchy attributeHierarchy )
+    {
+        if ( attributeHierarchy != viewer.getInput() )
+        {
+            viewer.setInput( attributeHierarchy );
+            actionGroup.setInput( attributeHierarchy );
+            expandFoldedAttributes();
+        }
+
+    }
+
+
+    /**
+     * Expands folded attributes if the appropriate preference is set.
+     */
+    protected void expandFoldedAttributes()
+    {
+        if ( configuration.getPreferences().isAutoExpandFoldedAttributes() )
+        {
+            viewer.expandAll();
+        }
+    }
+
 }

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryAttributesWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryAttributesWizardPage.java?rev=691748&r1=691747&r2=691748&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryAttributesWizardPage.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryAttributesWizardPage.java
Wed Sep  3 12:44:51 2008
@@ -191,7 +191,7 @@
             }
 
             // set the input
-            mainWidget.getViewer().setInput( newEntry );
+            universalListener.setInput( newEntry );
             mainWidget.getViewer().refresh();
             validate();
 
@@ -263,8 +263,8 @@
         actionGroup.activateGlobalActionHandlers();
 
         // create the listener
-        universalListener = new EntryEditorWidgetUniversalListener( mainWidget.getViewer(),
actionGroup
-            .getOpenDefaultEditorAction() );
+        universalListener = new EntryEditorWidgetUniversalListener( mainWidget.getViewer(),
configuration, actionGroup,
+            actionGroup.getOpenDefaultEditorAction() );
         EventRegistry.addEntryUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner()
);
 
         setControl( composite );

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java?rev=691748&r1=691747&r2=691748&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java
Wed Sep  3 12:44:51 2008
@@ -31,7 +31,6 @@
 import org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor.EditAttributeDescriptionAction;
 import org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor.EntryEditorWidgetActionGroup;
 import org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor.OpenDefaultEditorAction;
-import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 import org.apache.directory.studio.ldapbrowser.ui.actions.CopyAttributeDescriptionAction;
 import org.apache.directory.studio.ldapbrowser.ui.actions.CopyDnAction;
 import org.apache.directory.studio.ldapbrowser.ui.actions.CopySearchFilterAction;
@@ -70,7 +69,7 @@
 
     /** The open entry value editor action. */
     private EntryEditorActionProxy openEntryValueEditorActionProxy;
-    
+
     /** The open entry editor preference page. */
     private OpenEntryEditorPreferencePageAction openEntryEditorPreferencePage;
 
@@ -415,18 +414,4 @@
         ActionUtils.deactivateActionHandler( openEntryValueEditorActionProxy );
     }
 
-
-    /**
-     * Sets the input.
-     * 
-     * @param entry the input
-     */
-    public void setInput( IEntry entry )
-    {
-        for ( EntryEditorActionProxy action : entryEditorActionMap.values() )
-        {
-            action.inputChanged( entry );
-        }
-    }
-
 }

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorUniversalListener.java?rev=691748&r1=691747&r2=691748&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorUniversalListener.java
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorUniversalListener.java
Wed Sep  3 12:44:51 2008
@@ -198,7 +198,8 @@
      */
     public EntryEditorUniversalListener( EntryEditor entryEditor )
     {
-        super( entryEditor.getMainWidget().getViewer(), entryEditor.getActionGroup().getOpenDefaultEditorAction()
);
+        super( entryEditor.getMainWidget().getViewer(), entryEditor.getConfiguration(), entryEditor.getActionGroup(),
+            entryEditor.getActionGroup().getOpenDefaultEditorAction() );
         this.entryEditor = entryEditor;
 
         // register listeners
@@ -226,21 +227,7 @@
     }
 
 
-    /**
-     * Sets the input to the viewer.
-     *
-     * @param entry the entry input
-     */
-    void setInput( IEntry entry )
-    {
-        if ( entry != viewer.getInput() )
-        {
-            viewer.setInput( entry );
-            entryEditor.getActionGroup().setInput( entry );
-            expandFoldedAttributes();
-        }
 
-    }
 
 
     /**
@@ -262,15 +249,6 @@
     }
 
 
-    /**
-     * Expands folded attributes if the appropriate preference is set.
-     */
-    private void expandFoldedAttributes()
-    {
-        if ( entryEditor.getConfiguration().getPreferences().isAutoExpandFoldedAttributes()
)
-        {
-            viewer.expandAll();
-        }
-    }
+
 
 }

Modified: directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java?rev=691748&r1=691747&r2=691748&view=diff
==============================================================================
--- directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java
(original)
+++ directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/dialogs/LdifEntryEditorDialog.java
Wed Sep  3 12:44:51 2008
@@ -229,8 +229,8 @@
         } );
 
         // create the listener
-        universalListener = new EntryEditorWidgetUniversalListener( mainWidget.getViewer(),
actionGroup
-            .getOpenDefaultEditorAction() );
+        universalListener = new EntryEditorWidgetUniversalListener( mainWidget.getViewer(),
configuration, actionGroup,
+            actionGroup.getOpenDefaultEditorAction() );
 
         try
         {
@@ -246,7 +246,7 @@
 
             if ( entry != null )
             {
-                mainWidget.getViewer().setInput( entry );
+                universalListener.setInput( entry );
             }
 
         }



Mime
View raw message