Author: rob.stryker(a)jboss.com
Date: 2011-12-21 16:55:56 -0500 (Wed, 21 Dec 2011)
New Revision: 37500
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.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/wizard/appimport/ImportProjectWizardModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ServerAdapterFactory.java
Log:
https://issues.jboss.org/browse/JBIDE-10542 - allow publishing to the destination chosen
in the new wizard.
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java 2011-12-21
19:28:55 UTC (rev 37499)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java 2011-12-21
21:55:56 UTC (rev 37500)
@@ -102,11 +102,9 @@
return IServer.PUBLISH_STATE_NONE;
} else if( changed == 0 && requestPushApproval(module)) {
monitor.beginTask("Publishing " + p.getName(), 100);
-// TODO: use the following instead of the current:
-// EGitUtils.push("<remote name configured in
AdapterWizardPageModel#getRemoteName>"
-// , EGitUtils.getRepository(p)
-// , new SubProgressMonitor(monitor, 100));
- EGitUtils.push(EGitUtils.getRepository(p), new SubProgressMonitor(monitor, 100));
+ String remoteName =
behaviour.getServer().getAttribute(ExpressServerUtils.ATTRIBUTE_REMOTE_NAME,
+ ExpressServerUtils.ATTRIBUTE_REMOTE_NAME_DEFAULT);
+ EGitUtils.push(remoteName, EGitUtils.getRepository(p), new SubProgressMonitor(monitor,
100));
monitor.done();
return IServer.PUBLISH_STATE_NONE;
}
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 2011-12-21
19:28:55 UTC (rev 37499)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2011-12-21
21:55:56 UTC (rev 37500)
@@ -23,7 +23,6 @@
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.ServerCreationUtils;
-import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
/**
* This class holds the attribute names whose values will be
@@ -41,6 +40,8 @@
public static final String ATTRIBUTE_DOMAIN =
"org.jboss.tools.openshift.express.internal.core.behaviour.Domain";
public static final String ATTRIBUTE_USERNAME =
"org.jboss.tools.openshift.express.internal.core.behaviour.Username";
public static final String ATTRIBUTE_PASSWORD =
"org.jboss.tools.openshift.express.internal.core.behaviour.Password";
+ public static final String ATTRIBUTE_REMOTE_NAME =
"org.jboss.tools.openshift.express.internal.core.behaviour.RemoteName";
+ public static final String ATTRIBUTE_REMOTE_NAME_DEFAULT = "origin";
/** the OpensHift Server Type as defined in the plugin.xml.*/
public static final String OPENSHIFT_SERVER_TYPE =
"org.jboss.tools.openshift.express.openshift.server.type";
@@ -126,12 +127,12 @@
public static IServer createAS7OpenShiftServer(
String host, String username, String password,
String domain, String appName, String appId,
- String sourceOrBinary,
+ String sourceOrBinary, String remoteName,
String localRuntimeHomeDir) throws CoreException {
IServer server = createServerAndRuntime(IJBossToolingConstants.AS_70,
IJBossToolingConstants.SERVER_AS_70,
localRuntimeHomeDir, /* irrelevant */ "default");
- return fillServerWithOpenShiftDetails(server, host, username, password, domain,
appName, appId, sourceOrBinary);
+ return fillServerWithOpenShiftDetails(server, host, username, password, domain,
appName, appId, sourceOrBinary, remoteName);
}
/**
@@ -150,10 +151,10 @@
*/
public static IServer createAS7OpenShiftServer(
String host, String username, String password,
- String domain, String appName, String appId, String sourceOrBinary,
+ String domain, String appName, String appId, String sourceOrBinary, String
remoteName,
IRuntime runtime) throws CoreException {
IServer server = createServer(runtime, IJBossToolingConstants.SERVER_AS_70);
- return fillServerWithOpenShiftDetails(server, host, username, password, domain,
appName, appId, sourceOrBinary);
+ return fillServerWithOpenShiftDetails(server, host, username, password, domain,
appName, appId, sourceOrBinary, remoteName);
}
/**
@@ -170,9 +171,9 @@
* @throws CoreException
*/
@SuppressWarnings("restriction")
- public static IServer fillServerWithOpenShiftDetails(IServer server,
- String host, String username, String password, String domain, String appName, String
appId,
- String mode) throws CoreException {
+ public static IServer fillServerWithOpenShiftDetails(IServer server, String host,
+ String username, String password, String domain, String appName, String appId,
+ String mode, String remoteName) throws CoreException {
if( host.indexOf("://") != -1)
host = host.substring(host.indexOf("://") + 3);
if( host.endsWith("/"))
@@ -186,6 +187,7 @@
wc.setAttribute(ATTRIBUTE_APPLICATION_NAME, appName);
wc.setAttribute(ATTRIBUTE_APPLICATION_ID, appId);
wc.setAttribute(ATTRIBUTE_EXPRESS_MODE, mode);
+ wc.setAttribute(ATTRIBUTE_REMOTE_NAME, remoteName);
wc.setAutoPublishSetting(Server.AUTO_PUBLISH_DISABLE);
wc.setAttribute(IJBossToolingConstants.IGNORE_LAUNCH_COMMANDS, "true");
wc.setAttribute(IJBossToolingConstants.WEB_PORT, 80);
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java 2011-12-21
19:28:55 UTC (rev 37499)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java 2011-12-21
21:55:56 UTC (rev 37500)
@@ -114,7 +114,7 @@
throws OpenShiftException {
Assert.isTrue(importedProjects.size() > 0);
IProject project = importedProjects.get(0);
- new ServerAdapterFactory().create(project, getServerType(), getRuntime(), getMode(),
getApplication(), getUser(), monitor);
+ new ServerAdapterFactory().create(project, this, monitor);
}
public File getRepositoryFile() {
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ServerAdapterFactory.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ServerAdapterFactory.java 2011-12-21
19:28:55 UTC (rev 37499)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ServerAdapterFactory.java 2011-12-21
21:55:56 UTC (rev 37500)
@@ -47,9 +47,14 @@
public ServerAdapterFactory() {
}
+ public void create(IProject project, ImportProjectWizardModel model, IProgressMonitor
monitor) throws OpenShiftException {
+ createServerAdapter(project, model.getServerType(), model.getRuntime(),
model.getMode(),
+ model.getApplication(), model.getUser(), model.getRemoteName(), monitor);
+ }
+
public void create(IProject project, IServerType serverType, IRuntime runtime, String
mode,
IApplication application, IUser user, IProgressMonitor monitor) throws
OpenShiftException {
- createServerAdapter(project, serverType, runtime, mode, application, user, monitor);
+ createServerAdapter(project, serverType, runtime, mode, application, user, null,
monitor);
}
/**
@@ -60,18 +65,18 @@
* @throws OpenShiftException
*/
protected void createServerAdapter(IProject project, IServerType serverType, IRuntime
runtime, String mode,
- IApplication application, IUser user, IProgressMonitor monitor) throws
OpenShiftException {
+ IApplication application, IUser user, String remoteName, IProgressMonitor monitor)
throws OpenShiftException {
String name = project.getName();
monitor.subTask(NLS.bind("Creating server adapter for project {0}", name));
- createServerAdapter(Collections.singletonList(project), serverType, runtime, mode,
application, user,
- monitor);
+ createServerAdapter(Collections.singletonList(project), serverType, runtime,
+ mode, application, user, remoteName, monitor);
}
protected void createServerAdapter(List<IProject> importedProjects, IServerType
serverType,
- IRuntime runtime, String mode, IApplication application, IUser user, IProgressMonitor
monitor) {
+ IRuntime runtime, String mode, IApplication application, IUser user, String
remoteName, IProgressMonitor monitor) {
try {
renameWebContextRoot(importedProjects);
- IServer server = doCreateServerAdapter(serverType, runtime, mode, application, user);
+ IServer server = doCreateServerAdapter(serverType, runtime, mode, application, user,
remoteName);
addModules(getModules(importedProjects), server, monitor);
} catch (CoreException ce) {
OpenShiftUIActivator.getDefault().getLog().log(ce.getStatus());
@@ -88,8 +93,8 @@
}
}
- private IServer doCreateServerAdapter(IServerType serverType, IRuntime rt, String mode,
IApplication application,
- IUser user) throws CoreException,
+ private IServer doCreateServerAdapter(IServerType serverType, IRuntime rt, String mode,
+ IApplication application, IUser user, String remoteName) throws CoreException,
OpenShiftException {
Assert.isLegal(serverType != null);
Assert.isLegal(mode != null);
@@ -101,8 +106,8 @@
IServer server = ExpressServerUtils.createServer(rt, serverType, serverName);
ExpressServerUtils.fillServerWithOpenShiftDetails(server,
application.getApplicationUrl(),
- user.getRhlogin(), user.getPassword(),
- user.getDomain().getNamespace(), application.getName(), application.getUUID(),
mode);
+ user.getRhlogin(), user.getPassword(), user.getDomain().getNamespace(),
+ application.getName(), application.getUUID(), mode, remoteName);
return server;
}