directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r819519 - in /directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors: attributetype/ objectclass/
Date Mon, 28 Sep 2009 13:03:54 GMT
Author: pamarcelot
Date: Mon Sep 28 13:03:53 2009
New Revision: 819519

URL: http://svn.apache.org/viewvc?rev=819519&view=rev
Log:
Fix for DIRSTUDIO-444 (Allow the user to enter the names of an item inline (using ',' as separator)
in the OC and AT Editors).

Modified:
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java
    directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/messages.properties

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java?rev=819519&r1=819518&r2=819519&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java
(original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java
Mon Sep 28 13:03:53 2009
@@ -729,7 +729,7 @@
         client_general_information.setLayout( new GridLayout( 2, false ) );
         toolkit.paintBordersFor( client_general_information );
         section_general_information.setClient( client_general_information );
-        section_general_information.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true,
true ) );
+        section_general_information.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true,
false ) );
 
         // Adding elements to the section
 
@@ -744,7 +744,6 @@
         aliasCompositeGridLayout.marginWidth = 0;
         aliasComposite.setLayout( aliasCompositeGridLayout );
         aliasComposite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
-
         aliasesText = toolkit.createText( aliasComposite, "" ); //$NON-NLS-1$
         aliasesText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
         aliasesButton = toolkit.createButton( aliasComposite, Messages

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java?rev=819519&r1=819518&r2=819519&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java
(original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java
Mon Sep 28 13:03:53 2009
@@ -35,6 +35,9 @@
 import org.apache.directory.studio.schemaeditor.model.ObjectClassImpl;
 import org.apache.directory.studio.schemaeditor.model.Schema;
 import org.apache.directory.studio.schemaeditor.model.SyntaxImpl;
+import org.apache.directory.studio.schemaeditor.model.alias.Alias;
+import org.apache.directory.studio.schemaeditor.model.alias.AliasWithError;
+import org.apache.directory.studio.schemaeditor.model.alias.AliasesStringParser;
 import org.apache.directory.studio.schemaeditor.view.ViewUtils;
 import org.apache.directory.studio.schemaeditor.view.dialogs.AttributeTypeSelectionDialog;
 import org.apache.directory.studio.schemaeditor.view.dialogs.EditAliasesDialog;
@@ -237,7 +240,7 @@
     };
 
     // UI fields
-    private Label aliasesLabel;
+    private Text aliasesText;
     private Button aliasesButton;
     private Text oidText;
     private Hyperlink schemaLink;
@@ -259,6 +262,29 @@
     private Button removeButtonOptionalTable;
 
     // Listeners
+
+    /** The listener for the Aliases Text Widget */
+    private ModifyListener aliasesTextModifyListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            AliasesStringParser parser = new AliasesStringParser();
+            parser.parse( aliasesText.getText() );
+            List<Alias> parsedAliases = parser.getAliases();
+            modifiedObjectClass.setNames( new String[0] );
+            List<String> aliasesList = new ArrayList<String>();
+            for ( Alias parsedAlias : parsedAliases )
+            {
+                if ( !( parsedAlias instanceof AliasWithError ) )
+                {
+                    aliasesList.add( parsedAlias.getAlias() );
+                }
+            }
+            modifiedObjectClass.setNames( aliasesList.toArray( new String[0] ) );
+            setEditorDirty();
+        }
+    };
+
     /** The listener for Aliases Button Widget */
     private SelectionAdapter aliasesButtonListener = new SelectionAdapter()
     {
@@ -274,11 +300,11 @@
                 modifiedObjectClass.setNames( editDialog.getAliases() );
                 if ( ( modifiedObjectClass.getNamesRef() != null ) && ( modifiedObjectClass.getNamesRef().length
!= 0 ) )
                 {
-                    aliasesLabel.setText( ViewUtils.concateAliases( modifiedObjectClass.getNamesRef()
) );
+                    aliasesText.setText( ViewUtils.concateAliases( modifiedObjectClass.getNamesRef()
) );
                 }
                 else
                 {
-                    aliasesLabel.setText( Messages.getString( "ObjectClassEditorOverviewPage.None"
) );
+                    aliasesText.setText( "" );
                 }
                 setEditorDirty();
             }
@@ -870,7 +896,8 @@
     private void createGeneralInformationSection( Composite parent, FormToolkit toolkit )
     {
         // General Information Section
-        Section section_general_information = toolkit.createSection( parent, Section.DESCRIPTION
| Section.TITLE_BAR );
+        Section section_general_information = toolkit.createSection( parent, Section.DESCRIPTION
| Section.EXPANDED
+            | Section.TITLE_BAR );
         section_general_information.setDescription( Messages
             .getString( "ObjectClassEditorOverviewPage.SpecifyGeneralInformation" ) );
         section_general_information.setText( Messages.getString( "ObjectClassEditorOverviewPage.GeneralInformation"
) );
@@ -878,56 +905,71 @@
 
         // Creating the layout of the section
         Composite client_general_information = toolkit.createComposite( section_general_information
);
-        client_general_information.setLayout( new GridLayout( 3, false ) );
+        client_general_information.setLayout( new GridLayout( 2, false ) );
         toolkit.paintBordersFor( client_general_information );
         section_general_information.setClient( client_general_information );
+        section_general_information.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true,
false ) );
+
+        // Adding elements to the section
 
         // ALIASES Button
         toolkit.createLabel( client_general_information, Messages.getString( "ObjectClassEditorOverviewPage.Aliases"
) );
-        aliasesLabel = toolkit.createLabel( client_general_information, "" ); //$NON-NLS-1$
-        aliasesLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 )
);
-        toolkit.createLabel( client_general_information, "" ); //$NON-NLS-1$
-        aliasesButton = toolkit.createButton( client_general_information, Messages
+        Composite aliasComposite = toolkit.createComposite( client_general_information );
+        GridLayout aliasCompositeGridLayout = new GridLayout( 2, false );
+        aliasCompositeGridLayout.horizontalSpacing = 0;
+        aliasCompositeGridLayout.verticalSpacing = 0;
+        aliasCompositeGridLayout.marginHeight = 0;
+        aliasCompositeGridLayout.marginWidth = 0;
+        aliasComposite.setLayout( aliasCompositeGridLayout );
+        aliasComposite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        aliasesText = toolkit.createText( aliasComposite, "" ); //$NON-NLS-1$
+        aliasesText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        aliasesButton = toolkit.createButton( aliasComposite, Messages
             .getString( "ObjectClassEditorOverviewPage.EditAliases" ), SWT.PUSH );
-        aliasesButton.setLayoutData( new GridData( SWT.NONE, SWT.NONE, false, false, 2, 1
) );
 
         // OID Field
         toolkit.createLabel( client_general_information, Messages.getString( "ObjectClassEditorOverviewPage.OID"
) );
         oidText = toolkit.createText( client_general_information, "" ); //$NON-NLS-1$
-        oidText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
+        oidText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
 
         // SCHEMA Field
         schemaLink = toolkit.createHyperlink( client_general_information, Messages
             .getString( "ObjectClassEditorOverviewPage.Schema" ), SWT.WRAP );
         schemaLabel = toolkit.createLabel( client_general_information, "" ); //$NON-NLS-1$
-        schemaLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 )
);
+        schemaLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
 
         // DESCRIPTION Field
         toolkit.createLabel( client_general_information, Messages
             .getString( "ObjectClassEditorOverviewPage.Description" ) );
         descriptionText = toolkit.createText( client_general_information, "", SWT.MULTI |
SWT.V_SCROLL ); //$NON-NLS-1$
-        GridData descriptionGridData = new GridData( SWT.FILL, SWT.NONE, true, false, 2,
1 );
+        GridData descriptionGridData = new GridData( SWT.FILL, SWT.NONE, true, false );
         descriptionGridData.heightHint = 42;
         descriptionText.setLayoutData( descriptionGridData );
 
         // SUPERIORS Table
         toolkit.createLabel( client_general_information, Messages
             .getString( "ObjectClassEditorOverviewPage.SuperiorClasses" ) );
-        superiorsTable = toolkit.createTable( client_general_information, SWT.SINGLE | SWT.FULL_SELECTION
-            | SWT.H_SCROLL | SWT.V_SCROLL );
-        GridData gridData = new GridData( SWT.FILL, SWT.NONE, true, false );
+        Composite superiorsComposite = toolkit.createComposite( client_general_information
);
+        GridLayout superiorsCompositeGridLayout = new GridLayout( 2, false );
+        superiorsCompositeGridLayout.horizontalSpacing = 0;
+        superiorsCompositeGridLayout.verticalSpacing = 0;
+        superiorsCompositeGridLayout.marginHeight = 0;
+        superiorsCompositeGridLayout.marginWidth = 0;
+        superiorsComposite.setLayout( superiorsCompositeGridLayout );
+        superiorsComposite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false )
);
+        superiorsTable = toolkit.createTable( superiorsComposite, SWT.SINGLE | SWT.FULL_SELECTION
| SWT.H_SCROLL
+            | SWT.V_SCROLL );
+        GridData gridData = new GridData( SWT.FILL, SWT.NONE, true, false, 1, 2 );
         gridData.heightHint = 45;
         gridData.minimumHeight = 45;
         superiorsTable.setLayoutData( gridData );
         superiorsTableViewer = new TableViewer( superiorsTable );
         superiorsTableViewer.setContentProvider( new ObjectClassEditorSuperiorsTableContentProvider()
);
         superiorsTableViewer.setLabelProvider( new ObjectClassEditorSuperiorsTableLabelProvider()
);
-        Composite superiorsButtonComposite = toolkit.createComposite( client_general_information
);
-        superiorsButtonComposite.setLayout( new GridLayout() );
-        addButtonSuperiorsTable = toolkit.createButton( superiorsButtonComposite, Messages
+        addButtonSuperiorsTable = toolkit.createButton( superiorsComposite, Messages
             .getString( "ObjectClassEditorOverviewPage.Add" ), SWT.PUSH );
         addButtonSuperiorsTable.setLayoutData( new GridData( SWT.FILL, SWT.NONE, false, false
) );
-        removeButtonSuperiorsTable = toolkit.createButton( superiorsButtonComposite, Messages
+        removeButtonSuperiorsTable = toolkit.createButton( superiorsComposite, Messages
             .getString( "ObjectClassEditorOverviewPage.Remove" ), SWT.PUSH );
         removeButtonSuperiorsTable.setLayoutData( new GridData( SWT.FILL, SWT.NONE, false,
false ) );
 
@@ -935,14 +977,14 @@
         toolkit
             .createLabel( client_general_information, Messages.getString( "ObjectClassEditorOverviewPage.ClassType"
) );
         classTypeCombo = new Combo( client_general_information, SWT.READ_ONLY | SWT.SINGLE
);
-        classTypeCombo.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1
) );
+        classTypeCombo.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
         initClassTypeCombo();
 
         // OBSOLETE Checkbox
         toolkit.createLabel( client_general_information, "" ); //$NON-NLS-1$
         obsoleteCheckbox = toolkit.createButton( client_general_information, Messages
-            .getString( "ObjectClassEditorOverviewPage.Obesolete" ), SWT.CHECK );
-        obsoleteCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2,
1 ) );
+            .getString( "ObjectClassEditorOverviewPage.Obsolete" ), SWT.CHECK );
+        obsoleteCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
     }
 
 
@@ -1050,11 +1092,11 @@
         // ALIASES Label
         if ( ( modifiedObjectClass.getNamesRef() != null ) && ( modifiedObjectClass.getNamesRef().length
!= 0 ) )
         {
-            aliasesLabel.setText( ViewUtils.concateAliases( modifiedObjectClass.getNamesRef()
) );
+            aliasesText.setText( ViewUtils.concateAliases( modifiedObjectClass.getNamesRef()
) );
         }
         else
         {
-            aliasesLabel.setText( Messages.getString( "ObjectClassEditorOverviewPage.None"
) );
+            aliasesText.setText( "" ); //$NON-NLS-1$
         }
 
         // OID Field
@@ -1151,6 +1193,7 @@
      */
     private void addListeners()
     {
+        aliasesText.addModifyListener( aliasesTextModifyListener );
         aliasesButton.addSelectionListener( aliasesButtonListener );
         oidText.addModifyListener( oidTextModifyListener );
         oidText.addVerifyListener( oidTextVerifyListener );
@@ -1175,6 +1218,7 @@
      */
     private void removeListeners()
     {
+        aliasesText.removeModifyListener( aliasesTextModifyListener );
         aliasesButton.removeSelectionListener( aliasesButtonListener );
         oidText.removeModifyListener( oidTextModifyListener );
         oidText.removeVerifyListener( oidTextVerifyListener );

Modified: directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/messages.properties?rev=819519&r1=819518&r2=819519&view=diff
==============================================================================
--- directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/messages.properties
(original)
+++ directory/studio/trunk/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/messages.properties
Mon Sep 28 13:03:53 2009
@@ -25,13 +25,13 @@
 ObjectClassEditorOverviewPage.Auxiliary=Auxiliary
 ObjectClassEditorOverviewPage.ClassType=Class type:
 ObjectClassEditorOverviewPage.Description=Description:
-ObjectClassEditorOverviewPage.EditAliases=Edit aliases
+ObjectClassEditorOverviewPage.EditAliases=Edit Aliases
 ObjectClassEditorOverviewPage.ElementOIDExists=An element with same oid already exists.
 ObjectClassEditorOverviewPage.GeneralInformation=General information
 ObjectClassEditorOverviewPage.MalformedOID=Malformed OID.
 ObjectClassEditorOverviewPage.MandatoryAttributes=Mandatory attributes
 ObjectClassEditorOverviewPage.None=(None)
-ObjectClassEditorOverviewPage.Obesolete=Obsolete
+ObjectClassEditorOverviewPage.Obsolete=Obsolete
 ObjectClassEditorOverviewPage.OID=OID:
 ObjectClassEditorOverviewPage.OptionalAttributes=Optional attributes
 ObjectClassEditorOverviewPage.Overview=Overview



Mime
View raw message