public abstract class LaunchConfigurationDelegate extends Object implements ILaunchConfigurationDelegate2
Clients implementing launch configuration delegates should subclass this class.
Modifier and Type | Field and Description |
---|---|
protected static IStatus |
complileErrorProjectPromptStatus
Status code for which a prompter is registered to ask the user if the
want to continue launch despite existing compile errors in specific
projects.
|
protected static IStatus |
complileErrorPromptStatus
Status code for which a prompter is registered to ask the user if the
want to continue launch despite existing compile errors
|
protected static IStatus |
promptStatus
Status code for which a UI prompter is registered.
|
protected static IStatus |
saveScopedDirtyEditors
Status code for which a prompter will ask the user to save any/all of the dirty editors which have only to do
with this launch (scoping them to the current launch/build)
|
protected static IStatus |
switchToDebugPromptStatus
Status code for which a prompter is registered to ask the user if they
want to launch in debug mode when breakpoints are present.
|
Constructor and Description |
---|
LaunchConfigurationDelegate() |
Modifier and Type | Method and Description |
---|---|
protected void |
addReferencedProjects(IProject project,
Set<IProject> references)
Adds all projects referenced by
project to the given
set. |
boolean |
buildForLaunch(ILaunchConfiguration configuration,
String mode,
IProgressMonitor monitor)
Optionally performs any required building before launching the given
configuration in the specified mode, and returns whether the debug platform
should perform an incremental workspace build before the launch continues.
|
protected void |
buildProjects(IProject[] projects,
IProgressMonitor monitor)
Performs an incremental build on each of the given projects.
|
protected IProject[] |
computeBuildOrder(IProject[] projects)
Returns a list of projects in their suggested build order from the
given unordered list of projects.
|
protected IProject[] |
computeReferencedBuildOrder(IProject[] baseProjects)
Returns an array of projects in their suggested build order
containing all of the projects specified by
baseProjects
and all of their referenced projects. |
protected boolean |
existsProblems(IProject proj)
Returns whether the given project contains any problem markers of the
specified severity.
|
boolean |
finalLaunchCheck(ILaunchConfiguration configuration,
String mode,
IProgressMonitor monitor)
Returns whether a launch should proceed.
|
protected IBreakpoint[] |
getBreakpoints(ILaunchConfiguration configuration)
Returns the breakpoint collection that is relevant for this launch delegate.
|
protected IProject[] |
getBuildOrder(ILaunchConfiguration configuration,
String mode)
Returns the projects to build before launching the given launch configuration
or
null if the entire workspace should be built incrementally. |
ILaunch |
getLaunch(ILaunchConfiguration configuration,
String mode)
Returns a launch object to use when launching the given launch
configuration in the given mode, or
null if a new default
launch object should be created by the debug platform. |
protected IProject[] |
getProjectsForProblemSearch(ILaunchConfiguration configuration,
String mode)
Returns the set of projects to use when searching for errors or
null
if no search is to be done. |
protected boolean |
isLaunchProblem(IMarker problemMarker)
Returns whether the given problem should potentially abort the launch.
|
boolean |
preLaunchCheck(ILaunchConfiguration configuration,
String mode,
IProgressMonitor monitor)
Returns whether a launch should proceed.
|
protected boolean |
saveBeforeLaunch(ILaunchConfiguration configuration,
String mode,
IProgressMonitor monitor)
Performs the scoped saving of resources before launching and returns whether
the launch should continue.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
launch
protected static final IStatus promptStatus
protected static final IStatus switchToDebugPromptStatus
protected static final IStatus complileErrorPromptStatus
protected static final IStatus saveScopedDirtyEditors
protected static final IStatus complileErrorProjectPromptStatus
public ILaunch getLaunch(ILaunchConfiguration configuration, String mode) throws CoreException
ILaunchConfigurationDelegate2
null
if a new default
launch object should be created by the debug platform. If a launch object
is returned, its launch mode must match that of the mode specified in
this method call.getLaunch
in interface ILaunchConfigurationDelegate2
configuration
- the configuration being launchedmode
- the mode the configuration is being launched innull
CoreException
- if unable to launchpublic boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException
ILaunchConfigurationDelegate2
false
is returned the launch will proceed without further
building, and if true
is returned an incremental build will
be performed on the workspace before launching.
This method is only called if the launch is invoked with flag indicating
building should take place before the launch. This is done via the
method
ILaunchConfiguration.launch(String mode, IProgressMonitor monitor, boolean build)
.
buildForLaunch
in interface ILaunchConfigurationDelegate2
configuration
- the configuration being launchedmode
- the mode the configuration is being launched inmonitor
- progress monitor, or null
. A cancelable progress monitor is provided by the Job
framework. It should be noted that the setCanceled(boolean) method should never be called on the provided
monitor or the monitor passed to any delegates from this method; due to a limitation in the progress monitor
framework using the setCanceled method can cause entire workspace batch jobs to be canceled, as the canceled flag
is propagated up the top-level parent monitor. The provided monitor is not guaranteed to have been started.CoreException
- if an exception occurs while buildingprotected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException
null
if the entire workspace should be built incrementally.
Subclasses should override as required.configuration
- the configuration being launchedmode
- launch modenull
CoreException
- if an exception occursprotected IProject[] getProjectsForProblemSearch(ILaunchConfiguration configuration, String mode) throws CoreException
null
if no search is to be done.configuration
- the configuration being launchedmode
- launch modenull
CoreException
- if an exception occurspublic boolean finalLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException
ILaunchConfigurationDelegate2
preLaunchCheck()
and buildForLaunch()
providing
a final chance for this launch delegate to abort a launch if required.
For example, a delegate could cancel a launch if it discovered compilation
errors that would prevent the launch from succeeding.finalLaunchCheck
in interface ILaunchConfigurationDelegate2
configuration
- the configuration being launchedmode
- launch modemonitor
- progress monitor, or null
. A cancelable progress monitor is provided by the Job
framework. It should be noted that the setCanceled(boolean) method should never be called on the provided
monitor or the monitor passed to any delegates from this method; due to a limitation in the progress monitor
framework using the setCanceled method can cause entire workspace batch jobs to be canceled, as the canceled flag
is propagated up the top-level parent monitor. The provided monitor is not guaranteed to have been started.CoreException
- if an exception occurs during final checkspublic boolean preLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException
ILaunchConfigurationDelegate2
preLaunchCheck
in interface ILaunchConfigurationDelegate2
configuration
- configuration being launchedmode
- launch modemonitor
- progress monitor, or null
. A cancelable progress monitor is provided by the Job
framework. It should be noted that the setCanceled(boolean) method should never be called on the provided
monitor or the monitor passed to any delegates from this method; due to a limitation in the progress monitor
framework using the setCanceled method can cause entire workspace batch jobs to be canceled, as the canceled flag
is propagated up the top-level parent monitor. The provided monitor is not guaranteed to have been started.CoreException
- if an exception occurs while performing pre-launch checksprotected boolean saveBeforeLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException
Subclasses may override this method if required.
configuration
- the configuration being launchedmode
- the launch modemonitor
- progress monitorCoreException
- if an exception occurs during the saveprotected IBreakpoint[] getBreakpoints(ILaunchConfiguration configuration)
configuration
- the configuration to get associated breakpoints forprotected IProject[] computeReferencedBuildOrder(IProject[] baseProjects) throws CoreException
baseProjects
and all of their referenced projects.baseProjects
- a collection of projectsbaseProjects
CoreException
- if an error occurs while computing referenced
projectsprotected void addReferencedProjects(IProject project, Set<IProject> references) throws CoreException
project
to the given
set.project
- projectreferences
- set to which referenced projects are addedCoreException
- if an error occurs while computing referenced
projectsprotected IProject[] computeBuildOrder(IProject[] projects)
projects
- the list of projects to sort into build orderprojects
sorted
according to their build order.protected boolean existsProblems(IProject proj) throws CoreException
proj
- the project to searchCoreException
- if an error occurs while searching for
problem markersprotected boolean isLaunchProblem(IMarker problemMarker) throws CoreException
problemMarker
- candidate problemCoreException
- if any exceptions occur while accessing marker attributesprotected void buildProjects(IProject[] projects, IProgressMonitor monitor) throws CoreException
projects
- projects to buildmonitor
- progress monitorCoreException
- if an exception occurs while building
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.