Author: rob.stryker(a)jboss.com
Date: 2012-10-12 09:44:36 -0400 (Fri, 12 Oct 2012)
New Revision: 44481
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServer.java
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/ui/behaviour/ExpressDetailsComposite.java
Log:
JBIDE-12839 to beta1 trunk
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServer.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServer.java 2012-10-12
13:33:43 UTC (rev 44480)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServer.java 2012-10-12
13:44:36 UTC (rev 44481)
@@ -27,14 +27,18 @@
import
org.jboss.ide.eclipse.as.core.server.internal.extendedproperties.ServerExtendedProperties;
import org.jboss.ide.eclipse.as.core.util.ServerUtil;
import org.jboss.ide.eclipse.as.wtp.core.util.ServerModelUtilities;
+import org.jboss.tools.openshift.express.internal.core.connection.ConnectionUtils;
+import org.jboss.tools.openshift.express.internal.core.util.UrlUtils;
/**
* @author Rob Stryker
*/
public class ExpressServer extends DeployableServer implements IURLProvider,
IExtendedPropertiesProvider {
+ public static final String DEFAULT_SERVER_NAME_BASE = "ApplicationName at
Openshift";
+ public void setDefaults(IProgressMonitor monitor) {
+ getServerWorkingCopy().setHost(UrlUtils.cutScheme(ConnectionUtils.getDefaultHostUrl()));
- public void setDefaults(IProgressMonitor monitor) {
- getServerWorkingCopy().setName(ServerUtil.getDefaultServerName(getServer().getServerType().getName()));
+ getServerWorkingCopy().setName(ServerUtil.getDefaultServerName(DEFAULT_SERVER_NAME_BASE));
setAttribute(IDeployableServer.SERVER_MODE, ExpressBehaviourDelegate.OPENSHIFT_ID);
}
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-12
13:33:43 UTC (rev 44480)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2012-10-12
13:44:36 UTC (rev 44481)
@@ -39,6 +39,7 @@
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.core.util.RuntimeUtils;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.core.util.ServerUtil;
import org.jboss.tools.openshift.egit.core.EGitUtils;
import org.jboss.tools.openshift.express.internal.core.connection.Connection;
import org.jboss.tools.openshift.express.internal.core.connection.ConnectionUtils;
@@ -257,15 +258,15 @@
* @throws CoreException
*/
public static IServer fillServerWithOpenShiftDetails(IServer server, String host,
- String deployProject, String remote) throws CoreException {
+ String deployProject, String remote, String appName) throws CoreException {
ServerWorkingCopy wc = (ServerWorkingCopy) server.createWorkingCopy();
- fillServerWithOpenShiftDetails((IServerWorkingCopy) wc, host, deployProject, remote);
+ fillServerWithOpenShiftDetails((IServerWorkingCopy) wc, host, deployProject, remote,
appName);
IServer saved = wc.save(true, new NullProgressMonitor());
return saved;
}
public static void fillServerWithOpenShiftDetails(IServerWorkingCopy wc, String host,
- String deployProject, String remote) {
+ String deployProject, String remote, String appName) {
if (host != null) {
if (host.indexOf("://") != -1)
@@ -289,6 +290,10 @@
wc.setAttribute(IJBossToolingConstants.WEB_PORT_DETECT, "false");
wc.setAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE,
IDeployableServer.DEPLOY_CUSTOM);
wc.setAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, true);
+ if( appName != null && ( wc.getName() == null || wc.getName().length() == 0 ||
wc.getName().startsWith(ExpressServer.DEFAULT_SERVER_NAME_BASE))) {
+ String newBase = appName + " at Openshift";
+ wc.setName(ServerUtil.getDefaultServerName(newBase));
+ }
}
public static IServer createServerAndRuntime(String runtimeID, String serverID,
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-12
13:33:43 UTC (rev 44480)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java 2012-10-12
13:44:36 UTC (rev 44481)
@@ -601,7 +601,7 @@
// 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,
app);
}
private void updateProjectSettings() {