directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r549127 - in /directory/studio/trunk/studio-apacheds-schemaeditor: ./ src/main/java/org/apache/directory/studio/apacheds/schemaeditor/ src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/ src/main/java/org/apache/dire...
Date Wed, 20 Jun 2007 15:11:49 GMT
Author: pamarcelot
Date: Wed Jun 20 08:11:48 2007
New Revision: 549127

URL: http://svn.apache.org/viewvc?view=rev&rev=549127
Log:
Updated DifferencesWidget with:
	- a toolbar with drop-down menu that allows to choose the grouping (by Property or Type).
	- an updated LabelProvider with correct Strings.
	- a new ContentProvider handling the grouping.
	- a new PreferenceInitializer class.
	- updated PluginConstants with the preferences constants.

Added:
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PreferenceInitializer.java
    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/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/plugin.xml
    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/view/views/SchemaView.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/widget/DifferencesWidgetLabelProvider.java

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml?view=diff&rev=549127&r1=549126&r2=549127
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml Wed Jun 20 08:11:48 2007
@@ -32,4 +32,8 @@
             id="org.apache.directory.studio.apacheds.schemaeditor.view.SchemaView"
             name="Apache DS Schema"/>
    </extension>
+ <extension
+       point="org.eclipse.core.runtime.preferences">
+    <initializer class="org.apache.directory.studio.apacheds.schemaeditor.PreferenceInitializer"/>
+ </extension>
 </plugin>

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=549127&r1=549126&r2=549127
==============================================================================
--- 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 Wed Jun 20 08:11:48 2007
@@ -41,8 +41,17 @@
     public static final String IMG_OBJECT_CLASS = "resources/icons/object_class.gif";
     public static final String IMG_SCHEMA = "resources/icons/schema.gif";
     public static final String IMG_TOOLBAR_MENU = "resources/icons/toolbar_menu.gif";
-    
+
     // Commands
-    public static final String CMD_CONNECT= Activator.PLUGIN_ID +".connect";
-    
+    public static final String CMD_CONNECT = Activator.PLUGIN_ID + ".connect";
+
+    // Preferences
+    /** The preferences ID for DifferencesWidget Grouping */
+    public static final String PREFS_DIFFERENCES_WIDGET_GROUPING = Activator.PLUGIN_ID
+        + ".prefs.DifferencesWidget.grouping";
+    /** The preference value for DifferencesWidget Grouping 'Property' */
+    public static final int PREFS_DIFFERENCES_WIDGET_GROUPING_PROPERTY = 0;
+    /** The preference value for DifferencesWidget Grouping 'Property' */
+    public static final int PREFS_DIFFERENCES_WIDGET_GROUPING_TYPE = 1;
+
 }

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PreferenceInitializer.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PreferenceInitializer.java?view=auto&rev=549127
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PreferenceInitializer.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PreferenceInitializer.java Wed Jun 20 08:11:48 2007
@@ -0,0 +1,46 @@
+/*
+ *  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;
+
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+
+/**
+ * This class initializes the preferences of the plug-in.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class PreferenceInitializer extends AbstractPreferenceInitializer
+{
+    /* (non-Javadoc)
+     * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+     */
+    public void initializeDefaultPreferences()
+    {
+        IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+
+        // DifferencesWidget
+        store.setDefault( PluginConstants.PREFS_DIFFERENCES_WIDGET_GROUPING,
+            PluginConstants.PREFS_DIFFERENCES_WIDGET_GROUPING_PROPERTY );
+    }
+}

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java?view=diff&rev=549127&r1=549126&r2=549127
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java Wed Jun 20 08:11:48 2007
@@ -23,12 +23,11 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
+import org.apache.directory.shared.ldap.schema.UsageEnum;
 import org.apache.directory.studio.apacheds.schemaeditor.Activator;
 import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaViewController;
-import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddAliasDifference;
-import org.apache.directory.studio.apacheds.schemaeditor.model.difference.Difference;
-import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyCollectiveDifference;
-import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveAliasDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.*;
 import org.apache.directory.studio.apacheds.schemaeditor.view.widget.DifferencesWidget;
 import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.SchemaViewRoot;
 import org.eclipse.jface.viewers.DecoratingLabelProvider;
@@ -75,9 +74,41 @@
         differencesWidget.createWidget( parent );
         
         List<Difference> differences = new ArrayList<Difference>();
-        differences.add( new AddAliasDifference(null, null, "toto") );
+        differences.add( new AddAliasDifference(null, null, "alias1") );
+        differences.add( new RemoveAliasDifference(null, null, "alias2") );
+        differences.add( new AddDescriptionDifference(null, null, "Description") );
+        differences.add( new ModifyDescriptionDifference(null, null, "Old description", "New Description") );
+        differences.add( new RemoveDescriptionDifference(null, null, "Description") );
+        differences.add( new AddEqualityDifference(null, null, "equality") );
+        differences.add( new ModifyEqualityDifference(null, null, "old equality", "new equality") );
+        differences.add( new RemoveEqualityDifference(null, null, "equality") );
+        differences.add( new AddMandatoryATDifference(null, null, "name") );
+        differences.add( new RemoveMandatoryATDifference(null, null, "name2") );
+        differences.add( new AddOptionalATDifference(null, null, "name") );
+        differences.add( new RemoveOptionalATDifference(null, null, "name2") );
+        differences.add( new AddOrderingDifference(null, null, "ordering") );
+        differences.add( new ModifyOrderingDifference(null, null, "old ordering", "new ordering") );
+        differences.add( new RemoveOrderingDifference(null, null, "ordering") );
+        differences.add( new AddSubstringDifference(null, null, "substring") );
+        differences.add( new ModifySubstringDifference(null, null, "old substring", "new substring") );
+        differences.add( new RemoveSubstringDifference(null, null, "substring") );
+        differences.add( new AddSuperiorATDifference(null, null, "supAT") );
+        differences.add( new ModifySuperiorATDifference(null, null, "oldSupAT", "newSupAT") );
+        differences.add( new RemoveSuperiorATDifference(null, null, "supAT") );
+        differences.add( new AddSuperiorOCDifference(null, null, "supOC") );
+        differences.add( new RemoveSuperiorOCDifference(null, null, "supOC") );
+        differences.add( new AddSyntaxDifference(null, null, "syntax") );
+        differences.add( new ModifySyntaxDifference(null, null, "syntax1", "syntax2") );
+        differences.add( new RemoveSyntaxDifference(null, null, "syntax") );
+        differences.add( new AddSyntaxLengthDifference(null, null, 1234) );
+        differences.add( new ModifySyntaxLengthDifference(null, null, 1234, 12345) );
+        differences.add( new RemoveSyntaxLengthDifference(null, null, 1234) );
+        differences.add( new ModifyClassTypeDifference(null, null, ObjectClassTypeEnum.AUXILIARY, ObjectClassTypeEnum.ABSTRACT) );
         differences.add( new ModifyCollectiveDifference(null, null, false, true) );
-        differences.add( new RemoveAliasDifference(null, null, "tata") );
+        differences.add( new ModifyNoUserModificationDifference(null, null, true, false) );
+        differences.add( new ModifyObsoleteDifference(null, null, true, false) );
+        differences.add( new ModifySingleValueDifference(null, null, true, false) );
+        differences.add( new ModifyUsageDifference(null, null, UsageEnum.DISTRIBUTED_OPERATION, UsageEnum.DSA_OPERATION) );
         differencesWidget.setInput( differences );
     }
 

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=549127&r1=549126&r2=549127
==============================================================================
--- 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 Wed Jun 20 08:11:48 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.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
@@ -57,6 +57,23 @@
     /** The TableViewer */
     private TableViewer viewer;
 
+    /** The PreferenceStore*/
+    private IPreferenceStore store;
+
+    // The MenuItems
+    private MenuItem groupByType;
+    private MenuItem groupByProperty;
+
+
+    /**
+     * Creates a new instance of DifferencesWidget.
+     *
+     */
+    public DifferencesWidget()
+    {
+        store = Activator.getDefault().getPreferenceStore();
+    }
+
 
     /**
      * Creates the widget.
@@ -100,13 +117,26 @@
             }
         } );
         // Adding the 'Group By Property' MenuItem
-        MenuItem groupByPropertyItem = new MenuItem( menu, SWT.CHECK );
-        groupByPropertyItem.setText( "Sort By Property" );
-        groupByPropertyItem.setSelection( true );
+        groupByProperty = new MenuItem( menu, SWT.CHECK );
+        groupByProperty.setText( "Group By Property" );
+        groupByProperty.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent arg0 )
+            {
+                changeGrouping( PluginConstants.PREFS_DIFFERENCES_WIDGET_GROUPING_PROPERTY );
+            }
+        } );
         // Adding the 'Group By Type' MenuItem
-        MenuItem groupByType = new MenuItem( menu, SWT.CHECK );
-        groupByType.setText( "Sort By Type" );
-        groupByType.setSelection( false );
+        groupByType = new MenuItem( menu, SWT.CHECK );
+        groupByType.setText( "Group By Type" );
+        groupByType.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent arg0 )
+            {
+                changeGrouping( PluginConstants.PREFS_DIFFERENCES_WIDGET_GROUPING_TYPE );
+            }
+        } );
+        updateMenuItemsCheckStatus();
 
         // Table
         Table table = new Table( composite, SWT.BORDER );
@@ -114,7 +144,7 @@
 
         // TableViewer
         viewer = new TableViewer( table );
-        viewer.setContentProvider( new ArrayContentProvider() );
+        viewer.setContentProvider( new DifferencesWidgetContentProvider() );
         viewer.setLabelProvider( new DifferencesWidgetLabelProvider() );
     }
 
@@ -140,5 +170,43 @@
     public TableViewer getViewer()
     {
         return viewer;
+    }
+
+
+    /**
+     * Changes the Grouping option.
+     *
+     * @param value
+     *      the value to store in the PreferenceStore
+     */
+    private void changeGrouping( int value )
+    {
+        store.setValue( PluginConstants.PREFS_DIFFERENCES_WIDGET_GROUPING, value );
+        updateMenuItemsCheckStatus();
+        viewer.refresh();
+    }
+
+
+    /**
+     * Updates the MenuItmes 'check' state according to the value from the PreferenceStore.
+     */
+    private void updateMenuItemsCheckStatus()
+    {
+        int prefValue = store.getInt( PluginConstants.PREFS_DIFFERENCES_WIDGET_GROUPING );
+        if ( prefValue == PluginConstants.PREFS_DIFFERENCES_WIDGET_GROUPING_PROPERTY )
+        {
+            groupByProperty.setSelection( true );
+            groupByType.setSelection( false );
+        }
+        else if ( prefValue == PluginConstants.PREFS_DIFFERENCES_WIDGET_GROUPING_TYPE )
+        {
+            groupByProperty.setSelection( false );
+            groupByType.setSelection( true );
+        }
+        else
+        {
+            groupByProperty.setSelection( false );
+            groupByType.setSelection( false );
+        }
     }
 }

Added: 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/DifferencesWidgetContentProvider.java?view=auto&rev=549127
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetContentProvider.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetContentProvider.java Wed Jun 20 08:11:48 2007
@@ -0,0 +1,108 @@
+/*
+ *  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.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.Difference;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+
+/**
+ * This class implements the ContentProvider for the DifferencesWidget.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DifferencesWidgetContentProvider implements IStructuredContentProvider
+{
+    /** The DifferencesWidgetPropertySorter */
+    private DifferencesWidgetPropertySorter propertySorter;
+
+    /** The DifferencesWidgetTypeSorter */
+    private DifferencesWidgetTypeSorter typeSorter;
+
+    /** The PreferenceStore */
+    private IPreferenceStore store;
+
+
+    /**
+     * Creates a new instance of DifferencesWidgetContentProvider.
+     *
+     */
+    public DifferencesWidgetContentProvider()
+    {
+        propertySorter = new DifferencesWidgetPropertySorter();
+        typeSorter = new DifferencesWidgetTypeSorter();
+
+        store = Activator.getDefault().getPreferenceStore();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+     */
+    public Object[] getElements( Object inputElement )
+    {
+        if ( inputElement instanceof List )
+        {
+            List<Difference> differences = ( List<Difference> ) inputElement;
+
+            int prefValue = store.getInt( PluginConstants.PREFS_DIFFERENCES_WIDGET_GROUPING );
+            if ( prefValue == PluginConstants.PREFS_DIFFERENCES_WIDGET_GROUPING_PROPERTY )
+            {
+                Collections.sort( differences, propertySorter );
+            }
+            else if ( prefValue == PluginConstants.PREFS_DIFFERENCES_WIDGET_GROUPING_TYPE )
+            {
+                Collections.sort( differences, typeSorter );
+            }
+
+            return differences.toArray();
+        }
+
+        // Default
+        return null;
+    }
+
+
+    /* (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 do to
+    }
+}

Modified: 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/DifferencesWidgetLabelProvider.java?view=diff&rev=549127&r1=549126&r2=549127
==============================================================================
--- 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/DifferencesWidgetLabelProvider.java Wed Jun 20 08:11:48 2007
@@ -25,6 +25,41 @@
 import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AbstractAddDifference;
 import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AbstractModifyDifference;
 import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AbstractRemoveDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddAliasDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddDescriptionDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddEqualityDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddMandatoryATDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddOptionalATDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddOrderingDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddSubstringDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddSuperiorATDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddSuperiorOCDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddSyntaxDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddSyntaxLengthDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyClassTypeDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyCollectiveDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyDescriptionDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyEqualityDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyNoUserModificationDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyObsoleteDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyOrderingDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifySingleValueDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifySubstringDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifySuperiorATDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifySyntaxDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifySyntaxLengthDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyUsageDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveAliasDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveDescriptionDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveEqualityDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveMandatoryATDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveOptionalATDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveOrderingDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveSubstringDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveSuperiorATDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveSuperiorOCDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveSyntaxDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveSyntaxLengthDifference;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -60,6 +95,184 @@
         }
 
         // Default
-        return null;
+        return super.getImage( element );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+     */
+    public String getText( Object element )
+    {
+        if ( element instanceof AbstractAddDifference )
+        {
+            if ( element instanceof AddAliasDifference )
+            {
+                return "Added a new alias: " + ( ( AbstractAddDifference ) element ).getValue();
+            }
+            else if ( element instanceof AddDescriptionDifference )
+            {
+                return "Added a description: " + ( ( AbstractAddDifference ) element ).getValue();
+            }
+            else if ( element instanceof AddEqualityDifference )
+            {
+                return "Added an equality matching rule: " + ( ( AbstractAddDifference ) element ).getValue();
+            }
+            else if ( element instanceof AddMandatoryATDifference )
+            {
+                return "Added a new mandatory attribute type: " + ( ( AbstractAddDifference ) element ).getValue();
+            }
+            else if ( element instanceof AddOptionalATDifference )
+            {
+                return "Added a new optional attribute type: " + ( ( AbstractAddDifference ) element ).getValue();
+            }
+            else if ( element instanceof AddOrderingDifference )
+            {
+                return "Added an ordering matching rule: " + ( ( AbstractAddDifference ) element ).getValue();
+            }
+            else if ( element instanceof AddSubstringDifference )
+            {
+                return "Added a substring matching rule: " + ( ( AbstractAddDifference ) element ).getValue();
+            }
+            else if ( element instanceof AddSuperiorATDifference )
+            {
+                return "Added a superior: " + ( ( AbstractAddDifference ) element ).getValue();
+            }
+            else if ( element instanceof AddSuperiorOCDifference )
+            {
+                return "Added a superior: " + ( ( AbstractAddDifference ) element ).getValue();
+            }
+            else if ( element instanceof AddSyntaxDifference )
+            {
+                return "Added a syntax: " + ( ( AbstractAddDifference ) element ).getValue();
+            }
+            else if ( element instanceof AddSyntaxLengthDifference )
+            {
+                return "Added a syntax length: " + ( ( AbstractAddDifference ) element ).getValue();
+            }
+        }
+        else if ( element instanceof AbstractModifyDifference )
+        {
+            if ( element instanceof ModifyClassTypeDifference )
+            {
+                return "Modified the class type to : " + ( ( AbstractModifyDifference ) element ).getNewValue()
+                    + " (was " + ( ( AbstractModifyDifference ) element ).getOldValue() + ")";
+            }
+            else if ( element instanceof ModifyCollectiveDifference )
+            {
+                return "Modified the 'collective' value to : " + ( ( AbstractModifyDifference ) element ).getNewValue()
+                    + " (was " + ( ( AbstractModifyDifference ) element ).getOldValue() + ")";
+            }
+            else if ( element instanceof ModifyDescriptionDifference )
+            {
+                return "Modified the description to : " + ( ( AbstractModifyDifference ) element ).getNewValue()
+                    + " (was " + ( ( AbstractModifyDifference ) element ).getOldValue() + ")";
+            }
+            else if ( element instanceof ModifyEqualityDifference )
+            {
+                return "Modified the equality matching rule to : "
+                    + ( ( AbstractModifyDifference ) element ).getNewValue() + " (was "
+                    + ( ( AbstractModifyDifference ) element ).getOldValue() + ")";
+            }
+            else if ( element instanceof ModifyNoUserModificationDifference )
+            {
+                return "Modified the 'no user modification' value to : "
+                    + ( ( AbstractModifyDifference ) element ).getNewValue() + " (was "
+                    + ( ( AbstractModifyDifference ) element ).getOldValue() + ")";
+            }
+            else if ( element instanceof ModifyObsoleteDifference )
+            {
+                return "Modified the 'obsolete' value to : " + ( ( AbstractModifyDifference ) element ).getNewValue()
+                    + " (was " + ( ( AbstractModifyDifference ) element ).getOldValue() + ")";
+            }
+            else if ( element instanceof ModifyOrderingDifference )
+            {
+                return "Modified the ordering matching rule to : "
+                    + ( ( AbstractModifyDifference ) element ).getNewValue() + " (was "
+                    + ( ( AbstractModifyDifference ) element ).getOldValue() + ")";
+            }
+            else if ( element instanceof ModifySingleValueDifference )
+            {
+                return "Modified the 'single value' value to : "
+                    + ( ( AbstractModifyDifference ) element ).getNewValue() + " (was "
+                    + ( ( AbstractModifyDifference ) element ).getOldValue() + ")";
+            }
+            else if ( element instanceof ModifySubstringDifference )
+            {
+                return "Modified the substring matching rule to : "
+                    + ( ( AbstractModifyDifference ) element ).getNewValue() + " (was "
+                    + ( ( AbstractModifyDifference ) element ).getOldValue() + ")";
+            }
+            else if ( element instanceof ModifySuperiorATDifference )
+            {
+                return "Modified the superior to : " + ( ( AbstractModifyDifference ) element ).getNewValue()
+                    + " (was " + ( ( AbstractModifyDifference ) element ).getOldValue() + ")";
+            }
+            else if ( element instanceof ModifySyntaxDifference )
+            {
+                return "Modified the syntax to : " + ( ( AbstractModifyDifference ) element ).getNewValue() + " (was "
+                    + ( ( AbstractModifyDifference ) element ).getOldValue() + ")";
+            }
+            else if ( element instanceof ModifySyntaxLengthDifference )
+            {
+                return "Modified the syntax length to : " + ( ( AbstractModifyDifference ) element ).getNewValue()
+                    + " (was " + ( ( AbstractModifyDifference ) element ).getOldValue() + ")";
+            }
+            else if ( element instanceof ModifyUsageDifference )
+            {
+                return "Modified the usage to : " + ( ( AbstractModifyDifference ) element ).getNewValue() + " (was "
+                    + ( ( AbstractModifyDifference ) element ).getOldValue() + ")";
+            }
+        }
+        else if ( element instanceof AbstractRemoveDifference )
+        {
+            if ( element instanceof RemoveAliasDifference )
+            {
+                return "Removed the alias: " + ( ( AbstractRemoveDifference ) element ).getValue();
+            }
+            else if ( element instanceof RemoveDescriptionDifference )
+            {
+                return "Removed the description: " + ( ( AbstractRemoveDifference ) element ).getValue();
+            }
+            else if ( element instanceof RemoveEqualityDifference )
+            {
+                return "Removed the equality matching rule: " + ( ( AbstractRemoveDifference ) element ).getValue();
+            }
+            else if ( element instanceof RemoveMandatoryATDifference )
+            {
+                return "Removed the mandatory attribute type: " + ( ( AbstractRemoveDifference ) element ).getValue();
+            }
+            else if ( element instanceof RemoveOptionalATDifference )
+            {
+                return "Removed the optional attribute type: " + ( ( AbstractRemoveDifference ) element ).getValue();
+            }
+            else if ( element instanceof RemoveOrderingDifference )
+            {
+                return "Removed the ordering matching rule: " + ( ( AbstractRemoveDifference ) element ).getValue();
+            }
+            else if ( element instanceof RemoveSubstringDifference )
+            {
+                return "Removed the substring matching rule: " + ( ( AbstractRemoveDifference ) element ).getValue();
+            }
+            else if ( element instanceof RemoveSuperiorATDifference )
+            {
+                return "Removed the superior: " + ( ( AbstractRemoveDifference ) element ).getValue();
+            }
+            else if ( element instanceof RemoveSuperiorOCDifference )
+            {
+                return "Removed the superior: " + ( ( AbstractRemoveDifference ) element ).getValue();
+            }
+            else if ( element instanceof RemoveSyntaxDifference )
+            {
+                return "Removed the syntax: " + ( ( AbstractRemoveDifference ) element ).getValue();
+            }
+            else if ( element instanceof RemoveSyntaxLengthDifference )
+            {
+                return "Removed the syntax length: " + ( ( AbstractRemoveDifference ) element ).getValue();
+            }
+        }
+
+        // Default
+        return super.getText( element );
     }
 }

Added: 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/DifferencesWidgetPropertySorter.java?view=auto&rev=549127
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetPropertySorter.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetPropertySorter.java Wed Jun 20 08:11:48 2007
@@ -0,0 +1,246 @@
+/*
+ *  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.studio.apacheds.schemaeditor.model.difference.AbstractAddDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AbstractModifyDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AbstractRemoveDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddAliasDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddDescriptionDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddEqualityDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddMandatoryATDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddOptionalATDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddOrderingDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddSubstringDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddSuperiorATDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddSuperiorOCDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddSyntaxDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddSyntaxLengthDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.Difference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyClassTypeDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyCollectiveDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyDescriptionDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyEqualityDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyNoUserModificationDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyObsoleteDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyOrderingDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifySingleValueDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifySubstringDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifySuperiorATDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifySyntaxDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifySyntaxLengthDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyUsageDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveAliasDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveDescriptionDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveEqualityDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveMandatoryATDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveOptionalATDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveOrderingDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveSubstringDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveSuperiorATDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveSuperiorOCDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveSyntaxDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveSyntaxLengthDifference;
+
+
+/**
+ * This class is used to compare, group and sort Differences by 'Property'
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DifferencesWidgetPropertySorter implements Comparator<Difference>
+{
+    /* (non-Javadoc)
+     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+     */
+    public int compare( Difference diff1, Difference diff2 )
+    {
+        return getWeight( diff1 ) - getWeight( diff2 );
+    }
+
+
+    /**
+     * Gets the weight of the Difference.
+     *
+     * @param o
+     *      the difference
+     * @return
+     *      the wright of the Difference
+     */
+    private int getWeight( Difference o )
+    {
+        if ( o instanceof AbstractAddDifference )
+        {
+            if ( o instanceof AddAliasDifference )
+            {
+                return 1;
+            }
+            else if ( o instanceof AddDescriptionDifference )
+            {
+                return 3;
+            }
+            else if ( o instanceof AddEqualityDifference )
+            {
+                return 23;
+            }
+            else if ( o instanceof AddMandatoryATDifference )
+            {
+                return 32;
+            }
+            else if ( o instanceof AddOptionalATDifference )
+            {
+                return 34;
+            }
+            else if ( o instanceof AddOrderingDifference )
+            {
+                return 26;
+            }
+            else if ( o instanceof AddSubstringDifference )
+            {
+                return 29;
+            }
+            else if ( o instanceof AddSuperiorATDifference )
+            {
+                return 6;
+            }
+            else if ( o instanceof AddSuperiorOCDifference )
+            {
+                return 9;
+            }
+            else if ( o instanceof AddSyntaxDifference )
+            {
+                return 12;
+            }
+            else if ( o instanceof AddSyntaxLengthDifference )
+            {
+                return 15;
+            }
+        }
+        else if ( o instanceof AbstractModifyDifference )
+        {
+            if ( o instanceof ModifyClassTypeDifference )
+            {
+                return 18;
+            }
+            else if ( o instanceof ModifyCollectiveDifference )
+            {
+                return 21;
+            }
+            else if ( o instanceof ModifyDescriptionDifference )
+            {
+                return 4;
+            }
+            else if ( o instanceof ModifyEqualityDifference )
+            {
+                return 24;
+            }
+            else if ( o instanceof ModifyNoUserModificationDifference )
+            {
+                return 22;
+            }
+            else if ( o instanceof ModifyObsoleteDifference )
+            {
+                return 19;
+            }
+            else if ( o instanceof ModifyOrderingDifference )
+            {
+                return 27;
+            }
+            else if ( o instanceof ModifySingleValueDifference )
+            {
+                return 20;
+            }
+            else if ( o instanceof ModifySubstringDifference )
+            {
+                return 30;
+            }
+            else if ( o instanceof ModifySuperiorATDifference )
+            {
+                return 7;
+            }
+            else if ( o instanceof ModifySyntaxDifference )
+            {
+                return 13;
+            }
+            else if ( o instanceof ModifySyntaxLengthDifference )
+            {
+                return 16;
+            }
+            else if ( o instanceof ModifyUsageDifference )
+            {
+                return 11;
+            }
+        }
+        else if ( o instanceof AbstractRemoveDifference )
+        {
+            if ( o instanceof RemoveAliasDifference )
+            {
+                return 2;
+            }
+            else if ( o instanceof RemoveDescriptionDifference )
+            {
+                return 5;
+            }
+            else if ( o instanceof RemoveEqualityDifference )
+            {
+                return 25;
+            }
+            else if ( o instanceof RemoveMandatoryATDifference )
+            {
+                return 33;
+            }
+            else if ( o instanceof RemoveOptionalATDifference )
+            {
+                return 35;
+            }
+            else if ( o instanceof RemoveOrderingDifference )
+            {
+                return 28;
+            }
+            else if ( o instanceof RemoveSubstringDifference )
+            {
+                return 31;
+            }
+            else if ( o instanceof RemoveSuperiorATDifference )
+            {
+                return 8;
+            }
+            else if ( o instanceof RemoveSuperiorOCDifference )
+            {
+                return 10;
+            }
+            else if ( o instanceof RemoveSyntaxDifference )
+            {
+                return 14;
+            }
+            else if ( o instanceof RemoveSyntaxLengthDifference )
+            {
+                return 17;
+            }
+        }
+
+        // Default
+        return 0;
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetTypeSorter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetTypeSorter.java?view=auto&rev=549127
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetTypeSorter.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetTypeSorter.java Wed Jun 20 08:11:48 2007
@@ -0,0 +1,246 @@
+/*
+ *  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.studio.apacheds.schemaeditor.model.difference.AbstractAddDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AbstractModifyDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AbstractRemoveDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddAliasDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddDescriptionDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddEqualityDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddMandatoryATDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddOptionalATDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddOrderingDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddSubstringDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddSuperiorATDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddSuperiorOCDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddSyntaxDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddSyntaxLengthDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.Difference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyClassTypeDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyCollectiveDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyDescriptionDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyEqualityDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyNoUserModificationDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyObsoleteDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyOrderingDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifySingleValueDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifySubstringDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifySuperiorATDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifySyntaxDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifySyntaxLengthDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyUsageDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveAliasDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveDescriptionDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveEqualityDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveMandatoryATDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveOptionalATDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveOrderingDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveSubstringDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveSuperiorATDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveSuperiorOCDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveSyntaxDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveSyntaxLengthDifference;
+
+
+/**
+ * This class is used to compare, group and sort Differences by 'Type'
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DifferencesWidgetTypeSorter implements Comparator<Difference>
+{
+    /* (non-Javadoc)
+     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+     */
+    public int compare( Difference diff1, Difference diff2 )
+    {
+        return getWeight( diff1 ) - getWeight( diff2 );
+    }
+
+
+    /**
+     * Gets the weight of the Difference.
+     *
+     * @param o
+     *      the difference
+     * @return
+     *      the wright of the Difference
+     */
+    private int getWeight( Difference o )
+    {
+        if ( o instanceof AbstractAddDifference )
+        {
+            if ( o instanceof AddAliasDifference )
+            {
+                return 1;
+            }
+            else if ( o instanceof AddDescriptionDifference )
+            {
+                return 2;
+            }
+            else if ( o instanceof AddEqualityDifference )
+            {
+                return 7;
+            }
+            else if ( o instanceof AddMandatoryATDifference )
+            {
+                return 10;
+            }
+            else if ( o instanceof AddOptionalATDifference )
+            {
+                return 11;
+            }
+            else if ( o instanceof AddOrderingDifference )
+            {
+                return 8;
+            }
+            else if ( o instanceof AddSubstringDifference )
+            {
+                return 9;
+            }
+            else if ( o instanceof AddSuperiorATDifference )
+            {
+                return 3;
+            }
+            else if ( o instanceof AddSuperiorOCDifference )
+            {
+                return 4;
+            }
+            else if ( o instanceof AddSyntaxDifference )
+            {
+                return 5;
+            }
+            else if ( o instanceof AddSyntaxLengthDifference )
+            {
+                return 6;
+            }
+        }
+        else if ( o instanceof AbstractModifyDifference )
+        {
+            if ( o instanceof ModifyClassTypeDifference )
+            {
+                return 17;
+            }
+            else if ( o instanceof ModifyCollectiveDifference )
+            {
+                return 20;
+            }
+            else if ( o instanceof ModifyDescriptionDifference )
+            {
+                return 12;
+            }
+            else if ( o instanceof ModifyEqualityDifference )
+            {
+                return 22;
+            }
+            else if ( o instanceof ModifyNoUserModificationDifference )
+            {
+                return 21;
+            }
+            else if ( o instanceof ModifyObsoleteDifference )
+            {
+                return 18;
+            }
+            else if ( o instanceof ModifyOrderingDifference )
+            {
+                return 23;
+            }
+            else if ( o instanceof ModifySingleValueDifference )
+            {
+                return 19;
+            }
+            else if ( o instanceof ModifySubstringDifference )
+            {
+                return 24;
+            }
+            else if ( o instanceof ModifySuperiorATDifference )
+            {
+                return 13;
+            }
+            else if ( o instanceof ModifySyntaxDifference )
+            {
+                return 15;
+            }
+            else if ( o instanceof ModifySyntaxLengthDifference )
+            {
+                return 16;
+            }
+            else if ( o instanceof ModifyUsageDifference )
+            {
+                return 14;
+            }
+        }
+        else if ( o instanceof AbstractRemoveDifference )
+        {
+            if ( o instanceof RemoveAliasDifference )
+            {
+                return 25;
+            }
+            else if ( o instanceof RemoveDescriptionDifference )
+            {
+                return 26;
+            }
+            else if ( o instanceof RemoveEqualityDifference )
+            {
+                return 31;
+            }
+            else if ( o instanceof RemoveMandatoryATDifference )
+            {
+                return 34;
+            }
+            else if ( o instanceof RemoveOptionalATDifference )
+            {
+                return 35;
+            }
+            else if ( o instanceof RemoveOrderingDifference )
+            {
+                return 32;
+            }
+            else if ( o instanceof RemoveSubstringDifference )
+            {
+                return 33;
+            }
+            else if ( o instanceof RemoveSuperiorATDifference )
+            {
+                return 27;
+            }
+            else if ( o instanceof RemoveSuperiorOCDifference )
+            {
+                return 28;
+            }
+            else if ( o instanceof RemoveSyntaxDifference )
+            {
+                return 29;
+            }
+            else if ( o instanceof RemoveSyntaxLengthDifference )
+            {
+                return 30;
+            }
+        }
+
+        // Default
+        return 0;
+    }
+}



Mime
View raw message