directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1427839 - in /directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor: OverviewPage.java PartitionsMasterDetailsBlock.java PartitionsPage.java
Date Wed, 02 Jan 2013 16:08:42 GMT
Author: pamarcelot
Date: Wed Jan  2 16:08:42 2013
New Revision: 1427839

URL: http://svn.apache.org/viewvc?rev=1427839&view=rev
Log:
Added a comparator to sort the partitions lists in the Overview and Partitions pages.

Modified:
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.java
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionsMasterDetailsBlock.java
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionsPage.java

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.java?rev=1427839&r1=1427838&r2=1427839&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.java
(original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.java
Wed Jan  2 16:08:42 2013
@@ -376,6 +376,7 @@ public class OverviewPage extends Server
         partitionsTableViewer = new TableViewer( partitionsTable );
         partitionsTableViewer.setContentProvider( new ArrayContentProvider() );
         partitionsTableViewer.setLabelProvider( PartitionsPage.PARTITIONS_LABEL_PROVIDER
);
+        partitionsTableViewer.setComparator( PartitionsPage.PARTITIONS_COMPARATOR );
 
         // Partitions Configuration Link
         openPartitionsConfigurationLink = toolkit.createHyperlink( composite,

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionsMasterDetailsBlock.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionsMasterDetailsBlock.java?rev=1427839&r1=1427838&r2=1427839&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionsMasterDetailsBlock.java
(original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionsMasterDetailsBlock.java
Wed Jan  2 16:08:42 2013
@@ -112,7 +112,7 @@ public class PartitionsMasterDetailsBloc
         toolkit.paintBordersFor( client );
         section.setClient( client );
 
-        // Creatig the Table and Table Viewer
+        // Creating the Table and Table Viewer
         Table table = toolkit.createTable( client, SWT.NULL );
         GridData gd = new GridData( SWT.FILL, SWT.FILL, true, true, 1, 2 );
         gd.heightHint = 20;
@@ -130,6 +130,7 @@ public class PartitionsMasterDetailsBloc
         } );
         viewer.setContentProvider( new ArrayContentProvider() );
         viewer.setLabelProvider( PartitionsPage.PARTITIONS_LABEL_PROVIDER );
+        viewer.setComparator( PartitionsPage.PARTITIONS_COMPARATOR );
 
         // Creating the button(s)
         addButton = toolkit.createButton( client, "Add", SWT.PUSH );

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionsPage.java?rev=1427839&r1=1427838&r2=1427839&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionsPage.java
(original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionsPage.java
Wed Jan  2 16:08:42 2013
@@ -24,6 +24,8 @@ import org.apache.directory.server.confi
 import org.apache.directory.studio.apacheds.configuration.v2.ApacheDS2ConfigurationPlugin;
 import org.apache.directory.studio.apacheds.configuration.v2.ApacheDS2ConfigurationPluginConstants;
 import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.widgets.Composite;
@@ -81,6 +83,29 @@ public class PartitionsPage extends Serv
         }
     };
 
+    /** The comparator for partition table viewers */
+    public static ViewerComparator PARTITIONS_COMPARATOR = new ViewerComparator()
+    {
+        public int compare( Viewer viewer, Object e1, Object e2 )
+        {
+            if ( ( e1 instanceof PartitionBean ) && ( e2 instanceof PartitionBean
) )
+            {
+                PartitionBean partition1 = ( PartitionBean ) e1;
+                PartitionBean partition2 = ( PartitionBean ) e2;
+
+                String partition1Id = partition1.getPartitionId();
+                String partition2Id = partition2.getPartitionId();
+
+                if ( ( partition1Id != null ) && ( partition2Id != null ) )
+                {
+                    return partition1Id.compareTo( partition2Id );
+                }
+            }
+
+            return super.compare( viewer, e1, e2 );
+        }
+    };
+
 
     /**
      * Creates a new instance of PartitionsPage.



Mime
View raw message