Author: xcoulon
Date: 2012-05-23 16:08:29 -0400 (Wed, 23 May 2012)
New Revision: 41316
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/EditCartridgesAction.java
Log:
fixing bad user selection (recent user may not be the selected application's user)
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/EditCartridgesAction.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/EditCartridgesAction.java 2012-05-23
20:07:54 UTC (rev 41315)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/EditCartridgesAction.java 2012-05-23
20:08:29 UTC (rev 41316)
@@ -18,9 +18,11 @@
import org.jboss.tools.openshift.express.internal.core.console.UserModel;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftImages;
import
org.jboss.tools.openshift.express.internal.ui.messages.OpenShiftExpressUIMessages;
+import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
import org.jboss.tools.openshift.express.internal.ui.wizard.EmbedCartridgeWizard;
import com.openshift.client.IApplication;
+import com.openshift.client.OpenShiftException;
/**
* @author Xavier Coulon
@@ -36,12 +38,16 @@
public void run() {
final ITreeSelection treeSelection = (ITreeSelection)selection;
if (selection != null && selection instanceof ITreeSelection &&
treeSelection.getFirstElement() instanceof IApplication) {
- final IApplication application = (IApplication) treeSelection.getFirstElement();
- final UserDelegate user = UserModel.getDefault().getRecentUser();
- EmbedCartridgeWizard wizard = new EmbedCartridgeWizard(application, user);
- int result = WizardUtils.openWizardDialog(wizard,
Display.getCurrent().getActiveShell());
- if(result == Dialog.OK) {
- viewer.refresh(application);
+ try {
+ final IApplication application = (IApplication) treeSelection.getFirstElement();
+ final UserDelegate user =
UserModel.getDefault().findUser(application.getDomain().getUser().getRhlogin());
+ EmbedCartridgeWizard wizard = new EmbedCartridgeWizard(application, user);
+ int result = WizardUtils.openWizardDialog(wizard,
Display.getCurrent().getActiveShell());
+ if(result == Dialog.OK) {
+ viewer.refresh(application);
+ }
+ } catch (OpenShiftException e) {
+ Logger.error("Failed to edit cartridges", e);
}
}
Show replies by date