directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1301093 - /directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/OpenElementAction.java
Date Thu, 15 Mar 2012 17:05:27 GMT
Author: pamarcelot
Date: Thu Mar 15 17:05:27 2012
New Revision: 1301093

URL: http://svn.apache.org/viewvc?rev=1301093&view=rev
Log:
Fix for DIRSTUDIO-796 (Unable to open multiple schema elements (attribute type, object class
or schema)).

Modified:
    directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/OpenElementAction.java

Modified: directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/OpenElementAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/OpenElementAction.java?rev=1301093&r1=1301092&r2=1301093&view=diff
==============================================================================
--- directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/OpenElementAction.java
(original)
+++ directory/studio/trunk/plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/OpenElementAction.java
Thu Mar 15 17:05:27 2012
@@ -75,10 +75,30 @@ public class OpenElementAction extends A
             public void selectionChanged( SelectionChangedEvent event )
             {
                 StructuredSelection selection = ( StructuredSelection ) event.getSelection();
-                setEnabled( ( selection.size() == 1 )
-                    && ( ( selection.getFirstElement() instanceof SchemaWrapper )
-                        || ( selection.getFirstElement() instanceof AttributeTypeWrapper
)
-                        || ( selection.getFirstElement() instanceof ObjectClassWrapper )
) );
+                
+                if ( selection.size() > 0 )
+                {
+                    boolean enabled = true;
+
+                    for ( Iterator<?> iterator = selection.iterator(); iterator.hasNext();
)
+                    {
+                        Object selectedItem = iterator.next();
+
+                        if ( !( selectedItem instanceof SchemaWrapper )
+                            && !( selectedItem instanceof AttributeTypeWrapper )
+                            && !( selectedItem instanceof ObjectClassWrapper ) )
+                        {
+                            enabled = false;
+                            break;
+                        }
+                    }
+
+                    setEnabled( enabled );
+                }
+                else
+                {
+                    setEnabled( false );
+                }
             }
         } );
     }



Mime
View raw message