Author: adietish
Date: 2012-05-25 05:35:40 -0400 (Fri, 25 May 2012)
New Revision: 41406
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/JobResultFuture.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/CreateApplicationJob.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
Log:
[JBIDE-11314] refreshing user after monitor was cancelled, preventing wizard from closing
if monitor was cancelled
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/JobResultFuture.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/JobResultFuture.java 2012-05-25
07:00:55 UTC (rev 41405)
+++
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/JobResultFuture.java 2012-05-25
09:35:40 UTC (rev 41406)
@@ -46,6 +46,7 @@
|| !isRunning(job)) {
cancelled.set(true);
job.cancel();
+ job.getThread().interrupt();
}
return isRunning(job);
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/CreateApplicationJob.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/CreateApplicationJob.java 2012-05-25
07:00:55 UTC (rev 41405)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/CreateApplicationJob.java 2012-05-25
09:35:40 UTC (rev 41406)
@@ -38,6 +38,8 @@
*/
public class CreateApplicationJob extends AbstractDelegatingMonitorJob {
+ public static final int CLOSE_WIZARD = 2;
+
private UserDelegate user;
private String name;
private ICartridge cartridge;
@@ -65,9 +67,11 @@
} catch (OpenShiftTimeoutException e) {
this.application = refreshAndCreateApplication(monitor);
}
+
if (application == null) {
- return OpenShiftUIActivator.createCancelStatus(NLS.bind(
- "User cancelled creation of application {0}", name));
+ int errorCode = monitor.isCanceled() ? CLOSE_WIZARD : 0;
+ return new Status(IStatus.CANCEL, OpenShiftUIActivator.PLUGIN_ID, errorCode,
+ NLS.bind("User cancelled creation of application {0}", name), null);
} else {
return Status.OK_STATUS;
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-05-25
07:00:55 UTC (rev 41405)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-05-25
09:35:40 UTC (rev 41406)
@@ -145,9 +145,11 @@
if (!success) {
IStatus status = createApplication();
- if (JobUtils.isCancel(status)) {
+ if (JobUtils.isCancel(status)
+ && CreateApplicationJob.CLOSE_WIZARD == status.getCode()) {
getContainer().getShell().close();
} else if (!JobUtils.isOk(status)) {
+ safeRefreshUser();
return false;
}
@@ -238,6 +240,14 @@
});
}
+ private void safeRefreshUser() {
+ try {
+ wizardModel.getUser().refresh();
+ } catch (OpenShiftException e) {
+ OpenShiftUIActivator.log(e);
+ }
+ }
+
/**
* A workspace job that will create a new project or enable the selected
* project to be used with OpenShift.
Show replies by date