public class DebugPlugin extends Plugin
DebugPlugin.getDefault()
. The debug plug-in provides:
Modifier and Type | Field and Description |
---|---|
static String |
ATTR_BREAKPOINT_IS_DELETED
Deleted breakpoint marker attribute (value
"org.eclipse.debug.core.breakpointIsDeleted" ). |
static String |
ATTR_CAPTURE_OUTPUT
The launch attribute that designates whether or not it's associated
launch should capture output.
|
static String |
ATTR_CONSOLE_ENCODING
This launch attribute designates the encoding to be used by the console
associated with the launch.
|
static String |
ATTR_ENVIRONMENT
Attribute key for the environment used when an
IProcess was run |
static String |
ATTR_LAUNCH_TIMESTAMP
The launch attribute that stores the time stamp of when a launch configuration was
launched.
|
static String |
ATTR_PATH
Attribute key for path of the executable that launched an
IProcess |
static String |
ATTR_PROCESS_FACTORY_ID
The launch configuration attribute that designates the process factory ID
for the process factory to be used when creating a new process as a result of launching
the launch configuration.
|
static String |
ATTR_WORKING_DIRECTORY
Attribute key for the path of the working directory for an
IProcess |
static int |
ERR_WORKING_DIRECTORY_NOT_SUPPORTED
Status code indicating that the Eclipse runtime does not support
launching a program with a working directory.
|
static int |
ERROR
Status code indicating an unexpected error.
|
static String |
EXTENSION_POINT_BREAKPOINT_IMPORT_PARTICIPANTS
Simple identifier constant for the breakpoint import participant extension point
|
static String |
EXTENSION_POINT_BREAKPOINTS
Simple identifier constant (value
"breakpoints" ) for the
breakpoints extension point. |
static String |
EXTENSION_POINT_LAUNCH_CONFIGURATION_COMPARATORS
Simple identifier constant (value
"launchConfigurationComparators" )
for the launch configuration comparators extension point. |
static String |
EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES
Simple identifier constant (value
"launchConfigurationTypes" )
for the launch configuration types extension point. |
static String |
EXTENSION_POINT_LAUNCH_DELEGATES
Simple identifier constant (value
"launchDelegates" ) for the
launch delegates extension point. |
static String |
EXTENSION_POINT_LAUNCH_MODES
Simple identifier constant (value
"launchModes" ) for the
source modes extension point. |
static String |
EXTENSION_POINT_LAUNCH_OPTIONS
Simple identifier constant for the launch options extension point
|
static String |
EXTENSION_POINT_LOGICAL_STRUCTURE_PROVIDERS
Simple identifier constant (value
"logicalStructureProviders" ) for the
logical structure types extension point. |
static String |
EXTENSION_POINT_LOGICAL_STRUCTURE_TYPES
Simple identifier constant (value
"logicalStructureTypes" ) for the
logical structure types extension point. |
static String |
EXTENSION_POINT_PROCESS_FACTORIES
Simple identifier constant (value
"processFactories" ) for the
process factories extension point. |
static String |
EXTENSION_POINT_SOURCE_CONTAINER_TYPES
Simple identifier constant (value
"sourceContainerTypes" ) for the
source container types extension point. |
static String |
EXTENSION_POINT_SOURCE_LOCATORS
Simple identifier constant (value
"sourceLocators" ) for the
source locators extension point. |
static String |
EXTENSION_POINT_SOURCE_PATH_COMPUTERS
Simple identifier constant (value
"sourcePathComputers" ) for the
source path computers extension point. |
static String |
EXTENSION_POINT_STATUS_HANDLERS
Simple identifier constant (value
"statusHandlers" ) for the
status handlers extension point. |
static int |
INTERNAL_ERROR
Status code indicating an unexpected internal error.
|
static String |
PREF_DELETE_CONFIGS_ON_PROJECT_DELETE
Boolean preference key (value
org.eclipse.debug.core.PREF_DELETE_CONFIGS_ON_PROJECT_DELETE ) that controls
whether to delete associated configurations when a project is deleted. |
PLUGIN_PREFERENCE_SCOPE, PREFERENCES_DEFAULT_OVERRIDE_BASE_NAME, PREFERENCES_DEFAULT_OVERRIDE_FILE_NAME
Constructor and Description |
---|
DebugPlugin()
Constructs the debug plug-in.
|
Modifier and Type | Method and Description |
---|---|
void |
addDebugEventFilter(IDebugEventFilter filter)
Adds the given debug event filter to the registered
event filters.
|
void |
addDebugEventListener(IDebugEventSetListener listener)
Adds the given listener to the collection of registered debug
event listeners.
|
void |
asyncExec(Runnable r)
Asynchronously executes the given runnable in a separate
thread, after debug event dispatch has completed.
|
static Process |
exec(String[] cmdLine,
File workingDirectory)
Convenience method that performs a runtime exec on the given command line
in the context of the specified working directory, and returns the
resulting process.
|
static Process |
exec(String[] cmdLine,
File workingDirectory,
String[] envp)
Convenience method that performs a runtime exec on the given command line
in the context of the specified working directory, and returns the
resulting process.
|
void |
fireDebugEventSet(DebugEvent[] events)
Notifies all registered debug event set listeners of the given
debug events.
|
static Object |
getAdapter(Object element,
Class<?> type)
Returns an adapter of the specified type for the given object or
null
if none. |
IBreakpointManager |
getBreakpointManager()
Returns the breakpoint manager.
|
static DebugPlugin |
getDefault()
Returns the singleton instance of the debug plug-in.
|
static ILogicalStructureType |
getDefaultStructureType(ILogicalStructureType[] types)
Returns the default logical structure type among the given combination of
logical structure types, or
null if none. |
IExpressionManager |
getExpressionManager()
Returns the expression manager.
|
ILaunchManager |
getLaunchManager()
Returns the launch manager.
|
static ILogicalStructureType[] |
getLogicalStructureTypes(IValue value)
Returns any logical structure types that have been contributed for the given
value.
|
IMemoryBlockManager |
getMemoryBlockManager()
Returns the memory block manager.
|
IStatusHandler |
getStatusHandler(IStatus status)
Returns the status handler registered for the given
status, or
null if none. |
static String |
getUniqueIdentifier()
Convenience method which returns the unique identifier of this plug-in.
|
static boolean |
isUseStepFilters()
Returns whether step filters are applied to step commands.
|
static void |
log(IStatus status)
Logs the specified status with this plug-in's log.
|
static void |
log(Throwable t)
Logs the specified throwable with this plug-in's log.
|
static void |
logDebugMessage(String message)
Logs the given message if in debug mode.
|
static void |
logMessage(String message,
Throwable throwable)
Logs the given message with this plug-in's log and the given
throwable or
null if none. |
static Document |
newDocument()
Creates and returns a new XML document.
|
static IProcess |
newProcess(ILaunch launch,
Process process,
String label)
Creates and returns a new process representing the given
java.lang.Process . |
static IProcess |
newProcess(ILaunch launch,
Process process,
String label,
Map<String,String> attributes)
Creates and returns a new process representing the given
java.lang.Process . |
static String[] |
parseArguments(String args)
Parses the given command line into separate arguments that can be passed to
DebugPlugin.exec(String[], File) . |
static Element |
parseDocument(String document)
Parses the given string representing an XML document, returning its
root element.
|
void |
removeDebugEventFilter(IDebugEventFilter filter)
Removes the given debug event filter from the registered
event filters.
|
void |
removeDebugEventListener(IDebugEventSetListener listener)
Removes the given listener from the collection of registered debug
event listeners.
|
static String |
renderArguments(String[] arguments,
int[] segments)
Renders the given array of strings into a single command line.
|
static String |
serializeDocument(Document document)
Serializes the given XML document into a string.
|
static void |
setDefaultStructureType(ILogicalStructureType[] types,
ILogicalStructureType def)
Sets the default logical structure type among the given combination of logical structure
types.
|
static void |
setUseStepFilters(boolean useStepFilters)
Sets whether step filters should be applied to step commands.
|
void |
start(BundleContext context)
Starts up this plug-in.
|
void |
stop(BundleContext context)
Stops this plug-in.
|
find, find, getBundle, getDescriptor, getLog, getPluginPreferences, getStateLocation, initializeDefaultPluginPreferences, internalInitializeDefaultPluginPreferences, isDebugging, openStream, openStream, savePluginPreferences, setDebugging, shutdown, startup, toString
public static final String EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES
"launchConfigurationTypes"
)
for the launch configuration types extension point.public static final String EXTENSION_POINT_LAUNCH_CONFIGURATION_COMPARATORS
"launchConfigurationComparators"
)
for the launch configuration comparators extension point.public static final String EXTENSION_POINT_BREAKPOINTS
"breakpoints"
) for the
breakpoints extension point.public static final String EXTENSION_POINT_STATUS_HANDLERS
"statusHandlers"
) for the
status handlers extension point.public static final String EXTENSION_POINT_SOURCE_LOCATORS
"sourceLocators"
) for the
source locators extension point.public static final String EXTENSION_POINT_LAUNCH_MODES
"launchModes"
) for the
source modes extension point.public static final String EXTENSION_POINT_LAUNCH_DELEGATES
"launchDelegates"
) for the
launch delegates extension point.public static final String EXTENSION_POINT_PROCESS_FACTORIES
"processFactories"
) for the
process factories extension point.public static final String EXTENSION_POINT_LOGICAL_STRUCTURE_TYPES
"logicalStructureTypes"
) for the
logical structure types extension point.public static final String EXTENSION_POINT_LOGICAL_STRUCTURE_PROVIDERS
"logicalStructureProviders"
) for the
logical structure types extension point.public static final String EXTENSION_POINT_SOURCE_CONTAINER_TYPES
"sourceContainerTypes"
) for the
source container types extension point.public static final String EXTENSION_POINT_SOURCE_PATH_COMPUTERS
"sourcePathComputers"
) for the
source path computers extension point.public static final String EXTENSION_POINT_LAUNCH_OPTIONS
public static final String EXTENSION_POINT_BREAKPOINT_IMPORT_PARTICIPANTS
public static final int ERROR
public static final int INTERNAL_ERROR
public static final int ERR_WORKING_DIRECTORY_NOT_SUPPORTED
A status handler may be registered for this error condition,
and should return a Boolean
indicating whether the program
should be re-launched with the default working directory.
public static final String ATTR_PROCESS_FACTORY_ID
public static final String ATTR_CAPTURE_OUTPUT
true
or false
. When unspecified, the default
value is considered true
.public static final String ATTR_LAUNCH_TIMESTAMP
Long.toString(long)
of System.currentTimeMillis()
.public static final String ATTR_CONSOLE_ENCODING
For release 3.3, the system encoding is used when unspecified. Since 3.4,
the inherited encoding is used when unspecified. See ILaunchManager
for a
description in getEncoding(ILaunchConfiguration)
.
Value of this constant is the same as the value of the old
IDebugUIConstants.ATTR_CONSOLE_ENCODING
constant for backward
compatibility.
public static final String PREF_DELETE_CONFIGS_ON_PROJECT_DELETE
org.eclipse.debug.core.PREF_DELETE_CONFIGS_ON_PROJECT_DELETE
) that controls
whether to delete associated configurations when a project is deleted. Default value is false
.public static final String ATTR_BREAKPOINT_IS_DELETED
"org.eclipse.debug.core.breakpointIsDeleted"
). The attribute is a
boolean
corresponding to the deleted state of a breakpoint.IMarker.getAttribute(String, boolean)
,
Constant Field Valuespublic static final String ATTR_ENVIRONMENT
IProcess
was runIProcess
,
Constant Field Valuespublic static final String ATTR_WORKING_DIRECTORY
IProcess
IProcess
,
Constant Field Valuespublic static final String ATTR_PATH
IProcess
IProcess
,
Constant Field Valuespublic DebugPlugin()
An instance of this plug-in runtime class is automatically created when the facilities provided by this plug-in are required. Clients must never explicitly instantiate a plug-in runtime class.
public static DebugPlugin getDefault()
public static String getUniqueIdentifier()
public void addDebugEventListener(IDebugEventSetListener listener)
listener
- the listener to addpublic void fireDebugEventSet(DebugEvent[] events)
events
- array of debug events to fireIDebugEventFilter
,
IDebugEventSetListener
public void asyncExec(Runnable r)
r
- runnable to execute asynchronouslypublic IBreakpointManager getBreakpointManager()
IBreakpointManager
public ILaunchManager getLaunchManager()
ILaunchManager
public IMemoryBlockManager getMemoryBlockManager()
IMemoryBlockManager
public IStatusHandler getStatusHandler(IStatus status)
null
if none.status
- status for which a status handler has been requestednull
if nonepublic IExpressionManager getExpressionManager()
IExpressionManager
public void removeDebugEventListener(IDebugEventSetListener listener)
listener
- the listener to removepublic void stop(BundleContext context) throws Exception
Plugin
This method should be re-implemented in subclasses that need to do something when the plug-in is shut down. Implementors should call the inherited method as late as possible to ensure that any system requirements can be met.
Plug-in shutdown code should be robust. In particular, this method should always make an effort to shut down the plug-in. Furthermore, the code should not assume that the plug-in was started successfully.
Note 1: If a plug-in has been automatically started, this method will be automatically invoked by the platform when the platform is shut down.
Note 2: This method is intended to perform simple termination of the plug-in environment. The platform may terminate invocations that do not complete in a timely fashion.
Note 3: The supplied bundle context represents the plug-in to the OSGi framework. For security reasons, it is strongly recommended that this object should not be divulged.
Note 4: This method and the Plugin.start(BundleContext)
may be called from separate threads,
but the OSGi framework ensures that both methods will not be called simultaneously.
stop
in interface BundleActivator
stop
in class Plugin
context
- the bundle context for this plug-inException
- if this method fails to shut down this plug-inpublic void start(BundleContext context) throws Exception
Plugin
This method should be overridden in subclasses that need to do something when this plug-in is started. Implementors should call the inherited method at the first possible point to ensure that any system requirements can be met.
If this method throws an exception, it is taken as an indication that plug-in initialization has failed; as a result, the plug-in will not be activated; moreover, the plug-in will be marked as disabled and ineligible for activation for the duration.
Note 1: This method is automatically invoked by the platform the first time any code in the plug-in is executed.
Note 2: This method is intended to perform simple initialization of the plug-in environment. The platform may terminate initializers that do not complete in a timely fashion.
Note 3: The class loader typically has monitors acquired during invocation of this method. It is strongly recommended that this method avoid synchronized blocks or other thread locking mechanisms, as this would lead to deadlock vulnerability.
Note 4: The supplied bundle context represents the plug-in to the OSGi framework. For security reasons, it is strongly recommended that this object should not be divulged.
Note 5: This method and the Plugin.stop(BundleContext)
may be called from separate threads,
but the OSGi framework ensures that both methods will not be called simultaneously.
start
in interface BundleActivator
start
in class Plugin
context
- the bundle context for this plug-inException
- if this plug-in did not start up properlypublic static IProcess newProcess(ILaunch launch, Process process, String label)
java.lang.Process
. A streams proxy is created
for the I/O streams in the system process. The process
is added to the given launch.
If the launch configuration associated with the given launch specifies a process factory, it will be used to instantiate the new process.
launch
- the launch the process is contained inprocess
- the system process to wraplabel
- the label assigned to the processIProcess
,
IProcessFactory
public static IProcess newProcess(ILaunch launch, Process process, String label, Map<String,String> attributes)
java.lang.Process
. A streams proxy is created
for the I/O streams in the system process. The process
is added to the given launch, and the process is initialized
with the given attribute map.
If the launch configuration associated with the given launch specifies a process factory, it will be used to instantiate the new process.
launch
- the launch the process is contained inprocess
- the system process to wraplabel
- the label assigned to the processattributes
- initial values for the attribute mapnull
can be returned if errors occur dealing with the process factory
designated to create the process.IProcess
,
IProcessFactory
public static ILogicalStructureType[] getLogicalStructureTypes(IValue value)
value
- the value for which logical structure types have been requestedpublic static ILogicalStructureType getDefaultStructureType(ILogicalStructureType[] types)
null
if none. When the given combination
of logical structure type is applicable for a value, the default logical structure
type is used to display a value.types
- a combination of structures applicable to a valuenull
if nonepublic static void setDefaultStructureType(ILogicalStructureType[] types, ILogicalStructureType def)
null
indicates there is no default logical structure
for the given combination of types.types
- a combination of logical structure types applicable to a valuedef
- the default logical structure among the given combination of types
or null
if nonepublic static Process exec(String[] cmdLine, File workingDirectory) throws CoreException
ERR_WORKING_DIRECTORY_NOT_SUPPORTED
is queried to see if the
exec should be re-executed without specifying a working directory.cmdLine
- the command lineworkingDirectory
- the working directory, or null
null
if the exec is
canceledCoreException
- if the exec failsRuntime
public static Process exec(String[] cmdLine, File workingDirectory, String[] envp) throws CoreException
ERR_WORKING_DIRECTORY_NOT_SUPPORTED
is queried to see if the
exec should be re-executed without specifying a working directory.cmdLine
- the command lineworkingDirectory
- the working directory, or null
envp
- the environment variables set in the process, or null
null
if the exec is
canceledCoreException
- if the exec failsRuntime
public void addDebugEventFilter(IDebugEventFilter filter)
filter
- debug event filterpublic void removeDebugEventFilter(IDebugEventFilter filter)
filter
- debug event filterpublic static void logDebugMessage(String message)
message
- the message to logpublic static void logMessage(String message, Throwable throwable)
null
if none.message
- the message to logthrowable
- the exception that occurred or null
if nonepublic static void log(IStatus status)
status
- status to logpublic static void log(Throwable t)
t
- throwable to logpublic static Document newDocument() throws CoreException
CoreException
- if unable to create a new documentpublic static String serializeDocument(Document document) throws CoreException
document
- XML document to serializeCoreException
- if unable to serialize the documentpublic static Element parseDocument(String document) throws CoreException
document
- XML document as a stringCoreException
- if unable to parse the documentpublic static String[] parseArguments(String args)
DebugPlugin.exec(String[], File)
. Embedded quotes and slashes
are escaped.args
- command line arguments as a single stringpublic static String renderArguments(String[] arguments, int[] segments)
If segments
is not null
, the array is filled
with the offsets of the start positions of arguments 1 to
arguments.length - 1
, as rendered in the resulting string.
arguments
- the command line argumentssegments
- an array of size arguments.length - 1
or
null
public static void setUseStepFilters(boolean useStepFilters)
useStepFilters
- whether step filters should be applied to step
commandsIStepFilters
public static boolean isUseStepFilters()
IStepFilters
,
IStepFiltersHandler
public static Object getAdapter(Object element, Class<?> type)
null
if none. The object itself is returned if it is an instance of the specified type.
If the object is adaptable and does not subclass PlatformObject
, and
does not provide the specified adapter directly, the platform's adapter manager
is consulted for an adapter.element
- element to retrieve adapter fortype
- adapter typenull
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.