directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r557324 - in /directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor: controller/ controller/actions/ view/wizards/
Date Wed, 18 Jul 2007 16:45:38 GMT
Author: pamarcelot
Date: Wed Jul 18 09:45:34 2007
New Revision: 557324

URL: http://svn.apache.org/viewvc?view=rev&rev=557324
Log:
Improved the ExportSchemas* Actions to pre-select in the wizard the schemas selected in the
SchemaView.

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/ExportSchemasAsOpenLdapAction.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportSchemasAsXmlAction.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportSchemasAsOpenLdapWizard.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportSchemasAsOpenLdapWizardPage.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportSchemasAsXmlWizard.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportSchemasAsXmlWizardPage.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=557324&r1=557323&r2=557324
==============================================================================
--- 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
Wed Jul 18 09:45:34 2007
@@ -136,8 +136,8 @@
         deleteSchemaElement = new DeleteSchemaElementAction();
         importSchemasFromOpenLdap = new ImportSchemasFromOpenLdapAction();
         importSchemasFromXml = new ImportSchemasFromXmlAction();
-        exportSchemasAsOpenLdap = new ExportSchemasAsOpenLdapAction();
-        exportSchemasAsXml = new ExportSchemasAsXmlAction();
+        exportSchemasAsOpenLdap = new ExportSchemasAsOpenLdapAction( viewer );
+        exportSchemasAsXml = new ExportSchemasAsXmlAction( viewer );
         collapseAll = new CollapseAllAction( viewer );
         openSchemaViewSortingDialog = new OpenSchemaViewSortingDialogAction();
         openSchemaViewPreference = new OpenSchemaViewPreferenceAction();

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportSchemasAsOpenLdapAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportSchemasAsOpenLdapAction.java?view=diff&rev=557324&r1=557323&r2=557324
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportSchemasAsOpenLdapAction.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportSchemasAsOpenLdapAction.java
Wed Jul 18 09:45:34 2007
@@ -20,13 +20,20 @@
 package org.apache.directory.studio.apacheds.schemaeditor.controller.actions;
 
 
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
 import org.apache.directory.studio.apacheds.schemaeditor.Activator;
 import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Schema;
 import org.apache.directory.studio.apacheds.schemaeditor.view.wizards.ExportSchemasAsOpenLdapWizard;
+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.jface.wizard.WizardDialog;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
@@ -42,10 +49,14 @@
  */
 public class ExportSchemasAsOpenLdapAction extends Action implements IWorkbenchWindowActionDelegate
 {
+    /** The associated viewer */
+    private TreeViewer viewer;
+
+
     /**
      * Creates a new instance of ExportSchemasAsOpenLdapAction.
      */
-    public ExportSchemasAsOpenLdapAction()
+    public ExportSchemasAsOpenLdapAction( TreeViewer viewer )
     {
         super( "Schemas as OpenLDAP files" );
         setToolTipText( getText() );
@@ -53,6 +64,7 @@
         setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
             PluginConstants.IMG_SCHEMAS_EXPORT ) );
         setEnabled( true );
+        this.viewer = viewer;
     }
 
 
@@ -61,8 +73,24 @@
      */
     public void run()
     {
+        List<Schema> selectedSchemas = new ArrayList<Schema>();
+        // Getting the selection
+        StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
+        if ( ( !selection.isEmpty() ) && ( selection.size() > 0 ) )
+        {
+            for ( Iterator<?> i = selection.iterator(); i.hasNext(); )
+            {
+                Object o = i.next();
+                if ( o instanceof SchemaWrapper )
+                {
+                    selectedSchemas.add( ( ( SchemaWrapper ) o ).getSchema() );
+                }
+            }
+        }
+
         // Instantiates and initializes the wizard
         ExportSchemasAsOpenLdapWizard wizard = new ExportSchemasAsOpenLdapWizard();
+        wizard.setSelectedSchemas( selectedSchemas.toArray( new Schema[0] ) );
         wizard.init( PlatformUI.getWorkbench(), StructuredSelection.EMPTY );
         // Instantiates the wizard container with the wizard and opens it
         WizardDialog dialog = new WizardDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
wizard );

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportSchemasAsXmlAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportSchemasAsXmlAction.java?view=diff&rev=557324&r1=557323&r2=557324
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportSchemasAsXmlAction.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ExportSchemasAsXmlAction.java
Wed Jul 18 09:45:34 2007
@@ -20,13 +20,20 @@
 package org.apache.directory.studio.apacheds.schemaeditor.controller.actions;
 
 
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
 import org.apache.directory.studio.apacheds.schemaeditor.Activator;
 import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.model.Schema;
 import org.apache.directory.studio.apacheds.schemaeditor.view.wizards.ExportSchemasAsXmlWizard;
+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.jface.wizard.WizardDialog;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
@@ -42,10 +49,14 @@
  */
 public class ExportSchemasAsXmlAction extends Action implements IWorkbenchWindowActionDelegate
 {
+    /** The associated viewer */
+    private TreeViewer viewer;
+
+
     /**
      * Creates a new instance of ExportSchemasAsXmlAction.
      */
-    public ExportSchemasAsXmlAction()
+    public ExportSchemasAsXmlAction( TreeViewer viewer )
     {
         super( "Schemas as XML file(s)" );
         setToolTipText( getText() );
@@ -53,6 +64,7 @@
         setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
             PluginConstants.IMG_SCHEMAS_EXPORT ) );
         setEnabled( true );
+        this.viewer = viewer;
     }
 
 
@@ -61,8 +73,24 @@
      */
     public void run()
     {
+        List<Schema> selectedSchemas = new ArrayList<Schema>();
+        // Getting the selection
+        StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
+        if ( ( !selection.isEmpty() ) && ( selection.size() > 0 ) )
+        {
+            for ( Iterator<?> i = selection.iterator(); i.hasNext(); )
+            {
+                Object o = i.next();
+                if ( o instanceof SchemaWrapper )
+                {
+                    selectedSchemas.add( ( ( SchemaWrapper ) o ).getSchema() );
+                }
+            }
+        }
+
         // Instantiates and initializes the wizard
         ExportSchemasAsXmlWizard wizard = new ExportSchemasAsXmlWizard();
+        wizard.setSelectedSchemas( selectedSchemas.toArray( new Schema[0] ) );
         wizard.init( PlatformUI.getWorkbench(), StructuredSelection.EMPTY );
         // Instantiates the wizard container with the wizard and opens it
         WizardDialog dialog = new WizardDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
wizard );

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportSchemasAsOpenLdapWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportSchemasAsOpenLdapWizard.java?view=diff&rev=557324&r1=557323&r2=557324
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportSchemasAsOpenLdapWizard.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportSchemasAsOpenLdapWizard.java
Wed Jul 18 09:45:34 2007
@@ -43,6 +43,9 @@
  */
 public class ExportSchemasAsOpenLdapWizard extends Wizard implements IExportWizard
 {
+    /** The selected schemas */
+    private Schema[] selectedSchemas = new Schema[0];
+
     // The pages of the wizard
     private ExportSchemasAsOpenLdapWizardPage page;
 
@@ -54,6 +57,7 @@
     {
         // Creating pages
         page = new ExportSchemasAsOpenLdapWizardPage();
+        page.setSelectedSchemas( selectedSchemas );
 
         // Adding pages
         addPage( page );
@@ -116,5 +120,17 @@
     public void init( IWorkbench workbench, IStructuredSelection selection )
     {
         setNeedsProgressMonitor( true );
+    }
+
+
+    /**
+     * Sets the selected projects.
+     *
+     * @param schemas
+     *      the schemas
+     */
+    public void setSelectedSchemas( Schema[] schemas )
+    {
+        selectedSchemas = schemas;
     }
 }

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportSchemasAsOpenLdapWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportSchemasAsOpenLdapWizardPage.java?view=diff&rev=557324&r1=557323&r2=557324
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportSchemasAsOpenLdapWizardPage.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportSchemasAsOpenLdapWizardPage.java
Wed Jul 18 09:45:34 2007
@@ -66,6 +66,9 @@
  */
 public class ExportSchemasAsOpenLdapWizardPage extends WizardPage
 {
+    /** The selected schemas */
+    private Schema[] selectedSchemas = new Schema[0];
+
     /** The SchemaHandler */
     private SchemaHandler schemaHandler;
 
@@ -230,10 +233,12 @@
                 {
                     return o1.getName().compareToIgnoreCase( o2.getName() );
                 }
-
             } );
 
             schemasTableViewer.setInput( schemas );
+
+            // Setting the selected schemas
+            schemasTableViewer.setCheckedElements( selectedSchemas );
         }
 
         displayErrorMessage( null );
@@ -332,6 +337,18 @@
         }
 
         return schemas.toArray( new Schema[0] );
+    }
+
+
+    /**
+     * Sets the selected projects.
+     *
+     * @param schemas
+     *      the schemas
+     */
+    public void setSelectedSchemas( Schema[] schemas )
+    {
+        selectedSchemas = schemas;
     }
 
 

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportSchemasAsXmlWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportSchemasAsXmlWizard.java?view=diff&rev=557324&r1=557323&r2=557324
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportSchemasAsXmlWizard.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportSchemasAsXmlWizard.java
Wed Jul 18 09:45:34 2007
@@ -43,6 +43,9 @@
  */
 public class ExportSchemasAsXmlWizard extends Wizard implements IExportWizard
 {
+    /** The selected schemas */
+    private Schema[] selectedSchemas = new Schema[0];
+
     // The pages of the wizard
     private ExportSchemasAsXmlWizardPage page;
 
@@ -54,6 +57,7 @@
     {
         // Creating pages
         page = new ExportSchemasAsXmlWizardPage();
+        page.setSelectedSchemas( selectedSchemas );
 
         // Adding pages
         addPage( page );
@@ -155,5 +159,17 @@
     public void init( IWorkbench workbench, IStructuredSelection selection )
     {
         setNeedsProgressMonitor( true );
+    }
+
+
+    /**
+     * Sets the selected projects.
+     *
+     * @param schemas
+     *      the schemas
+     */
+    public void setSelectedSchemas( Schema[] schemas )
+    {
+        selectedSchemas = schemas;
     }
 }

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportSchemasAsXmlWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportSchemasAsXmlWizardPage.java?view=diff&rev=557324&r1=557323&r2=557324
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportSchemasAsXmlWizardPage.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/wizards/ExportSchemasAsXmlWizardPage.java
Wed Jul 18 09:45:34 2007
@@ -67,6 +67,9 @@
  */
 public class ExportSchemasAsXmlWizardPage extends WizardPage
 {
+    /** The selected schemas */
+    private Schema[] selectedSchemas = new Schema[0];
+
     /** The SchemaHandler */
     private SchemaHandler schemaHandler;
 
@@ -292,10 +295,12 @@
                 {
                     return o1.getName().compareToIgnoreCase( o2.getName() );
                 }
-
             } );
 
             schemasTableViewer.setInput( schemas );
+
+            // Setting the selected schemas
+            schemasTableViewer.setCheckedElements( selectedSchemas );
         }
 
         // Selecting the Multiple Files choice
@@ -473,6 +478,18 @@
         }
 
         return schemas.toArray( new Schema[0] );
+    }
+
+
+    /**
+     * Sets the selected projects.
+     *
+     * @param schemas
+     *      the schemas
+     */
+    public void setSelectedSchemas( Schema[] schemas )
+    {
+        selectedSchemas = schemas;
     }
 
 



Mime
View raw message