directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r512311 - in /directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller: HierarchyViewController.java SchemasViewController.java
Date Tue, 27 Feb 2007 16:36:15 GMT
Author: pamarcelot
Date: Tue Feb 27 08:36:13 2007
New Revision: 512311

URL: http://svn.apache.org/viewvc?view=rev&rev=512311
Log:
Added a verification on the PropertyChangeListener to refresh the TreeViewer only when it
is necessary.

Modified:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchyViewController.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchyViewController.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchyViewController.java?view=diff&rev=512311&r1=512310&r2=512311
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchyViewController.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/HierarchyViewController.java
Tue Feb 27 08:36:13 2007
@@ -21,7 +21,11 @@
 package org.apache.directory.ldapstudio.schemas.controller;
 
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.directory.ldapstudio.schemas.Activator;
+import org.apache.directory.ldapstudio.schemas.PluginConstants;
 import org.apache.directory.ldapstudio.schemas.controller.actions.CollapseAllAction;
 import org.apache.directory.ldapstudio.schemas.controller.actions.HideAttributeTypesAction;
 import org.apache.directory.ldapstudio.schemas.controller.actions.HideObjectClassesAction;
@@ -62,6 +66,9 @@
 {
     /** The logger */
     private static Logger logger = Logger.getLogger( HierarchyViewController.class );
+    
+    /** The authorized Preferences keys*/
+    List<String> authorizedPrefs;
 
     /** The associated view */
     private HierarchyView view;
@@ -81,7 +88,8 @@
     public HierarchyViewController( HierarchyView view )
     {
         this.view = view;
-
+        
+        initAuthorizedPrefs();
         initActions();
         initToolbar();
         initMenu();
@@ -90,6 +98,22 @@
     }
 
 
+    private void initAuthorizedPrefs()
+    {
+        authorizedPrefs = new ArrayList<String>();
+        authorizedPrefs.add( PluginConstants.PREFS_HIERARCHY_VIEW_LABEL );
+        authorizedPrefs.add( PluginConstants.PREFS_HIERARCHY_VIEW_ABBREVIATE );
+        authorizedPrefs.add( PluginConstants.PREFS_HIERARCHY_VIEW_ABBREVIATE_MAX_LENGTH );
+        authorizedPrefs.add( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_DISPLAY
);
+        authorizedPrefs.add( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL );
+        authorizedPrefs.add( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_ABBREVIATE
);
+        authorizedPrefs.add( PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH
);
+        authorizedPrefs.add( PluginConstants.PREFS_HIERARCHY_VIEW_GROUPING );
+        authorizedPrefs.add( PluginConstants.PREFS_HIERARCHY_VIEW_SORTING_BY );
+        authorizedPrefs.add( PluginConstants.PREFS_HIERARCHY_VIEW_SORTING_ORDER );
+    }
+
+
     /**
      * Initializes the Actions.
      */
@@ -202,8 +226,11 @@
              * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
              */
             public void propertyChange( PropertyChangeEvent event )
-            {
-                view.getViewer().refresh();
+            { 
+                if ( authorizedPrefs.contains( event.getProperty() ) )
+                {
+                    view.getViewer().refresh();
+                }
             }
         } );
     }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java?view=diff&rev=512311&r1=512310&r2=512311
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java
Tue Feb 27 08:36:13 2007
@@ -21,7 +21,11 @@
 package org.apache.directory.ldapstudio.schemas.controller;
 
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.directory.ldapstudio.schemas.Activator;
+import org.apache.directory.ldapstudio.schemas.PluginConstants;
 import org.apache.directory.ldapstudio.schemas.controller.actions.CollapseAllAction;
 import org.apache.directory.ldapstudio.schemas.controller.actions.CreateANewAttributeTypeAction;
 import org.apache.directory.ldapstudio.schemas.controller.actions.CreateANewObjectClassAction;
@@ -93,6 +97,9 @@
     /** The associated view */
     private SchemasView view;
 
+    /** The authorized Preferences keys*/
+    List<String> authorizedPrefs;
+
     /** The Drag'n'Drop FileTransfer Object */
     private final static FileTransfer fileTransfer = FileTransfer.getInstance();
 
@@ -125,6 +132,7 @@
     {
         this.view = view;
 
+        initAuthorizedPrefs();
         initActions();
         initToolbar();
         initMenu();
@@ -136,6 +144,18 @@
     }
 
 
+    private void initAuthorizedPrefs()
+    {
+        authorizedPrefs = new ArrayList<String>();
+        authorizedPrefs.add( PluginConstants.PREFS_SCHEMAS_VIEW_LABEL );
+        authorizedPrefs.add( PluginConstants.PREFS_SCHEMAS_VIEW_ABBREVIATE );
+        authorizedPrefs.add( PluginConstants.PREFS_SCHEMAS_VIEW_ABBREVIATE_MAX_LENGTH );
+        authorizedPrefs.add( PluginConstants.PREFS_SCHEMAS_VIEW_GROUPING );
+        authorizedPrefs.add( PluginConstants.PREFS_SCHEMAS_VIEW_SORTING_BY );
+        authorizedPrefs.add( PluginConstants.PREFS_SCHEMAS_VIEW_SORTING_ORDER );
+    }
+
+
     /**
      * Initializes the Actions.
      */
@@ -569,7 +589,10 @@
              */
             public void propertyChange( PropertyChangeEvent event )
             {
-                view.getViewer().refresh();
+                if ( authorizedPrefs.contains( event.getProperty() ) )
+                {
+                    view.getViewer().refresh();
+                }
             }
         } );
     }



Mime
View raw message