directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1398315 - in /directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards: BatchOperationApplyOnWizardPage.java BatchOperationFinishWizardPage.java BatchOperationWizard.java
Date Mon, 15 Oct 2012 14:51:52 GMT
Author: pamarcelot
Date: Mon Oct 15 14:51:51 2012
New Revision: 1398315

URL: http://svn.apache.org/viewvc?rev=1398315&view=rev
Log:
Fix for DIRSTUDIO-806 (Editing Multiple Directory Objects at once) and DIRSTUDIO-736 (Implement
the "Execute Online" button of the BatchOperationWizard)

Modified:
    directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationApplyOnWizardPage.java
    directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationFinishWizardPage.java
    directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationWizard.java

Modified: directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationApplyOnWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationApplyOnWizardPage.java?rev=1398315&r1=1398314&r2=1398315&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationApplyOnWizardPage.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationApplyOnWizardPage.java
Mon Oct 15 14:51:51 2012
@@ -323,7 +323,9 @@ public class BatchOperationApplyOnWizard
 
     }
 
-
+    /**
+     * Saves the dialog settings.
+     */
     public void saveDialogSettings()
     {
         this.spw.saveToSearch( initSearch );

Modified: directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationFinishWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationFinishWizardPage.java?rev=1398315&r1=1398314&r2=1398315&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationFinishWizardPage.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationFinishWizardPage.java
Mon Oct 15 14:51:51 2012
@@ -22,6 +22,7 @@ package org.apache.directory.studio.ldap
 
 
 import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
@@ -32,21 +33,33 @@ import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 
 
+/**
+ * This class implements the Finish page of the Batch Operation Wizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
 public class BatchOperationFinishWizardPage extends WizardPage
 {
+    /** The continue on error flag key */
+    public static final String CONTINUE_ON_ERROR_DIALOGSETTING_KEY = BatchOperationFinishWizardPage.class.getName()
+        + ".continueOnError"; //$NON-NLS-1$
 
     public final static int EXECUTION_METHOD_NONE = -1;
-
     public final static int EXECUTION_METHOD_LDIF = 0;
-
     public final static int EXECUTION_METHOD_ONLINE = 1;
 
+    // UI widgets
     private Button executeOnlineButton;
-
     private Button generateLdifButton;
+    private Button continueOnErrorButton;
 
 
-    public BatchOperationFinishWizardPage( String pageName, BatchOperationWizard wizard )
+    /**
+     * Creates a new instance of BatchOperationFinishWizardPage.
+     *
+     * @param pageName the page name
+     */
+    public BatchOperationFinishWizardPage( String pageName )
     {
         super( pageName );
         super.setTitle( Messages.getString( "BatchOperationFinishWizardPage.SelectExecutionMethod"
) ); //$NON-NLS-1$
@@ -55,24 +68,32 @@ public class BatchOperationFinishWizardP
     }
 
 
+    /**
+     * Validates the page.
+     */
     private void validate()
     {
+        continueOnErrorButton.setEnabled( getExecutionMethod() == EXECUTION_METHOD_ONLINE
);
         setPageComplete( getExecutionMethod() != EXECUTION_METHOD_NONE );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void createControl( Composite parent )
     {
-
+        // Composite
         Composite composite = new Composite( parent, SWT.NONE );
-        GridLayout gl = new GridLayout( 1, false );
+        GridLayout gl = new GridLayout( 2, false );
         composite.setLayout( gl );
         composite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
 
-        generateLdifButton = BaseWidgetUtils.createRadiobutton( composite, Messages
-            .getString( "BatchOperationFinishWizardPage.GenerateLDIF" ), 1 ); //$NON-NLS-1$
-        generateLdifButton.setSelection( true );
-        generateLdifButton.addSelectionListener( new SelectionAdapter()
+        // Execute Online Button
+        executeOnlineButton = BaseWidgetUtils.createRadiobutton( composite, Messages
+            .getString( "BatchOperationFinishWizardPage.ExecuteOnline" ), 2 ); //$NON-NLS-1$
+        executeOnlineButton.setSelection( true );
+        executeOnlineButton.addSelectionListener( new SelectionAdapter()
         {
             public void widgetSelected( SelectionEvent e )
             {
@@ -80,10 +101,21 @@ public class BatchOperationFinishWizardP
             }
         } );
 
-        executeOnlineButton = BaseWidgetUtils.createRadiobutton( composite, Messages
-            .getString( "BatchOperationFinishWizardPage.ExecuteOnline" ), 1 ); //$NON-NLS-1$
-        executeOnlineButton.setEnabled( false );
-        executeOnlineButton.addSelectionListener( new SelectionAdapter()
+        // Continue On Error Radio Button
+        BaseWidgetUtils.createRadioIndent( composite, 1 );
+        continueOnErrorButton = BaseWidgetUtils.createCheckbox( composite, Messages
+            .getString( "ImportLdifMainWizardPage.ContinueOnError" ), 1 ); //$NON-NLS-1$
+        if ( BrowserUIPlugin.getDefault().getDialogSettings().get( CONTINUE_ON_ERROR_DIALOGSETTING_KEY
) == null )
+        {
+            BrowserUIPlugin.getDefault().getDialogSettings().put( CONTINUE_ON_ERROR_DIALOGSETTING_KEY,
true );
+        }
+        continueOnErrorButton.setSelection( BrowserUIPlugin.getDefault().getDialogSettings()
+            .getBoolean( CONTINUE_ON_ERROR_DIALOGSETTING_KEY ) );
+
+        // Generate LDIF Button
+        generateLdifButton = BaseWidgetUtils.createRadiobutton( composite, Messages
+            .getString( "BatchOperationFinishWizardPage.GenerateLDIF" ), 2 ); //$NON-NLS-1$
+        generateLdifButton.addSelectionListener( new SelectionAdapter()
         {
             public void widgetSelected( SelectionEvent e )
             {
@@ -97,6 +129,11 @@ public class BatchOperationFinishWizardP
     }
 
 
+    /**
+     * Gets the execution method.
+     *
+     * @return the execution method
+     */
     public int getExecutionMethod()
     {
         if ( executeOnlineButton.getSelection() )
@@ -113,4 +150,24 @@ public class BatchOperationFinishWizardP
         }
     }
 
+
+    /**
+     * Gets the continue on error flag.
+     *
+     * @return the continue on error flag
+     */
+    public boolean getContinueOnError()
+    {
+        return continueOnErrorButton.getSelection();
+    }
+
+
+    /**
+     * Saves the dialog settings.
+     */
+    public void saveDialogSettings()
+    {
+        BrowserUIPlugin.getDefault().getDialogSettings().put( CONTINUE_ON_ERROR_DIALOGSETTING_KEY,
+            continueOnErrorButton.getSelection() );
+    }
 }

Modified: directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationWizard.java?rev=1398315&r1=1398314&r2=1398315&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationWizard.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationWizard.java
Mon Oct 15 14:51:51 2012
@@ -26,7 +26,9 @@ import org.apache.directory.studio.conne
 import org.apache.directory.studio.connection.ui.RunnableContextRunner;
 import org.apache.directory.studio.ldapbrowser.common.actions.BrowserSelectionUtils;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
+import org.apache.directory.studio.ldapbrowser.core.jobs.ExecuteLdifRunnable;
 import org.apache.directory.studio.ldapbrowser.core.jobs.SearchRunnable;
+import org.apache.directory.studio.ldapbrowser.core.jobs.StudioBrowserJob;
 import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
 import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
@@ -131,7 +133,7 @@ public class BatchOperationWizard extend
             modifyPage = new BatchOperationModifyWizardPage( BatchOperationModifyWizardPage.class.getName(),
this );
             addPage( modifyPage );
 
-            finishPage = new BatchOperationFinishWizardPage( BatchOperationFinishWizardPage.class.getName(),
this );
+            finishPage = new BatchOperationFinishWizardPage( BatchOperationFinishWizardPage.class.getName()
);
             addPage( finishPage );
         }
         else
@@ -271,11 +273,10 @@ public class BatchOperationWizard extend
 
     public boolean performFinish()
     {
-
         if ( this.applyOnPage != null )
         {
-
             this.applyOnPage.saveDialogSettings();
+            this.finishPage.saveDialogSettings();
 
             // get LDIF
             String ldifFragment = ""; //$NON-NLS-1$
@@ -350,18 +351,22 @@ public class BatchOperationWizard extend
                                 document.set( ldif.toString() );
                             }
                         }
-
                     }
                     catch ( PartInitException e )
                     {
                         return false;
                     }
-                    return true;
 
+                    return true;
                 }
                 else if ( finishPage.getExecutionMethod() == BatchOperationFinishWizardPage.EXECUTION_METHOD_ONLINE
)
                 {
-                    // TODO
+                    ExecuteLdifRunnable runnable = new ExecuteLdifRunnable( getConnection(),
ldif.toString(), true,
+                        finishPage.getContinueOnError() );
+                    StudioBrowserJob job = new StudioBrowserJob( runnable );
+                    job.execute();
+
+                    return true;
                 }
             }
 
@@ -382,5 +387,4 @@ public class BatchOperationWizard extend
     {
         return this.connection;
     }
-
 }



Mime
View raw message