directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r581833 - in /directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions: NewAttributeTypeAction.java NewObjectClassAction.java
Date Thu, 04 Oct 2007 10:09:38 GMT
Author: pamarcelot
Date: Thu Oct  4 03:09:37 2007
New Revision: 581833

URL: http://svn.apache.org/viewvc?rev=581833&view=rev
Log:
Part of a fix for DIRSTUDIO-200 (Add an OC and AT hierarchical global view)

Modified:
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewAttributeTypeAction.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewObjectClassAction.java

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewAttributeTypeAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewAttributeTypeAction.java?rev=581833&r1=581832&r2=581833&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewAttributeTypeAction.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewAttributeTypeAction.java
Thu Oct  4 03:09:37 2007
@@ -76,44 +76,50 @@
     {
         // Getting the selection
         Schema selectedSchema = null;
-        StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
-        if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
+
+        int presentation = Activator.getDefault().getPreferenceStore().getInt(
+            PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION );
+        if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT )
         {
-            // TODO REFACTOR THIS
-            Object firstElement = selection.getFirstElement();
-            if ( firstElement instanceof SchemaWrapper )
-            {
-                selectedSchema = ( ( SchemaWrapper ) firstElement ).getSchema();
-            }
-            else if ( firstElement instanceof Folder )
-            {
-                selectedSchema = ( ( SchemaWrapper ) ( ( Folder ) firstElement ).getParent()
).getSchema();
-            }
-            else if ( firstElement instanceof AttributeTypeWrapper )
+            StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
+            if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
             {
-                TreeNode parent = ( ( AttributeTypeWrapper ) firstElement ).getParent();
-
-                if ( parent instanceof Folder )
+                // TODO REFACTOR THIS
+                Object firstElement = selection.getFirstElement();
+                if ( firstElement instanceof SchemaWrapper )
                 {
-                    selectedSchema = ( ( SchemaWrapper ) ( ( Folder ) parent ).getParent()
).getSchema();
-
+                    selectedSchema = ( ( SchemaWrapper ) firstElement ).getSchema();
                 }
-                else if ( parent instanceof SchemaWrapper )
+                else if ( firstElement instanceof Folder )
                 {
-                    selectedSchema = ( ( SchemaWrapper ) parent ).getSchema();
+                    selectedSchema = ( ( SchemaWrapper ) ( ( Folder ) firstElement ).getParent()
).getSchema();
                 }
-            }
-            else if ( firstElement instanceof ObjectClassWrapper )
-            {
-                TreeNode parent = ( ( ObjectClassWrapper ) firstElement ).getParent();
-
-                if ( parent instanceof Folder )
+                else if ( firstElement instanceof AttributeTypeWrapper )
                 {
-                    selectedSchema = ( ( SchemaWrapper ) ( ( Folder ) parent ).getParent()
).getSchema();
+                    TreeNode parent = ( ( AttributeTypeWrapper ) firstElement ).getParent();
+
+                    if ( parent instanceof Folder )
+                    {
+                        selectedSchema = ( ( SchemaWrapper ) ( ( Folder ) parent ).getParent()
).getSchema();
+
+                    }
+                    else if ( parent instanceof SchemaWrapper )
+                    {
+                        selectedSchema = ( ( SchemaWrapper ) parent ).getSchema();
+                    }
                 }
-                else if ( parent instanceof SchemaWrapper )
+                else if ( firstElement instanceof ObjectClassWrapper )
                 {
-                    selectedSchema = ( ( SchemaWrapper ) parent ).getSchema();
+                    TreeNode parent = ( ( ObjectClassWrapper ) firstElement ).getParent();
+
+                    if ( parent instanceof Folder )
+                    {
+                        selectedSchema = ( ( SchemaWrapper ) ( ( Folder ) parent ).getParent()
).getSchema();
+                    }
+                    else if ( parent instanceof SchemaWrapper )
+                    {
+                        selectedSchema = ( ( SchemaWrapper ) parent ).getSchema();
+                    }
                 }
             }
         }

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewObjectClassAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewObjectClassAction.java?rev=581833&r1=581832&r2=581833&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewObjectClassAction.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/actions/NewObjectClassAction.java
Thu Oct  4 03:09:37 2007
@@ -76,43 +76,49 @@
     {
         // Getting the selection
         Schema selectedSchema = null;
-        StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
-        if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
+
+        int presentation = Activator.getDefault().getPreferenceStore().getInt(
+            PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION );
+        if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT )
         {
-            Object firstElement = selection.getFirstElement();
-            if ( firstElement instanceof SchemaWrapper )
-            {
-                selectedSchema = ( ( SchemaWrapper ) firstElement ).getSchema();
-            }
-            else if ( firstElement instanceof Folder )
-            {
-                selectedSchema = ( ( SchemaWrapper ) ( ( Folder ) firstElement ).getParent()
).getSchema();
-            }
-            else if ( firstElement instanceof AttributeTypeWrapper )
+            StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
+            if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
             {
-                TreeNode parent = ( ( AttributeTypeWrapper ) firstElement ).getParent();
-
-                if ( parent instanceof Folder )
+                Object firstElement = selection.getFirstElement();
+                if ( firstElement instanceof SchemaWrapper )
                 {
-                    selectedSchema = ( ( SchemaWrapper ) ( ( Folder ) parent ).getParent()
).getSchema();
-
+                    selectedSchema = ( ( SchemaWrapper ) firstElement ).getSchema();
                 }
-                else if ( parent instanceof SchemaWrapper )
+                else if ( firstElement instanceof Folder )
                 {
-                    selectedSchema = ( ( SchemaWrapper ) parent ).getSchema();
+                    selectedSchema = ( ( SchemaWrapper ) ( ( Folder ) firstElement ).getParent()
).getSchema();
                 }
-            }
-            else if ( firstElement instanceof ObjectClassWrapper )
-            {
-                TreeNode parent = ( ( ObjectClassWrapper ) firstElement ).getParent();
-
-                if ( parent instanceof Folder )
+                else if ( firstElement instanceof AttributeTypeWrapper )
                 {
-                    selectedSchema = ( ( SchemaWrapper ) ( ( Folder ) parent ).getParent()
).getSchema();
+                    TreeNode parent = ( ( AttributeTypeWrapper ) firstElement ).getParent();
+
+                    if ( parent instanceof Folder )
+                    {
+                        selectedSchema = ( ( SchemaWrapper ) ( ( Folder ) parent ).getParent()
).getSchema();
+
+                    }
+                    else if ( parent instanceof SchemaWrapper )
+                    {
+                        selectedSchema = ( ( SchemaWrapper ) parent ).getSchema();
+                    }
                 }
-                else if ( parent instanceof SchemaWrapper )
+                else if ( firstElement instanceof ObjectClassWrapper )
                 {
-                    selectedSchema = ( ( SchemaWrapper ) parent ).getSchema();
+                    TreeNode parent = ( ( ObjectClassWrapper ) firstElement ).getParent();
+
+                    if ( parent instanceof Folder )
+                    {
+                        selectedSchema = ( ( SchemaWrapper ) ( ( Folder ) parent ).getParent()
).getSchema();
+                    }
+                    else if ( parent instanceof SchemaWrapper )
+                    {
+                        selectedSchema = ( ( SchemaWrapper ) parent ).getSchema();
+                    }
                 }
             }
         }



Mime
View raw message