Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2012-09-23 05:25:08 -0400
committerUwe Stieber2012-09-23 05:25:08 -0400
commit50667276e28a0e2007dd2121aecc11fd76cc2dbe (patch)
tree34eeda419dd60fd44ff59db4bf654221c451386c /target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core
parentbd7ea3854de6b5c022c2437de42ae14245bcd682 (diff)
downloadorg.eclipse.tcf-50667276e28a0e2007dd2121aecc11fd76cc2dbe.tar.gz
org.eclipse.tcf-50667276e28a0e2007dd2121aecc11fd76cc2dbe.tar.xz
org.eclipse.tcf-50667276e28a0e2007dd2121aecc11fd76cc2dbe.zip
Target Explorer: Bug 389026 - [TCF][Process] Support IProcessesV1 with the ProcessLauncher
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/IRemoteAppLaunchAttributes.java18
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/RemoteAppLaunchManagerDelegate.java41
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/LaunchProcessStep.java36
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/ResumeContextStep.java47
4 files changed, 106 insertions, 36 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/IRemoteAppLaunchAttributes.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/IRemoteAppLaunchAttributes.java
index 7f62918c9..e5db23e51 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/IRemoteAppLaunchAttributes.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/interfaces/IRemoteAppLaunchAttributes.java
@@ -25,5 +25,23 @@ public interface IRemoteAppLaunchAttributes {
*/
public static final String ATTR_PROCESS_ARGUMENTS = ICommonTCFLaunchAttributes.ATTR_PREFIX + ".process_arguments"; //$NON-NLS-1$
+ /**
+ * Launch configuration attribute: Flag if or if not to stop at process entry.
+ */
+ public static final String ATTR_STOP_AT_ENTRY = ICommonTCFLaunchAttributes.ATTR_PREFIX + ".process_stop_at_entry"; //$NON-NLS-1$
+
+ /**
+ * Launch configuration attribute: Flag if or if not to stop at main.
+ */
+ public static final String ATTR_STOP_AT_MAIN = ICommonTCFLaunchAttributes.ATTR_PREFIX + ".process_stop_at_main"; //$NON-NLS-1$
+
+ /**
+ * Launch configuration attribute: Flag if or if not to attach process children.
+ */
+ public static final String ATTR_ATTACH_CHILDREN = ICommonTCFLaunchAttributes.ATTR_PREFIX + ".process_attach_children"; //$NON-NLS-1$
+
+ /**
+ * Launch configuration attribute (internal use): The process context object.
+ */
public static final String ATTR_PROCESS_CONTEXT = ICommonTCFLaunchAttributes.ATTR_PREFIX + ".process_context"; //$NON-NLS-1$
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/RemoteAppLaunchManagerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/RemoteAppLaunchManagerDelegate.java
index 12c6e53ad..bcc97ece8 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/RemoteAppLaunchManagerDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/lm/delegates/RemoteAppLaunchManagerDelegate.java
@@ -65,20 +65,16 @@ public class RemoteAppLaunchManagerDelegate extends DefaultLaunchManagerDelegate
public void initLaunchConfigAttributes(ILaunchConfigurationWorkingCopy wc, ILaunchSpecification launchSpec) {
super.initLaunchConfigAttributes(wc, launchSpec);
- if (launchSpec.hasAttribute(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS)) {
- wc.setAttribute(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS, (String)launchSpec.getAttribute(ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS).getValue());
- }
- if (launchSpec.hasAttribute(IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE)) {
- wc.setAttribute(IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE, (String)launchSpec.getAttribute(IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE).getValue());
- }
- if (launchSpec.hasAttribute(IFileTransferLaunchAttributes.ATTR_FILE_TRANSFERS)) {
- wc.setAttribute(IFileTransferLaunchAttributes.ATTR_FILE_TRANSFERS, (String)launchSpec.getAttribute(IFileTransferLaunchAttributes.ATTR_FILE_TRANSFERS).getValue());
- }
- if (launchSpec.hasAttribute(IReferencedProjectLaunchAttributes.ATTR_REFERENCED_PROJECTS)) {
- wc.setAttribute(IReferencedProjectLaunchAttributes.ATTR_REFERENCED_PROJECTS, (String)launchSpec.getAttribute(IReferencedProjectLaunchAttributes.ATTR_REFERENCED_PROJECTS).getValue());
- }
+ wc.setAttribute(IRemoteAppLaunchAttributes.ATTR_STOP_AT_MAIN, true);
+ wc.setAttribute(IRemoteAppLaunchAttributes.ATTR_ATTACH_CHILDREN, true);
+ copySpecToConfig(launchSpec, wc);
+
+ wc.rename(getDefaultLaunchName(wc));
}
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.core.lm.delegates.DefaultLaunchManagerDelegate#updateLaunchConfig(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy, org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext, boolean)
+ */
@Override
public void updateLaunchConfig(ILaunchConfigurationWorkingCopy wc, ISelectionContext selContext, boolean replace) {
super.updateLaunchConfig(wc, selContext, replace);
@@ -114,6 +110,8 @@ public class RemoteAppLaunchManagerDelegate extends DefaultLaunchManagerDelegate
IRemoteSelectionContext remoteCtx = (IRemoteSelectionContext)selContext;
LaunchContextsPersistenceDelegate.setLaunchContexts(wc, new IModelNode[]{remoteCtx.getRemoteCtx()});
}
+
+ wc.rename(getDefaultLaunchName(wc));
}
/* (non-Javadoc)
@@ -269,7 +267,7 @@ public class RemoteAppLaunchManagerDelegate extends DefaultLaunchManagerDelegate
*/
@Override
protected int getNumAttributes() {
- return 5;
+ return 8;
}
/* (non-Javadoc)
@@ -278,18 +276,27 @@ public class RemoteAppLaunchManagerDelegate extends DefaultLaunchManagerDelegate
@Override
protected int getAttributeRanking(String attributeKey) {
if (ILaunchContextLaunchAttributes.ATTR_LAUNCH_CONTEXTS.equals(attributeKey)) {
- return getNumAttributes() * 32;
+ return getNumAttributes() * 256;
}
else if (IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE.equals(attributeKey)) {
- return getNumAttributes() * 16;
+ return getNumAttributes() * 128;
}
else if (IRemoteAppLaunchAttributes.ATTR_PROCESS_ARGUMENTS.equals(attributeKey)) {
- return getNumAttributes() * 8;
+ return getNumAttributes() * 64;
}
else if (IFileTransferLaunchAttributes.ATTR_FILE_TRANSFERS.equals(attributeKey)) {
- return getNumAttributes() * 4;
+ return getNumAttributes() * 32;
}
else if (IReferencedProjectLaunchAttributes.ATTR_REFERENCED_PROJECTS.equals(attributeKey)) {
+ return getNumAttributes() * 16;
+ }
+ else if (IRemoteAppLaunchAttributes.ATTR_STOP_AT_ENTRY.equals(attributeKey)) {
+ return getNumAttributes() * 8;
+ }
+ else if (IRemoteAppLaunchAttributes.ATTR_STOP_AT_MAIN.equals(attributeKey)) {
+ return getNumAttributes() * 4;
+ }
+ else if (IRemoteAppLaunchAttributes.ATTR_ATTACH_CHILDREN.equals(attributeKey)) {
return getNumAttributes() * 2;
}
else {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/LaunchProcessStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/LaunchProcessStep.java
index 63f75d25d..124957d5d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/LaunchProcessStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/LaunchProcessStep.java
@@ -18,11 +18,13 @@ 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.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.tcf.protocol.IChannel;
import org.eclipse.tcf.protocol.IPeer;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.services.IProcesses;
+import org.eclipse.tcf.services.IProcessesV1;
import org.eclipse.tcf.te.core.utils.text.StringUtil;
import org.eclipse.tcf.te.launch.core.persistence.DefaultPersistenceDelegate;
import org.eclipse.tcf.te.runtime.callback.Callback;
@@ -83,8 +85,13 @@ public class LaunchProcessStep extends AbstractTcfLaunchStep {
public void execute(IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, final ICallback callback) {
final IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ICommonTCFLaunchAttributes.ATTR_CHANNEL, fullQualifiedId, data);
Assert.isTrue(channel != null && channel.getState() == IChannel.STATE_OPEN, "channel is missing or closed"); //$NON-NLS-1$
+
+ // Get the launch configuration object
+ final ILaunchConfiguration lc = getLaunchConfiguration(context);
+ Assert.isNotNull(lc);
+
// Construct the launcher object
- ProcessLauncher launcher = new ProcessLauncher();
+ final ProcessLauncher launcher = new ProcessLauncher();
Map<String, Object> launchAttributes = new HashMap<String, Object>();
@@ -96,17 +103,32 @@ public class LaunchProcessStep extends AbstractTcfLaunchStep {
launchAttributes.put(ITerminalsConnectorConstants.PROP_LOCAL_ECHO, Boolean.FALSE);
- boolean outputConsole = DefaultPersistenceDelegate.getAttribute(getLaunchConfiguration(context), "org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON", true); //$NON-NLS-1$
+ boolean outputConsole = DefaultPersistenceDelegate.getAttribute(lc, "org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON", true); //$NON-NLS-1$
if (outputConsole) {
launchAttributes.put(IProcessLauncher.PROP_PROCESS_ASSOCIATE_CONSOLE, Boolean.TRUE);
}
- String outputFile = DefaultPersistenceDelegate.getAttribute(getLaunchConfiguration(context), "org.eclipse.debug.ui.ATTR_CAPTURE_IN_FILE", (String)null); //$NON-NLS-1$
+ String outputFile = DefaultPersistenceDelegate.getAttribute(lc, "org.eclipse.debug.ui.ATTR_CAPTURE_IN_FILE", (String)null); //$NON-NLS-1$
if (outputFile != null) {
launchAttributes.put(IProcessLauncher.PROP_PROCESS_OUTPUT_REDIRECT_TO_FILE, outputFile);
}
if (ILaunchManager.DEBUG_MODE.equals(getLaunchMode(context))) {
launchAttributes.put(IProcessLauncher.PROP_PROCESS_ATTACH, Boolean.TRUE);
+
+ boolean stopAtEntry = DefaultPersistenceDelegate.getAttribute(lc, IRemoteAppLaunchAttributes.ATTR_STOP_AT_ENTRY, false);
+ if (stopAtEntry) {
+ launchAttributes.put(IProcessesV1.START_STOP_AT_ENTRY, Boolean.TRUE);
+ }
+
+ boolean stopAtMain = DefaultPersistenceDelegate.getAttribute(lc, IRemoteAppLaunchAttributes.ATTR_STOP_AT_MAIN, false);
+ if (stopAtMain) {
+ launchAttributes.put(IProcessesV1.START_STOP_AT_MAIN, Boolean.TRUE);
+ }
+
+ boolean attachChildren = DefaultPersistenceDelegate.getAttribute(lc, IRemoteAppLaunchAttributes.ATTR_ATTACH_CHILDREN, false);
+ if (attachChildren) {
+ launchAttributes.put(IProcessesV1.START_ATTACH_CHILDREN, Boolean.TRUE);
+ }
}
// Determine the active peer
@@ -145,8 +167,12 @@ public class LaunchProcessStep extends AbstractTcfLaunchStep {
@Override
protected void internalDone(Object caller, IStatus status) {
Object result = getResult();
- if (status.isOK() && result instanceof IProcesses.ProcessContext) {
- StepperAttributeUtil.setProperty(IRemoteAppLaunchAttributes.ATTR_PROCESS_CONTEXT, fullQualifiedId.getParentId(), data, result);
+ if (status.isOK()) {
+ if (result instanceof IProcesses.ProcessContext) {
+ StepperAttributeUtil.setProperty(IRemoteAppLaunchAttributes.ATTR_PROCESS_CONTEXT, fullQualifiedId.getParentId(), data, result);
+ }
+ StepperAttributeUtil.setProperty("services.processes.name", fullQualifiedId.getParentId(), data, //$NON-NLS-1$
+ (launcher.getSvcProcesses() instanceof IProcessesV1 ? IProcessesV1.NAME : IProcesses.NAME));
}
Assert.isTrue(channel.getState() == IChannel.STATE_OPEN, "channel is closed"); //$NON-NLS-1$
super.internalDone(caller, status);
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/ResumeContextStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/ResumeContextStep.java
index b12ffcd71..79567fcfe 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/ResumeContextStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/steps/ResumeContextStep.java
@@ -9,16 +9,20 @@
*******************************************************************************/
package org.eclipse.tcf.te.tcf.launch.core.steps;
+import org.eclipse.core.runtime.Assert;
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.ILaunchConfiguration;
import org.eclipse.tcf.protocol.IChannel;
import org.eclipse.tcf.protocol.IToken;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.services.IProcesses;
+import org.eclipse.tcf.services.IProcessesV1;
import org.eclipse.tcf.services.IRunControl;
import org.eclipse.tcf.services.IRunControl.RunControlContext;
+import org.eclipse.tcf.te.launch.core.persistence.DefaultPersistenceDelegate;
import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.runtime.stepper.StepperAttributeUtil;
@@ -79,22 +83,37 @@ public class ResumeContextStep extends AbstractTcfLaunchStep {
final IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ICommonTCFLaunchAttributes.ATTR_CHANNEL, fullQualifiedId, data);
final IProcesses.ProcessContext processContext = (IProcesses.ProcessContext)StepperAttributeUtil.getProperty(IRemoteAppLaunchAttributes.ATTR_PROCESS_CONTEXT, fullQualifiedId, data);
final IRunControl runControl = channel.getRemoteService(IRunControl.class);
+ final String svcProcessesName = (String)StepperAttributeUtil.getProperty("services.processes.name", fullQualifiedId, data); //$NON-NLS-1$
- if (runControl != null) {
- runControl.getContext(processContext.getID(), new IRunControl.DoneGetContext() {
- @Override
- public void doneGetContext(IToken token, Exception error, RunControlContext context) {
- ProgressHelper.worked(monitor, 5);
- if (!ProgressHelper.isCancelOrError(ResumeContextStep.this, StatusHelper.getStatus(error), monitor, callback)) {
- context.resume(IRunControl.RM_RESUME, 1, new IRunControl.DoneCommand() {
- @Override
- public void doneCommand(IToken token, Exception error) {
- callback.done(ResumeContextStep.this, StatusHelper.getStatus(error));
- }
- });
+ if (IProcessesV1.NAME.equals(svcProcessesName)) {
+ // If the processes service used is IProcessesV1, there is nothing to do here
+ callback.done(ResumeContextStep.this, Status.OK_STATUS);
+ } else if (runControl != null) {
+ // Get the launch configuration object
+ final ILaunchConfiguration lc = getLaunchConfiguration(context);
+ Assert.isNotNull(lc);
+ boolean stopAtEntry = DefaultPersistenceDelegate.getAttribute(lc, IRemoteAppLaunchAttributes.ATTR_STOP_AT_ENTRY, false);
+
+ // In case "stop at entry" is not desired, we have to resume the context once to
+ // "stop at main".
+ if (!stopAtEntry) {
+ runControl.getContext(processContext.getID(), new IRunControl.DoneGetContext() {
+ @Override
+ public void doneGetContext(IToken token, Exception error, RunControlContext context) {
+ ProgressHelper.worked(monitor, 5);
+ if (!ProgressHelper.isCancelOrError(ResumeContextStep.this, StatusHelper.getStatus(error), monitor, callback)) {
+ context.resume(IRunControl.RM_RESUME, 1, new IRunControl.DoneCommand() {
+ @Override
+ public void doneCommand(IToken token, Exception error) {
+ callback.done(ResumeContextStep.this, StatusHelper.getStatus(error));
+ }
+ });
+ }
}
- }
- });
+ });
+ } else {
+ callback.done(ResumeContextStep.this, Status.OK_STATUS);
+ }
}
else {
callback.done(this, new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "missing run control service")); //$NON-NLS-1$

Back to the top