Author: adietish
Date: 2011-01-21 16:51:15 -0500 (Fri, 21 Jan 2011)
New Revision: 28491
Modified:
branches/jbosstools-3.2.0.CR1/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/WizardUtils.java
branches/jbosstools-3.2.0.CR1/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPage.java
Log:
[JBIDE-8186]
Modified:
branches/jbosstools-3.2.0.CR1/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/WizardUtils.java
===================================================================
---
branches/jbosstools-3.2.0.CR1/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/WizardUtils.java 2011-01-21
21:21:36 UTC (rev 28490)
+++
branches/jbosstools-3.2.0.CR1/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/WizardUtils.java 2011-01-21
21:51:15 UTC (rev 28491)
@@ -13,6 +13,7 @@
import java.lang.reflect.InvocationTargetException;
import java.util.concurrent.CountDownLatch;
+import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
@@ -43,6 +44,9 @@
* the interrupted exception
*
* @author André Dietisheim
+ *
+ * @see IWizardContainer#run(boolean, boolean, IRunnableWithProgress)
+ * @see Job
*/
public static void runInWizard(final Job job, IWizardContainer container) throws
InvocationTargetException,
InterruptedException {
@@ -66,6 +70,35 @@
}
/**
+ * Runs the given job in the given wizard container.
+ * <p>
+ * Furhtermore it updates the models and targets of the given data binding
+ * context. This might be necessary if the given job will change widget
+ * enablements in the calling wizard page. The reason for is that the runner
+ * saves the widget enablement states when it's up to execute the runnable.
+ * It then restores those states once he finished executing the runnable. It
+ * may therefore restore incorrect states since the job changed the
+ * enablements when it was run.
+ *
+ * @param job
+ * the job
+ * @param container
+ * the container
+ * @param dbc
+ * the dbc
+ * @throws InvocationTargetException
+ * the invocation target exception
+ * @throws InterruptedException
+ * the interrupted exception
+ */
+ public static void runInWizard(final Job job, IWizardContainer container, final
DataBindingContext dbc)
+ throws InvocationTargetException, InterruptedException {
+ runInWizard(job, container);
+ dbc.updateTargets();
+ dbc.updateModels();
+ }
+
+ /**
* Flips to the next wizard page or finishes the current wizard.
*
* @param wizardPage
Modified:
branches/jbosstools-3.2.0.CR1/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPage.java
===================================================================
---
branches/jbosstools-3.2.0.CR1/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPage.java 2011-01-21
21:21:36 UTC (rev 28490)
+++
branches/jbosstools-3.2.0.CR1/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPage.java 2011-01-21
21:51:15 UTC (rev 28491)
@@ -79,6 +79,7 @@
private final static String CONFIRM_KEY_DELETE_MSG = "ConfirmKeyDelete.msg";
//$NON-NLS-1$
private ManageKeysPageModel model;
+ private DataBindingContext dbc;
private class Key2IdConverter extends Converter {
@@ -124,7 +125,7 @@
@Override
public void createControl(Composite parent) {
- DataBindingContext dbc = new DataBindingContext();
+ this.dbc = new DataBindingContext();
// WizardPageSupport.create(this, dbc);
bindWizardComplete(dbc);
@@ -186,6 +187,11 @@
new UpdateValueStrategy().setConverter(new ObjectNotNullToBoolean()));
}
+ @Override
+ public void setPageComplete(boolean complete) {
+ super.setPageComplete(complete);
+ }
+
private List createKeyList(DataBindingContext dbc, Composite container) {
final List keyList = new List(container, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL);
// bind items
@@ -254,7 +260,7 @@
}
};
try {
- WizardUtils.runInWizard(job, getContainer());
+ WizardUtils.runInWizard(job, getContainer(), dbc);
} catch (Exception e) {
// ignore since the job will report its failure
}
@@ -396,7 +402,7 @@
}
}
};
- WizardUtils.runInWizard(job, getContainer());
+ WizardUtils.runInWizard(job, getContainer(), dbc);
} catch (Exception e) {
// ignore
}
@@ -447,7 +453,9 @@
}
}
};
- WizardUtils.runInWizard(job, getContainer());
+ WizardUtils.runInWizard(job, getContainer(), dbc);
+// // WORKAROUND (wizard runnable service always reenables OK-button)
+// setPageComplete(isPageComplete());
} catch (Exception e) {
// ignore
}
Show replies by date