directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1244636 - in /directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor: EntryEditorWidgetConfiguration.java EntryEditorWidgetLabelProvider.java
Date Wed, 15 Feb 2012 18:35:50 GMT
Author: pamarcelot
Date: Wed Feb 15 18:35:49 2012
New Revision: 1244636

URL: http://svn.apache.org/viewvc?rev=1244636&view=rev
Log:
Fix for DIRSTUDIO-779 (Label for folded attributes in TableEntryEditor is not updated when
quick filter is used)

Modified:
    directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetConfiguration.java
    directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetLabelProvider.java

Modified: directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetConfiguration.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetConfiguration.java?rev=1244636&r1=1244635&r2=1244636&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetConfiguration.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetConfiguration.java
Wed Feb 15 18:35:49 2012
@@ -151,7 +151,7 @@ public class EntryEditorWidgetConfigurat
     {
         if ( labelProvider == null )
         {
-            labelProvider = new EntryEditorWidgetLabelProvider( getValueEditorManager( viewer
) );
+            labelProvider = new EntryEditorWidgetLabelProvider( viewer, getValueEditorManager(
viewer ) );
         }
 
         return labelProvider;

Modified: directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetLabelProvider.java?rev=1244636&r1=1244635&r2=1244636&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetLabelProvider.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetLabelProvider.java
Wed Feb 15 18:35:49 2012
@@ -32,6 +32,7 @@ import org.eclipse.jface.viewers.IColorP
 import org.eclipse.jface.viewers.IFontProvider;
 import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Color;
@@ -56,6 +57,8 @@ import org.eclipse.swt.widgets.Display;
 public class EntryEditorWidgetLabelProvider extends LabelProvider implements ITableLabelProvider,
IFontProvider,
     IColorProvider
 {
+    /** The viewer */
+    private TreeViewer viewer;
 
     /** The value editor manager. */
     private ValueEditorManager valueEditorManager;
@@ -64,10 +67,12 @@ public class EntryEditorWidgetLabelProvi
     /**
      * Creates a new instance of EntryEditorWidgetLabelProvider.
      * 
+     * @param viewer the viewer
      * @param valueEditorManager the value editor manager
      */
-    public EntryEditorWidgetLabelProvider( ValueEditorManager valueEditorManager )
+    public EntryEditorWidgetLabelProvider( TreeViewer viewer, ValueEditorManager valueEditorManager
)
     {
+        this.viewer = viewer;
         this.valueEditorManager = valueEditorManager;
     }
 
@@ -109,7 +114,7 @@ public class EntryEditorWidgetLabelProvi
             {
                 return NLS
                     .bind(
-                        Messages.getString( "EntryEditorWidgetLabelProvider.AttributeLabel"
), attribute.getDescription(), attribute.getValueSize() ); //$NON-NLS-1$
+                        Messages.getString( "EntryEditorWidgetLabelProvider.AttributeLabel"
), attribute.getDescription(), getNumberOfValues( attribute ) ); //$NON-NLS-1$
             }
             else
             {
@@ -124,6 +129,32 @@ public class EntryEditorWidgetLabelProvi
 
 
     /**
+     * Gets the number of values attribute.
+     *
+     * @param element
+     * @return
+     */
+    private int getNumberOfValues( IAttribute attribute )
+    {
+        EntryEditorWidgetContentProvider contentProvider = ( EntryEditorWidgetContentProvider
) viewer
+            .getContentProvider();
+        EntryEditorWidgetFilter filter = ( EntryEditorWidgetFilter ) viewer.getFilters()[0];
+
+        int count = 0;
+
+        for ( Object child : contentProvider.getChildren( attribute ) )
+        {
+            if ( filter.select( viewer, attribute, child ) )
+            {
+                count++;
+            }
+        }
+
+        return count;
+    }
+
+
+    /**
      * {@inheritDoc}
      */
     public final Image getColumnImage( Object element, int index )



Mime
View raw message