Author: adietish
Date: 2012-10-17 11:49:34 -0400 (Wed, 17 Oct 2012)
New Revision: 44557
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/Connection.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionUtils.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionsModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/util/UrlUtils.java
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/behaviour/ExpressDetailsComposite.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/NewConnectionMarker.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/application/ApplicationWizardModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/connection/ConnectionWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/embed/EmbedCartridgeWizard.java
Log:
[JBIDE-12864] fixed NPE by refactoring connection model
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF 2012-10-17
10:35:47 UTC (rev 44556)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF 2012-10-17
15:49:34 UTC (rev 44557)
@@ -56,12 +56,34 @@
Bundle-Vendor: %Bundle-Vendor.0
Export-Package:
org.jboss.tools.openshift.express.internal.core;x-friends:="org.jboss.tools.openshift.express.test",
org.jboss.tools.openshift.express.internal.core.behaviour;x-friends:="org.jboss.tools.openshift.express.test",
+
org.jboss.tools.openshift.express.internal.core.connection;x-friends:="org.jboss.tools.openshift.express.test",
+
org.jboss.tools.openshift.express.internal.core.portforward;x-friends:="org.jboss.tools.openshift.express.test",
+
org.jboss.tools.openshift.express.internal.core.util;x-friends:="org.jboss.tools.openshift.express.test",
org.jboss.tools.openshift.express.internal.ui;x-friends:="org.jboss.tools.openshift.express.test",
+
org.jboss.tools.openshift.express.internal.ui.action;x-friends:="org.jboss.tools.openshift.express.test",
org.jboss.tools.openshift.express.internal.ui.behaviour;x-friends:="org.jboss.tools.openshift.express.test",
+
org.jboss.tools.openshift.express.internal.ui.command;x-friends:="org.jboss.tools.openshift.express.test",
org.jboss.tools.openshift.express.internal.ui.console;x-friends:="org.jboss.tools.openshift.express.test",
+
org.jboss.tools.openshift.express.internal.ui.databinding;x-friends:="org.jboss.tools.openshift.express.test",
+
org.jboss.tools.openshift.express.internal.ui.explorer;x-friends:="org.jboss.tools.openshift.express.test",
+
org.jboss.tools.openshift.express.internal.ui.explorer.actionDelegate;x-friends:="org.jboss.tools.openshift.express.test",
+
org.jboss.tools.openshift.express.internal.ui.explorer.actionProvider;x-friends:="org.jboss.tools.openshift.express.test",
+
org.jboss.tools.openshift.express.internal.ui.job;x-friends:="org.jboss.tools.openshift.express.test",
org.jboss.tools.openshift.express.internal.ui.messages;x-friends:="org.jboss.tools.openshift.express.test",
+
org.jboss.tools.openshift.express.internal.ui.preferences;x-friends:="org.jboss.tools.openshift.express.test",
+
org.jboss.tools.openshift.express.internal.ui.property;x-friends:="org.jboss.tools.openshift.express.test",
+
org.jboss.tools.openshift.express.internal.ui.propertytable;x-friends:="org.jboss.tools.openshift.express.test",
+
org.jboss.tools.openshift.express.internal.ui.serverviewer.actionDelegate;x-friends:="org.jboss.tools.openshift.express.test",
org.jboss.tools.openshift.express.internal.ui.utils;x-friends:="org.jboss.tools.openshift.express.test",
+
org.jboss.tools.openshift.express.internal.ui.viewer;x-friends:="org.jboss.tools.openshift.express.test",
org.jboss.tools.openshift.express.internal.ui.wizard;x-friends:="org.jboss.tools.openshift.express.test",
+
org.jboss.tools.openshift.express.internal.ui.wizard.application;x-friends:="org.jboss.tools.openshift.express.test",
+
org.jboss.tools.openshift.express.internal.ui.wizard.application.details;x-friends:="org.jboss.tools.openshift.express.test",
org.jboss.tools.openshift.express.internal.ui.wizard.application.importoperation;x-friends:="org.jboss.tools.openshift.express.test",
-
org.jboss.tools.openshift.express.internal.ui.wizard.application.importoperation.project;x-friends:="org.jboss.tools.openshift.express.test"
+
org.jboss.tools.openshift.express.internal.ui.wizard.application.importoperation.project;x-friends:="org.jboss.tools.openshift.express.test",
+
org.jboss.tools.openshift.express.internal.ui.wizard.connection;x-friends:="org.jboss.tools.openshift.express.test",
+
org.jboss.tools.openshift.express.internal.ui.wizard.domain;x-friends:="org.jboss.tools.openshift.express.test",
+
org.jboss.tools.openshift.express.internal.ui.wizard.embed;x-friends:="org.jboss.tools.openshift.express.test",
+
org.jboss.tools.openshift.express.internal.ui.wizard.ssh;x-friends:="org.jboss.tools.openshift.express.test",
+
org.jboss.tools.openshift.express.internal.ui.wizard.ssh.databinding;x-friends:="org.jboss.tools.openshift.express.test"
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2012-10-17
10:35:47 UTC (rev 44556)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2012-10-17
15:49:34 UTC (rev 44557)
@@ -480,7 +480,7 @@
private static void setConnectionUrl(Connection connection, IEclipsePreferences node) {
try {
- node.put(ExpressServerUtils.SETTING_CONNECTIONURL, connection.toURLString());
+ node.put(ExpressServerUtils.SETTING_CONNECTIONURL,
ConnectionUtils.getUrlForConnection(connection));
if (hasUsername(node)) {
node.put(ExpressServerUtils.SETTING_USERNAME, connection.getUsername());
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/Connection.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/Connection.java 2012-10-17
10:35:47 UTC (rev 44556)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/Connection.java 2012-10-17
15:49:34 UTC (rev 44557)
@@ -67,16 +67,21 @@
this(null, null, null, false);
}
- public Connection(String username, ICredentialsPrompter prompter) {
+ public Connection(String username) {
this.username = username;
- this.prompter = prompter;
}
-
- public Connection(URL url, ICredentialsPrompter prompter) throws MalformedURLException,
UnsupportedEncodingException {
+
+ public Connection(String username, String host) {
+ this.username = username;
+ setHost(host);
+ }
+
+ public Connection(URL url, ICredentialsPrompter prompter) throws MalformedURLException,
+ UnsupportedEncodingException {
UrlPortions portions = UrlUtils.toPortions(url);
this.username = portions.getUsername();
this.password = portions.getPassword();
- setHost(portions.getHost());
+ setHost(portions.getProtocol() + UrlUtils.SCHEME_SEPARATOR + portions.getHost());
this.prompter = prompter;
}
@@ -111,7 +116,7 @@
}
return username;
}
-
+
private void setUser(IUser user) {
if (user == null) {
return;
@@ -154,36 +159,37 @@
*/
public String getHost() {
if (isDefaultHost()) {
- return UrlUtils.cutScheme(ConnectionUtils.getDefaultHostUrl());
+ return ConnectionUtils.getDefaultHostUrl();
}
return host;
}
+
+ /**
+ * Returns the scheme of this connections. Returns https by default;
+ * @return
+ */
+ public String getScheme() {
+ String scheme = UrlUtils.getScheme(getHost());
+ if (StringUtils.isEmpty(scheme)) {
+ scheme = UrlUtils.HTTPS;
+ }
+ return scheme;
+ }
public String setHost(String host) {
- if (isDefaultHost(host)) {
- this.host = null;
- } else {
- this.host = host;
+ if (!UrlUtils.hasScheme(host)) {
+ host = UrlUtils.SCHEME_HTTPS + StringUtils.null2emptyString(host);
}
+ this.host = host;
clearUser();
return host;
}
-
- public boolean isDefaultHost() {
- return isDefaultHost(host);
+ private boolean isDefaultHost() {
+ return ConnectionUtils.isDefaultHost(host);
}
- private boolean isDefaultHost(String host) {
- try {
- return StringUtils.isEmpty(host)
- || new URL(UrlUtils.ensureStartsWithSchemeOrHttps(host)).getHost().isEmpty();
- } catch (MalformedURLException e) {
- return true;
- }
- }
-
public boolean isRememberPassword() {
return rememberPassword;
}
@@ -460,13 +466,4 @@
SecurePasswordStore store = new SecurePasswordStore(key);
return store;
}
-
- /**
- * @return an url-alike string that always starts with a scheme but
- * eventually has no host where the default host shall be used.
- * @throws UnsupportedEncodingException
- */
- public String toURLString() throws UnsupportedEncodingException {
- return UrlUtils.toUrlString(username, host);
- }
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionUtils.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionUtils.java 2012-10-17
10:35:47 UTC (rev 44556)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionUtils.java 2012-10-17
15:49:34 UTC (rev 44557)
@@ -12,6 +12,7 @@
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
+import java.net.URL;
import org.jboss.tools.openshift.express.internal.core.util.UrlUtils;
import org.jboss.tools.openshift.express.internal.core.util.UrlUtils.UrlPortions;
@@ -19,6 +20,7 @@
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
+import com.openshift.client.configuration.IOpenShiftConfiguration;
import com.openshift.client.configuration.OpenShiftConfiguration;
/**
@@ -31,16 +33,48 @@
}
public static String getUrlForUsername(String username) throws
UnsupportedEncodingException, MalformedURLException {
+ if (StringUtils.isEmpty(username)) {
+ return null;
+ }
UrlPortions portions = UrlUtils.toPortions(getDefaultHostUrl());
- return UrlUtils.getUrlFor(username, portions.getHost(), portions.getProtocol());
+ return UrlUtils.getUrlFor(username, null, portions.getProtocol() +
UrlUtils.SCHEME_SEPARATOR);
}
+ public static String getUrlForUsernameAndHost(String username, String host) throws
UnsupportedEncodingException {
+ String scheme = UrlUtils.SCHEME_HTTPS;
+ if (isDefaultHost(host)) {
+ scheme = UrlUtils.ensureStartsWithSchemeOrHttps(UrlUtils.getScheme(host));
+ host = null;
+ } else if (UrlUtils.hasScheme(host)) {
+ scheme = UrlUtils.getScheme(host);
+ host = UrlUtils.cutScheme(host);
+ }
+ return UrlUtils.getUrlFor(username, host, scheme);
+ }
+
/**
+ * @return an url-alike string that always starts with a scheme but
+ * eventually has no host where the default host shall be used.
+ * @throws UnsupportedEncodingException
+ */
+ public static String getUrlForConnection(Connection connection) throws
UnsupportedEncodingException {
+ String username = connection.getUsername();
+ String host = connection.getHost();
+ if (isDefaultHost(host)) {
+ host = null;
+ }
+ return UrlUtils.toUrlString(username, host, connection.getScheme());
+ }
+
+ /**
* Returns the default host from the preferences if present. If it's not it
* will return the host defined in the OpenShift configuration. The host
* that is returned will always have the scheme prefix.
*
* @return the default host
+ *
+ * @see OpenShiftPreferences#getDefaultHost()
+ * @see IOpenShiftConfiguration#getLibraServer()
*/
public static String getDefaultHostUrl() {
try {
@@ -54,4 +88,39 @@
}
return null;
}
+
+ /**
+ * Returns <code>true</code> if the given host is the default host. This
+ * method reports a given String is the default host if it is empty or if
+ * it's equal to the default host defined for this plugin. This plugin takes
+ * the default host from the preferences or the openshift configuration. If
+ * the given host has no scheme this method will assume it's https.
+ *
+ * @param host
+ * the host to check whether it is the default host
+ * @return true if it is equal to the default host
+ *
+ * @see getDefaultHost()
+ */
+ public static boolean isDefaultHost(String host) {
+ return isEmptyHost(host)
+ || getDefaultHostUrl().equals(UrlUtils.ensureStartsWithSchemeOrHttps(host));
+ }
+
+ /**
+ * Returns <code>true</code> if the given host is an empty string or is an
+ * url with an empty host portion.
+ *
+ * @param host
+ * the host to check whether it is empty
+ * @return true if empty string or url without a host portion
+ */
+ public static boolean isEmptyHost(String host) {
+ try {
+ return StringUtils.isEmpty(host)
+ || new URL(UrlUtils.ensureStartsWithSchemeOrHttps(host)).getHost().isEmpty();
+ } catch (MalformedURLException e) {
+ return false;
+ }
+ }
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionsModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionsModel.java 2012-10-17
10:35:47 UTC (rev 44556)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionsModel.java 2012-10-17
15:49:34 UTC (rev 44557)
@@ -64,7 +64,7 @@
public void addConnection(Connection connection) {
try {
- allConnections.put(connection.toURLString(), connection);
+ allConnections.put(ConnectionUtils.getUrlForConnection(connection), connection);
this.recentConnection = connection;
fireModelChange(connection, ADDED);
} catch (UnsupportedEncodingException e) {
@@ -76,7 +76,7 @@
public boolean hasConnection(Connection connection) {
try {
- String url = connection.toURLString();
+ String url = ConnectionUtils.getUrlForConnection(connection);
return getConnectionByUrl(url) != null;
} catch (UnsupportedEncodingException e) {
OpenShiftUIActivator.log(
@@ -92,7 +92,7 @@
public void removeConnection(Connection connection) {
try {
- allConnections.remove(connection.toURLString());
+ allConnections.remove(ConnectionUtils.getUrlForConnection(connection));
if (this.recentConnection == connection)
this.recentConnection = null;
fireModelChange(connection, REMOVED);
@@ -139,13 +139,24 @@
return allConnections.get(url);
}
+ public Connection getConnectionByUsernameAndHost(String username, String host) {
+ try {
+ return getConnectionByUrl(ConnectionUtils.getUrlForUsernameAndHost(username, host));
+ } catch (UnsupportedEncodingException e) {
+ OpenShiftUIActivator.log(NLS.bind("Could not get url for connection {0} -
{1}", username, host), e);
+ return null;
+ }
+ }
+
public Connection getConnectionByUsername(String username) {
try {
- String url = new Connection(username, null).toURLString();
- return getConnectionByUrl(url);
+ return getConnectionByUrl(ConnectionUtils.getUrlForUsername(username));
} catch (UnsupportedEncodingException e) {
OpenShiftUIActivator.log(NLS.bind("Could not get url for connection {0}",
username), e);
return null;
+ } catch (MalformedURLException e) {
+ OpenShiftUIActivator.log(NLS.bind("Could not get url for connection {0}",
username), e);
+ return null;
}
}
@@ -158,7 +169,7 @@
/**
* Load the user list from preferences and secure storage
*/
- public void load() {
+ private void load() {
String[] connections = OpenShiftPreferences.INSTANCE.getConnections();
for (int i = 0; i < connections.length; i++) {
Connection connection = null;
@@ -183,7 +194,7 @@
Connection connection = entry.getValue();
connection.save();
try {
- persistedConnections.add(connection.toURLString());
+ persistedConnections.add(ConnectionUtils.getUrlForConnection(connection));
} catch (UnsupportedEncodingException e) {
OpenShiftUIActivator.log(
NLS.bind("Could not store connection {0}/{1}", connection.getUsername(),
connection.getHost()),
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/util/UrlUtils.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/util/UrlUtils.java 2012-10-17
10:35:47 UTC (rev 44556)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/util/UrlUtils.java 2012-10-17
15:49:34 UTC (rev 44557)
@@ -82,9 +82,8 @@
}
- public static String toUrlString(String username, String host) throws
UnsupportedEncodingException {
- host = cutScheme(host);
- StringBuilder builder = new StringBuilder();
+ public static String toUrlString(String username, String host, String scheme) throws
UnsupportedEncodingException {
+ StringBuilder builder = new StringBuilder(scheme);
if (!isEmpty(username)) {
builder.append(URLEncoder.encode(username, "UTF-8"))
.append(CREDENTIALS_HOST_SEPARATOR);
@@ -92,7 +91,7 @@
if (!isEmpty(host)) {
builder.append(host);
}
- return ensureStartsWithSchemeOrHttps(builder.toString());
+ return (builder.toString());
}
public static String ensureStartsWithSchemeOrHttps(String host) {
@@ -109,20 +108,39 @@
if (isEmpty(host)) {
return host;
}
- int schemeDelimiterIndex = getSchemeIndex(host);
- if (schemeDelimiterIndex > -1) {
- return host.substring(schemeDelimiterIndex + SCHEME_SEPARATOR.length());
+ int hostIndex = getHostIndex(host);
+ if (hostIndex > -1) {
+ return host.substring(hostIndex);
}
return host;
}
- private static boolean hasScheme(String host) {
+ public static String getScheme(String url) {
+ if (isEmpty(url)) {
+ return null;
+ }
+
+ int hostIndex = getHostIndex(url);
+ if (hostIndex == -1) {
+ return null;
+ }
+
+ return url.substring(0, hostIndex);
+ }
+
+ public static boolean hasScheme(String host) {
+ if (isEmpty(host)) {
+ return false;
+ }
return host.indexOf(SCHEME_SEPARATOR) > -1;
}
- private static int getSchemeIndex(String host) {
- int schemeDelimiterIndex = host.indexOf(SCHEME_SEPARATOR);
- return schemeDelimiterIndex;
+ private static int getHostIndex(String url) {
+ int schemeSeparatorIndex = url.indexOf(SCHEME_SEPARATOR);
+ if (schemeSeparatorIndex == -1) {
+ return schemeSeparatorIndex;
+ }
+ return schemeSeparatorIndex + SCHEME_SEPARATOR.length();
}
private static boolean isEmpty(String string) {
@@ -141,19 +159,21 @@
* @param scheme
* the scheme to prepend
* @return
+ * @throws UnsupportedEncodingException
*/
- public static String getUrlFor(String username, String host, String scheme) {
+ public static String getUrlFor(String username, String host, String scheme) throws
UnsupportedEncodingException {
StringBuilder builder = new StringBuilder();
- if (StringUtils.isEmpty(host)
- || !hasScheme(host)) {
- builder.append(scheme).append(SCHEME_SEPARATOR);
+ if (!hasScheme(host)) {
+ builder.append(scheme);
}
if (!StringUtils.isEmpty(username)) {
- builder.append(username)
+ builder.append(URLEncoder.encode(username, "UTF-8"))
.append(UrlUtils.CREDENTIALS_HOST_SEPARATOR);
}
- return builder.append(host)
- .toString();
+ if (!isEmpty(host)) {
+ builder.append(host);
+ }
+ return builder.toString();
}
}
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-10-17
10:35:47 UTC (rev 44556)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/EditCartridgesAction.java 2012-10-17
15:49:34 UTC (rev 44557)
@@ -22,6 +22,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;
/**
@@ -40,8 +41,9 @@
if (selection != null && selection instanceof ITreeSelection &&
treeSelection.getFirstElement() instanceof IApplication) {
try {
final IApplication application = (IApplication) treeSelection.getFirstElement();
- final Connection user =
ConnectionsModel.getDefault().getConnectionByUrl(application.getDomain().getUser().getRhlogin());
- EmbedCartridgeWizard wizard = new EmbedCartridgeWizard(application, user);
+ final IUser user = application.getDomain().getUser();
+ final Connection connection =
ConnectionsModel.getDefault().getConnectionByUsernameAndHost(user.getRhlogin(),
user.getServer());
+ EmbedCartridgeWizard wizard = new EmbedCartridgeWizard(application, connection);
int result = WizardUtils.openWizardDialog(wizard,
Display.getCurrent().getActiveShell());
if(result == Dialog.OK) {
RefreshViewerJob.refresh(viewer);
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java 2012-10-17
10:35:47 UTC (rev 44556)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java 2012-10-17
15:49:34 UTC (rev 44557)
@@ -135,7 +135,7 @@
private void initModel() {
String connectionUrl = ExpressServerUtils.getExpressConnectionUrl(server);
- if (ConnectionUtils.getDefaultHostUrl().equals(connectionUrl)) {
+ if (ConnectionUtils.isDefaultHost(connectionUrl)) {
initModelNewServerWizard();
return;
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/NewConnectionMarker.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/NewConnectionMarker.java 2012-10-17
10:35:47 UTC (rev 44556)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/NewConnectionMarker.java 2012-10-17
15:49:34 UTC (rev 44557)
@@ -22,6 +22,6 @@
public class NewConnectionMarker extends Connection {
public NewConnectionMarker() {
- super();
+ super("<New Connection>");
}
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/application/ApplicationWizardModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/application/ApplicationWizardModel.java 2012-10-17
10:35:47 UTC (rev 44556)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/application/ApplicationWizardModel.java 2012-10-17
15:49:34 UTC (rev 44557)
@@ -21,11 +21,11 @@
public class ApplicationWizardModel extends ObservableUIPojo {
private IApplication application;
- private Connection user;
+ private Connection connection;
- public ApplicationWizardModel(IApplication application, Connection user) {
+ public ApplicationWizardModel(IApplication application, Connection connection) {
this.application = application;
- this.user = user;
+ this.connection = connection;
}
public IApplication getApplication() {
@@ -33,6 +33,6 @@
}
public Connection getUser() {
- return user;
+ return connection;
}
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/connection/ConnectionWizardPageModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/connection/ConnectionWizardPageModel.java 2012-10-17
10:35:47 UTC (rev 44556)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/connection/ConnectionWizardPageModel.java 2012-10-17
15:49:34 UTC (rev 44557)
@@ -103,9 +103,7 @@
}
public void setSelectedConnection(Connection connection) {
- if ((this.selectedConnection instanceof NewConnectionMarker
- && connection instanceof NewConnectionMarker)
- || Diffs.equals(selectedConnection, connection)) {
+ if (Diffs.equals(selectedConnection, connection)) {
return;
}
this.isCreateNewConnection = getIsCreateNewConnection(connection);
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/embed/EmbedCartridgeWizard.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/embed/EmbedCartridgeWizard.java 2012-10-17
10:35:47 UTC (rev 44556)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/embed/EmbedCartridgeWizard.java 2012-10-17
15:49:34 UTC (rev 44557)
@@ -24,8 +24,8 @@
private ApplicationWizardModel wizardModel;
private EmbedCartridgeWizardPage embedCartridgeWizardPage;
- public EmbedCartridgeWizard(IApplication application, Connection user) {
- this.wizardModel = new ApplicationWizardModel(application, user);
+ public EmbedCartridgeWizard(IApplication application, Connection connection) {
+ this.wizardModel = new ApplicationWizardModel(application, connection);
setNeedsProgressMonitor(true);
setWindowTitle("Edit Embedded Cartridges");
}