1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 235426

Make the FinalLaunchSequence class easily replaceable for someone that wants to extend the launch
This commit is contained in:
Marc Khouzam 2008-06-03 18:33:34 +00:00
parent 152ee1c3f1
commit 33ac8da64e
3 changed files with 15 additions and 10 deletions

View file

@ -18,7 +18,6 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.dd.gdb.internal.provisional.launching.FinalLaunchSequence;
import org.eclipse.dd.gdb.internal.provisional.launching.LaunchMessages;
import org.eclipse.dd.gdb.internal.ui.GdbUIPlugin;
import org.eclipse.debug.core.IStatusHandler;
@ -39,7 +38,7 @@ public class ProcessPrompter implements IStatusHandler {
* @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus,
* java.lang.Object)
*/
public Object handleStatus(IStatus status, Object source) throws CoreException {
public Object handleStatus(IStatus status, Object processList) throws CoreException {
Shell shell = GdbUIPlugin.getShell();
if (shell == null) {
IStatus error = new Status(IStatus.ERROR, GdbUIPlugin.getUniqueIdentifier(),
@ -48,8 +47,7 @@ public class ProcessPrompter implements IStatusHandler {
throw new CoreException(error);
}
// Get the process list from the FinalLaunchSequence
IProcessInfo[] plist = ((FinalLaunchSequence)source).getProcessList();
IProcessInfo[] plist = (IProcessInfo[])processList;
if (plist == null) {
MessageDialog.openError(
shell,

View file

@ -272,7 +272,7 @@ public class FinalLaunchSequence extends Sequence {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
Object result = prompter.handleStatus(processPromptStatus, FinalLaunchSequence.this);
Object result = prompter.handleStatus(processPromptStatus, fProcessList);
if (result instanceof Integer) {
rm.setData((Integer)result);
} else {
@ -389,8 +389,5 @@ public class FinalLaunchSequence extends Sequence {
public Step[] getSteps() {
return fSteps;
}
public IProcessInfo[] getProcessList() { return fProcessList; }
}

View file

@ -37,6 +37,8 @@ import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.dd.dsf.concurrent.DsfExecutor;
import org.eclipse.dd.dsf.concurrent.Sequence;
import org.eclipse.dd.dsf.concurrent.ThreadSafe;
import org.eclipse.dd.dsf.debug.sourcelookup.DsfSourceLookupDirector;
import org.eclipse.dd.dsf.service.DsfSession;
@ -131,8 +133,8 @@ public class GdbLaunchDelegate extends LaunchConfigurationDelegate
launch.addInferiorProcess(exePath.lastSegment());
// Create and invoke the final launch sequence to setup GDB
final FinalLaunchSequence finalLaunchSequence =
new FinalLaunchSequence(launch.getSession().getExecutor(), launch, sessionType, attach);
final Sequence finalLaunchSequence =
getFinalLaunchSequence(launch.getSession().getExecutor(), launch, sessionType, attach);
launch.getSession().getExecutor().execute(finalLaunchSequence);
try {
finalLaunchSequence.get();
@ -143,6 +145,14 @@ public class GdbLaunchDelegate extends LaunchConfigurationDelegate
}
}
/*
* This method can be overridden by subclasses to allow to change the final launch sequence without
* having to change the entire GdbLaunchDelegate
*/
protected Sequence getFinalLaunchSequence(DsfExecutor executor, GdbLaunch launch, SessionType type, boolean attach) {
return new FinalLaunchSequence(executor, launch, type, attach);
}
private SessionType getSessionType(ILaunchConfiguration config) {
try {
String debugMode = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN );