Author: adietish
Date: 2012-05-11 16:35:30 -0400 (Fri, 11 May 2012)
New Revision: 40960
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.client/openshift-java-client-2.0.0-SNAPSHOT.jar
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeListener.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPageModel.java
Log:
[JBIDE-10852] resetting selected embedded cartridges when error occurrs
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.client/openshift-java-client-2.0.0-SNAPSHOT.jar
===================================================================
(Binary files differ)
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeListener.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeListener.java 2012-05-11
17:40:41 UTC (rev 40959)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeListener.java 2012-05-11
20:35:30 UTC (rev 40960)
@@ -124,13 +124,13 @@
openLogDialog(jenkinsApplication);
return Status.OK_STATUS;
} catch (Exception e) {
- getShell().getDisplay().syncExec(new Runnable() {
+ viewer.getControl().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
viewer.setChecked(cartridge, false);
}
});
- return OpenShiftUIActivator.createErrorStatus("Could not load embeddable
cartridges", e);
+ return OpenShiftUIActivator.createErrorStatus("Could not create jenkins
application", e);
}
}
@@ -166,7 +166,6 @@
pageModel.selectEmbeddedCartridges(IEmbeddableCartridge.MYSQL_51);
} else {
viewer.setChecked(IEmbeddableCartridge.MYSQL_51, false);
- pageModel.unselectEmbeddedCartridges(IEmbeddableCartridge.MYSQL_51);
}
} else {
pageModel.selectEmbeddedCartridges(IEmbeddableCartridge.MYSQL_51);
@@ -238,13 +237,11 @@
if (!viewer.getChecked(IEmbeddableCartridge.MONGODB_20)) {
if (MessageDialog.openQuestion(getShell(), "Embed 10gen Cartridge",
"To embed 10gen cartridge, you'd also have to embed MongoDB. \n\nAlso embed
MongoDB?")) {
- pageModel.selectEmbeddedCartridges(IEmbeddableCartridge.MONGODB_20);
viewer.setChecked(IEmbeddableCartridge.MONGODB_20, true);
+ pageModel.selectEmbeddedCartridges(IEmbeddableCartridge.MONGODB_20);
pageModel.selectEmbeddedCartridges(IEmbeddableCartridge._10GEN_MMS_AGENT_01);
} else {
viewer.setChecked(IEmbeddableCartridge.MONGODB_20, false);
- pageModel.unselectEmbeddedCartridges(IEmbeddableCartridge.MYSQL_51);
- viewer.setChecked(IEmbeddableCartridge._10GEN_MMS_AGENT_01, false);
}
} else {
pageModel.selectEmbeddedCartridges(IEmbeddableCartridge.PHPMYADMIN_34);
@@ -261,7 +258,7 @@
}
private void openLogDialog(final IApplication application) {
- getShell().getDisplay().syncExec(new Runnable() {
+ viewer.getControl().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPage.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPage.java 2012-05-11
17:40:41 UTC (rev 40959)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPage.java 2012-05-11
20:35:30 UTC (rev 40960)
@@ -14,6 +14,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.Set;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.TimeUnit;
@@ -186,6 +187,22 @@
});
}
+ private void safeResetSelectedEmbeddedCartridges() {
+ getShell().getDisplay().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ Set<IEmbeddableCartridge> selectedEmbeddableCartridges =
pageModel.resetSelectedEmbeddedCartridges();
+ viewer.setCheckedElements(
+ selectedEmbeddableCartridges.toArray());
+ } catch (Exception e) {
+ OpenShiftUIActivator.log(e);
+ }
+ }
+ });
+ }
+
private void setViewerInput(final Collection<IEmbeddableCartridge> cartridges) {
getShell().getDisplay().syncExec(new Runnable() {
@@ -210,11 +227,13 @@
openLogDialog(addedCartridges);
queue.offer(true);
} catch (OpenShiftException e) {
+ safeResetSelectedEmbeddedCartridges();
queue.offer(false);
return new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
NLS.bind("Could not embed cartridges to application {0}",
pageModel.getApplication().getName()), e);
} catch (SocketTimeoutException e) {
+ safeResetSelectedEmbeddedCartridges();
queue.offer(false);
return new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
NLS.bind("Could not embed cartridges to application {0}",
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPageModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPageModel.java 2012-05-11
17:40:41 UTC (rev 40959)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPageModel.java 2012-05-11
20:35:30 UTC (rev 40960)
@@ -56,6 +56,11 @@
selectedCartridges.addAll(application.getEmbeddedCartridges());
}
+ protected void setSelectedEmbeddedCartridges(List<IEmbeddedCartridge> cartridges)
{
+ selectedCartridges.clear();
+ selectedCartridges.addAll(cartridges);
+ }
+
public List<IEmbeddableCartridge> loadEmbeddableCartridges() throws
OpenShiftException, SocketTimeoutException {
List<IEmbeddableCartridge> cartridges =
wizardModel.getUser().getEmbeddableCartridges();
setEmbeddableCartridges(cartridges);
@@ -88,17 +93,23 @@
}
@Override
- public void selectEmbeddedCartridges(IEmbeddableCartridge cartridge) throws
OpenShiftException,
- SocketTimeoutException {
+ public void selectEmbeddedCartridges(IEmbeddableCartridge cartridge)
+ throws OpenShiftException,SocketTimeoutException {
getSelectedEmbeddableCartridges().add(cartridge);
}
@Override
- public void unselectEmbeddedCartridges(IEmbeddableCartridge cartridge) throws
OpenShiftException,
- SocketTimeoutException {
+ public void unselectEmbeddedCartridges(IEmbeddableCartridge cartridge)
+ throws OpenShiftException,SocketTimeoutException {
getSelectedEmbeddableCartridges().remove(cartridge);
}
+ public Set<IEmbeddableCartridge> resetSelectedEmbeddedCartridges()
+ throws OpenShiftException, SocketTimeoutException {
+ setSelectedEmbeddedCartridges(getApplication().getEmbeddedCartridges());
+ return selectedCartridges;
+ }
+
/**
* Embeds/removes the cartridges that were added/removed in this wizard
* page.
Show replies by date