1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 08:46:02 +02:00

Added a method to create debug targets.

This commit is contained in:
Mikhail Khodjaiants 2002-08-06 19:57:04 +00:00
parent 1205962492
commit e1f66c1e77
2 changed files with 73 additions and 1 deletions

View file

@ -6,6 +6,16 @@
package org.eclipse.cdt.debug.core;
import org.eclipse.cdt.debug.core.cdi.model.ICTarget;
import org.eclipse.cdt.debug.internal.core.CDebugTarget;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.IProcess;
/**
@ -34,4 +44,62 @@ public class CDebugModel
{
return CDebugCorePlugin.getUniqueIdentifier();
}
/**
* Creates and returns a debug target for the given CDI target, with
* the specified name, and associates the debug target with the
* given process for console I/O. The allow terminate flag specifies whether
* the debug target will support termination (<code>ITerminate</code>).
* The allow disconnect flag specifies whether the debug target will
* support disconnection (<code>IDisconnect</code>). The resume
* flag specifies if the target process should be resumed on startup.
* The debug target is added to the given launch.
*
* @param launch the launch the new debug target will be contained in
* @param cdiTarget the CDI target to create a debug target for
* @param name the name to associate with this target, which will be
* returned from <code>IDebugTarget.getName</code>.
* @param process the process to associate with the debug target,
* which will be returned from <code>IDebugTarget.getProcess</code>
* @param allowTerminate whether the target will support termianation
* @param allowDisconnect whether the target will support disconnection
* @param resume whether the target is to be resumed on startup.
* @return a debug target
*
* @since 2.0
*/
public static IDebugTarget newDebugTarget( final ILaunch launch,
final ICTarget cdiTarget,
final String name,
final IProcess process,
final IDebugConfiguration config,
final boolean allowTerminate,
final boolean allowDisconnect,
final boolean resume )
{
final IDebugTarget[] target = new IDebugTarget[1];
IWorkspaceRunnable r = new IWorkspaceRunnable()
{
public void run( IProgressMonitor m )
{
target[0] = new CDebugTarget( launch,
cdiTarget,
name,
process,
config,
allowTerminate,
allowDisconnect,
resume );
}
};
try
{
ResourcesPlugin.getWorkspace().run( r, null );
}
catch( CoreException e )
{
CDebugCorePlugin.log( e );
}
return target[0];
}
}

View file

@ -11,6 +11,7 @@ import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.debug.core.CDebugModel;
import org.eclipse.cdt.debug.core.IDebugConfiguration;
import org.eclipse.cdt.debug.core.IFormattedMemoryBlock;
import org.eclipse.cdt.debug.core.IFormattedMemoryRetrieval;
import org.eclipse.cdt.debug.core.IInstructionStep;
@ -134,7 +135,10 @@ public class CDebugTarget extends CDebugElement
public CDebugTarget( ILaunch launch,
ICTarget cdiTarget,
String name,
IProcess process,
IProcess process,
IDebugConfiguration config,
boolean allowsTerminate,
boolean allowsDisconnect,
boolean resume )
{
super( null );