[jbosstools-commits] JBoss Tools SVN: r35655 - in trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core: util and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Oct 14 08:21:02 EDT 2011


Author: rob.stryker at jboss.com
Date: 2011-10-14 08:21:02 -0400 (Fri, 14 Oct 2011)
New Revision: 35655

Modified:
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/DelegatingStartLaunchConfiguration.java
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerCreationUtils.java
Log:
https://issues.jboss.org/browse/JBIDE-9913 - need to handle null-set behaviour mode as local 

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/DelegatingStartLaunchConfiguration.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/DelegatingStartLaunchConfiguration.java	2011-10-14 10:20:36 UTC (rev 35654)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/DelegatingStartLaunchConfiguration.java	2011-10-14 12:21:02 UTC (rev 35655)
@@ -15,11 +15,15 @@
 
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
 import org.eclipse.debug.core.ILaunch;
 import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
 import org.eclipse.wst.server.core.IServer;
 import org.eclipse.wst.server.core.ServerUtil;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
 import org.jboss.ide.eclipse.as.core.server.internal.BehaviourModel;
 import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
 import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader;
@@ -37,13 +41,14 @@
 		for( Iterator<IJBossLaunchDelegate> i = getSetupParticipants(server).iterator(); i.hasNext(); ) {
 			i.next().setupLaunchConfiguration(workingCopy, server);
 		}
-	}	
+	}
 
 	protected IJBossLaunchDelegate getDelegate(ILaunchConfiguration configuration) throws CoreException {
 		IServer server = ServerUtil.getServer(configuration);
 		DeployableServerBehavior beh = ServerConverter.getDeployableServerBehavior(server);
-		String currentMode = DeploymentPreferenceLoader.getCurrentDeploymentMethodTypeId(beh.getServer());
-		//return getLaunchDelegates(server).get(currentMode);
+		String currentMode = DeploymentPreferenceLoader.getCurrentDeploymentMethodTypeId(beh.getServer(), LocalPublishMethod.LOCAL_PUBLISH_METHOD);
+		if( currentMode == null )
+			throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, "Server's mode (local/rse/etc) is unset or missing.")); //$NON-NLS-1$
 		return BehaviourModel.getModel().getLaunchDelegate(server, currentMode);
 	}
 	

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerCreationUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerCreationUtils.java	2011-10-14 10:20:36 UTC (rev 35654)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerCreationUtils.java	2011-10-14 12:21:02 UTC (rev 35655)
@@ -5,8 +5,6 @@
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.launching.IVMInstall;
-import org.eclipse.jdt.launching.JavaRuntime;
 import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
 import org.eclipse.wst.server.core.IRuntime;
 import org.eclipse.wst.server.core.IRuntimeType;
@@ -18,6 +16,7 @@
 import org.eclipse.wst.server.core.ServerUtil;
 import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy;
 import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
 import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
 import org.jboss.ide.eclipse.as.core.server.internal.DeployableServer;
 
@@ -66,14 +65,21 @@
 		IServerType serverType = ServerCore.findServerType(serverTypeId);
 		return createServer2(currentRuntime, serverType, serverName);
 	}
+	public static IServer createServer2(IRuntime currentRuntime, String serverTypeId, String serverName, String mode) throws CoreException {
+		IServerType serverType = ServerCore.findServerType(serverTypeId);
+		return createServer2(currentRuntime, serverType, serverName, mode);
+	}
 	
-	
 	public static IServer createServer2(IRuntime currentRuntime, IServerType serverType, String serverName) throws CoreException {
+		return createServer2(currentRuntime, serverType, serverName, "local"); //$NON-NLS-1$
+	}
+	public static IServer createServer2(IRuntime currentRuntime, IServerType serverType, String serverName, String mode) throws CoreException {
 		IServerWorkingCopy serverWC = serverType.createServer(null, null,
 				new NullProgressMonitor());
 		serverWC.setRuntime(currentRuntime);
 		serverWC.setName(serverName);
 		serverWC.setServerConfiguration(null);
+		serverWC.setAttribute(IDeployableServer.SERVER_MODE, mode); 
 		return serverWC.save(true, new NullProgressMonitor());
 	}
 	



More information about the jbosstools-commits mailing list