directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r558704 - in /directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller: SchemaViewController.java actions/DeleteProjectAction.java actions/OpenElementAction.java
Date Mon, 23 Jul 2007 12:39:01 GMT
Author: pamarcelot
Date: Mon Jul 23 05:38:59 2007
New Revision: 558704

URL: http://svn.apache.org/viewvc?view=rev&rev=558704
Log:
Added implementation for the OpenElementAction.

Modified:
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/DeleteProjectAction.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/OpenElementAction.java

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java?view=diff&rev=558704&r1=558703&r2=558704
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SchemaViewController.java
Mon Jul 23 05:38:59 2007
@@ -365,7 +365,7 @@
         newSchema = new NewSchemaAction();
         newAttributeType = new NewAttributeTypeAction();
         newObjectClass = new NewObjectClassAction();
-        openElement = new OpenElementAction();
+        openElement = new OpenElementAction( viewer );
         deleteSchemaElement = new DeleteSchemaElementAction();
         importSchemasFromOpenLdap = new ImportSchemasFromOpenLdapAction();
         importSchemasFromXml = new ImportSchemasFromXmlAction();

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/DeleteProjectAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/DeleteProjectAction.java?view=diff&rev=558704&r1=558703&r2=558704
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/DeleteProjectAction.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/DeleteProjectAction.java
Mon Jul 23 05:38:59 2007
@@ -96,7 +96,6 @@
     /* (non-Javadoc)
      * @see org.eclipse.jface.action.Action#run()
      */
-    @SuppressWarnings("unchecked")
     public void run()
     {
         ProjectsHandler projectsHandler = Activator.getDefault().getProjectsHandler();
@@ -119,7 +118,7 @@
             }
             if ( messageBox.open() == SWT.YES )
             {
-                for ( Iterator iterator = selection.iterator(); iterator.hasNext(); )
+                for ( Iterator<?> iterator = selection.iterator(); iterator.hasNext();
)
                 {
                     ProjectWrapper wrapper = ( ProjectWrapper ) iterator.next();
                     projectsHandler.removeProject( wrapper.getProject() );

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/OpenElementAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/OpenElementAction.java?view=diff&rev=558704&r1=558703&r2=558704
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/OpenElementAction.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/OpenElementAction.java
Mon Jul 23 05:38:59 2007
@@ -20,12 +20,26 @@
 package org.apache.directory.studio.apacheds.schemaeditor.controller.actions;
 
 
+import java.util.Iterator;
+
 import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.view.editors.attributetype.AttributeTypeEditor;
+import org.apache.directory.studio.apacheds.schemaeditor.view.editors.attributetype.AttributeTypeEditorInput;
+import org.apache.directory.studio.apacheds.schemaeditor.view.editors.objectclass.ObjectClassEditor;
+import org.apache.directory.studio.apacheds.schemaeditor.view.editors.objectclass.ObjectClassEditorInput;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.AttributeTypeWrapper;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.Folder;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ObjectClassWrapper;
+import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.SchemaWrapper;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
 
 
 /**
@@ -36,15 +50,20 @@
  */
 public class OpenElementAction extends Action implements IWorkbenchWindowActionDelegate
 {
+    /** The associated viewer */
+    private TreeViewer viewer;
+
+
     /**
      * Creates a new instance of DeleteSchemaElementAction.
      */
-    public OpenElementAction()
+    public OpenElementAction( TreeViewer viewer )
     {
         super( "Open" );
         setToolTipText( getText() );
         setId( PluginConstants.CMD_OPEN_ELEMENT );
         setEnabled( true );
+        this.viewer = viewer;
     }
 
 
@@ -53,7 +72,41 @@
      */
     public void run()
     {
-        // TODO implement
+        StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
+        for ( Iterator<?> iterator = selection.iterator(); iterator.hasNext(); )
+        {
+            Object selectedItem = iterator.next();
+            if ( selectedItem instanceof AttributeTypeWrapper )
+            {
+                try
+                {
+                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(
+                        new AttributeTypeEditorInput( ( ( AttributeTypeWrapper ) selectedItem
).getAttributeType() ),
+                        AttributeTypeEditor.ID );
+                }
+                catch ( PartInitException e )
+                {
+                    // TODO Add logging
+                }
+            }
+            else if ( selectedItem instanceof ObjectClassWrapper )
+            {
+                try
+                {
+                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(
+                        new ObjectClassEditorInput( ( ( ObjectClassWrapper ) selectedItem
).getObjectClass() ),
+                        ObjectClassEditor.ID );
+                }
+                catch ( PartInitException e )
+                {
+                    // TODO Add logging
+                }
+            }
+            else if ( ( selectedItem instanceof Folder ) || ( selectedItem instanceof SchemaWrapper
) )
+            {
+                viewer.setExpandedState( selectedItem, !viewer.getExpandedState( selectedItem
) );
+            }
+        }
     }
 
 



Mime
View raw message