You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by fe...@apache.org on 2007/11/05 18:15:02 UTC

svn commit: r592094 [22/35] - in /directory/sandbox/felixk/studio-schemaeditor: ./ META-INF/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/org/apache/directory/studio/ src/m...

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidget.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidget.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidget.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidget.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,390 @@
+/*
+ *  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.schemaeditor.view.widget;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.controller.actions.OpenSchemaViewPreferenceAction;
+import org.apache.directory.studio.schemaeditor.controller.actions.OpenSchemaViewSortingDialogAction;
+import org.apache.directory.studio.schemaeditor.model.difference.AttributeTypeDifference;
+import org.apache.directory.studio.schemaeditor.model.difference.DifferenceType;
+import org.apache.directory.studio.schemaeditor.model.difference.ObjectClassDifference;
+import org.apache.directory.studio.schemaeditor.model.difference.SchemaDifference;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+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;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class represents the DifferencesWidget.
+ * <p>
+ * It is used to display a List of Difference given in input.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DifferencesWidget
+{
+    /** The PreferenceStore */
+    private IPreferenceStore store;
+
+    /** The authorized Preferences keys */
+    private List<String> authorizedPrefs;
+
+    /** The preference listener */
+    private IPropertyChangeListener preferenceListener = new IPropertyChangeListener()
+    {
+        /*
+         * (non-Javadoc)
+         * 
+         * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+         */
+        public void propertyChange( PropertyChangeEvent event )
+        {
+            if ( authorizedPrefs.contains( event.getProperty() ) )
+            {
+                treeViewer.refresh();
+            }
+        }
+    };
+
+    // The MenuItems
+    private TreeViewer treeViewer;
+    private TableViewer tableViewer;
+    private MenuItem groupByType;
+    private MenuItem groupByProperty;
+
+
+    /**
+     * Creates a new instance of DifferencesWidget.
+     */
+    public DifferencesWidget()
+    {
+        store = Activator.getDefault().getPreferenceStore();
+    }
+
+
+    /**
+     * Creates the widget.
+     * 
+     * @param parent
+     *            the parent Composite
+     */
+    public void createWidget( Composite parent )
+    {
+        // Composite
+        Composite composite = new Composite( parent, SWT.NONE );
+        GridLayout gridLayout = new GridLayout( 2, true );
+        gridLayout.marginBottom = 0;
+        gridLayout.marginHeight = 0;
+        gridLayout.marginLeft = 0;
+        gridLayout.marginRight = 0;
+        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 ) );
+
+        // ToolBar
+        final ToolBar leftToolBar = new ToolBar( leftComposite, SWT.HORIZONTAL | SWT.FLAT );
+        leftToolBar.setLayoutData( new GridData( SWT.RIGHT, SWT.NONE, false, false ) );
+        // Creating the 'Menu' ToolBar item
+        final ToolItem leftMenuToolItem = new ToolItem( leftToolBar, SWT.PUSH );
+        leftMenuToolItem.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+            PluginConstants.IMG_TOOLBAR_MENU ).createImage() );
+        leftMenuToolItem.setToolTipText( "Menu" );
+        // Creating the associated Menu
+        final Menu leftMenu = new Menu( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP );
+        // Adding the action to display the Menu when the item is clicked
+        leftMenuToolItem.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent event )
+            {
+                Rectangle rect = leftMenuToolItem.getBounds();
+                Point pt = new Point( rect.x, rect.y + rect.height );
+                pt = leftToolBar.toDisplay( pt );
+                leftMenu.setLocation( pt.x, pt.y );
+                leftMenu.setVisible( true );
+            }
+        } );
+        // Adding the 'Sorting...' MenuItem
+        MenuItem sortingMenuItem = new MenuItem( leftMenu, SWT.PUSH );
+        sortingMenuItem.setText( "Sorting..." );
+        sortingMenuItem.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+            PluginConstants.IMG_SORTING ).createImage() );
+        sortingMenuItem.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent arg0 )
+            {
+                new OpenSchemaViewSortingDialogAction().run();
+            }
+        } );
+        // Adding the 'Separator' MenuItem
+        new MenuItem( leftMenu, SWT.SEPARATOR );
+        // Adding the 'Preferences...' MenuItem
+        MenuItem preferencesMenuItem = new MenuItem( leftMenu, SWT.PUSH );
+        preferencesMenuItem.setText( "Preferences..." );
+        preferencesMenuItem.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent arg0 )
+            {
+                new OpenSchemaViewPreferenceAction().run();
+            }
+        } );
+
+        // TreeViewer
+        treeViewer = new TreeViewer( leftComposite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
+        GridData gridData = new GridData( SWT.FILL, SWT.FILL, true, true );
+        gridData.heightHint = 250;
+        treeViewer.getTree().setLayoutData( gridData );
+        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 rightToolBar = new ToolBar( rightComposite, SWT.HORIZONTAL | SWT.FLAT );
+        rightToolBar.setLayoutData( new GridData( SWT.RIGHT, SWT.NONE, false, false ) );
+        // Creating the 'Menu' ToolBar item
+        final ToolItem rightMenuToolItem = new ToolItem( rightToolBar, SWT.PUSH );
+        rightMenuToolItem.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+            PluginConstants.IMG_TOOLBAR_MENU ).createImage() );
+        rightMenuToolItem.setToolTipText( "Menu" );
+        // Creating the associated Menu
+        final Menu rightMenu = new Menu( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP );
+        // Adding the action to display the Menu when the item is clicked
+        rightMenuToolItem.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent event )
+            {
+                Rectangle rect = rightMenuToolItem.getBounds();
+                Point pt = new Point( rect.x, rect.y + rect.height );
+                pt = rightToolBar.toDisplay( pt );
+                rightMenu.setLocation( pt.x, pt.y );
+                rightMenu.setVisible( true );
+            }
+        } );
+        // Adding the 'Group By Property' MenuItem
+        groupByProperty = new MenuItem( rightMenu, 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
+        groupByType = new MenuItem( rightMenu, SWT.CHECK );
+        groupByType.setText( "Group By Type" );
+        groupByType.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent arg0 )
+            {
+                changeGrouping( PluginConstants.PREFS_DIFFERENCES_WIDGET_GROUPING_TYPE );
+            }
+        } );
+        updateMenuItemsCheckStatus();
+
+        // TableViewer
+        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() );
+
+        initAuthorizedPrefs();
+        initPreferencesListener();
+    }
+
+
+    /**
+     * Sets the Input of the DifferencesWidget.
+     * 
+     * @param input
+     *            the input
+     */
+    public void setInput( List<SchemaDifference> input )
+    {
+        treeViewer.setInput( input );
+    }
+
+
+    /**
+     * 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();
+        tableViewer.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 );
+        }
+    }
+
+
+    /**
+     * Initializes the Authorized Prefs IDs.
+     */
+    private void initAuthorizedPrefs()
+    {
+        authorizedPrefs = new ArrayList<String>();
+        authorizedPrefs.add( PluginConstants.PREFS_SCHEMA_VIEW_LABEL );
+        authorizedPrefs.add( PluginConstants.PREFS_SCHEMA_VIEW_ABBREVIATE );
+        authorizedPrefs.add( PluginConstants.PREFS_SCHEMA_VIEW_ABBREVIATE_MAX_LENGTH );
+        authorizedPrefs.add( PluginConstants.PREFS_SCHEMA_VIEW_SECONDARY_LABEL_DISPLAY );
+        authorizedPrefs.add( PluginConstants.PREFS_SCHEMA_VIEW_SECONDARY_LABEL );
+        authorizedPrefs.add( PluginConstants.PREFS_SCHEMA_VIEW_SECONDARY_LABEL_ABBREVIATE );
+        authorizedPrefs.add( PluginConstants.PREFS_SCHEMA_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH );
+        authorizedPrefs.add( PluginConstants.PREFS_SCHEMA_VIEW_GROUPING );
+        authorizedPrefs.add( PluginConstants.PREFS_SCHEMA_VIEW_SORTING_BY );
+        authorizedPrefs.add( PluginConstants.PREFS_SCHEMA_VIEW_SORTING_ORDER );
+    }
+
+
+    /**
+     * Initializes the listener on the preferences store
+     */
+    private void initPreferencesListener()
+    {
+        store.addPropertyChangeListener( preferenceListener );
+    }
+
+
+    /**
+     * Disposes the SWT resources allocated by this dialog page.
+     */
+    public void dispose()
+    {
+        store.removePropertyChangeListener( preferenceListener );
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidget.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetPropertiesContentProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetPropertiesContentProvider.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetPropertiesContentProvider.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetPropertiesContentProvider.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,109 @@
+/*
+ *  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.schemaeditor.view.widget;
+
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.model.difference.PropertyDifference;
+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 DifferencesWidgetPropertiesContentProvider implements IStructuredContentProvider
+{
+    /** The PropertySorter */
+    private PropertySorter propertySorter;
+
+    /** The TypeSorter */
+    private TypeSorter typeSorter;
+
+    /** The PreferenceStore */
+    private IPreferenceStore store;
+
+
+    /**
+     * Creates a new instance of DifferencesWidgetPropertiesContentProvider.
+     *
+     */
+    public DifferencesWidgetPropertiesContentProvider()
+    {
+        propertySorter = new PropertySorter();
+        typeSorter = new TypeSorter();
+
+        store = Activator.getDefault().getPreferenceStore();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+     */
+    @SuppressWarnings("unchecked")
+    public Object[] getElements( Object inputElement )
+    {
+        if ( inputElement instanceof List )
+        {
+            List<PropertyDifference> differences = ( List<PropertyDifference> ) 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
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetPropertiesContentProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetPropertiesLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetPropertiesLabelProvider.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetPropertiesLabelProvider.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetPropertiesLabelProvider.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,290 @@
+/*
+ *  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.schemaeditor.view.widget;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.model.difference.AliasDifference;
+import org.apache.directory.studio.schemaeditor.model.difference.ClassTypeDifference;
+import org.apache.directory.studio.schemaeditor.model.difference.CollectiveDifference;
+import org.apache.directory.studio.schemaeditor.model.difference.DescriptionDifference;
+import org.apache.directory.studio.schemaeditor.model.difference.EqualityDifference;
+import org.apache.directory.studio.schemaeditor.model.difference.MandatoryATDifference;
+import org.apache.directory.studio.schemaeditor.model.difference.NoUserModificationDifference;
+import org.apache.directory.studio.schemaeditor.model.difference.ObsoleteDifference;
+import org.apache.directory.studio.schemaeditor.model.difference.OptionalATDifference;
+import org.apache.directory.studio.schemaeditor.model.difference.OrderingDifference;
+import org.apache.directory.studio.schemaeditor.model.difference.PropertyDifference;
+import org.apache.directory.studio.schemaeditor.model.difference.SingleValueDifference;
+import org.apache.directory.studio.schemaeditor.model.difference.SubstringDifference;
+import org.apache.directory.studio.schemaeditor.model.difference.SuperiorATDifference;
+import org.apache.directory.studio.schemaeditor.model.difference.SuperiorOCDifference;
+import org.apache.directory.studio.schemaeditor.model.difference.SyntaxDifference;
+import org.apache.directory.studio.schemaeditor.model.difference.SyntaxLengthDifference;
+import org.apache.directory.studio.schemaeditor.model.difference.UsageDifference;
+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 DifferencesWidget.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DifferencesWidgetPropertiesLabelProvider extends LabelProvider
+{
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+     */
+    public Image getImage( Object element )
+    {
+        if ( element instanceof PropertyDifference )
+        {
+            PropertyDifference propertyDifference = ( PropertyDifference ) element;
+            switch ( propertyDifference.getType() )
+            {
+                case ADDED:
+                    return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                        PluginConstants.IMG_DIFFERENCE_PROPERTY_ADD ).createImage();
+
+                case MODIFIED:
+                    return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                        PluginConstants.IMG_DIFFERENCE_PROPERTY_MODIFY ).createImage();
+                case REMOVED:
+                    return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                        PluginConstants.IMG_DIFFERENCE_PROPERTY_REMOVE ).createImage();
+            }
+        }
+
+        // Default
+        return super.getImage( element );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+     */
+    public String getText( Object element )
+    {
+        if ( element instanceof AliasDifference )
+        {
+            AliasDifference diff = ( AliasDifference ) element;
+            switch ( diff.getType() )
+            {
+                case ADDED:
+                    return "Added alias: '" + diff.getNewValue() + "'.";
+                case REMOVED:
+                    return "Removed alias: '" + diff.getOldValue() + "'.";
+            }
+        }
+        else if ( element instanceof ClassTypeDifference )
+        {
+            ClassTypeDifference diff = ( ClassTypeDifference ) element;
+            switch ( diff.getType() )
+            {
+                case MODIFIED:
+                    return "Modified class type to : '" + diff.getNewValue() + "' (was '" + diff.getOldValue() + "').";
+            }
+        }
+        else if ( element instanceof CollectiveDifference )
+        {
+            CollectiveDifference diff = ( CollectiveDifference ) element;
+            switch ( diff.getType() )
+            {
+                case MODIFIED:
+                    return "Modified 'collective' value to : '" + diff.getNewValue() + "' (was '" + diff.getOldValue()
+                        + "').";
+            }
+        }
+        else if ( element instanceof DescriptionDifference )
+        {
+            DescriptionDifference diff = ( DescriptionDifference ) element;
+            switch ( diff.getType() )
+            {
+                case ADDED:
+                    return "Added description: '" + diff.getNewValue() + "'.";
+                case MODIFIED:
+                    return "Modified description to : '" + diff.getNewValue() + "' (was '" + diff.getOldValue() + "').";
+                case REMOVED:
+                    return "Removed description: '" + diff.getOldValue() + "'.";
+            }
+        }
+        else if ( element instanceof EqualityDifference )
+        {
+            EqualityDifference diff = ( EqualityDifference ) element;
+            switch ( diff.getType() )
+            {
+                case ADDED:
+                    return "Added equality matching rule: '" + diff.getNewValue() + "'.";
+                case MODIFIED:
+                    return "Modified equality matching rule to : '" + diff.getNewValue() + "' (was '"
+                        + diff.getOldValue() + "').";
+                case REMOVED:
+                    return "Removed equality matching rule: '" + diff.getOldValue() + "'.";
+            }
+        }
+        else if ( element instanceof MandatoryATDifference )
+        {
+            MandatoryATDifference diff = ( MandatoryATDifference ) element;
+            switch ( diff.getType() )
+            {
+                case ADDED:
+                    return "Added mandatory attribute type: '" + diff.getNewValue() + "'.";
+                case REMOVED:
+                    return "Removed mandatory attribute type: '" + diff.getOldValue() + "'.";
+            }
+        }
+        else if ( element instanceof NoUserModificationDifference )
+        {
+            NoUserModificationDifference diff = ( NoUserModificationDifference ) element;
+            switch ( diff.getType() )
+            {
+                case MODIFIED:
+                    return "Modified 'no user modification' value to : '" + diff.getNewValue() + "' (was '"
+                        + diff.getOldValue() + "').";
+            }
+        }
+        else if ( element instanceof ObsoleteDifference )
+        {
+            ObsoleteDifference diff = ( ObsoleteDifference ) element;
+            switch ( diff.getType() )
+            {
+                case MODIFIED:
+                    return "Modified 'obsolete' value to : '" + diff.getNewValue() + "' (was '" + diff.getOldValue()
+                        + "').";
+            }
+        }
+        else if ( element instanceof OptionalATDifference )
+        {
+            OptionalATDifference diff = ( OptionalATDifference ) element;
+            switch ( diff.getType() )
+            {
+                case ADDED:
+                    return "Added optional attribute type: '" + diff.getNewValue() + "'.";
+                case REMOVED:
+                    return "Removed optional attribute type: '" + diff.getOldValue() + "'.";
+            }
+        }
+        else if ( element instanceof OrderingDifference )
+        {
+            OrderingDifference diff = ( OrderingDifference ) element;
+            switch ( diff.getType() )
+            {
+                case ADDED:
+                    return "Added ordering matching rule: '" + diff.getNewValue() + "'.";
+                case MODIFIED:
+                    return "Modified ordering matching rule to : '" + diff.getNewValue() + "' (was '"
+                        + diff.getOldValue() + "').";
+                case REMOVED:
+                    return "Removed ordering matching rule: '" + diff.getOldValue() + "'.";
+            }
+        }
+        else if ( element instanceof SingleValueDifference )
+        {
+            SingleValueDifference diff = ( SingleValueDifference ) element;
+            switch ( diff.getType() )
+            {
+                case MODIFIED:
+                    return "Modified 'single value' value to : '" + diff.getNewValue() + "' (was '"
+                        + diff.getOldValue() + "').";
+            }
+        }
+        else if ( element instanceof SubstringDifference )
+        {
+            SubstringDifference diff = ( SubstringDifference ) element;
+            switch ( diff.getType() )
+            {
+                case ADDED:
+                    return "Added substring matching rule: '" + diff.getNewValue() + "'.";
+                case MODIFIED:
+                    return "Modified substring matching rule to : '" + diff.getNewValue() + "' (was '"
+                        + diff.getOldValue() + "').";
+                case REMOVED:
+                    return "Removed substring matching rule: '" + diff.getOldValue() + "'.";
+            }
+        }
+        else if ( element instanceof SuperiorATDifference )
+        {
+            SuperiorATDifference diff = ( SuperiorATDifference ) element;
+            switch ( diff.getType() )
+            {
+                case ADDED:
+                    return "Added superior: '" + diff.getNewValue() + "'.";
+                case MODIFIED:
+                    return "Modified superior to: '" + diff.getNewValue() + "' (was '" + diff.getOldValue() + "').";
+                case REMOVED:
+                    return "Removed superior: '" + diff.getOldValue() + "'.";
+            }
+        }
+        else if ( element instanceof SuperiorOCDifference )
+        {
+            SuperiorOCDifference diff = ( SuperiorOCDifference ) element;
+            switch ( diff.getType() )
+            {
+                case ADDED:
+                    return "Added superior: '" + diff.getNewValue() + "'.";
+                case REMOVED:
+                    return "Removed superior: '" + diff.getOldValue() + "'.";
+            }
+        }
+        else if ( element instanceof SyntaxDifference )
+        {
+            SyntaxDifference diff = ( SyntaxDifference ) element;
+            switch ( diff.getType() )
+            {
+                case ADDED:
+                    return "Added syntax: '" + diff.getNewValue() + "'.";
+                case MODIFIED:
+                    return "Modified syntax to: '" + diff.getNewValue() + "' (was '" + diff.getOldValue() + "').";
+                case REMOVED:
+                    return "Removed syntax: '" + diff.getOldValue() + "'.";
+            }
+        }
+        else if ( element instanceof SyntaxLengthDifference )
+        {
+            SyntaxLengthDifference diff = ( SyntaxLengthDifference ) element;
+            switch ( diff.getType() )
+            {
+                case ADDED:
+                    return "Added syntax length: '" + diff.getNewValue() + "'.";
+                case MODIFIED:
+                    return "Modified syntax length to: '" + diff.getNewValue() + "' (was '" + diff.getOldValue()
+                        + "').";
+                case REMOVED:
+                    return "Removed syntax length: '" + diff.getOldValue() + "'.";
+            }
+        }
+        else if ( element instanceof UsageDifference )
+        {
+            UsageDifference diff = ( UsageDifference ) element;
+            switch ( diff.getType() )
+            {
+                case MODIFIED:
+                    return "Modified usage to: '" + diff.getNewValue() + "' (was '" + diff.getOldValue() + "').";
+            }
+        }
+
+        // Default
+        return super.getText( element );
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetPropertiesLabelProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetSchemaContentProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetSchemaContentProvider.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetSchemaContentProvider.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetSchemaContentProvider.java Mon Nov  5 09:14:24 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.schemaeditor.view.widget;
+
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.model.difference.SchemaDifference;
+import org.apache.directory.studio.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;
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetSchemaContentProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetSchemaLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetSchemaLabelProvider.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetSchemaLabelProvider.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetSchemaLabelProvider.java Mon Nov  5 09:14:24 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.schemaeditor.view.widget;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.schemaeditor.model.Schema;
+import org.apache.directory.studio.schemaeditor.model.difference.AttributeTypeDifference;
+import org.apache.directory.studio.schemaeditor.model.difference.ObjectClassDifference;
+import org.apache.directory.studio.schemaeditor.model.difference.SchemaDifference;
+import org.apache.directory.studio.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;
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/DifferencesWidgetSchemaLabelProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/FirstNameSorter.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/FirstNameSorter.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/FirstNameSorter.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/FirstNameSorter.java Mon Nov  5 09:14:24 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.schemaeditor.view.widget;
+
+
+import java.util.Comparator;
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+import org.apache.directory.studio.schemaeditor.model.difference.AttributeTypeDifference;
+import org.apache.directory.studio.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() );
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/FirstNameSorter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/Folder.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/Folder.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/Folder.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/Folder.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,165 @@
+/*
+ *  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.schemaeditor.view.widget;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.directory.studio.schemaeditor.model.difference.Difference;
+import org.apache.directory.studio.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 );
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/Folder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/OidSorter.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/OidSorter.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/OidSorter.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/OidSorter.java Mon Nov  5 09:14:24 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.schemaeditor.view.widget;
+
+
+import java.util.Comparator;
+
+import org.apache.directory.shared.ldap.schema.SchemaObject;
+import org.apache.directory.studio.schemaeditor.model.difference.AttributeTypeDifference;
+import org.apache.directory.studio.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 );
+    }
+}

Propchange: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/widget/OidSorter.java
------------------------------------------------------------------------------
    svn:eol-style = native