Author: adietish
Date: 2011-07-05 10:49:35 -0400 (Tue, 05 Jul 2011)
New Revision: 32613
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchConfigProperties.java
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchConfigurator.java
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/src/org/jboss/ide/eclipse/as/rse/ui/RSELaunchTabProvider.java
Log:
[JBIDE-9215] replaced static #getDefaultStopCommand by read/write to launch config - like
it is done in all other launch config cases.
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchConfigProperties.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchConfigProperties.java 2011-07-05
13:33:51 UTC (rev 32612)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchConfigProperties.java 2011-07-05
14:49:35 UTC (rev 32613)
@@ -19,7 +19,9 @@
*/
public class RSELaunchConfigProperties {
+ public static final String RSE_DEFAULT_STARTUP_COMMAND =
"org.jboss.ide.eclipse.as.rse.core.RSELaunchDelegate.DEFAULT_STARTUP_COMMAND";
public static final String RSE_STARTUP_COMMAND =
"org.jboss.ide.eclipse.as.rse.core.RSELaunchDelegate.STARTUP_COMMAND";
+ public static final String RSE_DEFAULT_SHUTDOWN_COMMAND =
"org.jboss.ide.eclipse.as.rse.core.RSELaunchDelegate.DEFAULT_SHUTDOWN_COMMAND";
public static final String RSE_SHUTDOWN_COMMAND =
"org.jboss.ide.eclipse.as.rse.core.RSELaunchDelegate.SHUTDOWN_COMMAND";
public static final String DETECT_STARTUP_COMMAND =
"org.jboss.ide.eclipse.as.rse.core.RSELaunchDelegate.DETECT_STARTUP_COMMAND";
public static final String DETECT_SHUTDOWN_COMMAND =
"org.jboss.ide.eclipse.as.rse.core.RSELaunchDelegate.DETECT_SHUTDOWN_COMMAND";
@@ -50,6 +52,15 @@
launchConfig.setAttribute(DETECT_SHUTDOWN_COMMAND, detectShutdown);
}
+ public static void setDefaultStartupCommand(String startupCommand,
ILaunchConfigurationWorkingCopy launchConfig) {
+ launchConfig.setAttribute(RSE_DEFAULT_STARTUP_COMMAND, startupCommand);
+ }
+
+ public static String getDefaultStartupCommand(ILaunchConfiguration launchConfig, String
defaultCommand)
+ throws CoreException {
+ return launchConfig.getAttribute(RSE_DEFAULT_STARTUP_COMMAND, defaultCommand);
+ }
+
public static void setStartupCommand(String startupCommand,
ILaunchConfigurationWorkingCopy launchConfig) {
launchConfig.setAttribute(RSE_STARTUP_COMMAND, startupCommand);
}
@@ -75,4 +86,14 @@
throws CoreException {
return launchConfig.getAttribute(RSE_SHUTDOWN_COMMAND, defaultCommand);
}
+
+ public static void setDefaultShutdownCommand(String shutdownCommand,
ILaunchConfigurationWorkingCopy launchConfig) {
+ launchConfig.setAttribute(RSE_DEFAULT_SHUTDOWN_COMMAND, shutdownCommand);
+ }
+
+ public static String getDefaultShutdownCommand(ILaunchConfiguration launchConfig, String
defaultCommand)
+ throws CoreException {
+ return launchConfig.getAttribute(RSE_DEFAULT_SHUTDOWN_COMMAND, defaultCommand);
+ }
+
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchConfigurator.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchConfigurator.java 2011-07-05
13:33:51 UTC (rev 32612)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchConfigurator.java 2011-07-05
14:49:35 UTC (rev 32613)
@@ -29,12 +29,16 @@
@Override
public void configure(ILaunchConfigurationWorkingCopy launchConfig) throws CoreException
{
+ RSELaunchConfigProperties.setDefaultStartupCommand(defaultLaunchCommand,
launchConfig);
+
boolean detectStartupCommand =
RSELaunchConfigProperties.isDetectStartupCommand(launchConfig, true);
String currentStartupCmd = RSELaunchConfigProperties.getStartupCommand(launchConfig);
if( detectStartupCommand || !isSet(currentStartupCmd)) {
RSELaunchConfigProperties.setStartupCommand(defaultLaunchCommand, launchConfig);
}
+ RSELaunchConfigProperties.setDefaultShutdownCommand(defaultStopCommand, launchConfig);
+
boolean detectShutdownCommand =
RSELaunchConfigProperties.isDetectShutdownCommand(launchConfig, true);
String currentStopCmd = RSELaunchConfigProperties.getShutdownCommand(launchConfig);
if( detectShutdownCommand || isSet(currentStopCmd)) {
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchDelegate.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchDelegate.java 2011-07-05
13:33:51 UTC (rev 32612)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchDelegate.java 2011-07-05
14:49:35 UTC (rev 32613)
@@ -12,7 +12,6 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.rse.core;
-import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -121,7 +120,17 @@
String command2 = "";
try {
config = behaviour.getServer().getLaunchConfiguration(false, new
NullProgressMonitor());
- String defaultCmd = getDefaultStopCommand(behaviour.getServer(), true);
+ /*
+ * ATTENTION: this was commented since #getDefaultStopCommand is not static any
more
+ * String defaultCmd = getDefaultStopCommand(behaviour.getServer(), true);
+ */
+
+ /*
+ * This was added to make it compile
+ */
+ String defaultCmd = "";
+
+
command2 = config == null ? defaultCmd :
RSELaunchConfigProperties.getShutdownCommand(config, defaultCmd);
behaviour.setServerStopping();
@@ -182,8 +191,7 @@
*/
}
- @Deprecated
- public static String getDefaultStopCommand(IServer server) {
+ private String getDefaultStopCommand(IServer server) {
try {
return getDefaultStopCommand(server, false);
} catch (CoreException ce) {/* ignore, INTENTIONAL */
@@ -191,8 +199,7 @@
return null;
}
- @Deprecated
- public static String getDefaultStopCommand(IServer server, boolean errorOnFail) throws
CoreException {
+ private String getDefaultStopCommand(IServer server, boolean errorOnFail) throws
CoreException {
String rseHome = null;
rseHome = RSEUtils.getRSEHomeDir(server, errorOnFail);
JBossServer jbs = ServerConverter.getJBossServer(server);
@@ -220,7 +227,7 @@
return jbs.getServer();
}
- public static String getDefaultLaunchCommand(ILaunchConfiguration config) throws
CoreException {
+ private String getDefaultLaunchCommand(ILaunchConfiguration config) throws CoreException
{
String serverId = JBossLaunchConfigProperties.getServerId(config);
JBossServer jbossServer = ServerConverter.checkedFindJBossServer(serverId);
String rseHome = jbossServer.getServer().getAttribute(RSEUtils.RSE_SERVER_HOME_DIR,
"");
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/src/org/jboss/ide/eclipse/as/rse/ui/RSELaunchTabProvider.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/src/org/jboss/ide/eclipse/as/rse/ui/RSELaunchTabProvider.java 2011-07-05
13:33:51 UTC (rev 32612)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/src/org/jboss/ide/eclipse/as/rse/ui/RSELaunchTabProvider.java 2011-07-05
14:49:35 UTC (rev 32613)
@@ -27,11 +27,19 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Text;
+import
org.jboss.ide.eclipse.as.core.server.internal.launch.JBossServerStartupLaunchConfiguration.StartLaunchDelegate;
+import org.jboss.ide.eclipse.as.core.util.LaunchConfigUtils;
import org.jboss.ide.eclipse.as.rse.core.RSELaunchConfigProperties;
import org.jboss.ide.eclipse.as.rse.core.RSELaunchDelegate;
+import org.jboss.ide.eclipse.as.rse.core.RSEPublishMethod;
import org.jboss.ide.eclipse.as.ui.UIUtil;
import
org.jboss.ide.eclipse.as.ui.launch.JBossLaunchConfigurationTabGroup.IJBossLaunchTabProvider;
+/**
+ * @author Rob Stryker
+ * @author André Dietisheim
+ *
+ */
public class RSELaunchTabProvider implements IJBossLaunchTabProvider {
public ILaunchConfigurationTab[] createTabs() {
@@ -97,7 +105,8 @@
if( autoStartArgs.getSelection()) {
String command = null;
try {
- command = RSELaunchDelegate.getDefaultLaunchCommand(initialConfig);
+// command = RSELaunchDelegate.getDefaultLaunchCommand(initialConfig);
+ command = RSELaunchConfigProperties.getDefaultStartupCommand(initialConfig,
"");
startText.setText(command);
} catch(CoreException ce) {
// TODO