directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r523238 - in /directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors: ./ attributeType/ objectClass/
Date Wed, 28 Mar 2007 09:06:38 GMT
Author: pamarcelot
Date: Wed Mar 28 02:06:36 2007
New Revision: 523238

URL: http://svn.apache.org/viewvc?view=rev&rev=523238
Log:
Improvded Superiors Selection in the OC Editor. The editor now reveal explicitely if the a
Superior doesn't exist.

Added:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/NonExistingAttributeType.java
      - copied, changed from r522448, directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/NonExistingAttributeType.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/NonExistingObjectClass.java
Removed:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/NonExistingAttributeType.java
Modified:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/ATESuperiorComboContentProvider.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/ATESuperiorComboLabelProvider.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorOverviewPage.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorOverviewPage.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorSuperiorsTableContentProvider.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorSuperiorsTableLabelProvider.java

Copied: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/NonExistingAttributeType.java
(from r522448, directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/NonExistingAttributeType.java)
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/NonExistingAttributeType.java?view=diff&rev=523238&p1=directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/NonExistingAttributeType.java&r1=522448&p2=directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/NonExistingAttributeType.java&r2=523238
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/NonExistingAttributeType.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/NonExistingAttributeType.java
Wed Mar 28 02:06:36 2007
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.ldapstudio.schemas.view.editors.attributeType;
+package org.apache.directory.ldapstudio.schemas.view.editors;
 
 
 import org.apache.directory.ldapstudio.schemas.Messages;

Added: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/NonExistingObjectClass.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/NonExistingObjectClass.java?view=auto&rev=523238
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/NonExistingObjectClass.java
(added)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/NonExistingObjectClass.java
Wed Mar 28 02:06:36 2007
@@ -0,0 +1,95 @@
+/*
+ *  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.ldapstudio.schemas.view.editors;
+
+
+import org.apache.directory.ldapstudio.schemas.Messages;
+
+
+/**
+ * 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 = Messages.getString( "NonExistingObjectClass.(None)"
);
+
+    /** 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 + "   " + Messages.getString( "NonExistingObjectClass.(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;
+    }
+}

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/ATESuperiorComboContentProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/ATESuperiorComboContentProvider.java?view=diff&rev=523238&r1=523237&r2=523238
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/ATESuperiorComboContentProvider.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/ATESuperiorComboContentProvider.java
Wed Mar 28 02:06:36 2007
@@ -26,6 +26,7 @@
 
 import org.apache.directory.ldapstudio.schemas.model.AttributeType;
 import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
+import org.apache.directory.ldapstudio.schemas.view.editors.NonExistingAttributeType;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.Viewer;
 

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/ATESuperiorComboLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/ATESuperiorComboLabelProvider.java?view=diff&rev=523238&r1=523237&r2=523238
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/ATESuperiorComboLabelProvider.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/ATESuperiorComboLabelProvider.java
Wed Mar 28 02:06:36 2007
@@ -22,6 +22,7 @@
 
 import org.apache.directory.ldapstudio.schemas.model.AttributeType;
 import org.apache.directory.ldapstudio.schemas.view.ViewUtils;
+import org.apache.directory.ldapstudio.schemas.view.editors.NonExistingAttributeType;
 import org.eclipse.jface.viewers.LabelProvider;
 
 

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorOverviewPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorOverviewPage.java?view=diff&rev=523238&r1=523237&r2=523238
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorOverviewPage.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/attributeType/AttributeTypeEditorOverviewPage.java
Wed Mar 28 02:06:36 2007
@@ -33,6 +33,7 @@
 import org.apache.directory.ldapstudio.schemas.model.Syntaxes;
 import org.apache.directory.ldapstudio.schemas.view.ViewUtils;
 import org.apache.directory.ldapstudio.schemas.view.dialogs.ManageAliasesDialog;
+import org.apache.directory.ldapstudio.schemas.view.editors.NonExistingAttributeType;
 import org.apache.directory.ldapstudio.schemas.view.editors.schema.SchemaEditor;
 import org.apache.directory.ldapstudio.schemas.view.editors.schema.SchemaEditorInput;
 import org.apache.directory.shared.asn1.primitives.OID;

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorOverviewPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorOverviewPage.java?view=diff&rev=523238&r1=523237&r2=523238
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorOverviewPage.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorOverviewPage.java
Wed Mar 28 02:06:36 2007
@@ -33,12 +33,12 @@
 import org.apache.directory.ldapstudio.schemas.view.dialogs.AttributeTypeSelectionDialog;
 import org.apache.directory.ldapstudio.schemas.view.dialogs.ManageAliasesDialog;
 import org.apache.directory.ldapstudio.schemas.view.dialogs.ObjectClassSelectionDialog;
+import org.apache.directory.ldapstudio.schemas.view.editors.NonExistingObjectClass;
 import org.apache.directory.ldapstudio.schemas.view.editors.attributeType.AttributeTypeEditor;
 import org.apache.directory.ldapstudio.schemas.view.editors.attributeType.AttributeTypeEditorInput;
 import org.apache.directory.ldapstudio.schemas.view.editors.schema.SchemaEditor;
 import org.apache.directory.ldapstudio.schemas.view.editors.schema.SchemaEditorInput;
 import org.apache.directory.ldapstudio.schemas.view.views.wrappers.AttributeTypeWrapper;
-import org.apache.directory.ldapstudio.schemas.view.views.wrappers.ObjectClassWrapper;
 import org.apache.directory.shared.asn1.primitives.OID;
 import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
 import org.apache.log4j.Logger;
@@ -520,23 +520,22 @@
                 return;
             }
 
-            ObjectClassWrapper ocw = ( ObjectClassWrapper ) selection.getFirstElement();
-            if ( ocw == null )
+            Object selectedElement = selection.getFirstElement();
+            if ( selectedElement != null )
             {
-                return;
-            }
-
-            IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
-
-            ObjectClassEditorInput input = new ObjectClassEditorInput( schemaPool.getObjectClass(
ocw
-                .getMyObjectClass().getNames()[0] ) );
-            try
-            {
-                page.openEditor( input, ObjectClassEditor.ID );
-            }
-            catch ( PartInitException exception )
-            {
-                Logger.getLogger( ObjectClassEditorOverviewPage.class ).debug( "error when
opening the editor" ); //$NON-NLS-1$
+                if ( selectedElement instanceof ObjectClass )
+                {
+                    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+                    try
+                    {
+                        page.openEditor( new ObjectClassEditorInput( ( ObjectClass ) selectedElement
),
+                            ObjectClassEditor.ID );
+                    }
+                    catch ( PartInitException exception )
+                    {
+                        Logger.getLogger( ObjectClassEditorOverviewPage.class ).debug( "error
when opening the editor" ); //$NON-NLS-1$
+                    }
+                }
             }
         }
 
@@ -604,27 +603,34 @@
                 return;
             }
 
-            ObjectClassWrapper ocw = ( ObjectClassWrapper ) selection.getFirstElement();
-            if ( ocw == null )
+            Object selectedElement = selection.getFirstElement();
+            if ( selectedElement != null )
             {
-                return;
-            }
+                List<String> superiors = new ArrayList<String>();
+                String[] sups = modifiedObjectClass.getSuperiors();
+                for ( String sup : sups )
+                {
+                    superiors.add( sup );
+                }
 
-            List<String> superiors = new ArrayList<String>();
-            String[] sups = modifiedObjectClass.getSuperiors();
-            for ( String sup : sups )
-            {
-                superiors.add( sup );
-            }
-            for ( String name : ocw.getMyObjectClass().getNames() )
-            {
-                superiors.remove( name );
-            }
-            modifiedObjectClass.setSuperiors( superiors.toArray( new String[0] ) );
+                if ( selectedElement instanceof ObjectClass )
+                {
+                    for ( String name : ( ( ObjectClass ) selectedElement ).getNames() )
+                    {
+                        superiors.remove( name );
+                    }
+                }
+                else if ( selectedElement instanceof NonExistingObjectClass )
+                {
+                    superiors.remove( ( ( NonExistingObjectClass ) selectedElement ).getName()
);
+                }
 
-            fillInSuperiorsTable();
-            removeButtonSuperiorsTable.setEnabled( superiorsTable.getSelection().length !=
0 );
-            setEditorDirty();
+                modifiedObjectClass.setSuperiors( superiors.toArray( new String[0] ) );
+
+                fillInSuperiorsTable();
+                removeButtonSuperiorsTable.setEnabled( superiorsTable.getSelection().length
!= 0 );
+                setEditorDirty();
+            }
         }
     };
 

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorSuperiorsTableContentProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorSuperiorsTableContentProvider.java?view=diff&rev=523238&r1=523237&r2=523238
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorSuperiorsTableContentProvider.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorSuperiorsTableContentProvider.java
Wed Mar 28 02:06:36 2007
@@ -21,12 +21,13 @@
 
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
 import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
 import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
-import org.apache.directory.ldapstudio.schemas.view.views.wrappers.ObjectClassWrapper;
-import org.apache.directory.server.core.tools.schema.ObjectClassLiteral;
+import org.apache.directory.ldapstudio.schemas.view.editors.NonExistingObjectClass;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.Viewer;
 
@@ -59,7 +60,7 @@
     {
         if ( inputElement instanceof String[] )
         {
-            List<ObjectClassWrapper> results = new ArrayList<ObjectClassWrapper>();
+            List<Object> results = new ArrayList<Object>();
 
             String[] superiors = ( String[] ) inputElement;
             for ( String superior : superiors )
@@ -67,17 +68,43 @@
                 ObjectClass oc = schemaPool.getObjectClass( superior );
                 if ( oc != null )
                 {
-                    results.add( new ObjectClassWrapper( oc, null ) );
+                    results.add( oc );
                 }
                 else
                 {
-                    ObjectClassLiteral ocl = new ObjectClassLiteral( "" );
-                    ocl.setNames( new String[]
-                        { superior } );
-                    ObjectClass newOC = new ObjectClass( ocl, null );
-                    results.add( new ObjectClassWrapper( newOC, null ) );
+                    results.add( new NonExistingObjectClass( superior ) );
                 }
             }
+
+            // Sorting Children
+            Collections.sort( results, new Comparator<Object>()
+            {
+                public int compare( Object o1, Object o2 )
+                {
+                    if ( o1 instanceof ObjectClass && o2 instanceof ObjectClass )
+                    {
+                        return ( ( ObjectClass ) o1 ).getNames()[0].compareToIgnoreCase(
( ( ObjectClass ) o2 )
+                            .getNames()[0] );
+                    }
+                    else if ( o1 instanceof ObjectClass && o2 instanceof NonExistingObjectClass
)
+                    {
+                        return ( ( ObjectClass ) o1 ).getNames()[0]
+                            .compareToIgnoreCase( ( ( NonExistingObjectClass ) o2 ).getName()
);
+                    }
+                    else if ( o1 instanceof NonExistingObjectClass && o2 instanceof
ObjectClass )
+                    {
+                        return ( ( NonExistingObjectClass ) o1 ).getName().compareToIgnoreCase(
+                            ( ( ObjectClass ) o2 ).getNames()[0] );
+                    }
+                    else if ( o1 instanceof NonExistingObjectClass && o2 instanceof
NonExistingObjectClass )
+                    {
+                        return ( ( NonExistingObjectClass ) o1 ).getName().compareToIgnoreCase(
+                            ( ( NonExistingObjectClass ) o2 ).getName() );
+                    }
+
+                    return 0;
+                }
+            } );
 
             return results.toArray();
         }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorSuperiorsTableLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorSuperiorsTableLabelProvider.java?view=diff&rev=523238&r1=523237&r2=523238
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorSuperiorsTableLabelProvider.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorSuperiorsTableLabelProvider.java
Wed Mar 28 02:06:36 2007
@@ -23,8 +23,9 @@
 
 import org.apache.directory.ldapstudio.schemas.Activator;
 import org.apache.directory.ldapstudio.schemas.PluginConstants;
+import org.apache.directory.ldapstudio.schemas.model.ObjectClass;
 import org.apache.directory.ldapstudio.schemas.view.ViewUtils;
-import org.apache.directory.ldapstudio.schemas.view.views.wrappers.ObjectClassWrapper;
+import org.apache.directory.ldapstudio.schemas.view.editors.NonExistingObjectClass;
 import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.swt.graphics.Image;
@@ -44,7 +45,7 @@
      */
     public Image getColumnImage( Object element, int columnIndex )
     {
-        if ( element instanceof ObjectClassWrapper )
+        if ( ( element instanceof ObjectClass ) || ( element instanceof NonExistingObjectClass
) )
         {
             return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_OBJECT_CLASS
)
                 .createImage();
@@ -60,9 +61,13 @@
      */
     public String getColumnText( Object element, int columnIndex )
     {
-        if ( element instanceof ObjectClassWrapper )
+        if ( element instanceof ObjectClass )
         {
-            return ViewUtils.concateAliases( ( ( ObjectClassWrapper ) element ).getMyObjectClass().getNames()
);
+            return ViewUtils.concateAliases( ( ( ObjectClass ) element ).getNames() );
+        }
+        else if ( element instanceof NonExistingObjectClass )
+        {
+            return ( ( NonExistingObjectClass ) element ).getDisplayName();
         }
 
         // Default



Mime
View raw message