directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r757521 - in /directory/studio/trunk: ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/ ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/
Date Mon, 23 Mar 2009 19:49:25 GMT
Author: seelmann
Date: Mon Mar 23 19:49:24 2009
New Revision: 757521

URL: http://svn.apache.org/viewvc?rev=757521&view=rev
Log:
Fix DIRSTUDIO-423 (Outline view does not respect the settings of the Entry Editor on displaying
or not the operational attributes)

Modified:
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetFilter.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetPreferences.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetUniversalListener.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorOutlinePage.java

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetFilter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetFilter.java?rev=757521&r1=757520&r2=757521&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetFilter.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetFilter.java
Mon Mar 23 19:49:24 2009
@@ -21,6 +21,7 @@
 package org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor;
 
 
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
 import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
 import org.apache.directory.studio.ldapbrowser.core.model.IRootDSE;
 import org.apache.directory.studio.ldapbrowser.core.model.IValue;
@@ -96,7 +97,11 @@
                 return false;
             }
 
-            return true;
+            // check attribute category
+            if ( !goesThroughtCategoryFilter( attribute ) )
+            {
+                return false;
+            }
         }
         else if ( element instanceof IValue )
         {
@@ -108,32 +113,14 @@
                 return false;
             }
 
-            // filter attribute types
-            if ( value.getAttribute().isObjectClassAttribute() )
-            {
-                return isShowObjectClassAttribute() || ( value.getAttribute().getEntry()
instanceof IRootDSE );
-            }
-            else if ( value.getAttribute().isMustAttribute() )
-            {
-                return isShowMustAttributes() || ( value.getAttribute().getEntry() instanceof
IRootDSE );
-            }
-            else if ( value.getAttribute().isMayAttribute() )
-            {
-                return isShowMayAttributes() || ( value.getAttribute().getEntry() instanceof
IRootDSE );
-            }
-            else if ( value.getAttribute().isOperationalAttribute() )
-            {
-                return isShowOperationalAttributes() || ( value.getAttribute().getEntry()
instanceof IRootDSE );
-            }
-            else
+            // check attribute category
+            if ( !goesThroughtCategoryFilter( value.getAttribute() ) )
             {
-                return true;
+                return false;
             }
         }
-        else
-        {
-            return true;
-        }
+
+        return true;
     }
 
 
@@ -174,6 +161,38 @@
 
 
     /**
+     * Checks if the given attribute goes through attribute category filter.
+     * 
+     * @param attribute the attribute
+     * 
+     * @return true, if goes through attribute category filter
+     */
+    private boolean goesThroughtCategoryFilter( IAttribute attribute )
+    {
+        if ( attribute.isObjectClassAttribute() )
+        {
+            return isShowObjectClassAttribute() || ( attribute.getEntry() instanceof IRootDSE
);
+        }
+        else if ( attribute.isMustAttribute() )
+        {
+            return isShowMustAttributes() || ( attribute.getEntry() instanceof IRootDSE );
+        }
+        else if ( attribute.isMayAttribute() )
+        {
+            return isShowMayAttributes() || ( attribute.getEntry() instanceof IRootDSE );
+        }
+        else if ( attribute.isOperationalAttribute() )
+        {
+            return isShowOperationalAttributes() || ( attribute.getEntry() instanceof IRootDSE
);
+        }
+        else
+        {
+            return true;
+        }
+    }
+
+
+    /**
      * Disposes this filter.
      */
     public void dispose()
@@ -202,11 +221,10 @@
     {
         if ( !this.quickFilterAttribute.equals( quickFilterAttribute ) )
         {
+            String oldValue = this.quickFilterAttribute;
             this.quickFilterAttribute = quickFilterAttribute;
-            if ( viewer != null )
-            {
-                viewer.refresh();
-            }
+            BrowserCommonActivator.getDefault().getPreferenceStore().firePropertyChangeEvent(
+                "QuickFilterAttributeChanged", oldValue, quickFilterAttribute ); //$NON-NLS-1$
         }
     }
 
@@ -231,11 +249,10 @@
     {
         if ( !this.quickFilterValue.equals( quickFilterValue ) )
         {
+            String oldValue = this.quickFilterValue;
             this.quickFilterValue = quickFilterValue;
-            if ( viewer != null )
-            {
-                viewer.refresh();
-            }
+            BrowserCommonActivator.getDefault().getPreferenceStore().firePropertyChangeEvent(
+                "QuickFilterValueChanged", oldValue, quickFilterAttribute ); //$NON-NLS-1$
         }
     }
 

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetPreferences.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetPreferences.java?rev=757521&r1=757520&r2=757521&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetPreferences.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetPreferences.java
Mon Mar 23 19:49:24 2009
@@ -24,8 +24,6 @@
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.jface.viewers.Viewer;
 
@@ -36,7 +34,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class EntryEditorWidgetPreferences implements IPropertyChangeListener
+public class EntryEditorWidgetPreferences
 {
 
     /** The viewer. */
@@ -48,7 +46,6 @@
      */
     public EntryEditorWidgetPreferences()
     {
-        BrowserCommonActivator.getDefault().getPreferenceStore().addPropertyChangeListener(
this );
     }
 
 
@@ -68,7 +65,6 @@
      */
     public void dispose()
     {
-        BrowserCommonActivator.getDefault().getPreferenceStore().removePropertyChangeListener(
this );
         viewer = null;
     }
 
@@ -210,16 +206,4 @@
             BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_DEFAULT_SORT_ORDER );
     }
 
-
-    /**
-     * {@inheritDoc}
-     */
-    public void propertyChange( PropertyChangeEvent event )
-    {
-        if ( this.viewer != null )
-        {
-            this.viewer.refresh();
-        }
-    }
-
 }

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=757521&r1=757520&r2=757521&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
Mon Mar 23 19:49:24 2009
@@ -38,6 +38,8 @@
 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.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.swt.SWT;
@@ -139,6 +141,18 @@
         }
     };
 
+    /** This listener updates the viewer if an property (e.g. is operational attributes visible)
has been changed */
+    protected IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener()
+    {
+        public void propertyChange( PropertyChangeEvent event )
+        {
+            if ( viewer != null )
+            {
+                viewer.refresh();
+            }
+        }
+    };
+
 
     /**
      * Creates a new instance of EntryEditorWidgetUniversalListener.
@@ -160,6 +174,7 @@
         viewer.getTree().addSelectionListener( viewerSelectionListener );
         viewer.getTree().addMouseListener( viewerMouseListener );
         EventRegistry.addEntryUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner()
);
+        BrowserCommonActivator.getDefault().getPreferenceStore().addPropertyChangeListener(
propertyChangeListener );
 
         // Don't invoke Finish' or 'OK' button when pressing 'Enter' in wizard or dialog
         viewer.getTree().addTraverseListener( new TraverseListener()
@@ -183,6 +198,8 @@
         if ( viewer != null )
         {
             EventRegistry.removeEntryUpdateListener( this );
+            BrowserCommonActivator.getDefault().getPreferenceStore().removePropertyChangeListener(
+                propertyChangeListener );
 
             startEditAction = null;
             viewer = null;

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorOutlinePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorOutlinePage.java?rev=757521&r1=757520&r2=757521&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorOutlinePage.java
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorOutlinePage.java
Mon Mar 23 19:49:24 2009
@@ -25,12 +25,15 @@
 import java.util.Arrays;
 import java.util.List;
 
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
 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.apache.directory.studio.ldapbrowser.core.utils.Utils;
 import org.apache.directory.studio.ldifeditor.LdifEditorActivator;
 import org.apache.directory.studio.ldifeditor.LdifEditorConstants;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.jface.viewers.DoubleClickEvent;
 import org.eclipse.jface.viewers.IDoubleClickListener;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -58,6 +61,15 @@
     /** The editor it is attached to */
     private EntryEditor entryEditor;
 
+    /** This listener updates the viewer if an property (e.g. is operational attributes visible)
has been changed */
+    protected IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener()
+    {
+        public void propertyChange( PropertyChangeEvent event )
+        {
+            refresh();
+        }
+    };
+
 
     /**
      * Creates a new instance of EntryEditorOutlinePage.
@@ -68,6 +80,7 @@
     public EntryEditorOutlinePage( EntryEditor entryEditor )
     {
         this.entryEditor = entryEditor;
+        BrowserCommonActivator.getDefault().getPreferenceStore().addPropertyChangeListener(
propertyChangeListener );
     }
 
 
@@ -211,6 +224,8 @@
         super.dispose();
         if ( entryEditor != null )
         {
+            BrowserCommonActivator.getDefault().getPreferenceStore().removePropertyChangeListener(
+                propertyChangeListener );
             entryEditor = null;
         }
     }



Mime
View raw message