Author: adietish
Date: 2012-10-23 08:13:59 -0400 (Tue, 23 Oct 2012)
New Revision: 44609
Modified:
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/Connection.java
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionsModel.java
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/EditCartridgesAction.java
Log:
[JBIDE-12917] fixed erroneous connection lookup when editing cartridges
Modified:
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/Connection.java
===================================================================
---
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/Connection.java 2012-10-23
09:47:12 UTC (rev 44608)
+++
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/Connection.java 2012-10-23
12:13:59 UTC (rev 44609)
@@ -87,7 +87,7 @@
setUser(connection.getUser());
}
- private Connection(String username, String password, String host, boolean
rememberPassword) {
+ Connection(String username, String password, String host, boolean rememberPassword) {
this.username = getUsername(username);
this.password = password;
setHost(host);
Modified:
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionsModel.java
===================================================================
---
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionsModel.java 2012-10-23
09:47:12 UTC (rev 44608)
+++
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionsModel.java 2012-10-23
12:13:59 UTC (rev 44609)
@@ -149,6 +149,16 @@
}
}
+ public Connection getConnectionByUsernameAndHost(String username, String host) {
+ try {
+ String url = new Connection(username, null, host, false).toURLString();
+ return getConnectionByUrl(url);
+ } catch (UnsupportedEncodingException e) {
+ OpenShiftUIActivator.log(NLS.bind("Could not get url for connection {0}",
username), e);
+ return null;
+ }
+ }
+
public Connection[] getConnections() {
Collection<Connection> c = allConnections.values();
Connection[] rets = (Connection[]) c.toArray(new Connection[c.size()]);
Modified:
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/EditCartridgesAction.java
===================================================================
---
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/EditCartridgesAction.java 2012-10-23
09:47:12 UTC (rev 44608)
+++
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/EditCartridgesAction.java 2012-10-23
12:13:59 UTC (rev 44609)
@@ -11,7 +11,6 @@
package org.jboss.tools.openshift.express.internal.ui.action;
import java.io.UnsupportedEncodingException;
-import java.net.URI;
import java.net.URISyntaxException;
import org.eclipse.jface.dialogs.Dialog;
@@ -26,6 +25,7 @@
import org.jboss.tools.openshift.express.internal.ui.wizard.embed.EmbedCartridgeWizard;
import com.openshift.client.IApplication;
+import com.openshift.client.IUser;
import com.openshift.client.OpenShiftException;
/**
@@ -61,12 +61,7 @@
}
private Connection getConnection(final IApplication application) throws
UnsupportedEncodingException, OpenShiftException, URISyntaxException {
- Connection tmpConnection = new Connection(new
URI(application.getDomain().getUser().getRhlogin()), null);
- final Connection existingConnection =
ConnectionsModel.getDefault().getConnectionByUrl(tmpConnection.toURLString());
- if (existingConnection == null) {
- return tmpConnection;
- } else {
- return existingConnection;
- }
+ IUser user = application.getDomain().getUser();
+ return ConnectionsModel.getDefault().getConnectionByUsernameAndHost(user.getRhlogin(),
user.getServer());
}
}
Show replies by thread