directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r553196 [1/5] - in /directory/studio/trunk/studio-apacheds-schemaeditor: ./ META-INF/ src/main/java/org/apache/directory/studio/apacheds/schemaeditor/ src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/ src/main/java...
Date Wed, 04 Jul 2007 13:05:20 GMT
Author: pamarcelot
Date: Wed Jul  4 06:05:16 2007
New Revision: 553196

URL: http://svn.apache.org/viewvc?view=rev&rev=553196
Log:
Added the AttributeTypeEditor, ObjectClassEditor and SchemaEditor (some small refactorings are still needed).

Added:
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/ViewUtils.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/NonExistingAttributeType.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/NonExistingMatchingRule.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/NonExistingObjectClass.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/NonExistingSyntax.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboComparator.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboContentProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboInput.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboLabelProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboContentProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboInput.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboLabelProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESyntaxComboContentProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESyntaxComboInput.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESyntaxComboLabelProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEUsedByMandatoryTableContentProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEUsedByOptionalTableContentProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEUsedByTablesLabelProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditor.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditorInput.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditorSourceCodePage.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/AttributeTypeEditorUsedByPage.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditor.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditorAttributesTableContentProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditorAttributesTableLabelProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditorInput.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditorSourceCodePage.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditorSuperiorsTableContentProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/objectclass/ObjectClassEditorSuperiorsTableLabelProvider.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditor.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditorInput.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditorOverviewPage.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/schema/SchemaEditorSourceCodePage.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/SchemaCodeScanner.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/SchemaSourceViewer.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/SchemaSourceViewerConfiguration.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/SchemaTextAttributeProvider.java
Modified:
    directory/studio/trunk/studio-apacheds-schemaeditor/.classpath
    directory/studio/trunk/studio-apacheds-schemaeditor/META-INF/MANIFEST.MF
    directory/studio/trunk/studio-apacheds-schemaeditor/build.properties
    directory/studio/trunk/studio-apacheds-schemaeditor/ivy.xml
    directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginUtils.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandler.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/EditAliasesDialog.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/AttributeTypeWrapper.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wrappers/ObjectClassWrapper.java

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/.classpath
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/.classpath?view=diff&rev=553196&r1=553195&r2=553196
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/.classpath (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/.classpath Wed Jul  4 06:05:16 2007
@@ -5,5 +5,6 @@
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 	<classpathentry kind="lib" path="lib/junit-3.8.2.jar"/>
+	<classpathentry kind="lib" path="lib/apacheds-core-plugin-1.5.0-SNAPSHOT.jar"/>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/META-INF/MANIFEST.MF?view=diff&rev=553196&r1=553195&r2=553196
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/META-INF/MANIFEST.MF (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/META-INF/MANIFEST.MF Wed Jul  4 06:05:16 2007
@@ -8,6 +8,9 @@
 Bundle-Localization: plugin
 Require-Bundle: org.eclipse.ui,
  org.apache.directory.studio.jars,
- org.eclipse.core.runtime
+ org.eclipse.core.runtime,
+ org.eclipse.ui.forms,
+ org.eclipse.jface.text
 Eclipse-LazyStart: true
-Bundle-ClassPath: .
+Bundle-ClassPath: .,
+ lib/apacheds-core-plugin-1.5.0-SNAPSHOT.jar

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/build.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/build.properties?view=diff&rev=553196&r1=553195&r2=553196
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/build.properties (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/build.properties Wed Jul  4 06:05:16 2007
@@ -6,4 +6,5 @@
                META-INF/,\
                .,\
                resources/,\
-               lib/
+               lib/,\
+               lib/apacheds-core-plugin-1.5.0-SNAPSHOT.jar

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/ivy.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/ivy.xml?view=diff&rev=553196&r1=553195&r2=553196
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/ivy.xml (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/ivy.xml Wed Jul  4 06:05:16 2007
@@ -20,5 +20,6 @@
 	<info organisation="org.apache.directory.studio" module="studio-apacheds-schemaeditor"/>
 	<dependencies>
 		<dependency org="junit" name="junit" rev="3.8.2"/>
+		<dependency org="org.apache.directory.server" name="apacheds-core-plugin" rev="1.5.0-SNAPSHOT"/>
     </dependencies>
 </ivy-module>

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml?view=diff&rev=553196&r1=553195&r2=553196
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/plugin.xml Wed Jul  4 06:05:16 2007
@@ -58,4 +58,25 @@
           name="New Object Class"
           project="false"/>
  </extension>
+ <extension
+		point="org.eclipse.ui.editors">
+	<editor
+		class="org.apache.directory.studio.apacheds.schemaeditor.view.editors.objectclass.ObjectClassEditor"
+		default="false"
+		icon="resources/icons/object_class.gif"
+		id="org.apache.directory.studio.apacheds.schemaeditor.view.objectClassEditor"
+		name="Object Class Editor"/>
+      <editor
+ 		class="org.apache.directory.studio.apacheds.schemaeditor.view.editors.attributetype.AttributeTypeEditor"
+		default="false"
+		icon="resources/icons/attribute_type.gif"
+		id="org.apache.directory.studio.apacheds.schemaeditor.view.attributeTypeEditor"
+		name="Attribute Type Editor"/>
+      <editor
+		class="org.apache.directory.studio.apacheds.schemaeditor.view.editors.schema.SchemaEditor"
+		default="false"
+		icon="resources/icons/schema.gif"
+		id="org.apache.directory.studio.apacheds.schemaeditor.view.schemaformeditor"
+		name="Schema Editor"/>
+</extension>
 </plugin>

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java?view=diff&rev=553196&r1=553195&r2=553196
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/Activator.java Wed Jul  4 06:05:16 2007
@@ -21,6 +21,9 @@
 
 
 import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandler;
+import org.apache.directory.studio.apacheds.schemaeditor.view.widget.SchemaCodeScanner;
+import org.apache.directory.studio.apacheds.schemaeditor.view.widget.SchemaTextAttributeProvider;
+import org.eclipse.jface.text.rules.ITokenScanner;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
 
@@ -39,6 +42,12 @@
     /** The shared instance */
     private static Activator plugin;
 
+    /** the Schema Code Scanner */
+    private static ITokenScanner schemaCodeScanner;
+
+    /** The Schema Text Attribute Provider */
+    private static SchemaTextAttributeProvider schemaTextAttributeProvider;
+
     /** The SchemaHandler */
     private SchemaHandler schemaHandler;
 
@@ -60,7 +69,7 @@
     public void start( BundleContext context ) throws Exception
     {
         super.start( context );
-        
+
         FakeLoader.loadSchemas();
     }
 
@@ -96,5 +105,39 @@
     public SchemaHandler getSchemaHandler()
     {
         return schemaHandler;
+    }
+
+
+    /**
+     * Returns the Schema Code Scanner.
+     *
+     * @return
+     *      the Schema Code Scanner
+     */
+    public static ITokenScanner getSchemaCodeScanner()
+    {
+        if ( schemaCodeScanner == null )
+        {
+            schemaCodeScanner = new SchemaCodeScanner( getSchemaTextAttributeProvider() );
+        }
+
+        return schemaCodeScanner;
+    }
+
+
+    /**
+     * Returns the Schema Text Attribute Provider.
+     *
+     * @return
+     *     the Schema Text Attribute Provider 
+     */
+    private static SchemaTextAttributeProvider getSchemaTextAttributeProvider()
+    {
+        if ( schemaTextAttributeProvider == null )
+        {
+            schemaTextAttributeProvider = new SchemaTextAttributeProvider();
+        }
+
+        return schemaTextAttributeProvider;
     }
 }

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginUtils.java?view=diff&rev=553196&r1=553195&r2=553196
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginUtils.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginUtils.java Wed Jul  4 06:05:16 2007
@@ -20,6 +20,12 @@
 package org.apache.directory.studio.apacheds.schemaeditor;
 
 
+import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
+import org.apache.directory.shared.ldap.schema.UsageEnum;
+import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl;
+
+
 /**
  * This class contains helper methods.
  *
@@ -40,5 +46,311 @@
     public static boolean verifyName( String name )
     {
         return name.matches( "[a-zA-Z]+[a-zA-Z0-9;-]*" ); //$NON-NLS-1$
+    }
+
+
+    /**
+     * Returns a clone of the given attribute type.
+     *
+     * @param at
+     *      the attribute type to clone
+     * @return
+     *      a clone of the given attribute type
+     */
+    public static AttributeTypeImpl getClone( AttributeTypeImpl at )
+    {
+        AttributeTypeImpl clone = new AttributeTypeImpl( at.getOid() );
+        clone.setNames( at.getNames() );
+        clone.setSchema( at.getSchema() );
+        clone.setDescription( at.getDescription() );
+        clone.setSuperiorName( at.getSubstrName() );
+        clone.setUsage( clone.getUsage() );
+        clone.setSyntaxOid( at.getSyntaxOid() );
+        clone.setLength( at.getLength() );
+        clone.setObsolete( at.isObsolete() );
+        clone.setSingleValue( at.isSingleValue() );
+        clone.setCollective( at.isCollective() );
+        clone.setCanUserModify( clone.isCanUserModify() );
+        clone.setEqualityName( at.getEqualityName() );
+        clone.setOrderingName( at.getOrderingName() );
+        clone.setSubstrName( at.getSubstrName() );
+
+        return clone;
+    }
+
+
+    /**
+     * Returns a clone of the given object class.
+     *
+     * @param oc
+     *      the object class to clone
+     * @return
+     *      a clone of the given object class
+     */
+    public static ObjectClassImpl getClone( ObjectClassImpl oc )
+    {
+        ObjectClassImpl clone = new ObjectClassImpl( oc.getOid() );
+        clone.setNames( oc.getNames() );
+        clone.setSchema( oc.getSchema() );
+        clone.setDescription( oc.getDescription() );
+        clone.setSuperClassesNames( oc.getSuperClassesNames() );
+        clone.setType( oc.getType() );
+        clone.setObsolete( oc.isObsolete() );
+        clone.setMustNamesList( oc.getMustNamesList() );
+        clone.setMayNamesList( oc.getMayNamesList() );
+
+        return clone;
+    }
+
+
+    /**
+     * Converts the given attribute type to its source code representation
+     * in OpenLDAP Schema file format.
+     *
+     * @param at
+     *      the attribute type to convert
+     * @return
+     *      the corresponding source code representation
+     */
+    public static String toSourceCode( AttributeTypeImpl at )
+    {
+        StringBuffer sb = new StringBuffer();
+
+        // Opening the definition and OID
+        sb.append( "attributetype ( " + at.getOid() + " \n" ); //$NON-NLS-1$ //$NON-NLS-2$
+
+        // NAME(S)
+        String[] names = at.getNames();
+        sb.append( "\tNAME " ); //$NON-NLS-1$
+        if ( names.length > 1 )
+        {
+            sb.append( "( " ); //$NON-NLS-1$
+            for ( String name : names )
+            {
+                sb.append( "'" + name + "' " ); //$NON-NLS-1$ //$NON-NLS-2$
+            }
+            sb.append( ") \n" ); //$NON-NLS-1$
+        }
+        else
+        {
+            sb.append( "'" + names[0] + "' \n" ); //$NON-NLS-1$ //$NON-NLS-2$
+        }
+
+        // DESC
+        if ( ( at.getDescription() != null ) && ( !at.getDescription().equals( "" ) ) ) //$NON-NLS-1$
+        {
+            sb.append( "\tDESC '" + at.getDescription() + "' \n" ); //$NON-NLS-1$ //$NON-NLS-2$
+        }
+
+        // OBSOLETE
+        if ( at.isObsolete() )
+        {
+            sb.append( "\tOBSOLETE \n" ); //$NON-NLS-1$
+        }
+
+        // SUP
+        if ( ( at.getSuperiorName() != null ) && ( !at.getSuperiorName().equals( "" ) ) ) //$NON-NLS-1$
+        {
+            sb.append( "\tSUP " + at.getSuperiorName() + " \n" ); //$NON-NLS-1$ //$NON-NLS-2$
+        }
+
+        // EQUALITY
+        if ( ( at.getEqualityName() != null ) && ( !at.getEqualityName().equals( "" ) ) ) //$NON-NLS-1$
+        {
+            sb.append( "\tEQUALITY " + at.getEqualityName() + " \n" ); //$NON-NLS-1$ //$NON-NLS-2$
+        }
+
+        // ORDERING
+        if ( ( at.getOrderingName() != null ) && ( !at.getOrderingName().equals( "" ) ) ) //$NON-NLS-1$
+        {
+            sb.append( "\tORDERING " + at.getOrderingName() + " \n" ); //$NON-NLS-1$ //$NON-NLS-2$
+        }
+
+        // SUBSTR
+        if ( ( at.getSubstrName() != null ) && ( !at.getSubstrName().equals( "" ) ) ) //$NON-NLS-1$
+        {
+            sb.append( "\tSUBSTR " + at.getSubstrName() + " \n" ); //$NON-NLS-1$ //$NON-NLS-2$
+        }
+
+        // SYNTAX
+        if ( ( at.getSyntaxOid() != null ) && ( !at.getSyntaxOid().equals( "" ) ) ) //$NON-NLS-1$
+        {
+            sb.append( "\tSYNTAX " + at.getSyntaxOid() ); //$NON-NLS-1$
+            if ( at.getLength() > 0 )
+            {
+                sb.append( "{" + at.getLength() + "}" ); //$NON-NLS-1$ //$NON-NLS-2$
+            }
+            sb.append( " \n" ); //$NON-NLS-1$
+        }
+
+        // SINGLE-VALUE
+        if ( at.isSingleValue() )
+        {
+            sb.append( "\tSINGLE-VALUE \n" ); //$NON-NLS-1$
+        }
+
+        // COLLECTIVE
+        if ( at.isCollective() )
+        {
+            sb.append( "\tCOLLECTIVE \n" ); //$NON-NLS-1$
+        }
+
+        // NO-USER-MODIFICATION
+        if ( !at.isCanUserModify() )
+        {
+            sb.append( "\tNO-USER-MODIFICATION \n" ); //$NON-NLS-1$
+        }
+
+        // USAGE
+        UsageEnum usage = at.getUsage();
+        if ( usage != null )
+        {
+            if ( usage == UsageEnum.DIRECTORY_OPERATION )
+            {
+                sb.append( "\tUSAGE directoryOperation \n" ); //$NON-NLS-1$
+            }
+            else if ( usage == UsageEnum.DISTRIBUTED_OPERATION )
+            {
+                sb.append( "\tUSAGE distributedOperation \n" ); //$NON-NLS-1$
+            }
+            else if ( usage == UsageEnum.DSA_OPERATION )
+            {
+                sb.append( "\tUSAGE dSAOperation \n" ); //$NON-NLS-1$
+            }
+            else if ( usage == UsageEnum.USER_APPLICATIONS )
+            {
+                // There's nothing to write, this is the default option
+            }
+        }
+
+        // Closing the definition
+        sb.append( " )\n" ); //$NON-NLS-1$
+
+        return sb.toString();
+    }
+
+
+    /**
+     * Converts the given object class to its source code representation
+     * in OpenLDAP Schema file format.
+     *
+     * @param at
+     *      the object class to convert
+     * @return
+     *      the corresponding source code representation
+     */
+    public static String toSourceCode( ObjectClassImpl oc )
+    {
+        StringBuffer sb = new StringBuffer();
+
+        // Opening the definition and OID
+        sb.append( "objectclass ( " + oc.getOid() + " \n" ); //$NON-NLS-1$ //$NON-NLS-2$
+
+        // NAME(S)
+        String[] names = oc.getNames();
+        sb.append( "\tNAME " ); //$NON-NLS-1$
+        if ( names.length > 1 )
+        {
+            sb.append( "( " ); //$NON-NLS-1$
+            for ( String name : names )
+            {
+                sb.append( "'" + name + "' " ); //$NON-NLS-1$ //$NON-NLS-2$
+            }
+            sb.append( ") \n" ); //$NON-NLS-1$
+        }
+        else
+        {
+            sb.append( "'" + names[0] + "' \n" ); //$NON-NLS-1$ //$NON-NLS-2$
+        }
+
+        // DESC
+        if ( ( oc.getDescription() != null ) && ( !oc.getDescription().equals( "" ) ) ) //$NON-NLS-1$
+        {
+            sb.append( "\tDESC '" + oc.getDescription() + "' \n" ); //$NON-NLS-1$ //$NON-NLS-2$
+        }
+
+        // OBSOLETE
+        if ( oc.isObsolete() )
+        {
+            sb.append( "\tOBSOLETE \n" ); //$NON-NLS-1$
+        }
+
+        // SUP
+        String[] superiors = oc.getSuperClassesNames();
+        if ( ( superiors != null ) && ( superiors.length != 0 ) )
+        {
+            if ( superiors.length > 1 )
+            {
+                sb.append( "\tSUP (" + superiors[0] ); //$NON-NLS-1$
+                for ( int i = 1; i < superiors.length; i++ )
+                {
+                    sb.append( " $ " + superiors[i] ); //$NON-NLS-1$
+                }
+                sb.append( ") \n" ); //$NON-NLS-1$
+            }
+            else
+            {
+                sb.append( "\tSUP " + superiors[0] + " \n" ); //$NON-NLS-1$ //$NON-NLS-2$
+            }
+        }
+
+        // CLASSTYPE
+        ObjectClassTypeEnum classtype = oc.getType();
+        if ( classtype == ObjectClassTypeEnum.ABSTRACT )
+        {
+            sb.append( "\tABSTRACT \n" ); //$NON-NLS-1$
+        }
+        else if ( classtype == ObjectClassTypeEnum.AUXILIARY )
+        {
+            sb.append( "\tAUXILIARY \n" ); //$NON-NLS-1$
+        }
+        else if ( classtype == ObjectClassTypeEnum.STRUCTURAL )
+        {
+            sb.append( "\tSTRUCTURAL \n" ); //$NON-NLS-1$
+        }
+
+        // MUST
+        String[] must = oc.getMustNamesList();
+        if ( ( must != null ) && ( must.length != 0 ) )
+        {
+            sb.append( "\tMUST " ); //$NON-NLS-1$
+            if ( must.length > 1 )
+            {
+                sb.append( "( " + must[0] + " " ); //$NON-NLS-1$ //$NON-NLS-2$
+                for ( int i = 1; i < must.length; i++ )
+                {
+                    sb.append( "$ " + must[i] + " " ); //$NON-NLS-1$ //$NON-NLS-2$
+                }
+                sb.append( ") \n" ); //$NON-NLS-1$
+            }
+            else if ( must.length == 1 )
+            {
+                sb.append( must[0] + " \n" ); //$NON-NLS-1$
+            }
+        }
+
+        // MAY
+        String[] may = oc.getMayNamesList();
+        if ( ( may != null ) && ( may.length != 0 ) )
+        {
+            sb.append( "\tMAY " ); //$NON-NLS-1$
+            if ( may.length > 1 )
+            {
+                sb.append( "( " + may[0] + " " ); //$NON-NLS-1$ //$NON-NLS-2$
+                for ( int i = 1; i < may.length; i++ )
+                {
+                    sb.append( "$ " + may[i] + " " ); //$NON-NLS-1$ //$NON-NLS-2$
+                }
+                sb.append( ") \n" ); //$NON-NLS-1$
+            }
+            else if ( may.length == 1 )
+            {
+                sb.append( may[0] + " \n" ); //$NON-NLS-1$
+            }
+        }
+        // Closing the definition
+        sb.append( " )\n" ); //$NON-NLS-1$
+
+        return sb.toString();
     }
 }

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandler.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandler.java?view=diff&rev=553196&r1=553195&r2=553196
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandler.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaHandler.java Wed Jul  4 06:05:16 2007
@@ -260,10 +260,8 @@
 
 
     /**
-     * Adds a SchemaListener to the given schema.
+     * Adds a SchemaHandlerListener.
      *
-     * @param schema
-     *      the schema
      * @param listener
      *      the listener
      */
@@ -277,6 +275,18 @@
 
 
     /**
+     * Removes a SchemaHandlerListener.
+     *
+     * @param listener
+     *      the listener
+     */
+    public void removeListener( SchemaHandlerListener listener )
+    {
+        schemaHandlerListeners.remove( listener );
+    }
+
+
+    /**
      * Adds a SchemaListener to the given schema.
      *
      * @param schema
@@ -294,7 +304,21 @@
 
 
     /**
-     * Adds a AttributeTypeListener to the given attribute type.
+     * Removes a SchemaListener to the given schema.
+     *
+     * @param schema
+     *      the schema
+     * @param listener
+     *      the listener
+     */
+    public void removeListener( Schema schema, SchemaListener listener )
+    {
+        schemaListeners.remove( schema, listener );
+    }
+
+
+    /**
+     * Adds an AttributeTypeListener to the given attribute type.
      *
      * @param at
      *      the attribute type
@@ -311,7 +335,21 @@
 
 
     /**
-     * Adds a AttributeTypeListener to the given object class.
+     * Removes an AttributeTypeListener to the given attribute type.
+     *
+     * @param at
+     *      the attribute type
+     * @param listener
+     *      the listener
+     */
+    public void removeListener( AttributeTypeImpl at, AttributeTypeListener listener )
+    {
+        attributeTypeListeners.remove( at, listener );
+    }
+
+
+    /**
+     * Adds an ObjectClassListener to the given object class.
      *
      * @param oc
      *      the object class
@@ -328,6 +366,20 @@
 
 
     /**
+     * Removes an ObjectClassListener to the given object class.
+     *
+     * @param oc
+     *      the object class
+     * @param listener
+     *      the listener
+     */
+    public void removeListener( ObjectClassImpl oc, ObjectClassListener listener )
+    {
+        objectClassListeners.remove( oc, listener );
+    }
+
+
+    /**
      * Adds a schema
      *
      * @param schema
@@ -882,21 +934,29 @@
 
 
     /**
-     * Verifies if the Alias is already taken by a schema object
+     * Verifies if the given alias or oid is already taken by a schema object
      *
-     * @param alias
-     *      the alias
+     * @param id
+     *      the alias or oid
      * @return
-     *      true if the the alias is already taken
+     *      true if the the alias or oid is already taken
      */
-    public boolean isAliasAlreadyTaken( String alias )
+    public boolean isAliasOrOidAlreadyTaken( String id )
     {
-        String lowerCasedAlias = alias.toLowerCase();
-        if ( attributeTypesMap.containsKey( lowerCasedAlias ) )
+        String lowerCasedId = id.toLowerCase();
+        if ( attributeTypesMap.containsKey( lowerCasedId ) )
+        {
+            return true;
+        }
+        else if ( objectClassesMap.containsKey( lowerCasedId ) )
+        {
+            return true;
+        }
+        else if ( matchingRulesMap.containsKey( lowerCasedId ) )
         {
             return true;
         }
-        else if ( objectClassesMap.containsKey( lowerCasedAlias ) )
+        else if ( syntaxesMap.containsKey( lowerCasedId ) )
         {
             return true;
         }

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java?view=diff&rev=553196&r1=553195&r2=553196
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java Wed Jul  4 06:05:16 2007
@@ -21,6 +21,10 @@
 
 
 import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.ConnectAction;
+import org.apache.directory.studio.apacheds.schemaeditor.view.editors.attributetype.AttributeTypeEditor;
+import org.apache.directory.studio.apacheds.schemaeditor.view.editors.attributetype.AttributeTypeEditorInput;
+import org.apache.directory.studio.apacheds.schemaeditor.view.editors.objectclass.ObjectClassEditor;
+import org.apache.directory.studio.apacheds.schemaeditor.view.editors.objectclass.ObjectClassEditorInput;
 import org.apache.directory.studio.apacheds.schemaeditor.view.views.SchemaView;
 import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.AttributeTypeWrapper;
 import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.Folder;
@@ -34,6 +38,7 @@
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
 
 
@@ -47,7 +52,7 @@
 {
     /** The associated view */
     private SchemaView view;
-    
+
     // The Actions
     private Action connect;
 
@@ -61,12 +66,13 @@
     public SchemaViewController( SchemaView view )
     {
         this.view = view;
-        
+
         initActions();
         initToolbar();
         initDoubleClickListener();
     }
-    
+
+
     /**
      * Initializes the Actions.
      */
@@ -74,7 +80,8 @@
     {
         connect = new ConnectAction( view );
     }
-    
+
+
     /**
      * Initializes the Toolbar.
      */
@@ -109,34 +116,34 @@
                 // Selecting the right editor and input
                 if ( objectSelection instanceof AttributeTypeWrapper )
                 {
-//                    input = new AttributeTypeEditorInput( ( ( AttributeTypeWrapper ) objectSelection )
-//                        .getMyAttributeType() );
-//                    editorId = AttributeTypeEditor.ID;
+                    input = new AttributeTypeEditorInput( ( ( AttributeTypeWrapper ) objectSelection )
+                        .getAttributeType() );
+                    editorId = AttributeTypeEditor.ID;
                 }
                 else if ( objectSelection instanceof ObjectClassWrapper )
                 {
-//                    input = new ObjectClassEditorInput( ( ( ObjectClassWrapper ) objectSelection ).getMyObjectClass() );
-//                    editorId = ObjectClassEditor.ID;
+                    input = new ObjectClassEditorInput( ( ( ObjectClassWrapper ) objectSelection ).getObjectClass() );
+                    editorId = ObjectClassEditor.ID;
                 }
-                else if ( ( objectSelection instanceof Folder )
-                    || ( objectSelection instanceof SchemaWrapper ) )
+                else if ( ( objectSelection instanceof Folder ) || ( objectSelection instanceof SchemaWrapper ) )
                 {
                     // Here we don't open an editor, we just expand the node.
                     viewer.setExpandedState( objectSelection, !viewer.getExpandedState( objectSelection ) );
                 }
 
                 // Let's open the editor
-//                if ( input != null )
-//                {
-//                    try
-//                    {
-//                        page.openEditor( input, editorId );
-//                    }
-//                    catch ( PartInitException e )
-//                    {
-////                        logger.debug( "error when opening the editor" ); //$NON-NLS-1$
-//                    }
-//                }
+                if ( input != null )
+                {
+                    try
+                    {
+                        page.openEditor( input, editorId );
+                    }
+                    catch ( PartInitException e )
+                    {
+//                        logger.debug( "error when opening the editor" ); //$NON-NLS-1$
+                    e.printStackTrace();
+                    }
+                }
             }
         } );
     }

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/ViewUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/ViewUtils.java?view=auto&rev=553196
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/ViewUtils.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/ViewUtils.java Wed Jul  4 06:05:16 2007
@@ -0,0 +1,177 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.view;
+
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This Helper Class contains useful methods used to create the UI.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ViewUtils
+{
+    /** The Black Color */
+    public static final Color COLOR_BLACK = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()
+        .getDisplay().getSystemColor( SWT.COLOR_BLACK );
+
+    /** The Red Color */
+    public static final Color COLOR_RED = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getDisplay()
+        .getSystemColor( SWT.COLOR_RED );
+
+
+    /**
+     * Concatenates all aliases in a String format. Aliases are separated with a comma (',')
+     *
+     * @param aliases
+     *      the aliases to concatenate
+     * @return
+     *      a String representing all aliases
+     */
+    public static String concateAliases( String[] aliases )
+    {
+        StringBuffer sb = new StringBuffer();
+        if ( aliases.length > 0 )
+        {
+            sb.append( aliases[0] );
+            for ( int i = 1; i < aliases.length; i++ )
+            {
+                sb.append( ", " ); //$NON-NLS-1$
+                sb.append( aliases[i] );
+            }
+        }
+
+        return sb.toString();
+    }
+
+
+    /**
+     * Verifies that the given name is syntaxely correct according to the RFC 2252 
+     * (Lightweight Directory Access Protocol (v3): Attribute Syntax Definitions).
+     *
+     * @param name
+     *      the name to test
+     * @return
+     *      true if the name is correct, false if the name is not correct.
+     */
+    public static boolean verifyName( String name )
+    {
+        return name.matches( "[a-zA-Z]+[a-zA-Z0-9;-]*" ); //$NON-NLS-1$
+    }
+
+
+    /**
+     * Displays an Error Message Box with the given title and message.
+     *
+     * @param title
+     *      the title of the window
+     * @param message
+     *      the message to display
+     * @return
+     *      the ID of the button that was selected to dismiss 
+     *      the message box (e.g. SWT.OK, SWT.CANCEL, etc...)
+     */
+    public static int displayErrorMessageBox( String title, String message )
+    {
+        return displayMessageBox( SWT.OK | SWT.ICON_ERROR, title, message );
+    }
+
+
+    /**
+     * Displays a Information Message Box with the given title and message.
+     *
+     * @param title
+     *      the title of the window
+     * @param message
+     *      the message to display
+     * @return
+     *      the ID of the button that was selected to dismiss 
+     *      the message box (e.g. SWT.OK, SWT.CANCEL, etc...)
+     */
+    public static int displayWarningMessageBox( String title, String message )
+    {
+        return displayMessageBox( SWT.OK | SWT.ICON_WARNING, title, message );
+    }
+
+
+    /**
+     * Displays a Information Message Box with the given title and message.
+     *
+     * @param title
+     *      the title of the window
+     * @param message
+     *      the message to display
+     * @return
+     *      the ID of the button that was selected to dismiss 
+     *      the message box (e.g. SWT.OK, SWT.CANCEL, etc...)
+     */
+    public static int displayInformationMessageBox( String title, String message )
+    {
+        return displayMessageBox( SWT.OK | SWT.ICON_INFORMATION, title, message );
+    }
+
+
+    /**
+     * Displays a Information Question Box with the given title and message.
+     *
+     * @param buttonStyle
+     *      the style of the buttons of the dialog (e.g. SWT.OK, SWT.CANCEL, etc...)
+     * @param title
+     *      the title of the window
+     * @param message
+     *      the message to display
+     * @return
+     *      the ID of the button that was selected to dismiss 
+     *      the message box (e.g. SWT.OK, SWT.CANCEL, etc...)
+     */
+    public static int displayQuestionMessageBox( int buttonStyle, String title, String message )
+    {
+        return displayMessageBox( SWT.ICON_QUESTION | buttonStyle, title, message );
+    }
+
+
+    /**
+     * Displays a Message Box with the given style, title and message.
+     *
+     * @param style
+     *      the style of dialog
+     * @param title
+     *      the title of the window
+     * @param message
+     *      the message to display
+     * @return
+     *      the ID of the button that was selected to dismiss 
+     *      the message box (e.g. SWT.OK, SWT.CANCEL, etc...)
+     */
+    private static int displayMessageBox( int style, String title, String message )
+    {
+        MessageBox messageBox = new MessageBox( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), style );
+        messageBox.setText( title );
+        messageBox.setMessage( message );
+        return messageBox.open();
+    }
+
+}

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/EditAliasesDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/EditAliasesDialog.java?view=diff&rev=553196&r1=553195&r2=553196
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/EditAliasesDialog.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/dialogs/EditAliasesDialog.java Wed Jul  4 06:05:16 2007
@@ -241,7 +241,7 @@
                     String text = newAliasText.getText();
 
                     if ( ( !"".equals( text ) ) && ( !aliasesLowerCased.contains( text.toLowerCase() ) ) //$NON-NLS-1$
-                        && ( !Activator.getDefault().getSchemaHandler().isAliasAlreadyTaken( text ) ) )
+                        && ( !Activator.getDefault().getSchemaHandler().isAliasOrOidAlreadyTaken( text ) ) )
                     {
                         addANewAlias();
                     }
@@ -267,7 +267,7 @@
                     errorLabel.setText( "This alias already exists in the list." );
                     newAliasAddButton.setEnabled( false );
                 }
-                else if ( Activator.getDefault().getSchemaHandler().isAliasAlreadyTaken( text ) )
+                else if ( Activator.getDefault().getSchemaHandler().isAliasOrOidAlreadyTaken( text ) )
                 {
                     errorComposite.setVisible( true );
                     errorLabel.setText( "An element with the same alias already exists." );

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/NonExistingAttributeType.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/NonExistingAttributeType.java?view=auto&rev=553196
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/NonExistingAttributeType.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/NonExistingAttributeType.java Wed Jul  4 06:05:16 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.apacheds.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;
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/NonExistingMatchingRule.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/NonExistingMatchingRule.java?view=auto&rev=553196
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/NonExistingMatchingRule.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/NonExistingMatchingRule.java Wed Jul  4 06:05:16 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.apacheds.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;
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/NonExistingObjectClass.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/NonExistingObjectClass.java?view=auto&rev=553196
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/NonExistingObjectClass.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/NonExistingObjectClass.java Wed Jul  4 06:05:16 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.apacheds.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;
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/NonExistingSyntax.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/NonExistingSyntax.java?view=auto&rev=553196
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/NonExistingSyntax.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/NonExistingSyntax.java Wed Jul  4 06:05:16 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.apacheds.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;
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboComparator.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboComparator.java?view=auto&rev=553196
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboComparator.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboComparator.java Wed Jul  4 06:05:16 2007
@@ -0,0 +1,62 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.view.editors.attributetype;
+
+
+import java.util.Comparator;
+
+import org.apache.directory.studio.apacheds.schemaeditor.model.MatchingRuleImpl;
+import org.apache.directory.studio.apacheds.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 )
+        {
+            return ( ( MatchingRuleImpl ) o1 ).getName().compareToIgnoreCase( ( ( MatchingRuleImpl ) o2 ).getName() );
+        }
+        else if ( o1 instanceof MatchingRuleImpl && o2 instanceof NonExistingMatchingRule )
+        {
+            return ( ( MatchingRuleImpl ) o1 ).getName().compareToIgnoreCase( ( ( NonExistingMatchingRule ) o2 ).getName() );
+        }
+        else if ( o1 instanceof NonExistingMatchingRule && o2 instanceof MatchingRuleImpl )
+        {
+            return ( ( NonExistingMatchingRule ) o1 ).getName().compareToIgnoreCase( ( ( MatchingRuleImpl ) o2 ).getName() );
+        }
+        else if ( o1 instanceof NonExistingMatchingRule && o2 instanceof NonExistingMatchingRule )
+        {
+            return ( ( NonExistingMatchingRule ) o1 ).getName().compareToIgnoreCase(
+                ( ( NonExistingMatchingRule ) o2 ).getName() );
+        }
+
+        return 0;
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboContentProvider.java?view=auto&rev=553196
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboContentProvider.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboContentProvider.java Wed Jul  4 06:05:16 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.apacheds.schemaeditor.view.editors.attributetype;
+
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.model.MatchingRuleImpl;
+import org.apache.directory.studio.apacheds.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 )
+    {
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboInput.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboInput.java?view=auto&rev=553196
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboInput.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboInput.java Wed Jul  4 06:05:16 2007
@@ -0,0 +1,71 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.view.editors.attributetype;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * This class implements the Input of the Matching Rules Combo of the Attribute Type Editor
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ATEMatchingRulesComboInput
+{
+    /** The children */
+    private List<Object> children;
+
+
+    /**
+     * Adds a child.
+     *
+     * @param child
+     *      the child to add
+     */
+    public void addChild( Object child )
+    {
+        if ( children == null )
+        {
+            children = new ArrayList<Object>();
+        }
+
+        children.add( child );
+    }
+
+
+    /**
+     * Gets the children.
+     *
+     * @return
+     *      the children
+     */
+    public List<Object> getChildren()
+    {
+        if ( children == null )
+        {
+            children = new ArrayList<Object>();
+        }
+
+        return children;
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboLabelProvider.java?view=auto&rev=553196
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboLabelProvider.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATEMatchingRulesComboLabelProvider.java Wed Jul  4 06:05:16 2007
@@ -0,0 +1,53 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.view.editors.attributetype;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.model.MatchingRuleImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.view.editors.NonExistingMatchingRule;
+import org.eclipse.jface.viewers.LabelProvider;
+
+
+/**
+ * This class implements the Label Provider of the Matching Rules Combo of the Attribute Type Editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ATEMatchingRulesComboLabelProvider extends LabelProvider
+{
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+     */
+    public String getText( Object obj )
+    {
+        if ( obj instanceof MatchingRuleImpl )
+        {
+            return ( ( MatchingRuleImpl ) obj ).getName();
+        }
+        else if ( obj instanceof NonExistingMatchingRule )
+        {
+            return ( ( NonExistingMatchingRule ) obj ).getDisplayName();
+        }
+
+        // Default
+        return null;
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboContentProvider.java?view=auto&rev=553196
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboContentProvider.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboContentProvider.java Wed Jul  4 06:05:16 2007
@@ -0,0 +1,178 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.view.editors.attributetype;
+
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaHandler;
+import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.view.editors.NonExistingAttributeType;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+
+/**
+ * This class implements the Content Provider for the Superior Combo of the Attribute Type Editor.
+ *  
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ATESuperiorComboContentProvider implements IStructuredContentProvider
+{
+    /** The Schema Handler */
+    private SchemaHandler schemaHandler;
+
+
+    /**
+     * Creates a new instance of ATESuperiorComboContentProvider.
+     */
+    public ATESuperiorComboContentProvider()
+    {
+        schemaHandler = Activator.getDefault().getSchemaHandler();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+     */
+    public Object[] getElements( Object inputElement )
+    {
+        if ( inputElement instanceof ATESuperiorComboInput )
+        {
+            ATESuperiorComboInput input = ( ATESuperiorComboInput ) inputElement;
+
+            if ( input.getChildren().isEmpty() )
+            {
+                AttributeTypeImpl editorAT = input.getAttributeType();
+
+                // Creating the '(None)' item
+                input.addChild( new NonExistingAttributeType( NonExistingAttributeType.NONE ) );
+
+                // Creating Children
+                List<AttributeTypeImpl> ats = schemaHandler.getAttributeTypes();
+                for ( AttributeTypeImpl at : ats )
+                {
+                    if ( !isSubType( at, editorAT ) )
+                    {
+                        input.addChild( at );
+                    }
+                }
+            }
+
+            // Getting Children
+            List<Object> children = input.getChildren();
+
+            // Sorting Children
+            Collections.sort( children, new Comparator<Object>()
+            {
+                public int compare( Object o1, Object o2 )
+                {
+                    if ( o1 instanceof AttributeTypeImpl && o2 instanceof AttributeTypeImpl )
+                    {
+                        return ( ( AttributeTypeImpl ) o1 ).getNames()[0]
+                            .compareToIgnoreCase( ( ( AttributeTypeImpl ) o2 ).getNames()[0] );
+                    }
+                    else if ( o1 instanceof AttributeTypeImpl && o2 instanceof NonExistingAttributeType )
+                    {
+                        return ( ( AttributeTypeImpl ) o1 ).getNames()[0]
+                            .compareToIgnoreCase( ( ( NonExistingAttributeType ) o2 ).getName() );
+                    }
+                    else if ( o1 instanceof NonExistingAttributeType && o2 instanceof AttributeTypeImpl )
+                    {
+                        return ( ( NonExistingAttributeType ) o1 ).getName().compareToIgnoreCase(
+                            ( ( AttributeTypeImpl ) o2 ).getNames()[0] );
+                    }
+                    else if ( o1 instanceof NonExistingAttributeType && o2 instanceof NonExistingAttributeType )
+                    {
+                        return ( ( NonExistingAttributeType ) o1 ).getName().compareToIgnoreCase(
+                            ( ( NonExistingAttributeType ) o2 ).getName() );
+                    }
+
+                    return 0;
+                }
+            } );
+
+            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 )
+    {
+    }
+
+
+    /**
+     * Checks id an Attribute Type is a sub type of another Attribute Type.
+     *
+     * @param at1
+     *      the first Attribute Type
+     * @param at2
+     *      the second Attribute Type
+     * @return
+     *      true if at1 is a sub type of at2
+     */
+    private boolean isSubType( AttributeTypeImpl at1, AttributeTypeImpl at2 )
+    {
+        if ( at1.equals( at2 ) )
+        {
+            return true;
+        }
+        else
+        {
+            String sup = at1.getSuperiorName();
+
+            if ( sup == null )
+            {
+                return false;
+            }
+            else
+            {
+                AttributeTypeImpl supAT = schemaHandler.getAttributeType( sup );
+                if ( supAT == null )
+                {
+                    return false;
+                }
+                else
+                {
+                    return isSubType( supAT, at2 );
+                }
+            }
+        }
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboInput.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboInput.java?view=auto&rev=553196
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboInput.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboInput.java Wed Jul  4 06:05:16 2007
@@ -0,0 +1,100 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.view.editors.attributetype;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
+
+
+/**
+ * This class implements the Input of the Superior Combo of the Attribute Type Editor
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ATESuperiorComboInput
+{
+    /** The attribute type */
+    private AttributeTypeImpl at;
+
+    /** The children */
+    private List<Object> children;
+
+
+    /**
+     * Creates a new instance of ATESuperiorComboInput.
+     *
+     * @param at
+     *      the Attribute Type
+     */
+    public ATESuperiorComboInput( AttributeTypeImpl at )
+    {
+        this.at = at;
+    }
+
+
+    /**
+     * Gets the Attribute Type.
+     *
+     * @return
+     *      the attribute type
+     */
+    public AttributeTypeImpl getAttributeType()
+    {
+        return at;
+    }
+
+
+    /**
+     * Adds a child.
+     *
+     * @param child
+     *      the child to add
+     */
+    public void addChild( Object child )
+    {
+        if ( children == null )
+        {
+            children = new ArrayList<Object>();
+        }
+
+        children.add( child );
+    }
+
+
+    /**
+     * Gets the children.
+     *
+     * @return
+     *      the children
+     */
+    public List<Object> getChildren()
+    {
+        if ( children == null )
+        {
+            children = new ArrayList<Object>();
+        }
+
+        return children;
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboLabelProvider.java?view=auto&rev=553196
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboLabelProvider.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/editors/attributetype/ATESuperiorComboLabelProvider.java Wed Jul  4 06:05:16 2007
@@ -0,0 +1,54 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.view.editors.attributetype;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
+import org.apache.directory.studio.apacheds.schemaeditor.view.ViewUtils;
+import org.apache.directory.studio.apacheds.schemaeditor.view.editors.NonExistingAttributeType;
+import org.eclipse.jface.viewers.LabelProvider;
+
+
+/**
+ * This class implements the Label Provider of the Superior Combo of the Attribute Type Editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ATESuperiorComboLabelProvider extends LabelProvider
+{
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+     */
+    public String getText( Object obj )
+    {
+        if ( obj instanceof AttributeTypeImpl )
+        {
+            return ViewUtils.concateAliases( ( ( AttributeTypeImpl ) obj ).getNames() );
+        }
+        else if ( obj instanceof NonExistingAttributeType )
+        {
+            return ( ( NonExistingAttributeType ) obj ).getDisplayName();
+        }
+
+        // Default
+        return null;
+    }
+}



Mime
View raw message