directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r523294 - in /directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main: java/org/apache/directory/ldapstudio/schemas/view/dialogs/ java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ resources/org/apache/directory/ld...
Date Wed, 28 Mar 2007 12:34:56 GMT
Author: pamarcelot
Date: Wed Mar 28 05:34:53 2007
New Revision: 523294

URL: http://svn.apache.org/viewvc?view=rev&rev=523294
Log:
Improvded Mandatory and Optional Attributes Tables of the OC Editor. The editor now reveal
explicitly if the an attribute type doesn't exist.
Modified Aliases Dialog Window name.

Modified:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/dialogs/EditAliasesDialog.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorAttributesTableContentProvider.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorAttributesTableLabelProvider.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/resources/org/apache/directory/ldapstudio/schemas/messages.properties

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/dialogs/EditAliasesDialog.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/dialogs/EditAliasesDialog.java?view=diff&rev=523294&r1=523293&r2=523294
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/dialogs/EditAliasesDialog.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/dialogs/EditAliasesDialog.java
Wed Mar 28 05:34:53 2007
@@ -107,7 +107,7 @@
     protected void configureShell( Shell newShell )
     {
         super.configureShell( newShell );
-        newShell.setText( Messages.getString( "EditAliasesDialog.Manage_aliases" ) ); //$NON-NLS-1$
+        newShell.setText( Messages.getString( "EditAliasesDialog.Edit_aliases" ) ); //$NON-NLS-1$
     }
 
 

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorAttributesTableContentProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorAttributesTableContentProvider.java?view=diff&rev=523294&r1=523293&r2=523294
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorAttributesTableContentProvider.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorAttributesTableContentProvider.java
Wed Mar 28 05:34:53 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.AttributeType;
 import org.apache.directory.ldapstudio.schemas.model.SchemaPool;
-import org.apache.directory.ldapstudio.schemas.view.views.wrappers.AttributeTypeWrapper;
-import org.apache.directory.server.core.tools.schema.AttributeTypeLiteral;
+import org.apache.directory.ldapstudio.schemas.view.editors.NonExistingAttributeType;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.Viewer;
 
@@ -59,7 +60,7 @@
     {
         if ( inputElement instanceof String[] )
         {
-            List<AttributeTypeWrapper> results = new ArrayList<AttributeTypeWrapper>();
+            List<Object> results = new ArrayList<Object>();
 
             String[] attributes = ( String[] ) inputElement;
             for ( String attribute : attributes )
@@ -67,17 +68,43 @@
                 AttributeType at = schemaPool.getAttributeType( attribute );
                 if ( at != null )
                 {
-                    results.add( new AttributeTypeWrapper( at, null ) );
+                    results.add( at );
                 }
                 else
                 {
-                    AttributeTypeLiteral atl = new AttributeTypeLiteral( "" );
-                    atl.setNames( new String[]
-                        { attribute } );
-                    AttributeType newAT = new AttributeType( atl, null );
-                    results.add( new AttributeTypeWrapper( newAT, null ) );
+                    results.add( new NonExistingAttributeType( attribute ) );
                 }
             }
+            
+            // Sorting Elements
+            Collections.sort( results, new Comparator<Object>()
+            {
+                public int compare( Object o1, Object o2 )
+                {
+                    if ( o1 instanceof AttributeType && o2 instanceof AttributeType
)
+                    {
+                        return ( ( AttributeType ) o1 ).getNames()[0].compareToIgnoreCase(
( ( AttributeType ) o2 )
+                            .getNames()[0] );
+                    }
+                    else if ( o1 instanceof AttributeType && o2 instanceof NonExistingAttributeType
)
+                    {
+                        return ( ( AttributeType ) o1 ).getNames()[0]
+                            .compareToIgnoreCase( ( ( NonExistingAttributeType ) o2 ).getName()
);
+                    }
+                    else if ( o1 instanceof NonExistingAttributeType && o2 instanceof
AttributeType )
+                    {
+                        return ( ( NonExistingAttributeType ) o1 ).getName().compareToIgnoreCase(
+                            ( ( AttributeType ) o2 ).getNames()[0] );
+                    }
+                    else if ( o1 instanceof NonExistingAttributeType && o2 instanceof
NonExistingAttributeType )
+                    {
+                        return ( ( NonExistingAttributeType ) o1 ).getName().compareToIgnoreCase(
+                            ( ( NonExistingAttributeType ) 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/ObjectClassEditorAttributesTableLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorAttributesTableLabelProvider.java?view=diff&rev=523294&r1=523293&r2=523294
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorAttributesTableLabelProvider.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/objectClass/ObjectClassEditorAttributesTableLabelProvider.java
Wed Mar 28 05:34:53 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.AttributeType;
 import org.apache.directory.ldapstudio.schemas.view.ViewUtils;
-import org.apache.directory.ldapstudio.schemas.view.views.wrappers.AttributeTypeWrapper;
+import org.apache.directory.ldapstudio.schemas.view.editors.NonExistingAttributeType;
 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 AttributeTypeWrapper )
+        if ( ( element instanceof AttributeType ) || ( element instanceof NonExistingAttributeType
) )
         {
             return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_ATTRIBUTE_TYPE
)
                 .createImage();
@@ -60,9 +61,13 @@
      */
     public String getColumnText( Object element, int columnIndex )
     {
-        if ( element instanceof AttributeTypeWrapper )
+        if ( element instanceof AttributeType )
         {
-            return ViewUtils.concateAliases( ( ( AttributeTypeWrapper ) element ).getMyAttributeType().getNames()
);
+            return ViewUtils.concateAliases( ( ( AttributeType ) element ).getNames() );
+        }
+        else if ( element instanceof NonExistingAttributeType )
+        {
+            return ( ( NonExistingAttributeType ) element ).getDisplayName();
         }
 
         // Default

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=523294&r1=523293&r2=523294
==============================================================================
--- 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 05:34:53 2007
@@ -33,12 +33,12 @@
 import org.apache.directory.ldapstudio.schemas.view.dialogs.AttributeTypeSelectionDialog;
 import org.apache.directory.ldapstudio.schemas.view.dialogs.EditAliasesDialog;
 import org.apache.directory.ldapstudio.schemas.view.dialogs.ObjectClassSelectionDialog;
+import org.apache.directory.ldapstudio.schemas.view.editors.NonExistingAttributeType;
 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.shared.asn1.primitives.OID;
 import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
 import org.apache.log4j.Logger;
@@ -263,23 +263,22 @@
                 return;
             }
 
-            AttributeTypeWrapper atw = ( AttributeTypeWrapper ) selection.getFirstElement();
-            if ( atw == null )
-            {
-                return;
-            }
-
-            IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
-
-            AttributeTypeEditorInput input = new AttributeTypeEditorInput( schemaPool.getAttributeType(
atw
-                .getMyAttributeType().getNames()[0] ) );
-            try
-            {
-                page.openEditor( input, AttributeTypeEditor.ID );
-            }
-            catch ( PartInitException exception )
+            Object selectedElement = selection.getFirstElement();
+            if ( selectedElement != null )
             {
-                Logger.getLogger( ObjectClassEditorOverviewPage.class ).debug( "error when
opening the editor" ); //$NON-NLS-1$
+                if ( selectedElement instanceof AttributeType )
+                {
+                    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+                    try
+                    {
+                        page.openEditor( new AttributeTypeEditorInput( ( AttributeType )
selectedElement ),
+                            AttributeTypeEditor.ID );
+                    }
+                    catch ( PartInitException exception )
+                    {
+                        Logger.getLogger( ObjectClassEditorOverviewPage.class ).debug( "error
when opening the editor" ); //$NON-NLS-1$
+                    }
+                }
             }
         }
 
@@ -359,27 +358,35 @@
                 return;
             }
 
-            AttributeTypeWrapper atw = ( AttributeTypeWrapper ) selection.getFirstElement();
-            if ( atw == null )
+            Object selectedElement = selection.getFirstElement();
+            if ( selectedElement != null )
             {
-                return;
-            }
+                List<String> newMusts = new ArrayList<String>();
+                String[] musts = modifiedObjectClass.getMust();
+                for ( String must : musts )
+                {
+                    newMusts.add( must );
+                }
 
-            List<String> newMusts = new ArrayList<String>();
-            String[] musts = modifiedObjectClass.getMust();
-            for ( String must : musts )
-            {
-                newMusts.add( must );
-            }
-            for ( String name : atw.getMyAttributeType().getNames() )
-            {
-                newMusts.remove( name );
-            }
-            modifiedObjectClass.setMust( newMusts.toArray( new String[0] ) );
+                if ( selectedElement instanceof AttributeType )
+                {
+                    for ( String name : ( ( AttributeType ) selectedElement ).getNames()
)
+                    {
+                        newMusts.remove( name );
+                    }
+                }
+                else if ( selectedElement instanceof NonExistingAttributeType )
+                {
+                    newMusts.remove( ( ( NonExistingAttributeType ) selectedElement ).getName()
);
+                }
 
-            fillInMandatoryAttributesTable();
-            removeButtonMandatoryTable.setEnabled( mandatoryAttributesTable.getSelection().length
!= 0 );
-            setEditorDirty();
+                modifiedObjectClass.setMust( newMusts.toArray( new String[0] ) );
+
+                fillInMandatoryAttributesTable();
+                addButtonMandatoryTable.setFocus();
+                removeButtonMandatoryTable.setEnabled( mandatoryAttributesTable.getSelection().length
!= 0 );
+                setEditorDirty();
+            }
         }
     };
 
@@ -394,23 +401,22 @@
                 return;
             }
 
-            AttributeTypeWrapper atw = ( AttributeTypeWrapper ) selection.getFirstElement();
-            if ( atw == null )
-            {
-                return;
-            }
-
-            IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
-
-            AttributeTypeEditorInput input = new AttributeTypeEditorInput( schemaPool.getAttributeType(
atw
-                .getMyAttributeType().getNames()[0] ) );
-            try
-            {
-                page.openEditor( input, AttributeTypeEditor.ID );
-            }
-            catch ( PartInitException exception )
+            Object selectedElement = selection.getFirstElement();
+            if ( selectedElement != null )
             {
-                Logger.getLogger( ObjectClassEditorOverviewPage.class ).debug( "error when
opening the editor" ); //$NON-NLS-1$
+                if ( selectedElement instanceof AttributeType )
+                {
+                    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+                    try
+                    {
+                        page.openEditor( new AttributeTypeEditorInput( ( AttributeType )
selectedElement ),
+                            AttributeTypeEditor.ID );
+                    }
+                    catch ( PartInitException exception )
+                    {
+                        Logger.getLogger( ObjectClassEditorOverviewPage.class ).debug( "error
when opening the editor" ); //$NON-NLS-1$
+                    }
+                }
             }
         }
 
@@ -485,27 +491,35 @@
                 return;
             }
 
-            AttributeTypeWrapper atw = ( AttributeTypeWrapper ) selection.getFirstElement();
-            if ( atw == null )
+            Object selectedElement = selection.getFirstElement();
+            if ( selectedElement != null )
             {
-                return;
-            }
+                List<String> newMays = new ArrayList<String>();
+                String[] mays = modifiedObjectClass.getMay();
+                for ( String may : mays )
+                {
+                    newMays.add( may );
+                }
 
-            List<String> newMays = new ArrayList<String>();
-            String[] mays = modifiedObjectClass.getMay();
-            for ( String may : mays )
-            {
-                newMays.add( may );
-            }
-            for ( String name : atw.getMyAttributeType().getNames() )
-            {
-                newMays.remove( name );
-            }
-            modifiedObjectClass.setMay( newMays.toArray( new String[0] ) );
+                if ( selectedElement instanceof AttributeType )
+                {
+                    for ( String name : ( ( AttributeType ) selectedElement ).getNames()
)
+                    {
+                        newMays.remove( name );
+                    }
+                }
+                else if ( selectedElement instanceof NonExistingAttributeType )
+                {
+                    newMays.remove( ( ( NonExistingAttributeType ) selectedElement ).getName()
);
+                }
 
-            fillInOptionalAttributesTable();
-            removeButtonOptionalTable.setEnabled( optionalAttributesTable.getSelection().length
!= 0 );
-            setEditorDirty();
+                modifiedObjectClass.setMay( newMays.toArray( new String[0] ) );
+
+                fillInOptionalAttributesTable();
+                addButtonOptionalTable.setFocus();
+                removeButtonOptionalTable.setEnabled( optionalAttributesTable.getSelection().length
!= 0 );
+                setEditorDirty();
+            }
         }
     };
 
@@ -628,6 +642,7 @@
                 modifiedObjectClass.setSuperiors( superiors.toArray( new String[0] ) );
 
                 fillInSuperiorsTable();
+                addButtonSuperiorsTable.setFocus();
                 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=523294&r1=523293&r2=523294
==============================================================================
--- 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 05:34:53 2007
@@ -76,7 +76,7 @@
                 }
             }
 
-            // Sorting Children
+            // Sorting Elements
             Collections.sort( results, new Comparator<Object>()
             {
                 public int compare( Object o1, Object o2 )

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/resources/org/apache/directory/ldapstudio/schemas/messages.properties
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/resources/org/apache/directory/ldapstudio/schemas/messages.properties?view=diff&rev=523294&r1=523293&r2=523294
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/resources/org/apache/directory/ldapstudio/schemas/messages.properties
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/resources/org/apache/directory/ldapstudio/schemas/messages.properties
Wed Mar 28 05:34:53 2007
@@ -93,7 +93,7 @@
 AttributeTypeSelectionDialog.Schema=Schema
 
 # EditAliasesDialog  -  org.apache.directory.ldapstudio.schemas.view.dialogs
-EditAliasesDialog.Manage_aliases=Manage aliases
+EditAliasesDialog.Edit_aliases=Edit aliases
 EditAliasesDialog.Aliases=Aliases:
 EditAliasesDialog.Add_an_alias=Add an alias:
 EditAliasesDialog.Add=Add



Mime
View raw message