directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1214217 - in /directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor: controller/ view/dialogs/ view/editors/attributetype/ view/editors/objectclass/ view/wizards/
Date Wed, 14 Dec 2011 12:43:12 GMT
Author: pamarcelot
Date: Wed Dec 14 12:43:12 2011
New Revision: 1214217

URL: http://svn.apache.org/viewvc?rev=1214217&view=rev
Log:
Part of a fix for DIRSTUDIO-446 (Allow the user to rename any item using the F2 shortcut).

Modified:
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaHandler.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditAttributeTypeAliasesDialog.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditObjectClassAliasesDialog.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/RenameObjectClassDialog.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/MergeSchemasWizard.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/NewAttributeTypeGeneralWizardPage.java
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/NewObjectClassGeneralPageWizardPage.java

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaHandler.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaHandler.java?rev=1214217&r1=1214216&r2=1214217&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaHandler.java
(original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaHandler.java
Wed Dec 14 12:43:12 2011
@@ -911,29 +911,27 @@ public class SchemaHandler
 
 
     /**
-     * Verifies if the given alias or oid is already taken by a schema object
+     * Verifies if the given oid is already taken by a schema object.
      *
-     * @param id
-     *      the alias or oid
-     * @return
-     *      true if the the alias or oid is already taken
+     * @param oid the oid
+     * @return <code>true</code> if the the oid is already taken
      */
-    public boolean isAliasOrOidAlreadyTaken( String id )
+    public boolean isOidAlreadyTaken( String oid )
     {
-        String lowerCasedId = Strings.toLowerCase( id );
-        if ( attributeTypesMap.containsKey( lowerCasedId ) )
+        String lowerCasedOid = Strings.toLowerCase( oid );
+        if ( attributeTypesMap.containsKey( lowerCasedOid ) )
         {
             return true;
         }
-        else if ( objectClassesMap.containsKey( lowerCasedId ) )
+        else if ( objectClassesMap.containsKey( lowerCasedOid ) )
         {
             return true;
         }
-        else if ( matchingRulesMap.containsKey( lowerCasedId ) )
+        else if ( matchingRulesMap.containsKey( lowerCasedOid ) )
         {
             return true;
         }
-        else if ( syntaxesMap.containsKey( lowerCasedId ) )
+        else if ( syntaxesMap.containsKey( lowerCasedOid ) )
         {
             return true;
         }
@@ -943,6 +941,30 @@ public class SchemaHandler
 
 
     /**
+     * Verifies if the given alias is already taken by an attribute type.
+     *
+     * @param alias the alias
+     * @return <code>true</code> if the the alias is already taken
+     */
+    public boolean isAliasAlreadyTakenForAttributeType( String alias )
+    {
+        return attributeTypesMap.containsKey( Strings.toLowerCase( alias ) );
+    }
+
+
+    /**
+     * Verifies if the given alias is already taken by an object class.
+     *
+     * @param alias the alias
+     * @return <code>true</code> if the the alias is already taken
+     */
+    public boolean isAliasAlreadyTakenForObjectClass( String alias )
+    {
+        return objectClassesMap.containsKey( Strings.toLowerCase( alias ) );
+    }
+
+
+    /**
      * Verifies if the given name for a schema is already taken by another schema.
      *
      * @param name

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditAttributeTypeAliasesDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditAttributeTypeAliasesDialog.java?rev=1214217&r1=1214216&r2=1214217&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditAttributeTypeAliasesDialog.java
(original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditAttributeTypeAliasesDialog.java
Wed Dec 14 12:43:12 2011
@@ -22,6 +22,7 @@ package org.apache.directory.studio.sche
 
 import java.util.List;
 
+import org.apache.directory.studio.schemaeditor.Activator;
 import org.eclipse.swt.widgets.Shell;
 
 
@@ -67,7 +68,6 @@ public class EditAttributeTypeAliasesDia
      */
     protected boolean isAliasAlreadyTaken( String alias )
     {
-        // TODO Auto-generated method stub
-        return false;
+        return Activator.getDefault().getSchemaHandler().isAliasAlreadyTakenForAttributeType(
alias );
     }
 }

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditObjectClassAliasesDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditObjectClassAliasesDialog.java?rev=1214217&r1=1214216&r2=1214217&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditObjectClassAliasesDialog.java
(original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/EditObjectClassAliasesDialog.java
Wed Dec 14 12:43:12 2011
@@ -22,6 +22,7 @@ package org.apache.directory.studio.sche
 
 import java.util.List;
 
+import org.apache.directory.studio.schemaeditor.Activator;
 import org.eclipse.swt.widgets.Shell;
 
 
@@ -67,7 +68,6 @@ public class EditObjectClassAliasesDialo
      */
     protected boolean isAliasAlreadyTaken( String alias )
     {
-        // TODO Auto-generated method stub
-        return false;
+        return Activator.getDefault().getSchemaHandler().isAliasAlreadyTakenForObjectClass(
alias );
     }
 }

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/RenameObjectClassDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/RenameObjectClassDialog.java?rev=1214217&r1=1214216&r2=1214217&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/RenameObjectClassDialog.java
(original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/dialogs/RenameObjectClassDialog.java
Wed Dec 14 12:43:12 2011
@@ -30,7 +30,7 @@ import org.eclipse.swt.widgets.Shell;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class RenameObjectClassDialog extends EditAttributeTypeAliasesDialog
+public class RenameObjectClassDialog extends EditObjectClassAliasesDialog
 {
     /**
      * Creates a new instance of RenameObjectClassDialog.

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java?rev=1214217&r1=1214216&r2=1214217&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java
(original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/attributetype/AttributeTypeEditorOverviewPage.java
Wed Dec 14 12:43:12 2011
@@ -285,7 +285,7 @@ public class AttributeTypeEditorOverview
             if ( Oid.isOid( oid ) )
             {
                 if ( ( originalAttributeType.getOid().equals( oid ) )
-                    || !( schemaHandler.isAliasOrOidAlreadyTaken( oid ) ) )
+                    || !( schemaHandler.isOidAlreadyTaken( oid ) ) )
                 {
                     modifiedAttributeType.setOid( oid );
                     setEditorDirty();

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java?rev=1214217&r1=1214216&r2=1214217&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java
(original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/editors/objectclass/ObjectClassEditorOverviewPage.java
Wed Dec 14 12:43:12 2011
@@ -286,7 +286,7 @@ public class ObjectClassEditorOverviewPa
             if ( Oid.isOid( oid ) )
             {
                 if ( ( originalObjectClass.getOid().equals( oid ) )
-                    || !( schemaHandler.isAliasOrOidAlreadyTaken( oid ) ) )
+                    || !( schemaHandler.isOidAlreadyTaken( oid ) ) )
                 {
                     modifiedObjectClass.setOid( oid );
                     setEditorDirty();

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/MergeSchemasWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/MergeSchemasWizard.java?rev=1214217&r1=1214216&r2=1214217&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/MergeSchemasWizard.java
(original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/MergeSchemasWizard.java
Wed Dec 14 12:43:12 2011
@@ -261,13 +261,13 @@ public class MergeSchemasWizard extends 
         }
 
         // check if OID or alias name already exist in target project
-        boolean oidOrAliasAlreadyTaken = targetProject.getSchemaHandler().isAliasOrOidAlreadyTaken(
+        boolean oidOrAliasAlreadyTaken = targetProject.getSchemaHandler().isOidAlreadyTaken(
             sourceAttributeType.getOid() );
         if ( !oidOrAliasAlreadyTaken )
         {
             for ( String name : sourceAttributeType.getNames() )
             {
-                oidOrAliasAlreadyTaken = targetProject.getSchemaHandler().isAliasOrOidAlreadyTaken(
name );
+                oidOrAliasAlreadyTaken = targetProject.getSchemaHandler().isAliasAlreadyTakenForAttributeType(
name );
                 if ( oidOrAliasAlreadyTaken )
                 {
                     break;
@@ -385,13 +385,13 @@ public class MergeSchemasWizard extends 
         }
 
         // check if OID or alias name already exist in target project
-        boolean oidOrAliasAlreadyTaken = targetProject.getSchemaHandler().isAliasOrOidAlreadyTaken(
+        boolean oidOrAliasAlreadyTaken = targetProject.getSchemaHandler().isOidAlreadyTaken(
             sourceObjectClass.getOid() );
         if ( !oidOrAliasAlreadyTaken )
         {
             for ( String name : sourceObjectClass.getNames() )
             {
-                oidOrAliasAlreadyTaken = targetProject.getSchemaHandler().isAliasOrOidAlreadyTaken(
name );
+                oidOrAliasAlreadyTaken = targetProject.getSchemaHandler().isAliasAlreadyTakenForObjectClass(
name );
                 if ( oidOrAliasAlreadyTaken )
                 {
                     break;
@@ -442,7 +442,8 @@ public class MergeSchemasWizard extends 
                         {
                             if ( superClassName != null )
                             {
-                                ObjectClass superSourceObjectClass = Activator.getDefault().getSchemaHandler().getObjectClass(
superClassName );
+                                ObjectClass superSourceObjectClass = Activator.getDefault().getSchemaHandler()
+                                    .getObjectClass( superClassName );
                                 ObjectClass superTargetObjectClass = targetProject.getSchemaHandler()
                                     .getObjectClass( superClassName );
                                 if ( superSourceObjectClass != null )
@@ -482,7 +483,8 @@ public class MergeSchemasWizard extends 
                     {
                         if ( attributeName != null )
                         {
-                            AttributeType attributeType = Activator.getDefault().getSchemaHandler().getAttributeType(
attributeName );
+                            AttributeType attributeType = Activator.getDefault().getSchemaHandler()
+                                .getAttributeType( attributeName );
                             if ( attributeType != null )
                             {
                                 mergeAttributeType( attributeType, targetProject, targetSchema,
processedObjects,

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/NewAttributeTypeGeneralWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/NewAttributeTypeGeneralWizardPage.java?rev=1214217&r1=1214216&r2=1214217&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/NewAttributeTypeGeneralWizardPage.java
(original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/NewAttributeTypeGeneralWizardPage.java
Wed Dec 14 12:43:12 2011
@@ -335,7 +335,7 @@ public class NewAttributeTypeGeneralWiza
             return;
         }
         if ( ( !oidCombo.getText().equals( "" ) ) && ( Oid.isOid( oidCombo.getText()
) ) //$NON-NLS-1$
-            && ( schemaHandler.isAliasOrOidAlreadyTaken( oidCombo.getText() ) ) )
+            && ( schemaHandler.isOidAlreadyTaken( oidCombo.getText() ) ) )
         {
             displayErrorMessage( Messages.getString( "NewAttributeTypeGeneralWizardPage.ErrorObjectOIDExists"
) ); //$NON-NLS-1$
             return;

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/NewObjectClassGeneralPageWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/NewObjectClassGeneralPageWizardPage.java?rev=1214217&r1=1214216&r2=1214217&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/NewObjectClassGeneralPageWizardPage.java
(original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wizards/NewObjectClassGeneralPageWizardPage.java
Wed Dec 14 12:43:12 2011
@@ -336,7 +336,7 @@ public class NewObjectClassGeneralPageWi
             return;
         }
         if ( ( !oidCombo.getText().equals( "" ) ) && ( Oid.isOid( oidCombo.getText()
) ) //$NON-NLS-1$
-            && ( schemaHandler.isAliasOrOidAlreadyTaken( oidCombo.getText() ) ) )
+            && ( schemaHandler.isOidAlreadyTaken( oidCombo.getText() ) ) )
         {
             displayErrorMessage( Messages.getString( "NewObjectClassGeneralPageWizardPage.ErrorObjectOIDExists"
) ); //$NON-NLS-1$
             return;



Mime
View raw message