Author: adietish
Date: 2012-03-01 07:31:23 -0500 (Thu, 01 Mar 2012)
New Revision: 39224
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ServerAdapterFactory.java
Log:
[JBIDE-10511] moved check for existing server to server adapter factory so that it'll
get executed in all import cases (use existing project, create new project)
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java 2012-03-01
11:45:36 UTC (rev 39223)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java 2012-03-01
12:31:23 UTC (rev 39224)
@@ -16,7 +16,6 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerType;
import org.eclipse.wst.server.core.ServerCore;
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
@@ -82,28 +81,9 @@
, getRemoteName()
, getRepositoryFile())
.execute(monitor);
- String appName = getApplication().getName();
- String host = getApplication().getApplicationUrl();
- IServer found = findServer(appName, host);
- if( found == null )
- createServerAdapter(monitor, importedProjects);
- else {
- new ServerAdapterFactory().addModules(found, importedProjects, monitor);
- }
+ createServerAdapter(monitor, importedProjects);
}
- private IServer findServer(String appName, String host) {
- IServer[] all = ServerCore.getServers();
- for( int i = 0; i < all.length; i++ ) {
- String host1 = all[i].getHost();
- String app1 = ExpressServerUtils.getExpressApplicationName(all[i]);
- if( (host.endsWith("/" + host1 + "/") ||
(host.endsWith("/" + host1)))
- && appName.equals(app1))
- return all[i];
- }
- return null;
- }
-
/**
* Enables the user chosen, unshared project to be used on the chosen
* OpenShift application. Clones the application git repository, copies the
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 2012-03-01
11:45:36 UTC (rev 39223)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ServerAdapterFactory.java 2012-03-01
12:31:23 UTC (rev 39224)
@@ -30,6 +30,7 @@
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerType;
import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.core.ServerCore;
import org.eclipse.wst.server.core.ServerUtil;
import org.eclipse.wst.server.core.internal.Server;
import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
@@ -75,12 +76,30 @@
mode, application, user, project.getName(), remoteName, monitor);
}
+ private IServer findServer(String applicationName, String host) {
+ IServer[] all = ServerCore.getServers();
+ for( int i = 0; i < all.length; i++ ) {
+ String host1 = all[i].getHost();
+ String app1 = ExpressServerUtils.getExpressApplicationName(all[i]);
+ if( (host.endsWith("/" + host1 + "/") ||
(host.endsWith("/" + host1)))
+ && applicationName.equals(app1))
+ return all[i];
+ }
+ return null;
+ }
+
+
protected void createServerAdapter(List<IProject> importedProjects, IServerType
serverType,
IRuntime runtime, String mode, IApplication application, IUser user,
String deployProject, String remoteName, IProgressMonitor monitor) {
try {
renameWebContextRoot(importedProjects);
- IServer server = doCreateServerAdapter(serverType, runtime, mode, application, user,
deployProject, remoteName);
+ String name = application.getName();
+ String host = application.getApplicationUrl();
+ IServer server = findServer(name, host);
+ if( server == null ) {
+ server = doCreateServerAdapter(serverType, runtime, mode, application, user,
deployProject, remoteName);
+ }
addModules(getModules(importedProjects), server, monitor);
} catch (CoreException ce) {
OpenShiftUIActivator.getDefault().getLog().log(ce.getStatus());