directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r558013 [1/2] - in /directory/studio/trunk/studio-apacheds-schemaeditor: resources/icons/ src/main/java/org/apache/directory/studio/apacheds/schemaeditor/ src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/ src...
Date Fri, 20 Jul 2007 14:55:08 GMT
Author: pamarcelot
Date: Fri Jul 20 07:55:03 2007
New Revision: 558013

URL: http://svn.apache.org/viewvc?view=rev&rev=558013
Log:
Improved Differences widget to display the whole schema, and properties for modified ATs and OCs.

Added:
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_attribute_type_add.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_attribute_type_modify.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_attribute_type_remove.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_object_class_add.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_object_class_modify.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_object_class_remove.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_property_add.gif
      - copied unchanged from r557557, directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_add.gif
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_property_modify.gif
      - copied unchanged from r557557, directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_modify.gif
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_property_remove.gif
      - copied unchanged from r557557, directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_remove.gif
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_schema_add.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_schema_modify.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_schema_remove.gif   (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetPropertiesContentProvider.java
      - copied, changed from r555904, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetContentProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetPropertiesLabelProvider.java
      - copied, changed from r557690, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetLabelProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetSchemaContentProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetSchemaLabelProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/FirstNameSorter.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/Folder.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/OidSorter.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/PropertySorter.java
      - copied, changed from r557690, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetPropertySorter.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/SchemaDifferenceSorter.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/TypeSorter.java
      - copied, changed from r557690, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetTypeSorter.java
Removed:
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_add.gif
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_modify.gif
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_remove.gif
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetContentProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetLabelProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetPropertySorter.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetTypeSorter.java
Modified:
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/AttributeTypeDifference.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/DifferenceEngine.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/ObjectClassDifference.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewContentProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewLabelProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidget.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/CommitChangesDifferencesWizardPage.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/CommitChangesWizard.java

Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_attribute_type_add.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_attribute_type_add.gif?view=auto&rev=558013
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_attribute_type_add.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_attribute_type_modify.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_attribute_type_modify.gif?view=auto&rev=558013
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_attribute_type_modify.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_attribute_type_remove.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_attribute_type_remove.gif?view=auto&rev=558013
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_attribute_type_remove.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_object_class_add.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_object_class_add.gif?view=auto&rev=558013
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_object_class_add.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_object_class_modify.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_object_class_modify.gif?view=auto&rev=558013
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_object_class_modify.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_object_class_remove.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_object_class_remove.gif?view=auto&rev=558013
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_object_class_remove.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_schema_add.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_schema_add.gif?view=auto&rev=558013
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_schema_add.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_schema_modify.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_schema_modify.gif?view=auto&rev=558013
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_schema_modify.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_schema_remove.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_schema_remove.gif?view=auto&rev=558013
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_schema_remove.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java?view=diff&rev=558013&r1=558012&r2=558013
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java Fri Jul 20 07:55:03 2007
@@ -40,9 +40,18 @@
     public static final String IMG_COLLAPSE_ALL = "resources/icons/collapse_all.gif";
     public static final String IMG_DELETE = "resources/icons/delete.gif";
     public static final String IMG_DISCONNECT = "resources/icons/disconnect.gif";
-    public static final String IMG_DIFFERENCE_ADD = "resources/icons/difference_add.gif";
-    public static final String IMG_DIFFERENCE_MODIFY = "resources/icons/difference_modify.gif";
-    public static final String IMG_DIFFERENCE_REMOVE = "resources/icons/difference_remove.gif";
+    public static final String IMG_DIFFERENCE_ATTRIBUTE_TYPE_ADD = "resources/icons/difference_attribute_type_add.gif";
+    public static final String IMG_DIFFERENCE_ATTRIBUTE_TYPE_MODIFY = "resources/icons/difference_attribute_type_modify.gif";
+    public static final String IMG_DIFFERENCE_ATTRIBUTE_TYPE_REMOVE = "resources/icons/difference_attribute_type_remove.gif";
+    public static final String IMG_DIFFERENCE_OBJECT_CLASS_ADD = "resources/icons/difference_object_class_add.gif";
+    public static final String IMG_DIFFERENCE_OBJECT_CLASS_MODIFY = "resources/icons/difference_object_class_modify.gif";
+    public static final String IMG_DIFFERENCE_OBJECT_CLASS_REMOVE = "resources/icons/difference_object_class_remove.gif";
+    public static final String IMG_DIFFERENCE_PROPERTY_ADD = "resources/icons/difference_property_add.gif";
+    public static final String IMG_DIFFERENCE_PROPERTY_MODIFY = "resources/icons/difference_property_modify.gif";
+    public static final String IMG_DIFFERENCE_PROPERTY_REMOVE = "resources/icons/difference_property_remove.gif";
+    public static final String IMG_DIFFERENCE_SCHEMA_ADD = "resources/icons/difference_schema_add.gif";
+    public static final String IMG_DIFFERENCE_SCHEMA_MODIFY = "resources/icons/difference_schema_modify.gif";
+    public static final String IMG_DIFFERENCE_SCHEMA_REMOVE = "resources/icons/difference_schema_remove.gif";
     public static final String IMG_FOLDER = "resources/icons/folder.gif";
     public static final String IMG_FOLDER_AT = "resources/icons/folder_at.gif";
     public static final String IMG_FOLDER_OC = "resources/icons/folder_oc.gif";

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/AttributeTypeDifference.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/AttributeTypeDifference.java?view=diff&rev=558013&r1=558012&r2=558013
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/AttributeTypeDifference.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/AttributeTypeDifference.java Fri Jul 20 07:55:03 2007
@@ -98,7 +98,7 @@
      */
     public void addDifferences( List<PropertyDifference> differences )
     {
-        differences.addAll( differences );
+        this.differences.addAll( differences );
     }
 
 

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/DifferenceEngine.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/DifferenceEngine.java?view=diff&rev=558013&r1=558012&r2=558013
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/DifferenceEngine.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/DifferenceEngine.java Fri Jul 20 07:55:03 2007
@@ -52,9 +52,9 @@
      * @return
      *      the differences between the two schema Lists
      */
-    public static List<Difference> getDifferences( List<Schema> l1, List<Schema> l2 )
+    public static List<SchemaDifference> getDifferences( List<Schema> l1, List<Schema> l2 )
     {
-        List<Difference> differences = new ArrayList<Difference>();
+        List<SchemaDifference> differences = new ArrayList<SchemaDifference>();
 
         // Building Maps for schemas
         Map<String, Schema> mapL1 = new HashMap<String, Schema>();
@@ -81,6 +81,7 @@
             {
                 SchemaDifference schemaDifference = new SchemaDifference( schemaFromL1, schemaFromL2,
                     DifferenceType.IDENTICAL );
+                differences.add( schemaDifference );
 
                 // Building Maps for attribute types
                 Map<String, AttributeTypeImpl> atMapL1 = new HashMap<String, AttributeTypeImpl>();
@@ -124,7 +125,7 @@
                 // Looping on the attribute types from the Schema from the second list
                 for ( AttributeTypeImpl atFromL2 : schemaFromL2.getAttributeTypes() )
                 {
-                    AttributeTypeImpl atFromL1 = atMapL2.get( atFromL2.getOid() );
+                    AttributeTypeImpl atFromL1 = atMapL1.get( atFromL2.getOid() );
                     if ( atFromL1 == null )
                     {
                         AttributeTypeDifference attributeTypeDifference = new AttributeTypeDifference( null, atFromL2,
@@ -177,7 +178,7 @@
                 // Looping on the object classes from the Schema from the second list
                 for ( ObjectClassImpl ocFromL2 : schemaFromL2.getObjectClasses() )
                 {
-                    ObjectClassImpl ocFromL1 = ocMapL2.get( ocFromL2.getOid() );
+                    ObjectClassImpl ocFromL1 = ocMapL1.get( ocFromL2.getOid() );
                     if ( ocFromL1 == null )
                     {
                         ObjectClassDifference objectClassDifference = new ObjectClassDifference( null, ocFromL2,

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/ObjectClassDifference.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/ObjectClassDifference.java?view=diff&rev=558013&r1=558012&r2=558013
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/ObjectClassDifference.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/model/difference/ObjectClassDifference.java Fri Jul 20 07:55:03 2007
@@ -88,7 +88,8 @@
     {
         differences.add( difference );
     }
-    
+
+
     /**
      * Adds differences.
      *
@@ -97,7 +98,7 @@
      */
     public void addDifferences( List<PropertyDifference> differences )
     {
-        differences.addAll( differences );
+        this.differences.addAll( differences );
     }
 
 

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewContentProvider.java?view=diff&rev=558013&r1=558012&r2=558013
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewContentProvider.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewContentProvider.java Fri Jul 20 07:55:03 2007
@@ -68,7 +68,7 @@
 
 
     /**
-     * Creates a new instance of SchemaViewContentProvider.
+     * Creates a new instance of DifferencesWidgetSchemaContentProvider.
      */
     public SchemaViewContentProvider()
     {

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewLabelProvider.java?view=diff&rev=558013&r1=558012&r2=558013
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewLabelProvider.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaViewLabelProvider.java Fri Jul 20 07:55:03 2007
@@ -50,7 +50,7 @@
 
 
     /**
-     * Creates a new instance of SchemaViewLabelProvider.
+     * Creates a new instance of DifferencesWidgetSchemaLabelProvider.
      */
     public SchemaViewLabelProvider()
     {

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidget.java?view=diff&rev=558013&r1=558012&r2=558013
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidget.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidget.java Fri Jul 20 07:55:03 2007
@@ -24,9 +24,18 @@
 
 import org.apache.directory.studio.apacheds.schemaeditor.Activator;
 import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
-import org.apache.directory.studio.apacheds.schemaeditor.model.difference.Difference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AttributeTypeDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.DifferenceType;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ObjectClassDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.SchemaDifference;
 import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
@@ -37,7 +46,6 @@
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Menu;
 import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.ToolBar;
 import org.eclipse.swt.widgets.ToolItem;
 import org.eclipse.ui.PlatformUI;
@@ -54,8 +62,11 @@
  */
 public class DifferencesWidget
 {
+    /** The TreeViewer */
+    private TreeViewer treeViewer;
+
     /** The TableViewer */
-    private TableViewer viewer;
+    private TableViewer tableViewer;
 
     /** The PreferenceStore*/
     private IPreferenceStore store;
@@ -85,7 +96,7 @@
     {
         // Composite
         Composite composite = new Composite( parent, SWT.NONE );
-        GridLayout gridLayout = new GridLayout();
+        GridLayout gridLayout = new GridLayout( 2, true );
         gridLayout.marginBottom = 0;
         gridLayout.marginHeight = 0;
         gridLayout.marginLeft = 0;
@@ -93,9 +104,81 @@
         gridLayout.marginTop = 0;
         gridLayout.marginWidth = 0;
         composite.setLayout( gridLayout );
+        composite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+
+        // Left Composite
+        Composite leftComposite = new Composite( composite, SWT.NONE );
+        gridLayout = new GridLayout();
+        gridLayout.marginBottom = 0;
+        gridLayout.marginHeight = 0;
+        gridLayout.marginLeft = 0;
+        gridLayout.marginRight = 0;
+        gridLayout.marginTop = 0;
+        gridLayout.marginWidth = 0;
+        leftComposite.setLayout( gridLayout );
+        leftComposite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+
+        // TreeViewer
+        treeViewer = new TreeViewer( leftComposite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
+        treeViewer.getTree().setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+        treeViewer.setContentProvider( new DifferencesWidgetSchemaContentProvider() );
+        treeViewer.setLabelProvider( new DifferencesWidgetSchemaLabelProvider() );
+        treeViewer.addSelectionChangedListener( new ISelectionChangedListener()
+        {
+            public void selectionChanged( SelectionChangedEvent event )
+            {
+                StructuredSelection selection = ( StructuredSelection ) event.getSelection();
+                Object element = selection.getFirstElement();
+                if ( element instanceof AttributeTypeDifference )
+                {
+                    AttributeTypeDifference atd = ( AttributeTypeDifference ) element;
+                    if ( atd.getType().equals( DifferenceType.MODIFIED ) )
+                    {
+                        tableViewer.setInput( atd.getDifferences() );
+                        return;
+                    }
+                }
+                else if ( element instanceof ObjectClassDifference )
+                {
+                    ObjectClassDifference ocd = ( ObjectClassDifference ) element;
+                    if ( ocd.getType().equals( DifferenceType.MODIFIED ) )
+                    {
+                        tableViewer.setInput( ocd.getDifferences() );
+                        return;
+                    }
+                }
+
+                // Default
+                tableViewer.setInput( null );
+            }
+        } );
+        treeViewer.addDoubleClickListener( new IDoubleClickListener()
+        {
+            public void doubleClick( DoubleClickEvent event )
+            {
+                StructuredSelection selection = ( StructuredSelection ) event.getSelection();
+                Object element = selection.getFirstElement();
+                if ( ( element instanceof Folder ) || ( element instanceof SchemaDifference ) )
+                {
+                    treeViewer.setExpandedState( element, !treeViewer.getExpandedState( element ) );
+                }
+            }
+        } );
+
+        // Right Composite
+        Composite rightComposite = new Composite( composite, SWT.NONE );
+        gridLayout = new GridLayout();
+        gridLayout.marginBottom = 0;
+        gridLayout.marginHeight = 0;
+        gridLayout.marginLeft = 0;
+        gridLayout.marginRight = 0;
+        gridLayout.marginTop = 0;
+        gridLayout.marginWidth = 0;
+        rightComposite.setLayout( gridLayout );
+        rightComposite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
 
         // ToolBar
-        final ToolBar toolBar = new ToolBar( composite, SWT.HORIZONTAL );
+        final ToolBar toolBar = new ToolBar( rightComposite, SWT.HORIZONTAL );
         toolBar.setLayoutData( new GridData( SWT.RIGHT, SWT.NONE, false, false ) );
         // Creating the 'Menu' ToolBar item
         final ToolItem menuToolItem = new ToolItem( toolBar, SWT.PUSH );
@@ -138,38 +221,23 @@
         } );
         updateMenuItemsCheckStatus();
 
-        // Table
-        Table table = new Table( composite, SWT.BORDER );
-        table.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
-
         // TableViewer
-        viewer = new TableViewer( table );
-        viewer.setContentProvider( new DifferencesWidgetContentProvider() );
-        viewer.setLabelProvider( new DifferencesWidgetLabelProvider() );
+        tableViewer = new TableViewer( rightComposite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
+        tableViewer.getTable().setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+        tableViewer.setContentProvider( new DifferencesWidgetPropertiesContentProvider() );
+        tableViewer.setLabelProvider( new DifferencesWidgetPropertiesLabelProvider() );
     }
 
 
     /**
-     * Sets the Input of the TableViewer.
+     * Sets the Input of the DifferencesWidget.
      *
      * @param input
      *      the input
      */
-    public void setInput( List<Difference> input )
-    {
-        viewer.setInput( input );
-    }
-
-
-    /**
-     * Gets the TableViewer used in the Widget.
-     *
-     * @return
-     *      the TableViewer used in the Widget
-     */
-    public TableViewer getViewer()
+    public void setInput( List<SchemaDifference> input )
     {
-        return viewer;
+        treeViewer.setInput( input );
     }
 
 
@@ -183,7 +251,7 @@
     {
         store.setValue( PluginConstants.PREFS_DIFFERENCES_WIDGET_GROUPING, value );
         updateMenuItemsCheckStatus();
-        viewer.refresh();
+        tableViewer.refresh();
     }
 
 

Copied: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetPropertiesContentProvider.java (from r555904, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetContentProvider.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetPropertiesContentProvider.java?view=diff&rev=558013&p1=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetContentProvider.java&r1=555904&p2=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetPropertiesContentProvider.java&r2=558013
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetContentProvider.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetPropertiesContentProvider.java Fri Jul 20 07:55:03 2007
@@ -25,7 +25,7 @@
 
 import org.apache.directory.studio.apacheds.schemaeditor.Activator;
 import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
-import org.apache.directory.studio.apacheds.schemaeditor.model.difference.Difference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.PropertyDifference;
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.Viewer;
@@ -37,26 +37,26 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class DifferencesWidgetContentProvider implements IStructuredContentProvider
+public class DifferencesWidgetPropertiesContentProvider implements IStructuredContentProvider
 {
-    /** The DifferencesWidgetPropertySorter */
-    private DifferencesWidgetPropertySorter propertySorter;
+    /** The PropertySorter */
+    private PropertySorter propertySorter;
 
-    /** The DifferencesWidgetTypeSorter */
-    private DifferencesWidgetTypeSorter typeSorter;
+    /** The TypeSorter */
+    private TypeSorter typeSorter;
 
     /** The PreferenceStore */
     private IPreferenceStore store;
 
 
     /**
-     * Creates a new instance of DifferencesWidgetContentProvider.
+     * Creates a new instance of DifferencesWidgetPropertiesContentProvider.
      *
      */
-    public DifferencesWidgetContentProvider()
+    public DifferencesWidgetPropertiesContentProvider()
     {
-        propertySorter = new DifferencesWidgetPropertySorter();
-        typeSorter = new DifferencesWidgetTypeSorter();
+        propertySorter = new PropertySorter();
+        typeSorter = new TypeSorter();
 
         store = Activator.getDefault().getPreferenceStore();
     }
@@ -65,11 +65,12 @@
     /* (non-Javadoc)
      * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
      */
+    @SuppressWarnings("unchecked")
     public Object[] getElements( Object inputElement )
     {
         if ( inputElement instanceof List )
         {
-            List<Difference> differences = ( List<Difference> ) inputElement;
+            List<PropertyDifference> differences = ( List<PropertyDifference> ) inputElement;
 
             int prefValue = store.getInt( PluginConstants.PREFS_DIFFERENCES_WIDGET_GROUPING );
             if ( prefValue == PluginConstants.PREFS_DIFFERENCES_WIDGET_GROUPING_PROPERTY )

Copied: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetPropertiesLabelProvider.java (from r557690, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetLabelProvider.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetPropertiesLabelProvider.java?view=diff&rev=558013&p1=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetLabelProvider.java&r1=557690&p2=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetPropertiesLabelProvider.java&r2=558013
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetLabelProvider.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetPropertiesLabelProvider.java Fri Jul 20 07:55:03 2007
@@ -51,7 +51,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class DifferencesWidgetLabelProvider extends LabelProvider
+public class DifferencesWidgetPropertiesLabelProvider extends LabelProvider
 {
     /* (non-Javadoc)
      * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
@@ -65,14 +65,14 @@
             {
                 case ADDED:
                     return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
-                        PluginConstants.IMG_DIFFERENCE_ADD ).createImage();
+                        PluginConstants.IMG_DIFFERENCE_PROPERTY_ADD ).createImage();
 
                 case MODIFIED:
                     return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
-                        PluginConstants.IMG_DIFFERENCE_MODIFY ).createImage();
+                        PluginConstants.IMG_DIFFERENCE_PROPERTY_MODIFY ).createImage();
                 case REMOVED:
                     return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
-                        PluginConstants.IMG_DIFFERENCE_REMOVE ).createImage();
+                        PluginConstants.IMG_DIFFERENCE_PROPERTY_REMOVE ).createImage();
             }
         }
 

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetSchemaContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetSchemaContentProvider.java?view=auto&rev=558013
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetSchemaContentProvider.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetSchemaContentProvider.java Fri Jul 20 07:55:03 2007
@@ -0,0 +1,206 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.view.widget;
+
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.SchemaDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.view.widget.Folder.FolderType;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+
+/**
+ * This class implements the ContentProvider for the Difference Widget.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DifferencesWidgetSchemaContentProvider implements IStructuredContentProvider, ITreeContentProvider
+{
+    /** The preferences store */
+    private IPreferenceStore store;
+
+    /** The FirstName Sorter */
+    private FirstNameSorter firstNameSorter;
+
+    /** The OID Sorter */
+    private OidSorter oidSorter;
+
+    /** The Schema Sorter */
+    private SchemaDifferenceSorter schemaDifferenceSorter;
+
+
+    /**
+     * Creates a new instance of DifferencesWidgetSchemaContentProvider.
+     */
+    public DifferencesWidgetSchemaContentProvider()
+    {
+        store = Activator.getDefault().getPreferenceStore();
+
+        firstNameSorter = new FirstNameSorter();
+        oidSorter = new OidSorter();
+        schemaDifferenceSorter = new SchemaDifferenceSorter();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+     */
+    public Object[] getElements( Object inputElement )
+    {
+        return getChildren( inputElement );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+     */
+    public void dispose()
+    {
+        // Nothing to do
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+     */
+    public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
+    {
+        // Nothing to do
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+     */
+    @SuppressWarnings("unchecked")
+    public Object[] getChildren( Object parentElement )
+    {
+        List<Object> children = new ArrayList<Object>();
+
+        int group = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_GROUPING );
+        int sortBy = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SORTING_BY );
+        int sortOrder = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SORTING_ORDER );
+
+        if ( parentElement instanceof List )
+        {
+            List<SchemaDifference> schemaDifferences = ( List<SchemaDifference> ) parentElement;
+
+            children.addAll( schemaDifferences );
+
+            Collections.sort( children, schemaDifferenceSorter );
+        }
+        else if ( parentElement instanceof SchemaDifference )
+        {
+            SchemaDifference difference = ( SchemaDifference ) parentElement;
+
+            if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_FOLDERS )
+            {
+                Folder atFolder = new Folder( FolderType.ATTRIBUTE_TYPE );
+                atFolder.addAllChildren( difference.getAttributeTypesDifferences() );
+                children.add( atFolder );
+
+                Folder ocFolder = new Folder( FolderType.OBJECT_CLASS );
+                ocFolder.addAllChildren( difference.getObjectClassesDifferences() );
+                children.add( ocFolder );
+            }
+            else if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_MIXED )
+            {
+                children.addAll( difference.getAttributeTypesDifferences() );
+                children.addAll( difference.getObjectClassesDifferences() );
+
+                // Sort by
+                if ( sortBy == PluginConstants.PREFS_SCHEMA_VIEW_SORTING_BY_FIRSTNAME )
+                {
+                    Collections.sort( children, firstNameSorter );
+                }
+                else if ( sortBy == PluginConstants.PREFS_SCHEMA_VIEW_SORTING_BY_OID )
+                {
+                    Collections.sort( children, oidSorter );
+                }
+
+                // Sort Order
+                if ( sortOrder == PluginConstants.PREFS_SCHEMA_VIEW_SORTING_ORDER_DESCENDING )
+                {
+                    Collections.reverse( children );
+                }
+            }
+        }
+        else if ( parentElement instanceof Folder )
+        {
+            children.addAll( ( ( Folder ) parentElement ).getChildren() );
+
+            // Sort by
+            if ( sortBy == PluginConstants.PREFS_SCHEMA_VIEW_SORTING_BY_FIRSTNAME )
+            {
+                Collections.sort( children, firstNameSorter );
+            }
+            else if ( sortBy == PluginConstants.PREFS_SCHEMA_VIEW_SORTING_BY_OID )
+            {
+                Collections.sort( children, oidSorter );
+            }
+
+            // Sort Order
+            if ( sortOrder == PluginConstants.PREFS_SCHEMA_VIEW_SORTING_ORDER_DESCENDING )
+            {
+                Collections.reverse( children );
+            }
+        }
+
+        return children.toArray();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+     */
+    public Object getParent( Object element )
+    {
+        // Default
+        return null;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+     */
+    public boolean hasChildren( Object element )
+    {
+        if ( element instanceof SchemaDifference )
+        {
+            return true;
+        }
+        else if ( element instanceof Folder )
+        {
+            return true;
+        }
+
+        // Default
+        return false;
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetSchemaLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetSchemaLabelProvider.java?view=auto&rev=558013
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetSchemaLabelProvider.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetSchemaLabelProvider.java Fri Jul 20 07:55:03 2007
@@ -0,0 +1,445 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.view.widget;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Schema;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AttributeTypeDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ObjectClassDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.SchemaDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.view.ViewUtils;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class implements the LabelProvider for the SchemaView.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DifferencesWidgetSchemaLabelProvider extends LabelProvider
+{
+    private static final String NONE = "(None)";
+
+    /** The preferences store */
+    private IPreferenceStore store;
+
+
+    /**
+     * Creates a new instance of DifferencesWidgetSchemaLabelProvider.
+     */
+    public DifferencesWidgetSchemaLabelProvider()
+    {
+        store = Activator.getDefault().getPreferenceStore();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+     */
+    public String getText( Object element )
+    {
+        String label = ""; //$NON-NLS-1$
+
+        int labelValue = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_LABEL );
+        boolean abbreviate = store.getBoolean( PluginConstants.PREFS_SCHEMA_VIEW_ABBREVIATE );
+        int abbreviateMaxLength = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_ABBREVIATE_MAX_LENGTH );
+        boolean secondaryLabelDisplay = store.getBoolean( PluginConstants.PREFS_SCHEMA_VIEW_SECONDARY_LABEL_DISPLAY );
+        int secondaryLabelValue = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SECONDARY_LABEL );
+        boolean secondaryLabelAbbreviate = store
+            .getBoolean( PluginConstants.PREFS_SCHEMA_VIEW_SECONDARY_LABEL_ABBREVIATE );
+        int secondaryLabelAbbreviateMaxLength = store
+            .getInt( PluginConstants.PREFS_SCHEMA_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH );
+
+        if ( element instanceof SchemaDifference )
+        {
+            SchemaDifference sd = ( SchemaDifference ) element;
+
+            switch ( sd.getType() )
+            {
+                case ADDED:
+                    return ( ( Schema ) sd.getDestination() ).getName();
+                case MODIFIED:
+                    return ( ( Schema ) sd.getDestination() ).getName();
+                case REMOVED:
+                    return ( ( Schema ) sd.getSource() ).getName();
+                case IDENTICAL:
+                    return ( ( Schema ) sd.getDestination() ).getName();
+            }
+        }
+        else if ( element instanceof AttributeTypeDifference )
+        {
+            AttributeTypeDifference atd = ( AttributeTypeDifference ) element;
+
+            AttributeTypeImpl at = null;
+
+            switch ( atd.getType() )
+            {
+                case ADDED:
+                    at = ( ( AttributeTypeImpl ) atd.getDestination() );
+                    break;
+                case MODIFIED:
+                    at = ( ( AttributeTypeImpl ) atd.getDestination() );
+                    break;
+                case REMOVED:
+                    at = ( ( AttributeTypeImpl ) atd.getSource() );
+                    break;
+                case IDENTICAL:
+                    at = ( ( AttributeTypeImpl ) atd.getDestination() );
+                    break;
+            }
+
+            // Label
+            if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_FIRST_NAME )
+            {
+                String[] names = at.getNames();
+                if ( ( names != null ) && ( names.length > 0 ) )
+                {
+                    label = names[0];
+                }
+                else
+                {
+                    label = NONE;
+                }
+            }
+            else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES )
+            {
+                String[] names = at.getNames();
+                if ( ( names != null ) && ( names.length > 0 ) )
+                {
+                    label = ViewUtils.concateAliases( names );
+                }
+                else
+                {
+                    label = NONE;
+                }
+            }
+            else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID )
+            {
+                label = at.getOid();
+            }
+            else
+            // Default
+            {
+                String[] names = at.getNames();
+                if ( ( names != null ) && ( names.length > 0 ) )
+                {
+                    label = names[0];
+                }
+                else
+                {
+                    label = NONE;
+                }
+            }
+
+            // Abbreviate
+            if ( abbreviate && ( abbreviateMaxLength < label.length() ) )
+            {
+                label = label.substring( 0, abbreviateMaxLength ) + "..."; //$NON-NLS-1$
+            }
+        }
+        else if ( element instanceof ObjectClassDifference )
+        {
+            ObjectClassDifference ocd = ( ObjectClassDifference ) element;
+
+            ObjectClassImpl oc = null;
+
+            switch ( ocd.getType() )
+            {
+                case ADDED:
+                    oc = ( ( ObjectClassImpl ) ocd.getDestination() );
+                    break;
+                case MODIFIED:
+                    oc = ( ( ObjectClassImpl ) ocd.getDestination() );
+                    break;
+                case REMOVED:
+                    oc = ( ( ObjectClassImpl ) ocd.getSource() );
+                    break;
+                case IDENTICAL:
+                    oc = ( ( ObjectClassImpl ) ocd.getDestination() );
+                    break;
+            }
+
+            // Label
+            if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_FIRST_NAME )
+            {
+                String[] names = oc.getNames();
+                if ( ( names != null ) && ( names.length > 0 ) )
+                {
+                    label = names[0];
+                }
+                else
+                {
+                    label = NONE;
+                }
+            }
+            else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES )
+            {
+                String[] names = oc.getNames();
+                if ( ( names != null ) && ( names.length > 0 ) )
+                {
+                    label = ViewUtils.concateAliases( names );
+                }
+                else
+                {
+                    label = NONE;
+                }
+            }
+            else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID )
+            {
+                label = oc.getOid();
+            }
+            else
+            // Default
+            {
+                String[] names = oc.getNames();
+                if ( ( names != null ) && ( names.length > 0 ) )
+                {
+                    label = names[0];
+                }
+                else
+                {
+                    label = NONE;
+                }
+            }
+
+            // Abbreviate
+            if ( abbreviate && ( abbreviateMaxLength < label.length() ) )
+            {
+                label = label.substring( 0, abbreviateMaxLength ) + "..."; //$NON-NLS-1$
+            }
+        }
+        else if ( element instanceof Folder )
+        {
+            Folder folder = ( Folder ) element;
+
+            return folder.getName() + " (" + folder.getChildren().size() + ")";
+        }
+
+        // Secondary Label
+        if ( secondaryLabelDisplay )
+        {
+            String secondaryLabel = ""; //$NON-NLS-1$
+            if ( element instanceof AttributeTypeDifference )
+            {
+                AttributeTypeDifference atd = ( AttributeTypeDifference ) element;
+
+                AttributeTypeImpl at = null;
+
+                switch ( atd.getType() )
+                {
+                    case ADDED:
+                        at = ( ( AttributeTypeImpl ) atd.getDestination() );
+                        break;
+                    case MODIFIED:
+                        at = ( ( AttributeTypeImpl ) atd.getDestination() );
+                        break;
+                    case REMOVED:
+                        at = ( ( AttributeTypeImpl ) atd.getSource() );
+                        break;
+                    case IDENTICAL:
+                        at = ( ( AttributeTypeImpl ) atd.getDestination() );
+                        break;
+                }
+
+                if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_FIRST_NAME )
+                {
+                    String[] names = at.getNames();
+                    if ( ( names != null ) && ( names.length > 0 ) )
+                    {
+                        secondaryLabel = names[0];
+                    }
+                    else
+                    {
+                        secondaryLabel = NONE;
+                    }
+                }
+                else if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES )
+                {
+                    String[] names = at.getNames();
+                    if ( ( names != null ) && ( names.length > 0 ) )
+                    {
+                        secondaryLabel = ViewUtils.concateAliases( names );
+                    }
+                    else
+                    {
+                        secondaryLabel = NONE;
+                    }
+                }
+                else if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID )
+                {
+                    secondaryLabel = at.getOid();
+                }
+            }
+            else if ( element instanceof ObjectClassDifference )
+            {
+                ObjectClassDifference ocd = ( ObjectClassDifference ) element;
+
+                ObjectClassImpl oc = null;
+
+                switch ( ocd.getType() )
+                {
+                    case ADDED:
+                        oc = ( ( ObjectClassImpl ) ocd.getDestination() );
+                        break;
+                    case MODIFIED:
+                        oc = ( ( ObjectClassImpl ) ocd.getDestination() );
+                        break;
+                    case REMOVED:
+                        oc = ( ( ObjectClassImpl ) ocd.getSource() );
+                        break;
+                    case IDENTICAL:
+                        oc = ( ( ObjectClassImpl ) ocd.getDestination() );
+                        break;
+                }
+
+                if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_FIRST_NAME )
+                {
+                    String[] names = oc.getNames();
+                    if ( ( names != null ) && ( names.length > 0 ) )
+                    {
+                        secondaryLabel = names[0];
+                    }
+                    else
+                    {
+                        secondaryLabel = NONE;
+                    }
+                }
+                else if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES )
+                {
+                    String[] names = oc.getNames();
+                    if ( ( names != null ) && ( names.length > 0 ) )
+                    {
+                        secondaryLabel = ViewUtils.concateAliases( names );
+                    }
+                    else
+                    {
+                        secondaryLabel = NONE;
+                    }
+                }
+                else if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID )
+                {
+                    secondaryLabel = oc.getOid();
+                }
+            }
+
+            if ( secondaryLabelAbbreviate && ( secondaryLabelAbbreviateMaxLength < secondaryLabel.length() ) )
+            {
+                secondaryLabel = secondaryLabel.substring( 0, secondaryLabelAbbreviateMaxLength ) + "..."; //$NON-NLS-1$
+            }
+
+            label += "   [" + secondaryLabel + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+        }
+
+        return label;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+     */
+    public Image getImage( Object element )
+    {
+        if ( element instanceof SchemaDifference )
+        {
+            SchemaDifference sd = ( SchemaDifference ) element;
+            switch ( sd.getType() )
+            {
+                case ADDED:
+                    return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                        PluginConstants.IMG_DIFFERENCE_SCHEMA_ADD ).createImage();
+                case MODIFIED:
+                    return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                        PluginConstants.IMG_DIFFERENCE_SCHEMA_MODIFY ).createImage();
+                case REMOVED:
+                    return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                        PluginConstants.IMG_DIFFERENCE_SCHEMA_REMOVE ).createImage();
+                case IDENTICAL:
+                    return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_SCHEMA )
+                        .createImage();
+            }
+        }
+        else if ( element instanceof AttributeTypeDifference )
+        {
+            AttributeTypeDifference atd = ( AttributeTypeDifference ) element;
+            switch ( atd.getType() )
+            {
+                case ADDED:
+                    return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                        PluginConstants.IMG_DIFFERENCE_ATTRIBUTE_TYPE_ADD ).createImage();
+                case MODIFIED:
+                    return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                        PluginConstants.IMG_DIFFERENCE_ATTRIBUTE_TYPE_MODIFY ).createImage();
+                case REMOVED:
+                    return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                        PluginConstants.IMG_DIFFERENCE_ATTRIBUTE_TYPE_REMOVE ).createImage();
+                case IDENTICAL:
+                    return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                        PluginConstants.IMG_ATTRIBUTE_TYPE ).createImage();
+            }
+        }
+        else if ( element instanceof ObjectClassDifference )
+        {
+            ObjectClassDifference ocd = ( ObjectClassDifference ) element;
+            switch ( ocd.getType() )
+            {
+                case ADDED:
+                    return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                        PluginConstants.IMG_DIFFERENCE_OBJECT_CLASS_ADD ).createImage();
+                case MODIFIED:
+                    return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                        PluginConstants.IMG_DIFFERENCE_OBJECT_CLASS_MODIFY ).createImage();
+                case REMOVED:
+                    return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                        PluginConstants.IMG_DIFFERENCE_OBJECT_CLASS_REMOVE ).createImage();
+                case IDENTICAL:
+                    return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                        PluginConstants.IMG_OBJECT_CLASS ).createImage();
+            }
+        }
+        else if ( element instanceof Folder )
+        {
+            Folder folder = ( Folder ) element;
+
+            switch ( folder.getType() )
+            {
+                case ATTRIBUTE_TYPE:
+                    return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                        PluginConstants.IMG_FOLDER_AT ).createImage();
+                case OBJECT_CLASS:
+                    return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                        PluginConstants.IMG_FOLDER_OC ).createImage();
+                case NONE:
+                    return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_FOLDER )
+                        .createImage();
+            }
+        }
+
+        // Default
+        return null;
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/FirstNameSorter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/FirstNameSorter.java?view=auto&rev=558013
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/FirstNameSorter.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/FirstNameSorter.java Fri Jul 20 07:55:03 2007
@@ -0,0 +1,213 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.apacheds.schemaeditor.view.widget;
+
+
+import java.util.Comparator;
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AttributeTypeDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ObjectClassDifference;
+
+
+/**
+ * This class is used to compare and sort ascending two TreeNode.
+ */
+public class FirstNameSorter implements Comparator<Object>
+{
+    /* (non-Javadoc)
+     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+     */
+    public int compare( Object o1, Object o2 )
+    {
+        String[] o1Names = null;
+        String[] o2Names = null;
+
+        if ( ( o1 instanceof AttributeTypeDifference ) && ( o2 instanceof AttributeTypeDifference ) )
+        {
+            AttributeTypeDifference atd1 = ( AttributeTypeDifference ) o1;
+            AttributeTypeDifference atd2 = ( AttributeTypeDifference ) o2;
+
+            switch ( atd1.getType() )
+            {
+                case ADDED:
+                    o1Names = ( ( SchemaObject ) atd1.getDestination() ).getNames();
+                    break;
+                case MODIFIED:
+                    o1Names = ( ( SchemaObject ) atd1.getDestination() ).getNames();
+                    break;
+                case REMOVED:
+                    o1Names = ( ( SchemaObject ) atd1.getSource() ).getNames();
+                    break;
+                case IDENTICAL:
+                    o1Names = ( ( SchemaObject ) atd1.getDestination() ).getNames();
+                    break;
+            }
+
+            switch ( atd2.getType() )
+            {
+                case ADDED:
+                    o2Names = ( ( SchemaObject ) atd2.getDestination() ).getNames();
+                    break;
+                case MODIFIED:
+                    o2Names = ( ( SchemaObject ) atd2.getDestination() ).getNames();
+                    break;
+                case REMOVED:
+                    o2Names = ( ( SchemaObject ) atd2.getSource() ).getNames();
+                    break;
+                case IDENTICAL:
+                    o2Names = ( ( SchemaObject ) atd2.getDestination() ).getNames();
+                    break;
+            }
+        }
+        else if ( ( o1 instanceof ObjectClassDifference ) && ( o2 instanceof ObjectClassDifference ) )
+        {
+            ObjectClassDifference ocd1 = ( ObjectClassDifference ) o1;
+            ObjectClassDifference ocd2 = ( ObjectClassDifference ) o2;
+
+            switch ( ocd1.getType() )
+            {
+                case ADDED:
+                    o1Names = ( ( SchemaObject ) ocd1.getDestination() ).getNames();
+                    break;
+                case MODIFIED:
+                    o1Names = ( ( SchemaObject ) ocd1.getDestination() ).getNames();
+                    break;
+                case REMOVED:
+                    o1Names = ( ( SchemaObject ) ocd1.getSource() ).getNames();
+                    break;
+                case IDENTICAL:
+                    o1Names = ( ( SchemaObject ) ocd1.getDestination() ).getNames();
+                    break;
+            }
+
+            switch ( ocd2.getType() )
+            {
+                case ADDED:
+                    o2Names = ( ( SchemaObject ) ocd2.getDestination() ).getNames();
+                    break;
+                case MODIFIED:
+                    o2Names = ( ( SchemaObject ) ocd2.getDestination() ).getNames();
+                    break;
+                case REMOVED:
+                    o2Names = ( ( SchemaObject ) ocd2.getSource() ).getNames();
+                    break;
+                case IDENTICAL:
+                    o2Names = ( ( SchemaObject ) ocd2.getDestination() ).getNames();
+                    break;
+            }
+        }
+        else if ( ( o1 instanceof AttributeTypeDifference ) && ( o2 instanceof ObjectClassDifference ) )
+        {
+            AttributeTypeDifference atd = ( AttributeTypeDifference ) o1;
+            ObjectClassDifference ocd = ( ObjectClassDifference ) o2;
+
+            switch ( atd.getType() )
+            {
+                case ADDED:
+                    o1Names = ( ( SchemaObject ) atd.getDestination() ).getNames();
+                    break;
+                case MODIFIED:
+                    o1Names = ( ( SchemaObject ) atd.getDestination() ).getNames();
+                    break;
+                case REMOVED:
+                    o1Names = ( ( SchemaObject ) atd.getSource() ).getNames();
+                    break;
+                case IDENTICAL:
+                    o1Names = ( ( SchemaObject ) atd.getDestination() ).getNames();
+                    break;
+            }
+
+            switch ( ocd.getType() )
+            {
+                case ADDED:
+                    o2Names = ( ( SchemaObject ) ocd.getDestination() ).getNames();
+                    break;
+                case MODIFIED:
+                    o2Names = ( ( SchemaObject ) ocd.getDestination() ).getNames();
+                    break;
+                case REMOVED:
+                    o2Names = ( ( SchemaObject ) ocd.getSource() ).getNames();
+                    break;
+                case IDENTICAL:
+                    o2Names = ( ( SchemaObject ) ocd.getDestination() ).getNames();
+                    break;
+            }
+        }
+        else if ( ( o1 instanceof ObjectClassDifference ) && ( o2 instanceof AttributeTypeDifference ) )
+        {
+            ObjectClassDifference ocd = ( ObjectClassDifference ) o1;
+            AttributeTypeDifference atd = ( AttributeTypeDifference ) o2;
+
+            switch ( ocd.getType() )
+            {
+                case ADDED:
+                    o1Names = ( ( SchemaObject ) ocd.getDestination() ).getNames();
+                    break;
+                case MODIFIED:
+                    o1Names = ( ( SchemaObject ) ocd.getDestination() ).getNames();
+                    break;
+                case REMOVED:
+                    o1Names = ( ( SchemaObject ) ocd.getSource() ).getNames();
+                    break;
+                case IDENTICAL:
+                    o1Names = ( ( SchemaObject ) ocd.getDestination() ).getNames();
+                    break;
+            }
+
+            switch ( atd.getType() )
+            {
+                case ADDED:
+                    o2Names = ( ( SchemaObject ) atd.getDestination() ).getNames();
+                    break;
+                case MODIFIED:
+                    o2Names = ( ( SchemaObject ) atd.getDestination() ).getNames();
+                    break;
+                case REMOVED:
+                    o2Names = ( ( SchemaObject ) atd.getSource() ).getNames();
+                    break;
+                case IDENTICAL:
+                    o2Names = ( ( SchemaObject ) atd.getDestination() ).getNames();
+                    break;
+            }
+        }
+
+        // Comparing the First Name
+        if ( ( o1Names != null ) && ( o2Names != null ) )
+        {
+            if ( ( o1Names.length > 0 ) && ( o2Names.length > 0 ) )
+            {
+                return o1Names[0].compareToIgnoreCase( o2Names[0] );
+            }
+            else if ( ( o1Names.length == 0 ) && ( o2Names.length > 0 ) )
+            {
+                return "".compareToIgnoreCase( o2Names[0] );
+            }
+            else if ( ( o1Names.length > 0 ) && ( o2Names.length == 0 ) )
+            {
+                return o1Names[0].compareToIgnoreCase( "" );
+            }
+        }
+
+        // Default
+        return o1.toString().compareToIgnoreCase( o2.toString() );
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/Folder.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/Folder.java?view=auto&rev=558013
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/Folder.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/Folder.java Fri Jul 20 07:55:03 2007
@@ -0,0 +1,146 @@
+package org.apache.directory.studio.apacheds.schemaeditor.view.widget;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.Difference;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.TreeNode;
+
+
+/**
+ * This used to represent a folder in a TreeViewer.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class Folder
+{
+    /** The children */
+    protected List<Difference> children;
+
+    /**
+     * This enum represents the different types of folders.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    public enum FolderType
+    {
+        NONE, ATTRIBUTE_TYPE, OBJECT_CLASS, ERROR, WARNING
+    }
+
+    /** The type of the Folder */
+    private FolderType type = FolderType.NONE;
+
+    /** The name of the Folder */
+    private String name = "";
+
+    private static final String NAME_AT = "Attribute Types";
+    private static final String NAME_OC = "Object Classes";
+
+
+    /**
+     * Creates a new instance of Folder.
+     *
+     * @param type
+     *      the type of the Folder
+     * @param parent
+     *      the parent TreeNode
+     */
+    public Folder( FolderType type )
+    {
+        this.type = type;
+
+        switch ( type )
+        {
+            case ATTRIBUTE_TYPE:
+                name = NAME_AT;
+                break;
+            case OBJECT_CLASS:
+                name = NAME_OC;
+                break;
+        }
+    }
+
+
+    /**
+     * Get the type of the Folder.
+     *
+     * @return
+     *      the type of the Folder
+     */
+    public FolderType getType()
+    {
+        return type;
+    }
+
+
+    /**
+     * Gets the name of the Folder.
+     * 
+     * @return
+     *      the name of the Folder
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+
+    public boolean hasChildren()
+    {
+        if ( children == null )
+        {
+            return false;
+        }
+
+        return !children.isEmpty();
+    }
+
+
+    public List<Difference> getChildren()
+    {
+        if ( children == null )
+        {
+            children = new ArrayList<Difference>();
+        }
+
+        return children;
+    }
+
+
+    public void addChild( Difference diff )
+    {
+        if ( children == null )
+        {
+            children = new ArrayList<Difference>();
+        }
+
+        if ( !children.contains( diff ) )
+        {
+            children.add( diff );
+        }
+    }
+
+
+    public void removeChild( TreeNode node )
+    {
+        if ( children != null )
+        {
+            children.remove( node );
+        }
+    }
+
+
+    public boolean addAllChildren( Collection<? extends Difference> c )
+    {
+        if ( children == null )
+        {
+            children = new ArrayList<Difference>();
+        }
+
+        return children.addAll( c );
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/OidSorter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/OidSorter.java?view=auto&rev=558013
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/OidSorter.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/OidSorter.java Fri Jul 20 07:55:03 2007
@@ -0,0 +1,195 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.apacheds.schemaeditor.view.widget;
+
+
+import java.util.Comparator;
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AttributeTypeDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ObjectClassDifference;
+
+
+/**
+ * This class is used to compare and sort ascending two DisplayableTreeElement
+ */
+public class OidSorter implements Comparator<Object>
+{
+    /* (non-Javadoc)
+     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+     */
+    public int compare( Object o1, Object o2 )
+    {
+        String oid1 = "";
+        String oid2 = "";
+
+        if ( ( o1 instanceof AttributeTypeDifference ) && ( o2 instanceof AttributeTypeDifference ) )
+        {
+            AttributeTypeDifference atd1 = ( AttributeTypeDifference ) o1;
+            AttributeTypeDifference atd2 = ( AttributeTypeDifference ) o2;
+
+            switch ( atd1.getType() )
+            {
+                case ADDED:
+                    oid1 = ( ( SchemaObject ) atd1.getDestination() ).getOid();
+                    break;
+                case MODIFIED:
+                    oid1 = ( ( SchemaObject ) atd1.getDestination() ).getOid();
+                    break;
+                case REMOVED:
+                    oid1 = ( ( SchemaObject ) atd1.getSource() ).getOid();
+                    break;
+                case IDENTICAL:
+                    oid1 = ( ( SchemaObject ) atd1.getDestination() ).getOid();
+                    break;
+            }
+
+            switch ( atd2.getType() )
+            {
+                case ADDED:
+                    oid2 = ( ( SchemaObject ) atd2.getDestination() ).getOid();
+                    break;
+                case MODIFIED:
+                    oid2 = ( ( SchemaObject ) atd2.getDestination() ).getOid();
+                    break;
+                case REMOVED:
+                    oid2 = ( ( SchemaObject ) atd2.getSource() ).getOid();
+                    break;
+                case IDENTICAL:
+                    oid2 = ( ( SchemaObject ) atd2.getDestination() ).getOid();
+                    break;
+            }
+        }
+        else if ( ( o1 instanceof ObjectClassDifference ) && ( o2 instanceof ObjectClassDifference ) )
+        {
+            ObjectClassDifference ocd1 = ( ObjectClassDifference ) o1;
+            ObjectClassDifference ocd2 = ( ObjectClassDifference ) o2;
+
+            switch ( ocd1.getType() )
+            {
+                case ADDED:
+                    oid1 = ( ( SchemaObject ) ocd1.getDestination() ).getOid();
+                    break;
+                case MODIFIED:
+                    oid1 = ( ( SchemaObject ) ocd1.getDestination() ).getOid();
+                    break;
+                case REMOVED:
+                    oid1 = ( ( SchemaObject ) ocd1.getSource() ).getOid();
+                    break;
+                case IDENTICAL:
+                    oid1 = ( ( SchemaObject ) ocd1.getDestination() ).getOid();
+                    break;
+            }
+
+            switch ( ocd2.getType() )
+            {
+                case ADDED:
+                    oid2 = ( ( SchemaObject ) ocd2.getDestination() ).getOid();
+                    break;
+                case MODIFIED:
+                    oid2 = ( ( SchemaObject ) ocd2.getDestination() ).getOid();
+                    break;
+                case REMOVED:
+                    oid2 = ( ( SchemaObject ) ocd2.getSource() ).getOid();
+                    break;
+                case IDENTICAL:
+                    oid2 = ( ( SchemaObject ) ocd2.getDestination() ).getOid();
+                    break;
+            }
+        }
+        else if ( ( o1 instanceof AttributeTypeDifference ) && ( o2 instanceof ObjectClassDifference ) )
+        {
+            AttributeTypeDifference atd = ( AttributeTypeDifference ) o1;
+            ObjectClassDifference ocd = ( ObjectClassDifference ) o2;
+
+            switch ( atd.getType() )
+            {
+                case ADDED:
+                    oid1 = ( ( SchemaObject ) atd.getDestination() ).getOid();
+                    break;
+                case MODIFIED:
+                    oid1 = ( ( SchemaObject ) atd.getDestination() ).getOid();
+                    break;
+                case REMOVED:
+                    oid1 = ( ( SchemaObject ) atd.getSource() ).getOid();
+                    break;
+                case IDENTICAL:
+                    oid1 = ( ( SchemaObject ) atd.getDestination() ).getOid();
+                    break;
+            }
+
+            switch ( ocd.getType() )
+            {
+                case ADDED:
+                    oid2 = ( ( SchemaObject ) ocd.getDestination() ).getOid();
+                    break;
+                case MODIFIED:
+                    oid2 = ( ( SchemaObject ) ocd.getDestination() ).getOid();
+                    break;
+                case REMOVED:
+                    oid2 = ( ( SchemaObject ) ocd.getSource() ).getOid();
+                    break;
+                case IDENTICAL:
+                    oid2 = ( ( SchemaObject ) ocd.getDestination() ).getOid();
+                    break;
+            }
+        }
+        else if ( ( o1 instanceof ObjectClassDifference ) && ( o2 instanceof AttributeTypeDifference ) )
+        {
+            ObjectClassDifference ocd = ( ObjectClassDifference ) o1;
+            AttributeTypeDifference atd = ( AttributeTypeDifference ) o2;
+
+            switch ( ocd.getType() )
+            {
+                case ADDED:
+                    oid1 = ( ( SchemaObject ) ocd.getDestination() ).getOid();
+                    break;
+                case MODIFIED:
+                    oid1 = ( ( SchemaObject ) ocd.getDestination() ).getOid();
+                    break;
+                case REMOVED:
+                    oid1 = ( ( SchemaObject ) ocd.getSource() ).getOid();
+                    break;
+                case IDENTICAL:
+                    oid1 = ( ( SchemaObject ) ocd.getDestination() ).getOid();
+                    break;
+            }
+
+            switch ( atd.getType() )
+            {
+                case ADDED:
+                    oid2 = ( ( SchemaObject ) atd.getDestination() ).getOid();
+                    break;
+                case MODIFIED:
+                    oid2 = ( ( SchemaObject ) atd.getDestination() ).getOid();
+                    break;
+                case REMOVED:
+                    oid2 = ( ( SchemaObject ) atd.getSource() ).getOid();
+                    break;
+                case IDENTICAL:
+                    oid2 = ( ( SchemaObject ) atd.getDestination() ).getOid();
+                    break;
+            }
+        }
+
+        return oid1.compareToIgnoreCase( oid2 );
+    }
+}

Copied: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/PropertySorter.java (from r557690, directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetPropertySorter.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/PropertySorter.java?view=diff&rev=558013&p1=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetPropertySorter.java&r1=557690&p2=directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/PropertySorter.java&r2=558013
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetPropertySorter.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/PropertySorter.java Fri Jul 20 07:55:03 2007
@@ -26,13 +26,13 @@
 import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ClassTypeDifference;
 import org.apache.directory.studio.apacheds.schemaeditor.model.difference.CollectiveDifference;
 import org.apache.directory.studio.apacheds.schemaeditor.model.difference.DescriptionDifference;
-import org.apache.directory.studio.apacheds.schemaeditor.model.difference.Difference;
 import org.apache.directory.studio.apacheds.schemaeditor.model.difference.EqualityDifference;
 import org.apache.directory.studio.apacheds.schemaeditor.model.difference.MandatoryATDifference;
 import org.apache.directory.studio.apacheds.schemaeditor.model.difference.NoUserModificationDifference;
 import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ObsoleteDifference;
 import org.apache.directory.studio.apacheds.schemaeditor.model.difference.OptionalATDifference;
 import org.apache.directory.studio.apacheds.schemaeditor.model.difference.OrderingDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.PropertyDifference;
 import org.apache.directory.studio.apacheds.schemaeditor.model.difference.SingleValueDifference;
 import org.apache.directory.studio.apacheds.schemaeditor.model.difference.SubstringDifference;
 import org.apache.directory.studio.apacheds.schemaeditor.model.difference.SuperiorATDifference;
@@ -48,12 +48,12 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class DifferencesWidgetPropertySorter implements Comparator<Difference>
+public class PropertySorter implements Comparator<PropertyDifference>
 {
     /* (non-Javadoc)
      * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
      */
-    public int compare( Difference diff1, Difference diff2 )
+    public int compare( PropertyDifference diff1, PropertyDifference diff2 )
     {
         return getWeight( diff1 ) - getWeight( diff2 );
     }
@@ -67,7 +67,7 @@
      * @return
      *      the weight of the difference
      */
-    private int getWeight( Difference diff )
+    private int getWeight( PropertyDifference diff )
     {
         if ( diff instanceof AliasDifference )
         {



Mime
View raw message