diff options
author | Uwe Stieber | 2012-09-23 09:25:08 +0000 |
---|---|---|
committer | Uwe Stieber | 2012-09-23 09:25:08 +0000 |
commit | 50667276e28a0e2007dd2121aecc11fd76cc2dbe (patch) | |
tree | 34eeda419dd60fd44ff59db4bf654221c451386c /target_explorer | |
parent | bd7ea3854de6b5c022c2437de42ae14245bcd682 (diff) | |
download | org.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')
7 files changed, 202 insertions, 39 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$ diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.java index 8e5985561..042823366 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.java @@ -71,6 +71,9 @@ public class Messages extends NLS { public static String LaunchConfigurationMainTabSection_processArguments_label; public static String LaunchConfigurationMainTabSection_processImage_label; public static String LaunchConfigurationMainTabSection_error_missingProcessImage; + public static String LaunchConfigurationMainTabSection_stopAtEntry_label; + public static String LaunchConfigurationMainTabSection_stopAtMain_label; + public static String LaunchConfigurationMainTabSection_attachChildren_label; public static String AddEditFileTransferDialog_add_dialogTitle; public static String AddEditFileTransferDialog_edit_dialogTitle; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.properties index d89726679..05c9e4ae2 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.properties +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.properties @@ -12,6 +12,9 @@ LaunchConfigurationMainTabSection_title = Process LaunchConfigurationMainTabSection_processImage_label = Image: LaunchConfigurationMainTabSection_processArguments_label = Arguments: LaunchConfigurationMainTabSection_error_missingProcessImage = Please select or enter a process image. +LaunchConfigurationMainTabSection_stopAtEntry_label = Stop at Entry +LaunchConfigurationMainTabSection_stopAtMain_label = Stop at Main (ProcessesV1 only) +LaunchConfigurationMainTabSection_attachChildren_label = Attach Process Children (ProcessesV1 only) AddEditFileTransferDialog_add_dialogTitle = Add AddEditFileTransferDialog_edit_dialogTitle = Edit diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/remote/app/LaunchConfigurationMainTabSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/remote/app/LaunchConfigurationMainTabSection.java index e4e8fd12b..3710b8ce5 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/remote/app/LaunchConfigurationMainTabSection.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/remote/app/LaunchConfigurationMainTabSection.java @@ -12,16 +12,23 @@ package org.eclipse.tcf.te.tcf.launch.ui.remote.app; import org.eclipse.core.runtime.Assert; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.ILaunchManager; +import org.eclipse.debug.ui.ILaunchConfigurationDialog; import org.eclipse.jface.dialogs.IMessageProvider; import org.eclipse.jface.window.Window; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; import org.eclipse.tcf.te.launch.core.persistence.DefaultPersistenceDelegate; import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate; import org.eclipse.tcf.te.launch.ui.interfaces.ILaunchConfigurationTabFormPart; +import org.eclipse.tcf.te.launch.ui.tabs.AbstractLaunchConfigurationTab; import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode; import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode; import org.eclipse.tcf.te.tcf.filesystem.ui.dialogs.FSOpenFileDialog; @@ -39,9 +46,13 @@ import org.eclipse.ui.forms.widgets.Section; */ public class LaunchConfigurationMainTabSection extends AbstractSection implements ILaunchConfigurationTabFormPart { - BaseEditBrowseTextControl processImage; - BaseEditBrowseTextControl processArguments; - IModelNode firstSelection = null; + /* default */ BaseEditBrowseTextControl processImage; + /* default */ BaseEditBrowseTextControl processArguments; + private Button stopAtEntry; + private Button stopAtMain; + private Button attachChildren; + + /* default */ IModelNode firstSelection = null; /** * Constructor. @@ -125,6 +136,55 @@ public class LaunchConfigurationMainTabSection extends AbstractSection implement processArguments.setParentControlIsInnerPanel(true); processArguments.setFormToolkit(toolkit); processArguments.setupPanel(client); + + Object container = getManagedForm().getContainer(); + if (container instanceof AbstractLaunchConfigurationTab) { + ILaunchConfigurationDialog dialog = ((AbstractLaunchConfigurationTab)container).getLaunchConfigurationDialog(); + String mode = dialog != null ? dialog.getMode() : null; + if (ILaunchManager.DEBUG_MODE.equals(mode)) { + // Add the debug options to the launch tab + Label label = new Label(client, SWT.HORIZONTAL); + GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + layoutData.horizontalSpan = 3; + label.setLayoutData(layoutData); + + stopAtEntry = new Button(client, SWT.CHECK); + stopAtEntry.setText(Messages.LaunchConfigurationMainTabSection_stopAtEntry_label); + layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + layoutData.horizontalSpan = 3; + stopAtEntry.setLayoutData(layoutData); + stopAtEntry.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + getManagedForm().dirtyStateChanged(); + } + }); + + stopAtMain = new Button(client, SWT.CHECK); + stopAtMain.setText(Messages.LaunchConfigurationMainTabSection_stopAtMain_label); + layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + layoutData.horizontalSpan = 3; + stopAtMain.setLayoutData(layoutData); + stopAtMain.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + getManagedForm().dirtyStateChanged(); + } + }); + + attachChildren = new Button(client, SWT.CHECK); + attachChildren.setText(Messages.LaunchConfigurationMainTabSection_attachChildren_label); + layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + layoutData.horizontalSpan = 3; + attachChildren.setLayoutData(layoutData); + attachChildren.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + getManagedForm().dirtyStateChanged(); + } + }); + } + } } /* (non-Javadoc) @@ -143,6 +203,21 @@ public class LaunchConfigurationMainTabSection extends AbstractSection implement String arguments = DefaultPersistenceDelegate.getAttribute(configuration, IRemoteAppLaunchAttributes.ATTR_PROCESS_ARGUMENTS, ""); //$NON-NLS-1$ processArguments.setEditFieldControlText(arguments); } + + if (stopAtEntry != null) { + boolean selected = DefaultPersistenceDelegate.getAttribute(configuration, IRemoteAppLaunchAttributes.ATTR_STOP_AT_ENTRY, false); + stopAtEntry.setSelection(selected); + } + + if (stopAtMain != null) { + boolean selected = DefaultPersistenceDelegate.getAttribute(configuration, IRemoteAppLaunchAttributes.ATTR_STOP_AT_MAIN, false); + stopAtMain.setSelection(selected); + } + + if (attachChildren != null) { + boolean selected = DefaultPersistenceDelegate.getAttribute(configuration, IRemoteAppLaunchAttributes.ATTR_ATTACH_CHILDREN, false); + attachChildren.setSelection(selected); + } } /* (non-Javadoc) @@ -175,6 +250,18 @@ public class LaunchConfigurationMainTabSection extends AbstractSection implement } else { DefaultPersistenceDelegate.setAttribute(configuration, IRemoteAppLaunchAttributes.ATTR_PROCESS_ARGUMENTS, (String)null); } + + if (stopAtEntry != null) { + DefaultPersistenceDelegate.setAttribute(configuration, IRemoteAppLaunchAttributes.ATTR_STOP_AT_ENTRY, stopAtEntry.getSelection()); + } + + if (stopAtMain != null) { + DefaultPersistenceDelegate.setAttribute(configuration, IRemoteAppLaunchAttributes.ATTR_STOP_AT_MAIN, stopAtMain.getSelection()); + } + + if (attachChildren != null) { + DefaultPersistenceDelegate.setAttribute(configuration, IRemoteAppLaunchAttributes.ATTR_ATTACH_CHILDREN, attachChildren.getSelection()); + } } @Override |