directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1428828 - /directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ReplicationMasterDetailsBlock.java
Date Fri, 04 Jan 2013 13:00:29 GMT
Author: pamarcelot
Date: Fri Jan  4 13:00:29 2013
New Revision: 1428828

URL: http://svn.apache.org/viewvc?rev=1428828&view=rev
Log:
Added a comparator to sort the replication consumers list in the Replication page.

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

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ReplicationMasterDetailsBlock.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/ReplicationMasterDetailsBlock.java?rev=1428828&r1=1428827&r2=1428828&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ReplicationMasterDetailsBlock.java
(original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ReplicationMasterDetailsBlock.java
Fri Jan  4 13:00:29 2013
@@ -31,6 +31,8 @@ import org.eclipse.jface.viewers.LabelPr
 import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
@@ -148,6 +150,27 @@ public class ReplicationMasterDetailsBlo
                 return super.getText( element );
             }
         } );
+        viewer.setComparator( new ViewerComparator()
+        {
+            public int compare( Viewer viewer, Object e1, Object e2 )
+            {
+                if ( ( e1 instanceof ReplConsumerBean ) && ( e2 instanceof ReplConsumerBean
) )
+                {
+                    ReplConsumerBean o1 = ( ReplConsumerBean ) e1;
+                    ReplConsumerBean o2 = ( ReplConsumerBean ) e2;
+
+                    String id1 = o1.getReplConsumerId();
+                    String id2 = o2.getReplConsumerId();
+
+                    if ( ( id1 != null ) && ( id2 != null ) )
+                    {
+                        return id1.compareTo( id2 );
+                    }
+                }
+
+                return super.compare( viewer, e1, e2 );
+            }
+        } );
 
         // Creating the button(s)
         addButton = toolkit.createButton( client, "Add", SWT.PUSH );



Mime
View raw message