JBoss Tools SVN: r44440 - trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2012-10-11 15:26:19 -0400 (Thu, 11 Oct 2012)
New Revision: 44440
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/messages.properties
Log:
"Add missing required attribute(s)" quick fix for "Missing required attribute" WTP problem marker https://issues.jboss.org/browse/JBIDE-12390
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/messages.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/messages.properties 2012-10-11 19:00:51 UTC (rev 44439)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/messages.properties 2012-10-11 19:26:19 UTC (rev 44440)
@@ -66,7 +66,7 @@
WebCompoundEditor_WebXMLEditor=Web XML Editor
XActionProvider_CompanyName=JBoss Tools
AddTLDMarkerResolution_Name=Insert ''{0}'' tag library definition
-AddAttributeMarkerResolution_Name= Insert ''{0}'' attribute to ''{1}'' tag
+AddAttributeMarkerResolution_Name= Add ''{0}'' attribute to ''{1}'' tag
NewXHTMLTemplatesWizardPage_0=Select XHTML Template
NewXHTMLTemplatesWizardPage_1=Select a template as initial content in theX HTML page.
NewXHTMLTemplatesWizardPage_2=Name
12 years, 3 months
JBoss Tools SVN: r44439 - trunk/build/parent.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2012-10-11 15:00:51 -0400 (Thu, 11 Oct 2012)
New Revision: 44439
Modified:
trunk/build/parent/pom.xml
Log:
switch default TP in parent to be latest minimum (SR0*), not latest maximum (SR1*) - JBIDE-10312, JBIDE-12761
Modified: trunk/build/parent/pom.xml
===================================================================
--- trunk/build/parent/pom.xml 2012-10-11 17:33:10 UTC (rev 44438)
+++ trunk/build/parent/pom.xml 2012-10-11 19:00:51 UTC (rev 44439)
@@ -38,17 +38,17 @@
<!-- Default coverage filter, to be overriden when necessary -->
<coverage.filter>org.jboss.tools.*</coverage.filter>
- <targetPlatformGroup>jbosstools-JunoSR1</targetPlatformGroup>
+ <targetPlatformGroup>jbosstools-JunoSR0b</targetPlatformGroup>
<!-- 1a. URL of latest JBT target platform site -->
<!-- minimum TP: use http://download.jboss.org/jbosstools/updates/juno/SR0b/latest/ -->
<!-- latest TP: use http://download.jboss.org/jbosstools/updates/juno/SR1/latest/ -->
- <jbosstools-target-site>http://download.jboss.org/jbosstools/updates/juno/SR1/latest/</jbosstools-target-site>
+ <jbosstools-target-site>http://download.jboss.org/jbosstools/updates/juno/SR0b/latest/</jbosstools-target-site>
<!-- 1b. or use -Plocal.site -Dlocal.site=file:///${HOME}/trunk/build/target-platform/REPO/ -->
<!-- TODO: don't forget to update JBDS .updatesite jobs when this value changes! -->
<!-- TODO: see also 'hudson' profile below for other default value -->
- <local.site>file:///${user.home}/.m2/jbosstools-target-platform_4.0.juno.SR1/</local.site>
+ <local.site>file:///${user.home}/.m2/jbosstools-target-platform_4.0.juno.SR0b/</local.site>
<!-- 2a. URL of latest JBT nightly staging composite site (all the components
in once place) -->
@@ -64,8 +64,8 @@
<!-- 3a. URL of latest JBT requirements composite mirror -->
<!-- TODO: don't forget to update this in ../aggregate/*/associate.properties too (5 files)! -->
- <jboss-requirements-composite-mirror>http://download.jboss.org/jbosstools/updates/juno/SR1/</jboss-requirements-composite-mirror>
- <jboss-requirements-composite-soa-tooling-mirror>http://download.jboss.org/jbosstools/updates/juno/soa-tooling/SR1/</jboss-requirements-composite-soa-tooling-mirror>
+ <jboss-requirements-composite-mirror>http://download.jboss.org/jbosstools/updates/juno/SR0b/latest/</jboss-requirements-composite-mirror>
+ <jboss-requirements-composite-soa-tooling-mirror>http://download.jboss.org/jbosstools/updates/juno/soa-tooling/SR0/</jboss-requirements-composite-soa-tooling-mirror>
<!-- 3b., or use -Plocal.requirements -Dlocal.requirements=file:///path/to/mirror/of/composite/requirements/site -->
<local.requirements>file:///qa/services/http/binaries/RHDS/updates/juno/</local.requirements>
12 years, 3 months
JBoss Tools SVN: r44438 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui: wizard/connection and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-10-11 13:33:10 -0400 (Thu, 11 Oct 2012)
New Revision: 44438
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/databinding/TrimmingStringConverter.java
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/connection/ConnectionWizardPage.java
Log:
[JBIDE-12572] trimming usernames to make it more robust (copy paste where you copy trailing space)
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/databinding/TrimmingStringConverter.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/databinding/TrimmingStringConverter.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/databinding/TrimmingStringConverter.java 2012-10-11 17:33:10 UTC (rev 44438)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.databinding;
+
+import org.eclipse.core.databinding.conversion.Converter;
+
+public class TrimmingStringConverter extends Converter {
+
+ public TrimmingStringConverter() {
+ super(String.class, String.class);
+ }
+
+ @Override
+ public Object convert(Object fromObject) {
+ if (!(fromObject instanceof String)) {
+ return fromObject;
+ }
+ return ((String) fromObject).trim();
+ }
+
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/databinding/TrimmingStringConverter.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/connection/ConnectionWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/connection/ConnectionWizardPage.java 2012-10-11 17:31:33 UTC (rev 44437)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/connection/ConnectionWizardPage.java 2012-10-11 17:33:10 UTC (rev 44438)
@@ -54,6 +54,7 @@
import org.jboss.tools.openshift.express.internal.ui.databinding.HostNameValidator;
import org.jboss.tools.openshift.express.internal.ui.databinding.RequiredControlDecorationUpdater;
import org.jboss.tools.openshift.express.internal.ui.databinding.RequiredStringValidator;
+import org.jboss.tools.openshift.express.internal.ui.databinding.TrimmingStringConverter;
import org.jboss.tools.openshift.express.internal.ui.explorer.AbstractLabelProvider;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
@@ -143,6 +144,7 @@
.align(SWT.FILL, SWT.CENTER).grab(true, false).span(1, 1).applyTo(rhLoginText);
Binding usernameBinding = ValueBindingBuilder
.bind(WidgetProperties.text(SWT.Modify).observe(rhLoginText))
+ .converting(new TrimmingStringConverter())
.validatingAfterGet(new RequiredStringValidator("username"))
.to(BeanProperties.value(ConnectionWizardPageModel.PROPERTY_USERNAME).observe(pageModel))
.in(dbc);
12 years, 3 months
JBoss Tools SVN: r44437 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-10-11 13:31:33 -0400 (Thu, 11 Oct 2012)
New Revision: 44437
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
Log:
[JBIDE-12572] fixed property providers in plugin.xml (erroneous refactoring)
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2012-10-11 17:08:15 UTC (rev 44436)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2012-10-11 17:31:33 UTC (rev 44437)
@@ -570,21 +570,21 @@
point="org.eclipse.core.runtime.adapters">
<factory
adaptableType="org.jboss.tools.openshift.express.internal.core.connection.Connection"
- class="org.jboss.tools.openshift.express.internal.ui.explorerproperty.PropertySourceAdapterFactory">
+ class="org.jboss.tools.openshift.express.internal.ui.explorer.property.PropertySourceAdapterFactory">
<adapter
type="org.eclipse.ui.views.properties.IPropertySource">
</adapter>
</factory>
<factory
adaptableType="com.openshift.client.IApplication"
- class="org.jboss.tools.openshift.express.internal.ui.explorerproperty.PropertySourceAdapterFactory">
+ class="org.jboss.tools.openshift.express.internal.ui.explorer.property.PropertySourceAdapterFactory">
<adapter
type="org.eclipse.ui.views.properties.IPropertySource">
</adapter>
</factory>
<factory
adaptableType="com.openshift.client.IEmbeddableCartridge"
- class="org.jboss.tools.openshift.express.internal.ui.explorerproperty.PropertySourceAdapterFactory">
+ class="org.jboss.tools.openshift.express.internal.ui.explorer.property.PropertySourceAdapterFactory">
<adapter
type="org.eclipse.ui.views.properties.IPropertySource">
</adapter>
12 years, 3 months
JBoss Tools SVN: r44436 - trunk/openshift/plugins/org.jboss.tools.openshift.express.client.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-10-11 13:08:15 -0400 (Thu, 11 Oct 2012)
New Revision: 44436
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.client/openshift-java-client-2.0.0-SNAPSHOT.jar
Log:
[JBIDE-12572] committed latest client
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.client/openshift-java-client-2.0.0-SNAPSHOT.jar
===================================================================
(Binary files differ)
12 years, 3 months
JBoss Tools SVN: r44435 - trunk/common/plugins/org.jboss.tools.common.mylyn/src.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2012-10-11 13:08:06 -0400 (Thu, 11 Oct 2012)
New Revision: 44435
Added:
trunk/common/plugins/org.jboss.tools.common.mylyn/src/.gitkeep
Log:
add gitkeep
Added: trunk/common/plugins/org.jboss.tools.common.mylyn/src/.gitkeep
===================================================================
12 years, 3 months
JBoss Tools SVN: r44434 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-10-11 13:07:18 -0400 (Thu, 11 Oct 2012)
New Revision: 44434
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java
Log:
[JBIDE-12572] committed latest client
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-11 16:36:48 UTC (rev 44433)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java 2012-10-11 17:07:18 UTC (rev 44434)
@@ -134,18 +134,18 @@
}
private void initModel() {
- String connectionUrl = ExpressServerUtils.getExpressConnectionUrl(server);
- if (connectionUrl == null) {
+// String connectionUrl = ExpressServerUtils.getExpressConnectionUrl(server);
+// if (connectionUrl == null) {
initModelNewServerWizard();
- return;
- }
-
- this.connectionUrl = connectionUrl;
- this.connection = ConnectionsModel.getDefault().getConnection(this.connectionUrl);
- this.app = ExpressServerUtils.getExpressApplicationName(server);
- this.deployProject = ExpressServerUtils.getExpressDeployProject(server);
- this.deployFolder = ExpressServerUtils.getExpressDeployFolder(server);
- this.remote = ExpressServerUtils.getExpressRemoteName(server);
+// return;
+// }
+//
+// this.connectionUrl = connectionUrl;
+// this.connection = ConnectionsModel.getDefault().getConnection(this.connectionUrl);
+// this.app = ExpressServerUtils.getExpressApplicationName(server);
+// this.deployProject = ExpressServerUtils.getExpressDeployProject(server);
+// this.deployFolder = ExpressServerUtils.getExpressDeployFolder(server);
+// this.remote = ExpressServerUtils.getExpressRemoteName(server);
}
private void initModelNewServerWizard() {
12 years, 3 months
JBoss Tools SVN: r44433 - trunk/build/parent.
by jbosstools-commits@lists.jboss.org
Author: mickael_istria
Date: 2012-10-11 12:36:48 -0400 (Thu, 11 Oct 2012)
New Revision: 44433
Modified:
trunk/build/parent/pom.xml
Log:
JBIDE-11404: Removed default profile, and set activeByDefault to true on unified.target and jbosstools-staging-aggregate
Modified: trunk/build/parent/pom.xml
===================================================================
--- trunk/build/parent/pom.xml 2012-10-11 15:52:19 UTC (rev 44432)
+++ trunk/build/parent/pom.xml 2012-10-11 16:36:48 UTC (rev 44433)
@@ -410,12 +410,7 @@
<profile>
<id>jbosstools-staging-aggregate</id>
<activation>
- <!-- JBIDE-11663 disable automatic enablement when swtbot.test.skip = false
- <property>
- <name>swtbot.test.skip</name>
- <value>false</value>
- </property>
- -->
+ <activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
@@ -564,6 +559,9 @@
the unified.target file -->
<profile>
<id>unified.target</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
<build>
<plugins>
<plugin>
@@ -725,26 +723,6 @@
</build>
</profile>
- <profile>
- <id>default</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <repositories>
- <repository>
- <id>jbosstools-target-site</id>
- <url>${jbosstools-target-site}</url>
- <layout>p2</layout>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>true</enabled>
- </releases>
- </repository>
- </repositories>
- </profile>
-
<!-- Multiple triggers to disable tests that depends on private requirements
These profiles are workaround for Maven to support minimal operations
http://jira.codehaus.org/browse/MNG-5347 -->
12 years, 3 months
JBoss Tools SVN: r44432 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal: core/connection and 9 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-10-11 11:52:19 -0400 (Thu, 11 Oct 2012)
New Revision: 44432
Added:
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/ui/viewer/ConnectionColumLabelProvider.java
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/connection/Connection.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/OpenshiftUIMessages.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenshiftUIMessages.properties
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteConnectionAction.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/behaviour/ExpressDetailsSection.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/explorer/ConnectToOpenShiftWizard.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/explorer/OpenShiftExplorerLabelProvider.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/preferences/IOpenShiftPreferenceConstants.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/preferences/OpenShiftPreferences.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/preferences/ServerPreferencePage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/UIUtils.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/connection/ConnectionWizardPage.java
Log:
[JBIDE-12798] changed server adapter wizard to support available connections now.
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-11 15:20:32 UTC (rev 44431)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2012-10-11 15:52:19 UTC (rev 44432)
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.jboss.tools.openshift.express.internal.core.behaviour;
+import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -75,6 +76,7 @@
public static final String SETTING_APPLICATION_ID = "org.jboss.tools.openshift.ApplicationId";
public static final String SETTING_DOMAIN = "org.jboss.tools.openshift.Domain";
public static final String SETTING_USERNAME = "org.jboss.tools.openshift.Username";
+ public static final String SETTING_CONNECTIONURL = "org.jboss.tools.openshift.Connection";
public static final String SETTING_DEPLOY_FOLDER_NAME = "org.jboss.tools.openshift.DeployFolder";
// Legacy, not to be used
@@ -117,7 +119,8 @@
* OpenShift if the user's applications list had not been loaded before.
* Callers should use this methd without blocking the UI.
*
- * @param server the server
+ * @param server
+ * the server
* @return the openshift application or null if it could not be located.
* @throws OpenShiftException
*/
@@ -151,11 +154,29 @@
attributes.getAttribute(ATTRIBUTE_DOMAIN, (String) null));
}
- public static String getExpressUsername(IServerAttributes attributes) {
+ private static String getExpressUsername(IServerAttributes attributes) {
return getProjectAttribute(getExpressDeployProject2(attributes), SETTING_USERNAME,
attributes.getAttribute(ATTRIBUTE_USERNAME, (String) null));
}
+ public static String getExpressConnectionUrl(IServerAttributes attributes) {
+ String connectionValue =
+ getProjectAttribute(
+ getExpressDeployProject2(attributes), SETTING_CONNECTIONURL, null);
+ if (connectionValue == null) {
+ String username = getExpressUsername(attributes);
+// connectionValue = ConnectionUtils.getUrlForUsername(getExpressUsername(attributes));
+ try {
+ connectionValue = new Connection(username, null).toURLString();
+ } catch (UnsupportedEncodingException e) {
+ OpenShiftUIActivator.log(NLS.bind("Could not get connection url for user {0}", username), e);
+ return null;
+ }
+ }
+
+ return connectionValue;
+ }
+
/* Settings stored in the project, maybe over-ridden in the server */
public static String getExpressDeployFolder(IServerAttributes attributes) {
if (getOverridesProject(attributes))
@@ -378,7 +399,7 @@
/**
* This method will search for all projects connected to git and having the
* proper settings file containing domain, application id, app name, and
- * username
+ * connection url
*
* @return
*/
@@ -386,19 +407,26 @@
final ArrayList<IProject> results = new ArrayList<IProject>();
final IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
for (int i = 0; i < projects.length; i++) {
- if (EGitUtils.getRepository(projects[i]) != null) {
- String appName = getProjectAttribute(projects[i], SETTING_APPLICATION_NAME, null);
- String appId = getProjectAttribute(projects[i], SETTING_APPLICATION_ID, null);
- String domain = getProjectAttribute(projects[i], SETTING_DOMAIN, null);
- String username = getProjectAttribute(projects[i], SETTING_USERNAME, null);
- if (appName != null && appId != null && domain != null && username != null) {
- results.add(projects[i]);
- }
+ if (EGitUtils.getRepository(projects[i]) != null
+ && hasOpenShiftSettings(projects[i])) {
+ results.add(projects[i]);
}
}
return results.toArray(new IProject[results.size()]);
}
+ private static boolean hasOpenShiftSettings(IProject project) {
+ String appName = getProjectAttribute(project, SETTING_APPLICATION_NAME, null);
+ String appId = getProjectAttribute(project, SETTING_APPLICATION_ID, null);
+ String domain = getProjectAttribute(project, SETTING_DOMAIN, null);
+ String connectionUrl = getProjectAttribute(project, SETTING_CONNECTIONURL, null);
+ String username = getProjectAttribute(project, SETTING_USERNAME, null);
+ return appName != null
+ && appId != null
+ && domain != null
+ && (connectionUrl != null || username != null);
+ }
+
public static IProject findProjectForApplication(IApplication application) {
IProject[] p = findProjectsForApplication(application);
return p == null ? null : p.length == 0 ? null : p[0];
@@ -415,9 +443,9 @@
public static IApplication findApplicationForServer(IServerAttributes server) {
try {
String user = ExpressServerUtils.getExpressUsername(server);
- Connection user2 = ConnectionsModel.getDefault().getConnection(user);
+ Connection connection = ConnectionsModel.getDefault().getConnection(user);
String appName = ExpressServerUtils.getExpressApplicationName(server);
- IApplication app = user2 == null ? null : user2.getApplicationByName(appName);
+ IApplication app = connection == null ? null : connection.getApplicationByName(appName);
return app;
} catch (OpenShiftException ose) {
Logger.error(NLS.bind("Could not find application for server {0}", server.getName()));
@@ -426,13 +454,13 @@
}
public static void updateOpenshiftProjectSettings(IProject project, IApplication app,
- Connection user, String remoteName, String deployFolder) {
+ Connection connection, String remoteName, String deployFolder) {
String qualifier = OpenShiftUIActivator.getDefault().getBundle().getSymbolicName();
IScopeContext context = new ProjectScope(project);
IEclipsePreferences node = context.getNode(qualifier);
node.put(ExpressServerUtils.SETTING_APPLICATION_ID, app.getUUID());
node.put(ExpressServerUtils.SETTING_APPLICATION_NAME, app.getName());
- node.put(ExpressServerUtils.SETTING_USERNAME, user.getUsername());
+ setConnectionUrl(connection, node);
node.put(ExpressServerUtils.SETTING_DOMAIN, app.getDomain().getId());
node.put(ExpressServerUtils.SETTING_REMOTE_NAME, remoteName);
node.put(ExpressServerUtils.SETTING_DEPLOY_FOLDER_NAME, deployFolder);
@@ -443,6 +471,22 @@
}
}
+ private static void setConnectionUrl(Connection connection, IEclipsePreferences node) {
+ try {
+ node.put(ExpressServerUtils.SETTING_CONNECTIONURL, connection.toURLString());
+ if (hasUsername(node)) {
+ node.put(ExpressServerUtils.SETTING_USERNAME, connection.getUsername());
+ }
+ } catch (UnsupportedEncodingException e) {
+ OpenShiftUIActivator.log(NLS.bind("Could not get connection url for connection {0}/{1}",
+ connection.getUsername(), connection.getHost()), e);
+ }
+ }
+
+ private static boolean hasUsername(IEclipsePreferences node) {
+ return node.get(ExpressServerUtils.SETTING_USERNAME, null) != null;
+ }
+
public static IServer setExpressDeployProject(IServer server, String val) throws CoreException {
IServerWorkingCopy wc = server.createWorkingCopy();
wc.setAttribute(ATTRIBUTE_DEPLOY_PROJECT, val);
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-11 15:20:32 UTC (rev 44431)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/Connection.java 2012-10-11 15:52:19 UTC (rev 44432)
@@ -67,8 +67,13 @@
this(null, null, null, false);
}
- public Connection(String url, ICredentialsPrompter prompter) throws MalformedURLException, UnsupportedEncodingException {
- UrlPortions portions = UrlUtils.toPortions(new URL(url));
+ public Connection(String username, ICredentialsPrompter prompter) {
+ this.username = username;
+ this.prompter = prompter;
+ }
+
+ 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());
@@ -149,11 +154,8 @@
* @return
*/
public String getHost() {
- if (StringUtils.isEmpty(host)) {
- return getDefaultHost();
- }
if (isDefaultHost()) {
- return getDefaultHost() + UrlUtils.cutScheme(host);
+ return UrlUtils.cutScheme(ConnectionUtils.getDefaultHostUrl());
}
return host;
@@ -183,16 +185,6 @@
}
}
- private String getDefaultHost() {
- try {
- // TODO: override by default server set in preferences
- return getOpenShiftConfiguration().getLibraServer();
- } catch (Exception e) {
- Logger.error("Could not load default server from OpenShift configuration.", e);
- }
- return null;
- }
-
public boolean isRememberPassword() {
return rememberPassword;
}
Added: 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 (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionUtils.java 2012-10-11 15:52:19 UTC (rev 44432)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.core.connection;
+
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.openshift.express.internal.core.util.UrlUtils;
+import org.jboss.tools.openshift.express.internal.core.util.UrlUtils.UrlPortions;
+import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+import org.jboss.tools.openshift.express.internal.ui.preferences.OpenShiftPreferences;
+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.OpenShiftConfiguration;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class ConnectionUtils {
+
+ private ConnectionUtils() {
+ // inhibit instantiation
+ }
+
+ public static String getUrlForUsername(String username) {
+ UrlPortions portions;
+ try {
+ portions = UrlUtils.toPortions(getDefaultHostUrl());
+ return UrlUtils.getUrlFor(username, portions.getHost(), portions.getProtocol());
+ } catch (UnsupportedEncodingException e) {
+ OpenShiftUIActivator.log(NLS.bind("Could not get default host for user {0}", username), e);
+ } catch (MalformedURLException e) {
+ OpenShiftUIActivator.log(NLS.bind("Could not get default host for user {0}", username), e);
+ }
+ return null;
+ }
+
+ /**
+ * 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 alwas have the scheme prefix.
+ *
+ * @return the default host
+ */
+ public static String getDefaultHostUrl() {
+ try {
+ String defaultHost = OpenShiftPreferences.INSTANCE.getDefaultHost();
+ if (!StringUtils.isEmpty(defaultHost)) {
+ return defaultHost;
+ }
+ return new OpenShiftConfiguration().getLibraServer();
+ } catch (Exception e) {
+ Logger.error("Could not load default server from OpenShift configuration.", e);
+ }
+ return null;
+ }
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
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-11 15:20:32 UTC (rev 44431)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionsModel.java 2012-10-11 15:52:19 UTC (rev 44432)
@@ -12,6 +12,7 @@
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -78,10 +79,14 @@
}
public void removeConnection(Connection connection) {
- allConnections.remove(connection.getUsername());
- if (this.recentConnection == connection)
- this.recentConnection = null;
- fireModelChange(connection, REMOVED);
+ try {
+ allConnections.remove(connection.toURLString());
+ if (this.recentConnection == connection)
+ this.recentConnection = null;
+ fireModelChange(connection, REMOVED);
+ } catch (UnsupportedEncodingException e) {
+ OpenShiftUIActivator.log(NLS.bind("Could not remove connection {0} - {1}", connection.getUsername(), connection.getHost()), e);
+ }
}
private void fireModelChange(Connection connection, int type) {
@@ -134,7 +139,8 @@
for (int i = 0; i < connections.length; i++) {
Connection connection = null;
try {
- connection = new Connection(connections[i], new CredentialsPrompter());
+ URL connectionUrl = new URL(connections[i]);
+ connection = new Connection(connectionUrl, new CredentialsPrompter());
addConnection(connection);
} catch (MalformedURLException e) {
OpenShiftUIActivator.log(NLS.bind("Could not add connection for {0}.", connections[i]), e);
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-11 15:20:32 UTC (rev 44431)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/util/UrlUtils.java 2012-10-11 15:52:19 UTC (rev 44432)
@@ -11,46 +11,57 @@
package org.jboss.tools.openshift.express.internal.core.util;
import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLDecoder;
import java.net.URLEncoder;
+import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
+
/**
* @author Andre Dietisheim
*/
public class UrlUtils {
- private static final String HTTPS = "https";
- private static final String HTTP = "http";
- private static final String SCHEME_SEPARATOR = "://";
+ public static final String HTTP = "http";
+ public static final String HTTPS = "https";
+ public static final String SCHEME_SEPARATOR = "://";
public static final String SCHEME_HTTPS = HTTPS + SCHEME_SEPARATOR;
public static final String SCHEME_HTTP = HTTP + SCHEME_SEPARATOR;
+ public static final char CREDENTIALS_HOST_SEPARATOR = '@';
- private static final char CREDENTIALS_HOST_DELIMITER = '@';
-
private UrlUtils() {
// inhibit instantiation
}
+ public static UrlPortions toPortions(String url) throws UnsupportedEncodingException, MalformedURLException {
+ return new UrlPortions(new URL(url));
+ }
+
public static UrlPortions toPortions(URL url) throws UnsupportedEncodingException {
return new UrlPortions(url);
}
public static class UrlPortions {
+ private String protocol;
private String username;
private String password;
private String host;
private UrlPortions(URL url) throws UnsupportedEncodingException {
- String[] userInfo = url.getUserInfo().split(":");
- if (userInfo.length >= 1) {
- this.username = URLDecoder.decode(userInfo[0], "UTF-8");
+ String userInfo = url.getUserInfo();
+ if (userInfo != null) {
+ String[] userInfos = url.getUserInfo().split(":");
+ if (userInfos.length >= 1) {
+ this.username = URLDecoder.decode(userInfos[0], "UTF-8");
+ }
+ if (userInfos.length >= 2) {
+ this.password = userInfos[1];
+ }
}
- if (userInfo.length >= 2) {
- this.password = userInfo[1];
- }
this.host = url.getHost();
+ this.protocol = url.getProtocol();
}
public String getUsername() {
@@ -64,12 +75,20 @@
public String getHost() {
return host;
}
+
+ public String getProtocol() {
+ return protocol;
+ }
+
}
public static String toUrlString(String username, String host) throws UnsupportedEncodingException {
host = cutScheme(host);
- StringBuilder builder = new StringBuilder(URLEncoder.encode(username, "UTF-8"))
- .append(CREDENTIALS_HOST_DELIMITER);
+ StringBuilder builder = new StringBuilder();
+ if (!isEmpty(username)) {
+ builder.append(URLEncoder.encode(username, "UTF-8"))
+ .append(CREDENTIALS_HOST_SEPARATOR);
+ }
if (!isEmpty(host)) {
builder.append(host);
}
@@ -90,15 +109,51 @@
if (isEmpty(host)) {
return host;
}
- int schemeDelimiterIndex = host.indexOf(SCHEME_SEPARATOR);
+ int schemeDelimiterIndex = getSchemeIndex(host);
if (schemeDelimiterIndex > -1) {
return host.substring(schemeDelimiterIndex + SCHEME_SEPARATOR.length());
}
return host;
}
-
+
+ private static boolean hasScheme(String host) {
+ return host.indexOf(SCHEME_SEPARATOR) > -1;
+ }
+
+ private static int getSchemeIndex(String host) {
+ int schemeDelimiterIndex = host.indexOf(SCHEME_SEPARATOR);
+ return schemeDelimiterIndex;
+ }
+
private static boolean isEmpty(String string) {
return string == null
|| string.isEmpty();
}
+
+ /**
+ * Returns an url for the given username, host and scheme. If the given host
+ * already has a scheme, the scheme wont get prepended.
+ *
+ * @param username
+ * the username for the url
+ * @param host
+ * the host for the url
+ * @param scheme
+ * the scheme to prepend
+ * @return
+ */
+ public static String getUrlFor(String username, String host, String scheme) {
+ StringBuilder builder = new StringBuilder();
+ if (StringUtils.isEmpty(host)
+ || !hasScheme(host)) {
+ builder.append(scheme).append(SCHEME_SEPARATOR);
+ }
+ if (!StringUtils.isEmpty(username)) {
+ builder.append(username)
+ .append(UrlUtils.CREDENTIALS_HOST_SEPARATOR);
+ }
+ return builder.append(host)
+ .toString();
+
+ }
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenshiftUIMessages.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenshiftUIMessages.java 2012-10-11 15:20:32 UTC (rev 44431)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenshiftUIMessages.java 2012-10-11 15:52:19 UTC (rev 44432)
@@ -25,7 +25,7 @@
public static String EditorSectionAppNameLabel;
public static String EditorSectionDeployLocLabel;
public static String EditorSectionZipDestLabel;
- public static String EditorSectionUserLabel;
+ public static String EditorSectionConnectionLabel;
public static String EditorSectionRemoteLabel;
public static String EditorSectionBrowseDestButton;
public static String EditorSectionProjectSettingsGroup;
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenshiftUIMessages.properties
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenshiftUIMessages.properties 2012-10-11 15:20:32 UTC (rev 44431)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenshiftUIMessages.properties 2012-10-11 15:52:19 UTC (rev 44432)
@@ -2,7 +2,7 @@
EditorSectionAppNameLabel=Application Name:
EditorSectionDeployLocLabel=Deploy Project:
EditorSectionZipDestLabel=Output Directory:
-EditorSectionUserLabel=Username:
+EditorSectionConnectionLabel=Connection:
EditorSectionRemoteLabel=Remote:
EditorSectionBrowseDestButton=Browse...
EditorSectionProjectSettingsGroup=Project Settings:
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteConnectionAction.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteConnectionAction.java 2012-10-11 15:20:32 UTC (rev 44431)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteConnectionAction.java 2012-10-11 15:52:19 UTC (rev 44432)
@@ -29,8 +29,8 @@
if (selection instanceof ITreeSelection
&& ((ITreeSelection) selection).getFirstElement() instanceof Connection) {
final ITreeSelection treeSelection = (ITreeSelection) selection;
- final Connection user = (Connection) treeSelection.getFirstElement();
- ConnectionsModel.getDefault().removeConnection(user);
+ final Connection connection = (Connection) treeSelection.getFirstElement();
+ ConnectionsModel.getDefault().removeConnection(connection);
}
}
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-11 15:20:32 UTC (rev 44431)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java 2012-10-11 15:52:19 UTC (rev 44432)
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.behaviour;
-import java.net.SocketTimeoutException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -27,8 +26,14 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.jface.wizard.WizardDialog;
@@ -40,7 +45,6 @@
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
@@ -60,16 +64,17 @@
import org.jboss.ide.eclipse.as.ui.UIUtil;
import org.jboss.ide.eclipse.as.ui.editor.DeploymentTypeUIUtil;
import org.jboss.ide.eclipse.as.ui.editor.IDeploymentTypeUI.IServerModeUICallback;
+import org.jboss.tools.common.ui.WizardUtils;
import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
import org.jboss.tools.openshift.express.internal.core.connection.Connection;
import org.jboss.tools.openshift.express.internal.core.connection.ConnectionsModel;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
-import org.jboss.tools.openshift.express.internal.ui.OpenshiftUIMessages;
-import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
-import org.jboss.tools.openshift.express.internal.ui.wizard.ConnectToOpenShiftWizardModel;
+import org.jboss.tools.openshift.express.internal.ui.explorer.ConnectToOpenShiftWizard;
+import org.jboss.tools.openshift.express.internal.ui.utils.UIUpdatingJob;
+import org.jboss.tools.openshift.express.internal.ui.utils.UIUtils;
+import org.jboss.tools.openshift.express.internal.ui.viewer.ConnectionColumLabelProvider;
import org.jboss.tools.openshift.express.internal.ui.wizard.application.ImportOpenShiftExpressApplicationWizard;
import org.jboss.tools.openshift.express.internal.ui.wizard.application.OpenShiftExpressApplicationWizard;
-import org.jboss.tools.openshift.express.internal.ui.wizard.connection.ConnectionWizardPageModel;
import com.openshift.client.IApplication;
import com.openshift.client.IDomain;
@@ -78,36 +83,34 @@
/**
* @author Rob Stryker
+ * @author Andre Dietisheim
*/
public class ExpressDetailsComposite {
// How to display errors, set attributes, etc
protected IServerModeUICallback callback;
-
- // Widgets
- private ModifyListener nameModifyListener, remoteModifyListener,
+
+ // Widgets
+ private ModifyListener remoteModifyListener,
appModifyListener, deployProjectModifyListener, deployDestinationModifyListener;
- private ModifyListener passModifyListener;
private Composite composite;
private Link importLink;
- protected Text userText, remoteText;
- protected Text passText;
+ private ComboViewer connectionComboViewer;
+ protected Text remoteText;
protected Text deployFolderText;
protected Combo appNameCombo, deployProjectCombo;
- protected Button verifyButton, browseDestButton, rememberPasswordCheckBox;
+ protected Button browseDestButton;
protected boolean showVerify, showImportLink;
-
- // Data / Model
- private boolean rememberPassword = true;
- private String user, pass, app, remote, deployProject, deployFolder;
+
+ // Data / Model
+ private String connectionUrl, app, remote, deployProject, deployFolder;
private IApplication fapplication;
private Connection connection;
private IDomain fdomain;
private List<IApplication> appList;
- private String[] appListNames;
+ private String[] appListNames = new String[0];
private IServerWorkingCopy server;
private HashMap<IApplication, IProject[]> projectsPerApp = new HashMap<IApplication, IProject[]>();
- private boolean credentialsFailed = false;
-
+
public ExpressDetailsComposite(Composite fill, IServerModeUICallback callback, boolean showVerify) {
this.callback = callback;
this.server = callback.getServer();
@@ -119,8 +122,8 @@
createWidgets(fill);
fillWidgets();
addListeners();
- quickValidate();
- } catch(RuntimeException e) {
+ updateErrorMessage();
+ } catch (RuntimeException e) {
e.printStackTrace();
throw e;
}
@@ -131,16 +134,15 @@
}
private void initModel() {
- String nameFromExistingServer = ExpressServerUtils.getExpressUsername(server);
- if (nameFromExistingServer == null) {
+ String connectionUrl = ExpressServerUtils.getExpressConnectionUrl(server);
+ if (connectionUrl == null) {
initModelNewServerWizard();
return;
}
- this.user = nameFromExistingServer;
- this.connection = ConnectionsModel.getDefault().getConnection(this.user);
+ this.connectionUrl = connectionUrl;
+ this.connection = ConnectionsModel.getDefault().getConnection(this.connectionUrl);
this.app = ExpressServerUtils.getExpressApplicationName(server);
- this.pass = connection.getPassword();
this.deployProject = ExpressServerUtils.getExpressDeployProject(server);
this.deployFolder = ExpressServerUtils.getExpressDeployFolder(server);
this.remote = ExpressServerUtils.getExpressRemoteName(server);
@@ -148,64 +150,51 @@
private void initModelNewServerWizard() {
// We're in a new server wizard.
- Connection tmpUser = (Connection) callback.getAttribute(ExpressServerUtils.TASK_WIZARD_ATTR_USER);
+ Connection tmpConnection = (Connection) callback.getAttribute(ExpressServerUtils.TASK_WIZARD_ATTR_USER);
IApplication app = (IApplication) callback.getAttribute(ExpressServerUtils.TASK_WIZARD_ATTR_SELECTED_APP);
-
- if( tmpUser != null && app != null ) {
+
+ if (tmpConnection != null && app != null) {
// started from express console with a user and an app
- try {
- this.app = app.getName();
- updateModelForNewUser(tmpUser);
- quickValidate();
- showVerify = false;
- IProject[] p = projectsPerApp.get(app);
- showImportLink = p == null || p.length == 0;
- } catch( OpenShiftException ose ) {
- // ignore, allow appList and appListNames to be null / empty
- } catch( SocketTimeoutException ste) {
- // ignore, allow appList and appListNames to be null / empty
- }
+ this.app = app.getName();
+ updateModel(tmpConnection);
+ updateErrorMessage();
+ showVerify = false;
+ IProject[] p = projectsPerApp.get(app);
+ showImportLink = p == null || p.length == 0;
} else {
// we may or may not have a user, clearly no app
- this.connection = tmpUser == null ? ConnectionsModel.getDefault().getRecentConnection() : tmpUser;
- this.user = connection == null ? null : connection.getUsername();
+ this.connection = tmpConnection == null ? ConnectionsModel.getDefault().getRecentConnection()
+ : tmpConnection;
}
-
- this.pass = this.user == null ? null : connection.getPassword();
+
this.deployFolder = ExpressServerUtils.getExpressDeployFolder(server);
- this.deployFolder = this.deployFolder == null ? ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT : this.deployFolder;
+ this.deployFolder = this.deployFolder == null ? ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT
+ : this.deployFolder;
this.remote = ExpressServerUtils.getExpressRemoteName(server);
this.remote = this.remote == null ? ExpressServerUtils.ATTRIBUTE_REMOTE_NAME_DEFAULT : this.remote;
}
-
+
/* Set widgets initial values */
private void fillWidgets() {
- if (user != null) {
- userText.setText(user);
- userText.setEnabled(showVerify);
+ connectionComboViewer.setInput(ConnectionsModel.getDefault().getConnections());
+ if (connection != null) {
+ selectComboConnection(connection);
+ connectionComboViewer.getControl().setEnabled(showVerify);
}
- if( showVerify ) {
- if (pass != null) {
- passText.setText(pass);
- passText.setEnabled(fapplication == null);
- }
- rememberPassword = pass != null && !"".equals(pass);
- rememberPasswordCheckBox.setSelection(rememberPassword);
- }
- if (remote != null)
+ if (remote != null) {
remoteText.setText(remote);
- if (appListNames != null)
- appNameCombo.setItems(appListNames);
+ }
+ appNameCombo.setItems(appListNames);
if (app != null) {
appNameCombo.setEnabled(false);
- appNameCombo.setItems(new String[]{app});
+ appNameCombo.setItems(new String[] { app });
appNameCombo.select(0);
- if( fapplication != null ) {
+ if (fapplication != null) {
resetDeployProjectCombo();
} else {
this.deployProject = ExpressServerUtils.getExpressDeployProject(server);
- if( deployProject != null ) {
- this.deployProjectCombo.setItems(new String[]{deployProject});
+ if (deployProject != null) {
+ this.deployProjectCombo.setItems(new String[] { deployProject });
this.deployProjectCombo.select(0);
this.deployProjectCombo.setEnabled(false);
} else {
@@ -213,7 +202,7 @@
}
}
}
-
+
deployFolderText.setText(deployFolder);
remoteText.setText(remote);
}
@@ -221,11 +210,11 @@
private void resetDeployProjectCombo() {
IProject[] p = ExpressServerUtils.findProjectsForApplication(fapplication);
String[] names = p == null ? new String[0] : new String[p.length];
- for( int i = 0; i < names.length; i++ ) {
+ for (int i = 0; i < names.length; i++) {
names[i] = p[i].getName();
}
this.deployProjectCombo.setItems(names);
- if( names.length > 0 ) {
+ if (names.length > 0) {
deployProjectCombo.select(0);
this.deployProject = names[0];
browseDestButton.setEnabled(true);
@@ -233,103 +222,136 @@
browseDestButton.setEnabled(false);
}
}
-
+
private void createWidgets(Composite composite) {
- composite.setLayout(new GridLayout(2, false));
- Label userLabel = new Label(composite, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(userLabel);
- userText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(userText);
- Label passLabel = null;
- if( showVerify ) {
- passLabel = new Label(composite, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(passLabel);
- passText = new Text(composite, SWT.PASSWORD | SWT.BORDER);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(passText);
- verifyButton = new Button(composite, SWT.PUSH);
- verifyButton.setText("Verify...");
-
- // Add label to check for password remember
- rememberPasswordCheckBox = new Button(composite, SWT.CHECK);
- rememberPasswordCheckBox.setText(OpenshiftUIMessages.OpenshiftWizardSavePassword);
- }
-
+ GridLayoutFactory.fillDefaults().numColumns(3).equalWidth(false).applyTo(composite);
+ Label connectionLabel = new Label(composite, SWT.NONE);
+ connectionLabel.setText("Connection:");
+ GridDataFactory.fillDefaults()
+ .align(SWT.LEFT, SWT.CENTER).applyTo(connectionLabel);
+ Combo connectionCombo = new Combo(composite, SWT.DEFAULT);
+ this.connectionComboViewer = new ComboViewer(connectionCombo);
+ connectionComboViewer.setContentProvider(ArrayContentProvider.getInstance());
+ connectionComboViewer.setLabelProvider(new ConnectionColumLabelProvider());
+ GridDataFactory.fillDefaults()
+ .align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(connectionCombo);
+
+ Button newConnectionButton = new Button(composite, SWT.PUSH);
+ GridDataFactory.fillDefaults()
+ .align(SWT.FILL, SWT.CENTER).applyTo(newConnectionButton);
+ newConnectionButton.setText("New...");
+ newConnectionButton.addSelectionListener(onNewConnection());
+
Label appNameLabel = new Label(composite, SWT.NONE);
GridDataFactory.fillDefaults()
.align(SWT.LEFT, SWT.CENTER).applyTo(appNameLabel);
appNameCombo = new Combo(composite, SWT.READ_ONLY);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(appNameCombo);
+ GridDataFactory.fillDefaults()
+ .span(2, 1).align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(appNameCombo);
appNameLabel.setText("Application Name: ");
-
+
Label deployLocationLabel = new Label(composite, SWT.NONE);
deployProjectCombo = new Combo(composite, SWT.READ_ONLY);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(deployProjectCombo);
- deployLocationLabel.setText("Deploy Project: " );
-
- if( showImportLink ) {
+ GridDataFactory.fillDefaults()
+ .span(2, 1).align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(deployProjectCombo);
+ deployLocationLabel.setText("Deploy Project: ");
+
+ if (showImportLink) {
importLink = new Link(composite, SWT.None);
importLink.setText("<a>Import this application</a>"); //$NON-NLS-1$
- // if we show verify, start import link disabled (wait for verify pressed to enable)
- // Otherwise, not showing verify means we're inside new wizard fragment with no suitable projects
+ // if we show verify, start import link disabled (wait for verify
+ // pressed to enable)
+ // Otherwise, not showing verify means we're inside new wizard
+ // fragment with no suitable projects
importLink.setEnabled(!showVerify);
- GridData gd = GridDataFactory.fillDefaults().span(2, 1).create();
- importLink.setLayoutData(gd);
+ GridDataFactory.fillDefaults()
+ .span(3, 1).applyTo(importLink);
}
-
+
Label remoteLabel = new Label(composite, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(remoteLabel);
remoteText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(remoteText);
-
+ GridDataFactory.fillDefaults()
+ .span(2, 1).align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(remoteText);
+
Group projectSettings = new Group(composite, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).span(2,1).applyTo(projectSettings);
+ GridDataFactory.fillDefaults()
+ .span(3, 1).align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(projectSettings);
projectSettings.setLayout(new GridLayout(2, false));
-
+
Label zipDestLabel = new Label(projectSettings, SWT.NONE);
zipDestLabel.setText("Output Directory: ");
-
+
Composite zipDestComposite = new Composite(projectSettings, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(zipDestComposite);
zipDestComposite.setLayout(new FormLayout());
browseDestButton = new Button(zipDestComposite, SWT.PUSH);
browseDestButton.setText("Browse...");
- browseDestButton.setLayoutData(UIUtil.createFormData2(0,5,100,-5,null,0,100,0));
+ browseDestButton.setLayoutData(UIUtil.createFormData2(0, 5, 100, -5, null, 0, 100, 0));
deployFolderText = new Text(zipDestComposite, SWT.SINGLE | SWT.BORDER);
- deployFolderText.setLayoutData(UIUtil.createFormData2(0,5,100,-5,0,0,browseDestButton,-5));
+ deployFolderText.setLayoutData(UIUtil.createFormData2(0, 5, 100, -5, 0, 0, browseDestButton, -5));
// Text
projectSettings.setText("Project Settings");
- userLabel.setText("Username: ");
- if( passLabel != null ) passLabel.setText("Password: ");
remoteLabel.setText("Remote: ");
}
- private void addListeners() {
- nameModifyListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- user = userText.getText();
- Connection connection = ConnectionsModel.getDefault().getConnection(user);
- String storedPass = connection.getPassword();
- if (!StringUtils.isEmpty(storedPass))
- passText.setText(storedPass);
- }
- };
- userText.addModifyListener(nameModifyListener);
+ private SelectionListener onNewConnection() {
+ return new SelectionAdapter() {
- passModifyListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- pass = passText.getText();
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Connection connection = UIUtils.getFirstElement(connectionComboViewer.getSelection(), Connection.class);
+ ConnectToOpenShiftWizard wizard = new ConnectToOpenShiftWizard(connection);
+ if (WizardUtils.openWizardDialog(
+ wizard, connectionComboViewer.getControl().getShell()) == Window.OK) {
+ connectionComboViewer.getControl().setEnabled(true);
+ connectionComboViewer.setInput(ConnectionsModel.getDefault().getConnections());
+ final Connection selectedConnection =
+ ConnectionsModel.getDefault().getRecentConnection();
+ selectComboConnection(selectedConnection);
+ }
}
};
-
- if( showVerify )
- passText.addModifyListener(passModifyListener);
+ }
- remoteModifyListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- remote = remoteText.getText();
+ private ISelectionChangedListener onConnectionSelected() {
+ return new ISelectionChangedListener() {
+
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ final Connection connection = UIUtils.getFirstElement(event.getSelection(), Connection.class);
+ if (connection != null) {
+ Job j = new UIUpdatingJob("Verifying connection...") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ updateModel(connection);
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ protected IStatus updateUI(IProgressMonitor monitor) {
+ updateWidgets();
+ updateErrorMessage();
+ return Status.OK_STATUS;
+ }
+ };
+ callback.executeLongRunning(j);
+ }
}
};
+ }
+
+ private void addListeners() {
+ connectionComboViewer.addSelectionChangedListener(onConnectionSelected());
+
+ if (showVerify)
+ remoteModifyListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ remote = remoteText.getText();
+ }
+ };
remoteText.addModifyListener(remoteModifyListener);
if (appNameCombo != null) {
@@ -337,12 +359,12 @@
public void modifyText(ModifyEvent e) {
app = appNameCombo.getText();
int ind = appNameCombo.indexOf(app);
- if( ind != -1 ) {
+ if (ind != -1) {
fapplication = appList.get(ind);
}
resetDeployProjectCombo();
enableImportLink();
- quickValidate();
+ updateErrorMessage();
}
};
appNameCombo.addModifyListener(appModifyListener);
@@ -362,95 +384,86 @@
}
};
deployFolderText.addModifyListener(deployDestinationModifyListener);
-
+
browseDestButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
browsePressed();
}
});
-
- if (showImportLink ) {
- importLink.addSelectionListener(new SelectionListener() {
+ if (showImportLink) {
+ importLink.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- OpenShiftExpressApplicationWizard wizard =
+ OpenShiftExpressApplicationWizard wizard =
new ImportOpenShiftExpressApplicationWizard(connection, null, fapplication);
WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
int oldServerCount = ServerCore.getServers().length;
dialog.create();
dialog.open();
- if( ServerCore.getServers().length > oldServerCount ) {
+ if (ServerCore.getServers().length > oldServerCount) {
// Cancel this wizard, a server has already been created
// This is reeeaally ugly
- IWizardHandle handle = ((DeploymentTypeUIUtil.NewServerWizardBehaviourCallback)callback).getHandle();
- IWizardContainer container = ((WizardPage)handle).getWizard().getContainer();
- ((WizardDialog)container).close();
+ IWizardHandle handle = ((DeploymentTypeUIUtil.NewServerWizardBehaviourCallback) callback)
+ .getHandle();
+ IWizardContainer container = ((WizardPage) handle).getWizard().getContainer();
+ ((WizardDialog) container).close();
}
}
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
});
}
- if (showVerify) {
- verifyButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- verifyPressed();
+
+ deployProjectCombo.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ int index = deployProjectCombo.getSelectionIndex();
+ if (index > -1) {
+ deployProject = deployProjectCombo.getText();
+ deployProjectChanged(deployProject);
}
- });
- rememberPasswordCheckBox.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- rememberPassword = rememberPasswordCheckBox.getSelection();
- }
- });
- }
-
- deployProjectCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- deployProjectChanged();
}
});
}
- private void deployProjectChanged() {
- int i = deployProjectCombo.getSelectionIndex();
- if( i != -1 ) {
+ private void deployProjectChanged(String deployProject) {
+ if (deployProject != null) {
IProject depProj = ResourcesPlugin.getWorkspace().getRoot().getProject(deployProject);
- if( depProj != null && depProj.isAccessible() ) {
- String depFolder = ExpressServerUtils.getProjectAttribute(depProj,
- ExpressServerUtils.SETTING_DEPLOY_FOLDER_NAME, null);
- //ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
- if( depFolder == null )
+ if (depProj != null && depProj.isAccessible()) {
+ String depFolder = ExpressServerUtils.getProjectAttribute(depProj,
+ ExpressServerUtils.SETTING_DEPLOY_FOLDER_NAME, null);
+ // ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
+ if (depFolder == null)
deployFolderText.setText(ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
deployFolderText.setEnabled(depFolder == null);
browseDestButton.setEnabled(depFolder == null);
}
}
}
-
+
private void browsePressed() {
IFolder f = chooseFolder();
- if( f != null ) {
+ if (f != null) {
deployFolderText.setText(f.getFullPath().removeFirstSegments(1).makeRelative().toOSString());
}
}
-
+
private IFolder chooseFolder() {
- if( this.deployProject == null )
+ if (this.deployProject == null)
return null;
-
+
IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(this.deployProject);
- ILabelProvider lp= new WorkbenchLabelProvider();
- ITreeContentProvider cp= new WorkbenchContentProvider();
+ ILabelProvider lp = new WorkbenchLabelProvider();
+ ITreeContentProvider cp = new WorkbenchContentProvider();
- ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(Display.getDefault().getActiveShell(), lp, cp);
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(Display.getDefault().getActiveShell(), lp,
+ cp);
dialog.setTitle("Deploy Location");
dialog.setMessage("Please choose a location to put zipped projects");
dialog.setInput(p);
dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
-
- IResource res= p.findMember(new Path(this.deployFolder));
+
+ IResource res = p.findMember(new Path(this.deployFolder));
if (res != null) {
dialog.setInitialSelection(res);
}
@@ -460,36 +473,29 @@
}
return null;
}
-
- private void verifyPressed() {
- this.fapplication = null;
- this.connection = null;
- this.appListNames = null;
- verifyButton.setEnabled(false);
- Job j = new Job("Verifying Credentials and Application") {
- protected IStatus run(IProgressMonitor monitor) {
- getVerifyingCredentialsRunnable().run();
- return Status.OK_STATUS;
- }
- };
- callback.executeLongRunning(j);
- postVerifyUpdateWidgets();
- quickValidate();
- }
- private void postVerifyUpdateWidgets() {
+ private void updateWidgets() {
importLink.setEnabled(false);
- verifyButton.setEnabled(true);
+ if (connection == null
+ || !connection.isConnected()) {
+ selectComboConnection(null);
+ }
+ populateAppNamesCombo();
+ enableImportLink();
+ resetDeployProjectCombo();
+ }
+
+ private void populateAppNamesCombo() {
if (appNameCombo != null && connection != null) {
appNameCombo.setItems(appListNames);
int index = Arrays.asList(appListNames).indexOf(app);
if (index != -1)
appNameCombo.select(index);
- else if( (app == null || "".equals(app)) && appListNames.length > 0) {
+ else if ((app == null || "".equals(app)) && appListNames.length > 0) {
int select = 0;
- for( int i = 0; i < appList.size(); i++ ) {
+ for (int i = 0; i < appList.size(); i++) {
IProject[] p = projectsPerApp.get(appList.get(i));
- if( p != null && p.length > 0 ) {
+ if (p != null && p.length > 0) {
select = i;
break;
}
@@ -497,30 +503,26 @@
appNameCombo.select(select);
}
}
- enableImportLink();
- resetDeployProjectCombo();
}
-
+
private void enableImportLink() {
IProject[] p = ExpressServerUtils.findProjectsForApplication(fapplication);
importLink.setEnabled(p == null || p.length == 0);
}
- private void quickValidate() {
- if( !showVerify )
+ private void updateErrorMessage() {
+ if (!showVerify)
return;
callback.setErrorMessage(getErrorString());
}
public String getErrorString() {
String error = null;
- if( credentialsFailed ) {
- error = "Credentials Failed";
- } else if( appList == null ) {
- error = "Please click \"verify\" to test your credentials.";
- } else if( fdomain == null ) {
+ if (appList == null) {
+ error = "Please select an existing connection or create a new one.";
+ } else if (fdomain == null) {
error = "Your OpenShift account has not been configured with a domain.";
- } else if( app == null || app.equals("")) {
+ } else if (app == null || app.equals("")) {
error = "Please select an application from the combo below.";
} else {
IProject[] p = ExpressServerUtils.findProjectsForApplication(fapplication);
@@ -531,40 +533,13 @@
return error;
}
- private Runnable getVerifyingCredentialsRunnable() {
- final ConnectToOpenShiftWizardModel credentialsWizardModel = new ConnectToOpenShiftWizardModel();
- final ConnectionWizardPageModel model = new ConnectionWizardPageModel(credentialsWizardModel);
- model.setPassword(pass);
- model.setUsername(user);
- model.setRememberPassword(rememberPassword);
- return new Runnable() {
- public void run() {
- final IStatus s = model.connect();
- if (!s.isOK()) {
- credentialsFailed = true;
- } else {
- credentialsFailed = false;
- try {
- updateModelForNewUser(credentialsWizardModel.getConnection());
- } catch(NotFoundOpenShiftException nose) {
- // Ignore this. It will be handled later
- } catch(OpenShiftException ose) {
- } catch(SocketTimeoutException ose) {
- }
- }
- }
- };
- }
-
- private void updateModelForNewUser(Connection user) throws OpenShiftException, SocketTimeoutException {
-
- // Updating the model, some long-running
- projectsPerApp.clear();
+ private void updateModel(Connection connection) {
try {
- // IF we load the applications first, domain gets loaded automatically
- this.appList = user.getApplications();
- fdomain = user.getDefaultDomain();
- } catch(NotFoundOpenShiftException nfose) {
+ // IF we load the applications first, domain gets loaded
+ // automatically
+ this.appList = connection.getApplications();
+ fdomain = connection.getDefaultDomain();
+ } catch (NotFoundOpenShiftException nfose) {
// Credentials work, but no domain, so no applications either
this.appList = new ArrayList<IApplication>();
fdomain = null;
@@ -574,56 +549,79 @@
IApplication application = index == -1 ? null : appList.get(index);
this.appListNames = appNames == null ? new String[0] : appNames;
this.fapplication = application;
- this.connection = user;
- this.user = connection.getUsername();
-
- for( int i = 0; i < appList.size(); i++ ) {
- projectsPerApp.put(appList.get(i), ExpressServerUtils.findProjectsForApplication(appList.get(i)));
+ if (connection.isConnected()) {
+ this.connection = connection;
+ this.connectionUrl = connection.getUsername();
+ } else {
+ connection = null;
}
-
+ updateProjectsPerApp(appList);
IProject[] possibleProjects = projectsPerApp.get(fapplication);
- this.deployProject = possibleProjects == null || possibleProjects.length == 0 ? null : possibleProjects[0].getName();
-
+ this.deployProject =
+ possibleProjects == null || possibleProjects.length == 0 ?
+ null : possibleProjects[0].getName();
+
fillServerWithDetails();
}
-
-
+
+ private void updateProjectsPerApp(List<IApplication> appList) {
+ projectsPerApp.clear();
+ if (appList != null) {
+ for (int i = 0; i < appList.size(); i++) {
+ projectsPerApp.put(appList.get(i), ExpressServerUtils.findProjectsForApplication(appList.get(i)));
+ }
+ }
+ }
+
+ private String[] getAppNamesAsStrings(List<IApplication> allApps) {
+ if (allApps == null) {
+ return new String[] {};
+ }
+ String[] appNames = new String[allApps.size()];
+ for (int i = 0; i < allApps.size(); i++) {
+ appNames[i] = allApps.get(i).getName();
+ }
+ return appNames;
+ }
+
public void finish(IProgressMonitor monitor) throws CoreException {
try {
ConnectionsModel.getDefault().addConnection(connection);
connection.save();
fillServerWithDetails();
updateProjectSettings();
- } catch(OpenShiftException ose) {
+ } catch (OpenShiftException ose) {
throw new CoreException(new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID, ose.getMessage(), ose));
}
}
+
private void fillServerWithDetails() throws OpenShiftException {
// Fill the server working copy
// update the values
IServerWorkingCopy wc = callback.getServer();
String host = fapplication == null ? null : fapplication.getApplicationUrl();
- ExpressServerUtils.fillServerWithOpenShiftDetails(wc, host, deployProject,remote);
+ ExpressServerUtils.fillServerWithOpenShiftDetails(wc, host, deployProject, remote);
}
-
+
private void updateProjectSettings() {
IProject depProj = ResourcesPlugin.getWorkspace().getRoot().getProject(deployProject);
- String projRemote = ExpressServerUtils.getProjectAttribute(depProj,
+ String projRemote = ExpressServerUtils.getProjectAttribute(depProj,
ExpressServerUtils.SETTING_REMOTE_NAME, null);
- String projDepFolder = ExpressServerUtils.getProjectAttribute(depProj,
- ExpressServerUtils.SETTING_DEPLOY_FOLDER_NAME, null);
- if( projRemote == null && projDepFolder == null ) {
+ String projDepFolder = ExpressServerUtils.getProjectAttribute(depProj,
+ ExpressServerUtils.SETTING_DEPLOY_FOLDER_NAME, null);
+ if (projRemote == null && projDepFolder == null) {
ExpressServerUtils.updateOpenshiftProjectSettings(
depProj, fapplication, connection, remote, deployFolder);
}
}
-
- private String[] getAppNamesAsStrings(List<IApplication> allApps) {
- String[] appNames = new String[allApps.size()];
- for (int i = 0; i < allApps.size(); i++) {
- appNames[i] = allApps.get(i).getName();
+
+ private void selectComboConnection(final Connection connection) {
+ if (connection != null
+ && connection.isConnected()) {
+ connectionComboViewer.setSelection(new StructuredSelection(connection));
+ } else {
+ connectionComboViewer.setSelection(new StructuredSelection());
}
- return appNames;
}
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java 2012-10-11 15:20:32 UTC (rev 44431)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java 2012-10-11 15:52:19 UTC (rev 44432)
@@ -10,6 +10,9 @@
*******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.behaviour;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.Arrays;
import org.eclipse.core.resources.IFolder;
@@ -18,9 +21,11 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -54,14 +59,17 @@
import org.jboss.ide.eclipse.as.ui.editor.ServerWorkingCopyPropertyComboCommand;
import org.jboss.ide.eclipse.as.ui.editor.ServerWorkingCopyPropertyCommand;
import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
+import org.jboss.tools.openshift.express.internal.core.connection.Connection;
+import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import org.jboss.tools.openshift.express.internal.ui.OpenshiftUIMessages;
+import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
/**
* @author Rob Stryker
*/
public class ExpressDetailsSection extends ServerEditorSection {
private IEditorInput input;
- protected Text userText, remoteText;
+ protected Text connectionText, remoteText;
protected Text deployFolderText;
protected Text appNameText;
protected Combo deployProjectCombo;
@@ -76,110 +84,138 @@
public void createSection(Composite parent) {
super.createSection(parent);
FormToolkit toolkit = new FormToolkit(parent.getDisplay());
-
- Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE|ExpandableComposite.EXPANDED|ExpandableComposite.TITLE_BAR);
+
+ Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
+ | ExpandableComposite.TITLE_BAR);
section.setText("Openshift Server");
- section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL| GridData.GRAB_VERTICAL));
+ section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL
+ | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
Composite c = toolkit.createComposite(section, SWT.NONE);
- c.setLayout(new GridLayout(2,true));
+ GridLayoutFactory.fillDefaults()
+ .numColumns(2).equalWidth(true).applyTo(c);
createWidgets(c, toolkit);
toolkit.paintBordersFor(c);
toolkit.adapt(c);
section.setClient(c);
-
+
initWidgets();
addListeners();
}
-
+
protected void initWidgets() {
// Set the widgets
- String user = ExpressServerUtils.getExpressUsername(server);
+ deployProjectCombo.setEnabled(true);
+ String connectionUrl = ExpressServerUtils.getExpressConnectionUrl(server);
+ connectionText.setText(getConnectionLabel(connectionUrl));
String appName = ExpressServerUtils.getExpressApplicationName(server);
- deployProjectCombo.setEnabled(true);
- userText.setText(user == null ? "" : user);
appNameText.setText(appName == null ? "" : appName);
- userText.setEnabled(false);
+ connectionText.setEnabled(false);
appNameText.setEnabled(false);
-
+
String outDir = ExpressServerUtils.getExpressDeployFolder(server);
String remote = ExpressServerUtils.getExpressRemoteName(server);
deployFolderText.setText(outDir == null ? "" : outDir);
remoteText.setText(remote == null ? "" : remote);
-
+
deployProjectCombo.setItems(getSuitableProjects());
java.util.List<String> l = Arrays.asList(deployProjectCombo.getItems());
String depProj = ExpressServerUtils.getExpressDeployProject(server);
- if( depProj != null ) {
+ if (depProj != null) {
int ind = l.indexOf(depProj);
- if( ind != -1 )
+ if (ind != -1)
deployProjectCombo.select(ind);
}
-
+
boolean overrides = ExpressServerUtils.getOverridesProject(server);
overrideProjectSettings.setSelection(overrides);
remoteText.setEnabled(overrides);
deployFolderText.setEnabled(overrides);
browseDestButton.setEnabled(overrides);
}
-
+
+ private String getConnectionLabel(String connectionUrl) {
+ String connectionLabel = "";
+ if (!StringUtils.isEmpty(connectionUrl)) {
+ try {
+ Connection connection = new Connection(new URL(connectionUrl), null);
+ connectionLabel = connection.getUsername() + " - " + connection.getHost();
+ } catch (MalformedURLException e) {
+ OpenShiftUIActivator.log(NLS.bind("Could not get URL for connection {0}", connectionUrl), e);
+ } catch (UnsupportedEncodingException e) {
+ OpenShiftUIActivator.log(NLS.bind("Could not get URL for connection {0}", connectionUrl), e);
+ }
+ }
+ return connectionLabel;
+ }
+
private String[] getSuitableProjects() {
IProject[] all = ExpressServerUtils.findAllSuitableOpenshiftProjects();
String[] s = new String[all.length];
- for( int i = 0; i < all.length; i++ ) {
+ for (int i = 0; i < all.length; i++) {
s[i] = all[i].getName();
}
return s;
}
-
+
protected Composite createComposite(Section section) {
createWidgets(section, new FormToolkit(section.getDisplay()));
return section;
}
-
+
private void createWidgets(Composite composite, FormToolkit toolkit) {
- composite.setLayout(new GridLayout(2, false));
+ GridLayoutFactory.fillDefaults()
+ .numColumns(2).equalWidth(false).applyTo(composite);
- Label deployLocationLabel = toolkit.createLabel(composite, OpenshiftUIMessages.EditorSectionDeployLocLabel, SWT.NONE);
+ Label deployLocationLabel = toolkit.createLabel(composite, OpenshiftUIMessages.EditorSectionDeployLocLabel,
+ SWT.NONE);
deployProjectCombo = new Combo(composite, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(deployProjectCombo);
-
projectSettingGroup = new Group(composite, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).span(2, 1).applyTo(projectSettingGroup);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).span(2, 1)
+ .applyTo(projectSettingGroup);
projectSettingGroup.setLayout(new GridLayout(2, false));
projectSettingGroup.setText(OpenshiftUIMessages.EditorSectionProjectSettingsGroup);
-
- overrideProjectSettings = toolkit.createButton(projectSettingGroup, OpenshiftUIMessages.EditorSectionOverrideProjectSettings, SWT.CHECK);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).span(2, 1).applyTo(overrideProjectSettings);
- Label userLabel = toolkit.createLabel(projectSettingGroup, OpenshiftUIMessages.EditorSectionUserLabel, SWT.NONE);
+ overrideProjectSettings = toolkit.createButton(projectSettingGroup,
+ OpenshiftUIMessages.EditorSectionOverrideProjectSettings, SWT.CHECK);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).span(2, 1)
+ .applyTo(overrideProjectSettings);
+
+ Label userLabel = toolkit
+ .createLabel(projectSettingGroup, OpenshiftUIMessages.EditorSectionConnectionLabel, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(userLabel);
- userText = toolkit.createText(projectSettingGroup, "", SWT.SINGLE | SWT.BORDER);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(userText);
-
- Label appNameLabel = toolkit.createLabel(projectSettingGroup, OpenshiftUIMessages.EditorSectionAppNameLabel, SWT.NONE);
+ connectionText = toolkit.createText(projectSettingGroup, "", SWT.SINGLE | SWT.BORDER);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(connectionText);
+
+ Label appNameLabel = toolkit.createLabel(projectSettingGroup, OpenshiftUIMessages.EditorSectionAppNameLabel,
+ SWT.NONE);
GridDataFactory.fillDefaults()
.align(SWT.LEFT, SWT.CENTER).applyTo(appNameLabel);
appNameText = toolkit.createText(projectSettingGroup, "", SWT.SINGLE | SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(appNameText);
- Label zipDestLabel = toolkit.createLabel(projectSettingGroup, OpenshiftUIMessages.EditorSectionZipDestLabel, SWT.NONE);
+ Label zipDestLabel = toolkit.createLabel(projectSettingGroup, OpenshiftUIMessages.EditorSectionZipDestLabel,
+ SWT.NONE);
Composite zipDestComposite = toolkit.createComposite(projectSettingGroup, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(zipDestComposite);
zipDestComposite.setLayout(new FormLayout());
- browseDestButton = toolkit.createButton(zipDestComposite, OpenshiftUIMessages.EditorSectionBrowseDestButton, SWT.PUSH);
- browseDestButton.setLayoutData(UIUtil.createFormData2(0,5,100,-5,null,0,100,0));
+ browseDestButton = toolkit.createButton(zipDestComposite, OpenshiftUIMessages.EditorSectionBrowseDestButton,
+ SWT.PUSH);
+ browseDestButton.setLayoutData(UIUtil.createFormData2(0, 5, 100, -5, null, 0, 100, 0));
deployFolderText = toolkit.createText(zipDestComposite, "", SWT.SINGLE | SWT.BORDER);
- deployFolderText.setLayoutData(UIUtil.createFormData2(0,5,100,-5,0,0,browseDestButton,-5));
-
- Label remoteLabel = toolkit.createLabel(projectSettingGroup, OpenshiftUIMessages.EditorSectionRemoteLabel, SWT.NONE);
+ deployFolderText.setLayoutData(UIUtil.createFormData2(0, 5, 100, -5, 0, 0, browseDestButton, -5));
+
+ Label remoteLabel = toolkit.createLabel(projectSettingGroup, OpenshiftUIMessages.EditorSectionRemoteLabel,
+ SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(remoteLabel);
remoteText = toolkit.createText(projectSettingGroup, "", SWT.SINGLE | SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(remoteText);
}
-
+
ModifyListener remoteModifyListener, deployDestinationModifyListener, deployProjectListener;
SelectionListener overrideListener;
+
protected void addListeners() {
deployProjectListener = new ModifyListener() {
public void modifyText(ModifyEvent e) {
@@ -187,7 +223,8 @@
String newVal = ind == -1 ? null : deployProjectCombo.getItem(ind);
((ServerEditorPartInput) input).getServerCommandManager().execute(
new SetProjectCommand(server, newVal));
- }};
+ }
+ };
deployProjectCombo.addModifyListener(deployProjectListener);
overrideListener = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@@ -196,7 +233,6 @@
};
overrideProjectSettings.addSelectionListener(overrideListener);
-
remoteModifyListener = new ModifyListener() {
public void modifyText(ModifyEvent e) {
((ServerEditorPartInput) input).getServerCommandManager().execute(new SetRemoteCommand(server));
@@ -209,7 +245,7 @@
}
};
deployFolderText.addModifyListener(deployDestinationModifyListener);
-
+
browseDestButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
browsePressed();
@@ -217,30 +253,31 @@
});
}
-
+
private void browsePressed() {
IFolder f = chooseFolder();
- if( f != null ) {
+ if (f != null) {
deployFolderText.setText(f.getFullPath().removeFirstSegments(1).makeRelative().toOSString());
}
}
-
+
private IFolder chooseFolder() {
String depProject = ExpressServerUtils.getExpressDeployProject(server);
String depFolder = ExpressServerUtils.getExpressDeployFolder(server);
-
+
IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(depProject);
- ILabelProvider lp= new WorkbenchLabelProvider();
- ITreeContentProvider cp= new WorkbenchContentProvider();
+ ILabelProvider lp = new WorkbenchLabelProvider();
+ ITreeContentProvider cp = new WorkbenchContentProvider();
- ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(Display.getDefault().getActiveShell(), lp, cp);
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(Display.getDefault().getActiveShell(), lp,
+ cp);
dialog.setTitle("Deploy Location");
dialog.setMessage("Please choose a location to put zipped projects");
dialog.setInput(p);
dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
-
- IResource res= p.findMember(new Path(depFolder));
+
+ IResource res = p.findMember(new Path(depFolder));
if (res != null)
dialog.setInitialSelection(res);
@@ -248,19 +285,21 @@
return (IFolder) dialog.getFirstResult();
return null;
}
-
+
public class SetRemoteCommand extends ServerWorkingCopyPropertyCommand {
public SetRemoteCommand(IServerWorkingCopy server) {
super(server, "Change Remote Name", remoteText, remoteText.getText(),
- ExpressServerUtils.ATTRIBUTE_REMOTE_NAME, remoteModifyListener,
+ ExpressServerUtils.ATTRIBUTE_REMOTE_NAME, remoteModifyListener,
ExpressServerUtils.ATTRIBUTE_REMOTE_NAME_DEFAULT);
}
}
public class SetProjectCommand extends ServerWorkingCopyPropertyComboCommand {
public SetProjectCommand(IServerWorkingCopy wc, String newVal) {
- super(wc, "Change Openshift Project", deployProjectCombo, newVal, ExpressServerUtils.ATTRIBUTE_DEPLOY_PROJECT, deployProjectListener);
+ super(wc, "Change Openshift Project", deployProjectCombo, newVal,
+ ExpressServerUtils.ATTRIBUTE_DEPLOY_PROJECT, deployProjectListener);
}
+
@Override
protected void postOp(int type) {
updateWidgetsFromWorkingCopy();
@@ -270,28 +309,30 @@
public class SetDeployFolderCommand extends ServerWorkingCopyPropertyCommand {
public SetDeployFolderCommand(IServerWorkingCopy server) {
super(server, "Change Deployment Folder", deployFolderText, deployFolderText.getText(),
- ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_NAME, deployDestinationModifyListener,
+ ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_NAME, deployDestinationModifyListener,
ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
}
}
public class SetOverrideCommand extends ServerWorkingCopyPropertyButtonCommand {
public SetOverrideCommand(IServerWorkingCopy wc) {
- super(wc, "Override Openshift Project Settings Command",
- overrideProjectSettings, overrideProjectSettings.getSelection(),
+ super(wc, "Override Openshift Project Settings Command",
+ overrideProjectSettings, overrideProjectSettings.getSelection(),
ExpressServerUtils.ATTRIBUTE_OVERRIDE_PROJECT_SETTINGS, overrideListener);
}
+
@Override
protected void postOp(int type) {
updateWidgetsFromWorkingCopy();
}
}
+
private void updateWidgetsFromWorkingCopy() {
- String user = ExpressServerUtils.getExpressUsername(server);
+ String connectionUrl = ExpressServerUtils.getExpressConnectionUrl(server);
+ connectionText.setText(getConnectionLabel(connectionUrl));
String appName = ExpressServerUtils.getExpressApplicationName(server);
- userText.setText(user == null ? "" : user);
appNameText.setText(appName == null ? "" : appName);
-
+
browseDestButton.setEnabled(overrideProjectSettings.getSelection());
deployFolderText.setEnabled(overrideProjectSettings.getSelection());
remoteText.setEnabled(overrideProjectSettings.getSelection());
@@ -299,7 +340,7 @@
String depFolder = ExpressServerUtils.getExpressDeployFolder(server, ExpressServerUtils.SETTING_FROM_PROJECT);
remote = remote == null ? "" : remote;
depFolder = depFolder == null ? "" : depFolder;
-
+
remoteText.removeModifyListener(remoteModifyListener);
deployFolderText.removeModifyListener(deployDestinationModifyListener);
remoteText.setText(remote);
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/explorer/ConnectToOpenShiftWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/explorer/ConnectToOpenShiftWizard.java 2012-10-11 15:20:32 UTC (rev 44431)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/explorer/ConnectToOpenShiftWizard.java 2012-10-11 15:52:19 UTC (rev 44432)
@@ -47,4 +47,8 @@
public void addPages() {
addPage(page);
}
+
+ public Connection getConnection() {
+ return page.getConnection();
+ }
}
\ No newline at end of file
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/explorer/OpenShiftExplorerLabelProvider.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/explorer/OpenShiftExplorerLabelProvider.java 2012-10-11 15:20:32 UTC (rev 44431)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/explorer/OpenShiftExplorerLabelProvider.java 2012-10-11 15:52:19 UTC (rev 44432)
@@ -97,15 +97,14 @@
}
private StyledString createStyledString(Connection connection) {
-// String name = connection.getName();
String name = connection.getUsername();
- String server = connection.getHost();
+ String host = connection.getHost();
String label = new StringBuilder(name)
.append(' ')
- .append(server)
+ .append(host)
.toString();
StyledString styledString = new StyledString(label);
- styledString.setStyle(name.length() + 1, server.length(), StyledString.QUALIFIER_STYLER);
+ styledString.setStyle(name.length() + 1, host.length(), StyledString.QUALIFIER_STYLER);
return styledString;
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/preferences/IOpenShiftPreferenceConstants.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/preferences/IOpenShiftPreferenceConstants.java 2012-10-11 15:20:32 UTC (rev 44431)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/preferences/IOpenShiftPreferenceConstants.java 2012-10-11 15:52:19 UTC (rev 44432)
@@ -24,6 +24,6 @@
/** server history */
public static final String SERVERS = "org.jboss.tools.openshift.express.SERVERS";
/** default server */
- public static final String DEFAULT_SERVER = "org.jboss.tools.openshift.express.SERVER";
+ public static final String DEFAULT_HOST = "org.jboss.tools.openshift.express.SERVER";
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/preferences/OpenShiftPreferences.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/preferences/OpenShiftPreferences.java 2012-10-11 15:20:32 UTC (rev 44431)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/preferences/OpenShiftPreferences.java 2012-10-11 15:52:19 UTC (rev 44432)
@@ -38,9 +38,13 @@
return OpenShiftUIActivator.getDefault().getPreferenceStore();
}
- public String getDefaultServer() {
- return getPreferencesStore().getString(DEFAULT_SERVER);
+ public String getDefaultHost() {
+ return getPreferencesStore().getString(DEFAULT_HOST);
}
+
+ public void setDefaultHost(String host) {
+ getPreferencesStore().setValue(DEFAULT_HOST, host);
+ }
public String getLastUsername() {
return lastUsernamePreferenceValue.get();
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/preferences/ServerPreferencePage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/preferences/ServerPreferencePage.java 2012-10-11 15:20:32 UTC (rev 44431)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/preferences/ServerPreferencePage.java 2012-10-11 15:52:19 UTC (rev 44432)
@@ -47,8 +47,8 @@
public void createFieldEditors() {
addField(new StringFieldEditor(
- OpenShiftPreferences.DEFAULT_SERVER
- , OpenShiftPreferences.INSTANCE.getDefaultServer()
+ OpenShiftPreferences.DEFAULT_HOST
+ , OpenShiftPreferences.INSTANCE.getDefaultHost()
, getFieldEditorParent()));
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/UIUtils.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/UIUtils.java 2012-10-11 15:20:32 UTC (rev 44431)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/UIUtils.java 2012-10-11 15:52:19 UTC (rev 44432)
@@ -16,6 +16,8 @@
import org.eclipse.jface.action.IContributionManager;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
@@ -164,5 +166,15 @@
return shell;
}
-
+ @SuppressWarnings("unchecked")
+ public static <E> E getFirstElement(ISelection selection, Class<E> clazz) {
+ if (selection instanceof IStructuredSelection) {
+ Object firstSelectedElement = ((IStructuredSelection) selection).getFirstElement();
+ if (firstSelectedElement != null
+ && clazz.isAssignableFrom(firstSelectedElement.getClass())) {
+ return (E) firstSelectedElement;
+ }
+ }
+ return null;
+ }
}
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/ConnectionColumLabelProvider.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/ConnectionColumLabelProvider.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/ConnectionColumLabelProvider.java 2012-10-11 15:52:19 UTC (rev 44432)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.viewer;
+
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.jboss.tools.openshift.express.internal.core.connection.Connection;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class ConnectionColumLabelProvider extends ColumnLabelProvider {
+
+ @Override
+ public String getText(Object element) {
+ if (!(element instanceof Connection)) {
+ return super.getText(element);
+ }
+ Connection connection = (Connection) element;
+ return connection.getUsername() + " - " + connection.getHost();
+ }
+
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/ConnectionColumLabelProvider.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/connection/ConnectionWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/connection/ConnectionWizardPage.java 2012-10-11 15:20:32 UTC (rev 44431)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/connection/ConnectionWizardPage.java 2012-10-11 15:52:19 UTC (rev 44432)
@@ -301,4 +301,9 @@
return Status.OK_STATUS;
}
}
+
+ public Connection getConnection(){
+ return pageModel.getConnection();
+ }
+
}
12 years, 3 months
JBoss Tools SVN: r44431 - trunk/download.jboss.org/jbosstools/examples.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2012-10-11 11:20:32 -0400 (Thu, 11 Oct 2012)
New Revision: 44431
Modified:
trunk/download.jboss.org/jbosstools/examples/project-examples-shared-4.0....
trunk/download.jboss.org/jbosstools/examples/project-examples-shared-4.0....
Log:
JBIDE-12830 : Sync up archetype default project names
Modified: trunk/download.jboss.org/jbosstools/examples/project-examples-shared-4.0....
===================================================================
--- trunk/download.jboss.org/jbosstools/examples/project-examples-shared-4.0.... 2012-10-11 14:23:23 UTC (rev 44430)
+++ trunk/download.jboss.org/jbosstools/examples/project-examples-shared-4.0.... 2012-10-11 15:20:32 UTC (rev 44431)
@@ -112,7 +112,7 @@
<archetypeRepository>http://repository.jboss.org/nexus/content/repositories/releases/</archetypeRepository>
-->
<groupId>org.jboss.tools.example</groupId>
- <artifactId>multi</artifactId>
+ <artifactId>jboss-javaee6-multi</artifactId>
<version>0.0.1-SNAPSHOT</version>
<javaPackage>org.jboss.tools.example</javaPackage>
</mavenArchetype>
@@ -168,7 +168,7 @@
<archetypeRepository>http://repository.jboss.org/nexus/content/repositories/releases/</archetypeRepository>
-->
<groupId>org.jboss.tools.example</groupId>
- <artifactId>poh5</artifactId>
+ <artifactId>jboss-html5-webapp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<javaPackage>org.jboss.tools.example.html5</javaPackage>
</mavenArchetype>
@@ -225,7 +225,7 @@
<archetypeRepository>http://repository.jboss.org/nexus/content/repositories/snapshots/</archetypeRepository>
-->
<groupId>org.jboss.tools.example</groupId>
- <artifactId>richfaces-webapp</artifactId>
+ <artifactId>jboss-richfaces-webapp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<javaPackage>org.jboss.tools.example.richfaces</javaPackage>
<properties>
@@ -286,7 +286,7 @@
<archetypeRepository>http://repository.jboss.org/nexus/content/repositories/releases/</archetypeRepository>
-->
<groupId>org.jboss.tools.example</groupId>
- <artifactId>springmvc</artifactId>
+ <artifactId>jboss-springmvc-webapp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<javaPackage>org.jboss.tools.example.springmvc</javaPackage>
<!--
@@ -356,7 +356,7 @@
<archetypeRepository>https://repository.jboss.org/nexus/content/groups/public/</archetypeRepository>
-->
<groupId>org.jboss.tools.example</groupId>
- <artifactId>gwt-kitchensink</artifactId>
+ <artifactId>jboss-gwt-webapp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<javaPackage>org.jboss.tools.gwt.kitchensink</javaPackage>
</mavenArchetype>
Modified: trunk/download.jboss.org/jbosstools/examples/project-examples-shared-4.0....
===================================================================
--- trunk/download.jboss.org/jbosstools/examples/project-examples-shared-4.0.... 2012-10-11 14:23:23 UTC (rev 44430)
+++ trunk/download.jboss.org/jbosstools/examples/project-examples-shared-4.0.... 2012-10-11 15:20:32 UTC (rev 44431)
@@ -112,7 +112,7 @@
<archetypeRepository>http://repository.jboss.org/nexus/content/repositories/releases/</archetypeRepository>
-->
<groupId>org.jboss.tools.example</groupId>
- <artifactId>multi</artifactId>
+ <artifactId>jboss-javaee6-multi</artifactId>
<version>0.0.1-SNAPSHOT</version>
<javaPackage>org.jboss.tools.example</javaPackage>
</mavenArchetype>
@@ -168,7 +168,7 @@
<archetypeRepository>http://repository.jboss.org/nexus/content/repositories/releases/</archetypeRepository>
-->
<groupId>org.jboss.tools.example</groupId>
- <artifactId>poh5</artifactId>
+ <artifactId>jboss-html5-webapp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<javaPackage>org.jboss.tools.example.html5</javaPackage>
</mavenArchetype>
@@ -225,7 +225,7 @@
<archetypeRepository>http://repository.jboss.org/nexus/content/repositories/snapshots/</archetypeRepository>
-->
<groupId>org.jboss.tools.example</groupId>
- <artifactId>richfaces-webapp</artifactId>
+ <artifactId>jboss-richfaces-webapp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<javaPackage>org.jboss.tools.example.richfaces</javaPackage>
<properties>
@@ -286,7 +286,7 @@
<archetypeRepository>http://repository.jboss.org/nexus/content/repositories/releases/</archetypeRepository>
-->
<groupId>org.jboss.tools.example</groupId>
- <artifactId>springmvc</artifactId>
+ <artifactId>jboss-springmvc-webapp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<javaPackage>org.jboss.tools.example.springmvc</javaPackage>
<!--
@@ -356,7 +356,7 @@
<archetypeRepository>https://repository.jboss.org/nexus/content/groups/public/</archetypeRepository>
-->
<groupId>org.jboss.tools.example</groupId>
- <artifactId>gwt-kitchensink</artifactId>
+ <artifactId>jboss-gwt-webapp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<javaPackage>org.jboss.tools.gwt.kitchensink</javaPackage>
</mavenArchetype>
12 years, 3 months