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 [13/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/dialogs/AttributeTypeSelectionDialogContentProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/AttributeTypeSelectionDialogContentProvider.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/AttributeTypeSelectionDialogContentProvider.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/AttributeTypeSelectionDialogContentProvider.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,172 @@
+/*
+ *  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.dialogs;
+
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.controller.SchemaHandler;
+import org.apache.directory.studio.schemaeditor.model.AttributeTypeImpl;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+
+/**
+ * This class is the Content Provider for the Attribute Type Selection Dialog.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AttributeTypeSelectionDialogContentProvider implements IStructuredContentProvider
+{
+    /** The Schema Pool */
+    private SchemaHandler schemaHandler;
+
+    /** The hidden Object Classes */
+    private List<AttributeTypeImpl> hiddenAttributeTypes;
+
+
+    /**
+     * Creates a new instance of AttributeTypeSelectionDialogContentProvider.
+     */
+    public AttributeTypeSelectionDialogContentProvider( List<AttributeTypeImpl> hiddenAttributeTypes )
+    {
+        this.hiddenAttributeTypes = hiddenAttributeTypes;
+        schemaHandler = Activator.getDefault().getSchemaHandler();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+     */
+    public Object[] getElements( Object inputElement )
+    {
+        if ( inputElement instanceof String )
+        {
+            ArrayList<AttributeTypeImpl> results = new ArrayList<AttributeTypeImpl>();
+
+            String searchText = ( String ) inputElement;
+
+            String searchRegexp;
+            if ( searchText.length() == 0 )
+            {
+                searchRegexp = ".*"; //$NON-NLS-1$
+            }
+            else
+            {
+                searchRegexp = searchText + ".*"; //$NON-NLS-1$
+            }
+            Pattern pattern = Pattern.compile( searchRegexp, Pattern.CASE_INSENSITIVE );
+
+            List<AttributeTypeImpl> atList = schemaHandler.getAttributeTypes();
+
+            // Sorting the list
+            Collections.sort( atList, new Comparator<AttributeTypeImpl>()
+            {
+                public int compare( AttributeTypeImpl at1, AttributeTypeImpl at2 )
+                {
+                    String[] at1Names = ( ( AttributeTypeImpl ) at1 ).getNames();
+                    String[] at2Names = ( ( AttributeTypeImpl ) at2 ).getNames();
+
+                    if ( ( at1Names == null || at1Names.length == 0 ) && ( at2Names == null || at2Names.length == 0 ) )
+                    {
+                        return 0;
+                    }
+                    else if ( ( at1Names == null || at1Names.length == 0 )
+                        && ( at2Names != null && at2Names.length > 0 ) )
+                    {
+                        return "".compareToIgnoreCase( at2Names[0] ); //$NON-NLS-1$
+                    }
+                    else if ( ( at1Names != null && at1Names.length > 0 )
+                        && ( at2Names == null || at2Names.length == 0 ) )
+                    {
+                        return at1Names[0].compareToIgnoreCase( "" ); //$NON-NLS-1$
+                    }
+                    else
+                    {
+                        return at1Names[0].compareToIgnoreCase( at2Names[0] );
+                    }
+                }
+            } );
+
+            // Searching for all matching elements
+            for ( AttributeTypeImpl at : atList )
+            {
+                for ( String name : at.getNames() )
+                {
+                    Matcher m = pattern.matcher( name );
+                    if ( m.matches() )
+                    {
+                        if ( !hiddenAttributeTypes.contains( at ) )
+                        {
+                            if ( !results.contains( at ) )
+                            {
+                                results.add( at );
+                            }
+                        }
+                        break;
+                    }
+                }
+                Matcher m = pattern.matcher( at.getOid() );
+                if ( m.matches() )
+                {
+                    if ( !hiddenAttributeTypes.contains( at ) )
+                    {
+                        if ( !results.contains( at ) )
+                        {
+                            results.add( at );
+                        }
+                    }
+                }
+            }
+
+            // Returns the results
+            return results.toArray();
+        }
+
+        // Default
+        return new Object[0];
+    }
+
+
+    /* (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
+    }
+}
\ No newline at end of file

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

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/AttributeTypeSelectionDialogLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/AttributeTypeSelectionDialogLabelProvider.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/AttributeTypeSelectionDialogLabelProvider.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/AttributeTypeSelectionDialogLabelProvider.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,80 @@
+/*
+ *  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.dialogs;
+
+
+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.view.ViewUtils;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class is the Label Provider for the Attribute Types Viewer of the AttributeTypeSelectionDialog.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AttributeTypeSelectionDialogLabelProvider extends LabelProvider
+{
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+     */
+    public Image getImage( Object element )
+    {
+        if ( element instanceof AttributeTypeImpl )
+        {
+            return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_ATTRIBUTE_TYPE )
+                .createImage();
+        }
+
+        // Default
+        return null;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+     */
+    public String getText( Object element )
+    {
+        if ( element instanceof AttributeTypeImpl )
+        {
+            AttributeTypeImpl at = ( AttributeTypeImpl ) element;
+
+            String[] names = at.getNames();
+            if ( ( names != null ) && ( names.length > 0 ) )
+            {
+                return ViewUtils.concateAliases( names ) + "  -  (" + at.getOid() + ")";
+            }
+            else
+            {
+                return "(None)  -  (" + at.getOid() + ")";
+            }
+        }
+
+        // Default
+        return null;
+    }
+}

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

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditAliasesDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditAliasesDialog.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditAliasesDialog.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditAliasesDialog.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,360 @@
+/*
+ *  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.dialogs;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginUtils;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.TraverseEvent;
+import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This class implements the Manage Aliases Dialog.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EditAliasesDialog extends Dialog
+{
+    /** The aliases List */
+    private List<String> aliases;
+    private List<String> aliasesLowerCased;
+
+    /** The dirty flag */
+    private boolean dirty = false;
+
+    // UI Fields
+    private Table aliasesTable;
+    private Text newAliasText;
+    private Button newAliasAddButton;
+    private Composite errorComposite;
+    private Image errorImage;
+    private Label errorLabel;
+
+
+    /**
+     * Creates a new instance of EditAliasesDialog.
+     *
+     * @param aliases
+     *      the array containing the aliases
+     */
+    public EditAliasesDialog( String[] aliases )
+    {
+        super( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() );
+        this.aliases = new ArrayList<String>();
+        aliasesLowerCased = new ArrayList<String>();
+        for ( String alias : aliases )
+        {
+            this.aliases.add( alias );
+            aliasesLowerCased.add( alias.toLowerCase() );
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+     */
+    protected void configureShell( Shell newShell )
+    {
+        super.configureShell( newShell );
+        newShell.setText( "Edit Aliases" );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+     */
+    protected Control createDialogArea( Composite parent )
+    {
+        Composite composite = new Composite( parent, SWT.NONE );
+        composite.setLayout( new GridLayout( 2, false ) );
+        composite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+
+        // ALIASES Label
+        Label aliases_label = new Label( composite, SWT.NONE );
+        aliases_label.setText( "Aliases" );
+        aliases_label.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, true, 2, 1 ) );
+
+        // ALIASES Table
+        aliasesTable = new Table( composite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION
+            | SWT.HIDE_SELECTION );
+        GridData gridData = new GridData( SWT.FILL, SWT.FILL, true, true, 2, 1 );
+        gridData.heightHint = 100;
+        gridData.minimumHeight = 100;
+        gridData.widthHint = 200;
+        gridData.minimumWidth = 200;
+        aliasesTable.setLayoutData( gridData );
+
+        // ADD Label
+        Label add_label = new Label( composite, SWT.NONE );
+        add_label.setText( "Add an alias" );
+        add_label.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, true, 2, 1 ) );
+
+        // NEW ALIAS Field
+        newAliasText = new Text( composite, SWT.BORDER );
+        newAliasText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Add Button
+        newAliasAddButton = new Button( composite, SWT.PUSH );
+        newAliasAddButton.setText( "Add" );
+        newAliasAddButton.setLayoutData( new GridData( SWT.NONE, SWT.NONE, false, false ) );
+        newAliasAddButton.setEnabled( false );
+
+        // Error Composite
+        errorComposite = new Composite( composite, SWT.NONE );
+        errorComposite.setLayout( new GridLayout( 2, false ) );
+        errorComposite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true, 2, 1 ) );
+        errorComposite.setVisible( false );
+
+        // Error Image
+        errorImage = PlatformUI.getWorkbench().getSharedImages().getImage( ISharedImages.IMG_OBJS_ERROR_TSK );
+        Label label = new Label( errorComposite, SWT.NONE );
+        label.setImage( errorImage );
+        label.setSize( 16, 16 );
+
+        // Error Label
+        errorLabel = new Label( errorComposite, SWT.NONE );
+        errorLabel.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+        errorLabel.setText( "An element with the same alias already exists." );
+
+        // Table initialization
+        fillAliasesTable();
+
+        // Listeners initialization
+        initListeners();
+
+        // Setting the focus to the text field
+        newAliasText.setFocus();
+
+        return composite;
+    }
+
+
+    /**
+     * Fills in the Aliases Table from the aliases list     */
+    private void fillAliasesTable()
+    {
+        aliasesTable.removeAll();
+        aliasesTable.setItemCount( 0 );
+        for ( String alias : aliases )
+        {
+            TableItem newItem = new TableItem( aliasesTable, SWT.NONE );
+            newItem.setText( alias );
+        }
+    }
+
+
+    /**
+     * Initializes the Listeners.
+     */
+    private void initListeners()
+    {
+        aliasesTable.addKeyListener( new KeyAdapter()
+        {
+            public void keyPressed( KeyEvent e )
+            {
+                if ( ( e.keyCode == SWT.DEL ) || ( e.keyCode == Action.findKeyCode( "BACKSPACE" ) ) ) { //$NON-NLS-1$
+                    // NOTE: I couldn't find the corresponding Identificator in the SWT.SWT Class,
+                    // so I Used JFace Action fineKeyCode method to get the Backspace keycode.
+
+                    removeAliases();
+                }
+            }
+        } );
+
+        // Aliases Table's Popup Menu
+        Menu menu = new Menu( getShell(), SWT.POP_UP );
+        aliasesTable.setMenu( menu );
+        MenuItem deleteMenuItem = new MenuItem( menu, SWT.PUSH );
+        deleteMenuItem.setText( "Delete" );
+        deleteMenuItem.setImage( PlatformUI.getWorkbench().getSharedImages().getImage( ISharedImages.IMG_TOOL_DELETE ) );
+        // Adding the listener
+        deleteMenuItem.addListener( SWT.Selection, new Listener()
+        {
+            public void handleEvent( Event event )
+            {
+                removeAliases();
+            }
+        } );
+
+        // NEW ALIAS Field
+        newAliasText.addTraverseListener( new TraverseListener()
+        {
+            public void keyTraversed( TraverseEvent e )
+            {
+                if ( e.detail == SWT.TRAVERSE_RETURN )
+                {
+                    String text = newAliasText.getText();
+
+                    if ( "".equals( text ) ) //$NON-NLS-1$
+                    {
+                        close();
+                    }
+                    else if ( ( !aliasesLowerCased.contains( text.toLowerCase() ) ) //$NON-NLS-1$
+                        && ( !Activator.getDefault().getSchemaHandler().isAliasOrOidAlreadyTaken( text ) ) )
+                    {
+                        addANewAlias();
+                    }
+                }
+            }
+        } );
+        newAliasText.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                errorComposite.setVisible( false );
+                newAliasAddButton.setEnabled( true );
+                String text = newAliasText.getText();
+
+                if ( "".equals( text ) ) //$NON-NLS-1$
+                {
+                    newAliasAddButton.setEnabled( false );
+                }
+                else if ( aliasesLowerCased.contains( text.toLowerCase() ) )
+                {
+                    errorComposite.setVisible( true );
+                    errorLabel.setText( "This alias already exists in the list." );
+                    newAliasAddButton.setEnabled( false );
+                }
+                else if ( Activator.getDefault().getSchemaHandler().isAliasOrOidAlreadyTaken( text ) )
+                {
+                    errorComposite.setVisible( true );
+                    errorLabel.setText( "An element with the same alias already exists." );
+                    newAliasAddButton.setEnabled( false );
+                }
+                else if ( !PluginUtils.verifyName( text ) )
+                {
+                    errorComposite.setVisible( true );
+                    errorLabel.setText( "Invalid Alias." );
+                    newAliasAddButton.setEnabled( false );
+                }
+            }
+        } );
+
+        // ADD Button
+        newAliasAddButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                addANewAlias();
+            }
+        } );
+
+    }
+
+
+    /**
+     * Removes the selected aliases in the Aliases Table from the Aliases List.
+     */
+    private void removeAliases()
+    {
+        TableItem[] selectedItems = aliasesTable.getSelection();
+        for ( TableItem item : selectedItems )
+        {
+            aliases.remove( item.getText() );
+            aliasesLowerCased.remove( item.getText().toLowerCase() );
+        }
+        dirty = true;
+        fillAliasesTable();
+    }
+
+
+    /**
+     * Adds a new alias
+     */
+    private void addANewAlias()
+    {
+        if ( newAliasText.getText().length() != 0 )
+        {
+            aliases.add( newAliasText.getText() );
+            aliasesLowerCased.add( newAliasText.getText().toLowerCase() );
+            fillAliasesTable();
+            newAliasText.setText( "" ); //$NON-NLS-1$
+            newAliasText.setFocus();
+            this.dirty = true;
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+     */
+    protected void createButtonsForButtonBar( Composite parent )
+    {
+        createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false );
+        createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+    }
+
+
+    /**
+     * Returns the aliases.
+     *  
+     * @return
+     *      the aliases
+     */
+    public String[] getAliases()
+    {
+        return aliases.toArray( new String[0] );
+    }
+
+
+    /**
+     * Gets the Dirty flag of the dialog
+     *
+     * @return
+     *      the dirty flag of the dialog
+     */
+    public boolean isDirty()
+    {
+        return dirty;
+    }
+}

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

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/ObjectClassSelectionDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/ObjectClassSelectionDialog.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/ObjectClassSelectionDialog.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/ObjectClassSelectionDialog.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,324 @@
+/*
+ *  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.dialogs;
+
+
+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.model.ObjectClassImpl;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+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.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class is the Object Class Selection Dialog, that allows user to select an object class.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ObjectClassSelectionDialog extends Dialog
+{
+    /** The selected object class */
+    private ObjectClassImpl selectedObjectClass;
+
+    /** The hidden Object Classes */
+    private List<ObjectClassImpl> hiddenObjectClasses;
+
+    // UI Fields
+    private Text searchText;
+    private Table objectClassesTable;
+    private TableViewer objectClassesTableViewer;
+    private Label schemaIconLabel;
+    private Label schemaNameLabel;
+    private Button chooseButton;
+
+
+    /**
+     * Creates a new instance of ObjectClassSelectionDialog.
+     */
+    public ObjectClassSelectionDialog()
+    {
+        super( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() );
+        hiddenObjectClasses = new ArrayList<ObjectClassImpl>();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+     */
+    protected void configureShell( Shell newShell )
+    {
+        super.configureShell( newShell );
+        newShell.setText( "Object Class Selection" );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+     */
+    protected Control createDialogArea( Composite parent )
+    {
+        Composite composite = new Composite( parent, SWT.NONE );
+        GridLayout layout = new GridLayout( 1, false );
+        composite.setLayout( layout );
+
+        Label chooseLabel = new Label( composite, SWT.NONE );
+        chooseLabel.setText( "Choose an object class" );
+        chooseLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        searchText = new Text( composite, SWT.BORDER );
+        searchText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        searchText.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                setSearchInput( searchText.getText() );
+            }
+        } );
+        searchText.addKeyListener( new KeyAdapter()
+        {
+            public void keyPressed( KeyEvent e )
+            {
+                if ( e.keyCode == SWT.ARROW_DOWN )
+                {
+                    objectClassesTable.setFocus();
+                }
+            }
+        } );
+
+        Label matchingLabel = new Label( composite, SWT.NONE );
+        matchingLabel.setText( "Matching object class(es)" );
+        matchingLabel.setLayoutData( new GridData( SWT.FILL, SWT.None, true, false ) );
+
+        objectClassesTable = new Table( composite, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
+            | SWT.FULL_SELECTION | SWT.HIDE_SELECTION );
+        GridData gridData = new GridData( SWT.FILL, SWT.FILL, true, true );
+        gridData.heightHint = 148;
+        gridData.minimumHeight = 148;
+        gridData.widthHint = 350;
+        gridData.minimumWidth = 350;
+        objectClassesTable.setLayoutData( gridData );
+        objectClassesTable.addMouseListener( new MouseAdapter()
+        {
+            public void mouseDoubleClick( MouseEvent e )
+            {
+                if ( objectClassesTable.getSelectionIndex() != -1 )
+                {
+                    okPressed();
+                }
+            }
+        } );
+
+        objectClassesTableViewer = new TableViewer( objectClassesTable );
+        objectClassesTableViewer
+            .setContentProvider( new ObjectClassSelectionDialogContentProvider( hiddenObjectClasses ) );
+        objectClassesTableViewer.setLabelProvider( new DecoratingLabelProvider(
+            new ObjectClassSelectionDialogLabelProvider(), Activator.getDefault().getWorkbench().getDecoratorManager()
+                .getLabelDecorator() ) );
+        objectClassesTableViewer.addSelectionChangedListener( new ISelectionChangedListener()
+        {
+            public void selectionChanged( SelectionChangedEvent event )
+            {
+                StructuredSelection selection = ( StructuredSelection ) objectClassesTableViewer.getSelection();
+                if ( selection.isEmpty() )
+                {
+                    if ( ( chooseButton != null ) && ( !chooseButton.isDisposed() ) )
+                    {
+                        chooseButton.setEnabled( false );
+                    }
+                    schemaIconLabel.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                        PluginConstants.IMG_TRANSPARENT_16X16 ).createImage() );
+                    schemaNameLabel.setText( "" );
+                }
+                else
+                {
+                    if ( ( chooseButton != null ) && ( !chooseButton.isDisposed() ) )
+                    {
+                        chooseButton.setEnabled( true );
+                    }
+                    schemaIconLabel.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                        PluginConstants.IMG_SCHEMA ).createImage() );
+                    schemaNameLabel.setText( ( ( ObjectClassImpl ) selection.getFirstElement() ).getSchema() );
+                }
+            }
+        } );
+
+        // Schema Composite
+        Composite schemaComposite = new Composite( composite, SWT.BORDER );
+        schemaComposite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        GridLayout schemaCompositeGridLayout = new GridLayout( 2, false );
+        schemaCompositeGridLayout.horizontalSpacing = 0;
+        schemaCompositeGridLayout.verticalSpacing = 0;
+        schemaCompositeGridLayout.marginWidth = 2;
+        schemaCompositeGridLayout.marginHeight = 2;
+        schemaComposite.setLayout( schemaCompositeGridLayout );
+
+        // Schema Icon Label
+        schemaIconLabel = new Label( schemaComposite, SWT.NONE );
+        GridData schemaIconLabelGridData = new GridData( SWT.NONE, SWT.BOTTOM, false, false );
+        schemaIconLabelGridData.widthHint = 18;
+        schemaIconLabelGridData.heightHint = 16;
+        schemaIconLabel.setLayoutData( schemaIconLabelGridData );
+        schemaIconLabel.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+            PluginConstants.IMG_TRANSPARENT_16X16 ).createImage() );
+
+        // Schema Name Label
+        schemaNameLabel = new Label( schemaComposite, SWT.NONE );
+        schemaNameLabel.setLayoutData( new GridData( SWT.FILL, SWT.BOTTOM, true, false ) );
+        schemaNameLabel.setText( "" );
+
+        // We need to force the input to load the complete list of attribute types
+        setSearchInput( "" ); //$NON-NLS-1$
+
+        return composite;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+     */
+    protected void createButtonsForButtonBar( Composite parent )
+    {
+        chooseButton = createButton( parent, IDialogConstants.OK_ID, "Choose", true ); //$NON-NLS-1$
+        createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+
+        StructuredSelection selection = ( StructuredSelection ) objectClassesTableViewer.getSelection();
+        if ( selection.isEmpty() )
+        {
+            if ( ( chooseButton != null ) && ( !chooseButton.isDisposed() ) )
+            {
+                chooseButton.setEnabled( false );
+            }
+        }
+        else
+        {
+            if ( ( chooseButton != null ) && ( !chooseButton.isDisposed() ) )
+            {
+                chooseButton.setEnabled( true );
+            }
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+     */
+    protected void okPressed()
+    {
+        StructuredSelection selection = ( StructuredSelection ) objectClassesTableViewer.getSelection();
+
+        if ( selection.isEmpty() )
+        {
+            MessageDialog.openError( getShell(), "Invalid Selection", "You have to choose an object class" );
+            return;
+        }
+        else
+        {
+            selectedObjectClass = ( ObjectClassImpl ) selection.getFirstElement();
+        }
+
+        super.okPressed();
+    }
+
+
+    /**
+     * Returns the selected Object Class.
+     * 
+     * @return 
+     *      the selected Object Class
+     */
+    public ObjectClassImpl getSelectedObjectClass()
+    {
+        return selectedObjectClass;
+    }
+
+
+    /**
+     * Set the hidden Object Classes.
+     *
+     * @param list
+     *      a list of Object Classes to hide
+     */
+    public void setHiddenObjectClasses( List<ObjectClassImpl> list )
+    {
+        hiddenObjectClasses = list;
+    }
+
+
+    /**
+     * Sets the hidden Object Classes.
+     *
+     * @param objectClasses
+     *      an array of Object Classes to hide
+     */
+    public void setHiddenObjectClasses( ObjectClassImpl[] objectClasses )
+    {
+        for ( ObjectClassImpl objectClass : objectClasses )
+        {
+            hiddenObjectClasses.add( objectClass );
+        }
+    }
+
+
+    /**
+     * Set the Search Input.
+     *
+     * @param searchString
+     *      the Search String
+     */
+    private void setSearchInput( String searchString )
+    {
+        objectClassesTableViewer.setInput( searchString );
+
+        Object firstElement = objectClassesTableViewer.getElementAt( 0 );
+        if ( firstElement != null )
+        {
+            objectClassesTableViewer.setSelection( new StructuredSelection( firstElement ), true );
+        }
+    }
+}

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

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/ObjectClassSelectionDialogContentProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/ObjectClassSelectionDialogContentProvider.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/ObjectClassSelectionDialogContentProvider.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/ObjectClassSelectionDialogContentProvider.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,170 @@
+/*
+ *  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.dialogs;
+
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.controller.SchemaHandler;
+import org.apache.directory.studio.schemaeditor.model.ObjectClassImpl;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+
+/**
+ * This class is the Content Provider for the Object Class Selection Dialog.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ObjectClassSelectionDialogContentProvider implements IStructuredContentProvider
+{
+    /** The schema handler */
+    private SchemaHandler schemaHandler;
+
+    /** The hidden object classes */
+    private List<ObjectClassImpl> hiddenObjectClasses;
+
+
+    /**
+     * Creates a new instance of ObjectClassSelectionDialogContentProvider.
+     */
+    public ObjectClassSelectionDialogContentProvider( List<ObjectClassImpl> hiddenObjectClasses )
+    {
+        schemaHandler = Activator.getDefault().getSchemaHandler();
+        this.hiddenObjectClasses = hiddenObjectClasses;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+     */
+    public Object[] getElements( Object inputElement )
+    {
+        if ( inputElement instanceof String )
+        {
+            ArrayList<ObjectClassImpl> results = new ArrayList<ObjectClassImpl>();
+
+            String searchText = ( String ) inputElement;
+
+            String searchRegexp;
+            if ( searchText.length() == 0 )
+            {
+                searchRegexp = ".*"; //$NON-NLS-1$
+            }
+            else
+            {
+                searchRegexp = searchText + ".*"; //$NON-NLS-1$
+            }
+            Pattern pattern = Pattern.compile( searchRegexp, Pattern.CASE_INSENSITIVE );
+
+            List<ObjectClassImpl> ocList = schemaHandler.getObjectClasses();
+
+            // Sorting the list
+            Collections.sort( ocList, new Comparator<ObjectClassImpl>()
+            {
+                public int compare( ObjectClassImpl oc1, ObjectClassImpl oc2 )
+                {
+                    String[] oc1Names = ( ( ObjectClassImpl ) oc1 ).getNames();
+                    String[] oc2Names = ( ( ObjectClassImpl ) oc2 ).getNames();
+
+                    if ( ( oc1Names == null || oc1Names.length == 0 ) && ( oc2Names == null || oc2Names.length == 0 ) )
+                    {
+                        return 0;
+                    }
+                    else if ( ( oc1Names == null || oc1Names.length == 0 )
+                        && ( oc2Names != null && oc2Names.length > 0 ) )
+                    {
+                        return "".compareToIgnoreCase( oc2Names[0] ); //$NON-NLS-1$
+                    }
+                    else if ( ( oc1Names != null && oc1Names.length > 0 )
+                        && ( oc2Names == null || oc2Names.length == 0 ) )
+                    {
+                        return oc1Names[0].compareToIgnoreCase( "" ); //$NON-NLS-1$
+                    }
+                    else
+                    {
+                        return oc1Names[0].compareToIgnoreCase( oc2Names[0] );
+                    }
+                }
+            } );
+
+            // Searching for all matching elements
+            for ( ObjectClassImpl oc : ocList )
+            {
+                for ( String name : oc.getNames() )
+                {
+                    Matcher m = pattern.matcher( name );
+                    if ( m.matches() )
+                    {
+                        if ( !hiddenObjectClasses.contains( oc ) )
+                        {
+                            if ( !results.contains( oc ) )
+                            {
+                                results.add( oc );
+                            }
+                        }
+                        break;
+                    }
+                }
+                Matcher m = pattern.matcher( oc.getOid() );
+                if ( m.matches() )
+                {
+                    if ( !hiddenObjectClasses.contains( oc ) )
+                    {
+                        if ( !results.contains( oc ) )
+                        {
+                            results.add( oc );
+                        }
+                    }
+                }
+            }
+
+            // Returns the results
+            return results.toArray();
+        }
+
+        // Default
+        return new Object[0];
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+     */
+    public void dispose()
+    {
+    }
+
+
+    /* (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 )
+    {
+    }
+}

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

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/ObjectClassSelectionDialogLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/ObjectClassSelectionDialogLabelProvider.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/ObjectClassSelectionDialogLabelProvider.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/ObjectClassSelectionDialogLabelProvider.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,80 @@
+/*
+ *  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.dialogs;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.model.ObjectClassImpl;
+import org.apache.directory.studio.schemaeditor.view.ViewUtils;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class is the Label Provider for the Object Classes Viewer of the ObjectClassSelectionDialog.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ObjectClassSelectionDialogLabelProvider extends LabelProvider
+{
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+     */
+    public Image getImage( Object element )
+    {
+        if ( element instanceof ObjectClassImpl )
+        {
+            return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_OBJECT_CLASS )
+                .createImage();
+        }
+
+        // Default
+        return null;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+     */
+    public String getText( Object element )
+    {
+        if ( element instanceof ObjectClassImpl )
+        {
+            ObjectClassImpl oc = ( ObjectClassImpl ) element;
+
+            String[] names = oc.getNames();
+            if ( ( names != null ) && ( names.length > 0 ) )
+            {
+                return ViewUtils.concateAliases( names ) + "  -  (" + oc.getOid() + ")";
+            }
+            else
+            {
+                return "(None)  -  (" + oc.getOid() + ")";
+            }
+        }
+
+        // Default
+        return null;
+    }
+}

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

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/PreviousSearchesDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/PreviousSearchesDialog.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/PreviousSearchesDialog.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/PreviousSearchesDialog.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,193 @@
+/*
+ *  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.dialogs;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.PluginConstants;
+import org.apache.directory.studio.schemaeditor.view.search.SearchPage;
+import org.apache.directory.studio.schemaeditor.view.search.SearchPage.SearchInEnum;
+import org.apache.directory.studio.schemaeditor.view.views.SearchView;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This dialog is used to display the previous searches.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class PreviousSearchesDialog extends Dialog
+{
+    /** The associated view */
+    private SearchView view;
+
+    // UI Fields
+    private TableViewer tableViewer;
+    private Button openButton;
+    private Button removeButton;
+
+
+    /**
+     * Creates a new instance of PreviousSearchesDialog.
+     */
+    public PreviousSearchesDialog( SearchView view )
+    {
+        super( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() );
+        this.view = view;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+     */
+    protected void configureShell( Shell newShell )
+    {
+        super.configureShell( newShell );
+        newShell.setText( "Previous Searches" );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+     */
+    protected Control createDialogArea( Composite parent )
+    {
+        Composite composite = new Composite( parent, SWT.NONE );
+        composite.setLayout( new GridLayout( 2, false ) );
+        composite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+
+        Label label = new Label( composite, SWT.NONE );
+        label.setText( "Select the search to show in the search results view:" );
+        label.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
+
+        tableViewer = new TableViewer( composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE );
+        GridData gd = new GridData( SWT.FILL, SWT.NONE, true, false );
+        gd.widthHint = 300;
+        gd.heightHint = 200;
+        tableViewer.getTable().setLayoutData( gd );
+        tableViewer.setContentProvider( new ArrayContentProvider() );
+        tableViewer.setLabelProvider( new LabelProvider()
+        {
+            public Image getImage( Object element )
+            {
+                return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                    PluginConstants.IMG_SEARCH_HISTORY_ITEM ).createImage();
+            }
+        } );
+        tableViewer.addSelectionChangedListener( new ISelectionChangedListener()
+        {
+            public void selectionChanged( SelectionChangedEvent event )
+            {
+                openButton.setEnabled( !event.getSelection().isEmpty() );
+                removeButton.setEnabled( !event.getSelection().isEmpty() );
+            }
+        } );
+        tableViewer.addDoubleClickListener( new IDoubleClickListener()
+        {
+            public void doubleClick( DoubleClickEvent event )
+            {
+                buttonPressed( IDialogConstants.OK_ID );
+            }
+        } );
+
+        removeButton = new Button( composite, SWT.NONE );
+        removeButton.setText( "Remove" );
+        removeButton.setLayoutData( new GridData( SWT.NONE, SWT.BEGINNING, false, false ) );
+        removeButton.setEnabled( false );
+        removeButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                StructuredSelection selection = ( StructuredSelection ) tableViewer.getSelection();
+                String selectedSearch = ( String ) selection.getFirstElement();
+                SearchPage.removeSearchStringHistory( selectedSearch );
+                initTableViewer();
+            }
+        } );
+
+        initTableViewer();
+
+        return composite;
+    }
+
+
+    /**
+     * Initializes the TableViewer.
+     */
+    private void initTableViewer()
+    {
+        tableViewer.setInput( SearchPage.loadSearchStringHistory() );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+     */
+    protected void createButtonsForButtonBar( Composite parent )
+    {
+        createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+        openButton = createButton( parent, IDialogConstants.OK_ID, "Open", true );
+        openButton.setEnabled( false );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
+     */
+    protected void buttonPressed( int buttonId )
+    {
+        if ( buttonId == IDialogConstants.OK_ID )
+        {
+            if ( !tableViewer.getSelection().isEmpty() )
+            {
+                StructuredSelection selection = ( StructuredSelection ) tableViewer.getSelection();
+                String selectedSearch = ( String ) selection.getFirstElement();
+
+                view.setSearchInput( selectedSearch, SearchPage.loadSearchIn().toArray( new SearchInEnum[0] ),
+                    SearchPage.loadScope() );
+            }
+        }
+
+        super.buttonPressed( buttonId );
+    }
+}

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

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/RenameProjectDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/RenameProjectDialog.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/RenameProjectDialog.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/RenameProjectDialog.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,174 @@
+/*
+ *  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.dialogs;
+
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.controller.ProjectsHandler;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * this dialog is used to rename a project.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class RenameProjectDialog extends Dialog
+{
+    /** The original name*/
+    private String originalName;
+
+    /** The new name */
+    private String newName;
+
+    /** The ProjectsHandler */
+    private ProjectsHandler projectsHandler;
+
+    // UI Fields
+    private Text newNameText;
+    private Composite errorComposite;
+    private Image errorImage;
+    private Label errorLabel;
+    private Button okButton;
+
+
+    /**
+     * Creates a new instance of RenameProjectDialog.
+     *
+     * @param originalName
+     *      the original name of the project
+     */
+    public RenameProjectDialog( String originalName )
+    {
+        super( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() );
+        this.originalName = originalName;
+        projectsHandler = Activator.getDefault().getProjectsHandler();
+
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+     */
+    protected void configureShell( Shell newShell )
+    {
+        super.configureShell( newShell );
+        newShell.setText( "Rename Schema Project" );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+     */
+    protected Control createDialogArea( Composite parent )
+    {
+        Composite composite = new Composite( parent, SWT.NONE );
+        composite.setLayout( new GridLayout( 2, false ) );
+        composite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+
+        // New Name
+        Label newNameLabel = new Label( composite, SWT.NONE );
+        newNameLabel.setText( "New name:" );
+        newNameText = new Text( composite, SWT.BORDER );
+        newNameText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        newNameText.setText( originalName );
+        newNameText.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                newName = newNameText.getText();
+
+                if ( !newName.equals( originalName ) )
+                {
+                    if ( projectsHandler.isProjectNameAlreadyTaken( newName ) )
+                    {
+                        okButton.setEnabled( false );
+                        errorComposite.setVisible( true );
+                        return;
+                    }
+                }
+
+                // Default
+                okButton.setEnabled( true );
+                errorComposite.setVisible( false );
+            }
+        } );
+
+        // Error Composite
+        errorComposite = new Composite( composite, SWT.NONE );
+        errorComposite.setLayout( new GridLayout( 2, false ) );
+        errorComposite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true, 2, 1 ) );
+        errorComposite.setVisible( false );
+
+        // Error Image
+        errorImage = PlatformUI.getWorkbench().getSharedImages().getImage( ISharedImages.IMG_OBJS_ERROR_TSK );
+        Label label = new Label( errorComposite, SWT.NONE );
+        label.setImage( errorImage );
+        label.setSize( 16, 16 );
+
+        // Error Label
+        errorLabel = new Label( errorComposite, SWT.NONE );
+        errorLabel.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+        errorLabel.setText( "A project with the same name already exists." );
+
+        newNameText.setFocus();
+        newNameText.selectAll();
+
+        return composite;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+     */
+    protected void createButtonsForButtonBar( Composite parent )
+    {
+        createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+        okButton = createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true );
+    }
+
+
+    /**
+     * Returns the new name.
+     *
+     * @return
+     *      the new name
+     */
+    public String getNewName()
+    {
+        return newName;
+    }
+}

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

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/NonExistingAttributeType.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/NonExistingAttributeType.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/NonExistingAttributeType.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/NonExistingAttributeType.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,92 @@
+/*
+ *  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.editors;
+
+
+/**
+ * This class implements the Non Existing Attribute Type.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NonExistingAttributeType
+{
+    public static final String NONE = "(None)"; //$NON-NLS-1$
+
+    /** The name */
+    private String name;
+
+
+    /**
+     * Creates a new instance of NonExistingAttributeType.
+     *
+     * @param name
+     *      the name the NonExistingAttributeType
+     */
+    public NonExistingAttributeType( String name )
+    {
+        this.name = name;
+    }
+
+
+    /**
+     * Gets the name of the NonExistingAttributeType.
+     *
+     * @return
+     *      the name of the NonExistingAttributeType
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+
+    /**
+     * Gets the displayable name of the NonExistingAttributeType.
+     *
+     * @return
+     *      the displayable name of the NonExistingAttributeType
+     */
+    public String getDisplayName()
+    {
+        if ( name.equals( NONE ) )
+        {
+            return NONE;
+        }
+        else
+        {
+            return name + "   " + "(This attribute type doesnt exist)";
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals( Object obj )
+    {
+        if ( obj instanceof NonExistingAttributeType )
+        {
+            return name.equalsIgnoreCase( ( ( NonExistingAttributeType ) obj ).getName() );
+        }
+
+        return false;
+    }
+}

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

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/NonExistingMatchingRule.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/NonExistingMatchingRule.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/NonExistingMatchingRule.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/NonExistingMatchingRule.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,93 @@
+/*
+ *  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.editors;
+
+
+/**
+ * This class implements the Non Existing Matching Rule.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NonExistingMatchingRule
+{
+    /** The None matching rule name */
+    public static final String NONE = "(None)";
+
+    /** The name */
+    private String name;
+
+
+    /**
+     * Creates a new instance of NonExistingMatchingRule.
+     *
+     * @param name
+     *      the name the NonExistingMatchingRule
+     */
+    public NonExistingMatchingRule( String name )
+    {
+        this.name = name;
+    }
+
+
+    /**
+     * Gets the name of the NonExistingMatchingRule.
+     *
+     * @return
+     *      the name of the NonExistingMatchingRule
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+
+    /**
+     * Gets the displayable name of the NonExistingMatchingRule.
+     *
+     * @return
+     *      the displayable name of the NonExistingMatchingRule
+     */
+    public String getDisplayName()
+    {
+        if ( name.equals( NONE ) )
+        {
+            return NONE;
+        }
+        else
+        {
+            return name + "   " + "(This matching rule doesnt exist)";
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals( Object obj )
+    {
+        if ( obj instanceof NonExistingMatchingRule )
+        {
+            return name.equalsIgnoreCase( ( ( NonExistingMatchingRule ) obj ).getName() );
+        }
+
+        return false;
+    }
+}

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

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/NonExistingObjectClass.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/NonExistingObjectClass.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/NonExistingObjectClass.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/NonExistingObjectClass.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,92 @@
+/*
+ *  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.editors;
+
+
+/**
+ * This class implements the Non Existing Object Class.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NonExistingObjectClass
+{
+    public static final String NONE = "(None)"; //$NON-NLS-1$
+
+    /** The name */
+    private String name;
+
+
+    /**
+     * Creates a new instance of NonExistingObjectClass.
+     *
+     * @param name
+     *      the name the NonExistingObjectClass
+     */
+    public NonExistingObjectClass( String name )
+    {
+        this.name = name;
+    }
+
+
+    /**
+     * Gets the name of the NonExistingObjectClass.
+     *
+     * @return
+     *      the name of the NonExistingObjectClass
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+
+    /**
+     * Gets the displayable name of the NonExistingObjectClass.
+     *
+     * @return
+     *      the displayable name of the NonExistingObjectClass
+     */
+    public String getDisplayName()
+    {
+        if ( name.equals( NONE ) )
+        {
+            return NONE;
+        }
+        else
+        {
+            return name + "   " + "(This object class doesnt exist)";
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals( Object obj )
+    {
+        if ( obj instanceof NonExistingObjectClass )
+        {
+            return name.equalsIgnoreCase( ( ( NonExistingObjectClass ) obj ).getName() );
+        }
+
+        return false;
+    }
+}

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

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/NonExistingSyntax.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/NonExistingSyntax.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/NonExistingSyntax.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/NonExistingSyntax.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,93 @@
+/*
+ *  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.editors;
+
+
+/**
+ * This class implements the Non Existing Syntax.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NonExistingSyntax
+{
+    /** The None syntax name */
+    public static final String NONE = "(None)"; //$NON-NLS-1$
+
+    /** The name */
+    private String name;
+
+
+    /**
+     * Creates a new instance of NonExistingSyntax.
+     *
+     * @param name
+     *      the name the NonExistingSyntax
+     */
+    public NonExistingSyntax( String name )
+    {
+        this.name = name;
+    }
+
+
+    /**
+     * Gets the name of the NonExistingSyntax.
+     *
+     * @return
+     *      the name of the NonExistingSyntax
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+
+    /**
+     * Gets the displayable name of the NonExistingSyntax.
+     *
+     * @return
+     *      the displayable name of the NonExistingSyntax
+     */
+    public String getDisplayName()
+    {
+        if ( name.equals( NONE ) )
+        {
+            return NONE;
+        }
+        else
+        {
+            return name + "   " + "(This syntax doesnt exist)";
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals( Object obj )
+    {
+        if ( obj instanceof NonExistingSyntax )
+        {
+            return name.equalsIgnoreCase( ( ( NonExistingSyntax ) obj ).getName() );
+        }
+
+        return false;
+    }
+}

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

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboComparator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboComparator.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboComparator.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboComparator.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,85 @@
+/*
+ *  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.editors.attributetype;
+
+
+import java.util.Comparator;
+
+import org.apache.directory.studio.schemaeditor.model.MatchingRuleImpl;
+import org.apache.directory.studio.schemaeditor.view.editors.NonExistingMatchingRule;
+
+
+/**
+ * This class implements the Comparator used to compare elements in the Matching Rules Content Providers.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ATEMatchingRulesComboComparator implements Comparator<Object>
+{
+    /* (non-Javadoc)
+     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+     */
+    public int compare( Object o1, Object o2 )
+    {
+        if ( o1 instanceof MatchingRuleImpl && o2 instanceof MatchingRuleImpl )
+        {
+            String[] mr1Names = ( ( MatchingRuleImpl ) o1 ).getNames();
+            String[] mr2Names = ( ( MatchingRuleImpl ) o2 ).getNames();
+
+            if ( ( mr1Names != null ) && ( mr2Names != null ) && ( mr1Names.length > 0 ) && ( mr2Names.length > 0 ) )
+            {
+                return mr1Names[0].compareToIgnoreCase( mr2Names[0] );
+            }
+        }
+        else if ( o1 instanceof MatchingRuleImpl && o2 instanceof NonExistingMatchingRule )
+        {
+            String[] mr1Names = ( ( MatchingRuleImpl ) o1 ).getNames();
+            String mr2Name = ( ( NonExistingMatchingRule ) o2 ).getName();
+
+            if ( ( mr1Names != null ) && ( mr2Name != null ) && ( mr1Names.length > 0 ) )
+            {
+                return mr1Names[0].compareToIgnoreCase( mr2Name );
+            }
+        }
+        else if ( o1 instanceof NonExistingMatchingRule && o2 instanceof MatchingRuleImpl )
+        {
+            String mr1Name = ( ( NonExistingMatchingRule ) o1 ).getName();
+            String[] mr2Names = ( ( MatchingRuleImpl ) o2 ).getNames();
+
+            if ( ( mr1Name != null ) && ( mr2Names != null ) && ( mr2Names.length > 0 ) )
+            {
+                return mr1Name.compareToIgnoreCase( mr2Names[0] );
+            }
+        }
+        else if ( o1 instanceof NonExistingMatchingRule && o2 instanceof NonExistingMatchingRule )
+        {
+            String mr1Name = ( ( NonExistingMatchingRule ) o1 ).getName();
+            String mr2Name = ( ( NonExistingMatchingRule ) o2 ).getName();
+
+            if ( ( mr1Name != null ) && ( mr2Name != null ) )
+            {
+                return mr1Name.compareToIgnoreCase( mr2Name );
+            }
+        }
+
+        return 0;
+    }
+}

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

Added: directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboContentProvider.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboContentProvider.java?rev=592094&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboContentProvider.java (added)
+++ directory/sandbox/felixk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboContentProvider.java Mon Nov  5 09:14:24 2007
@@ -0,0 +1,92 @@
+/*
+ *  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.editors.attributetype;
+
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.directory.studio.schemaeditor.Activator;
+import org.apache.directory.studio.schemaeditor.model.MatchingRuleImpl;
+import org.apache.directory.studio.schemaeditor.view.editors.NonExistingMatchingRule;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+
+/**
+ * This class implements the Content Provider for the Equality Combo of the Attribute Type Editor.
+ *  
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ATEMatchingRulesComboContentProvider implements IStructuredContentProvider
+{
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+     */
+    public Object[] getElements( Object inputElement )
+    {
+        if ( inputElement instanceof ATEMatchingRulesComboInput )
+        {
+            ATEMatchingRulesComboInput input = ( ATEMatchingRulesComboInput ) inputElement;
+
+            if ( input.getChildren().isEmpty() )
+            {
+                // Creating the '(None)' item
+                input.addChild( new NonExistingMatchingRule( NonExistingMatchingRule.NONE ) );
+
+                // Creating Children
+                List<MatchingRuleImpl> equalityMatchingRules = Activator.getDefault().getSchemaHandler()
+                    .getMatchingRules();
+                for ( MatchingRuleImpl matchingRule : equalityMatchingRules )
+                {
+                    input.addChild( matchingRule );
+                }
+            }
+
+            // Getting Children
+            List<Object> children = input.getChildren();
+
+            // Sorting Children
+            Collections.sort( children, new ATEMatchingRulesComboComparator() );
+
+            return children.toArray();
+        }
+
+        // Default
+        return new Object[0];
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+     */
+    public void dispose()
+    {
+    }
+
+
+    /* (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 )
+    {
+    }
+}

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