Package org.eclipse.debug.core.model
Class LaunchConfigurationDelegate
java.lang.Object
org.eclipse.debug.core.model.LaunchConfigurationDelegate
- All Implemented Interfaces:
ILaunchConfigurationDelegate,ILaunchConfigurationDelegate2
public abstract class LaunchConfigurationDelegate
extends Object
implements ILaunchConfigurationDelegate2
Default implementation of a launch configuration delegate. Provides
convenience methods for computing the build order of projects,
building projects, and searching for errors in the workspace. The
default pre-launch check prompts the user to launch in debug mode
if breakpoints are present in the workspace.
Clients implementing launch configuration delegates should subclass this class.
- Since:
- 3.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final IStatusStatus 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 final IStatusStatus code for which a prompter is registered to ask the user if the want to continue launch despite existing compile errorsprotected static final IStatusStatus code for which a UI prompter is registered.protected static final IStatusStatus 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 final IStatusStatus code for which a prompter is registered to ask the user if they want to launch in debug mode when breakpoints are present. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddReferencedProjects(IProject project, Set<IProject> references) Adds all projects referenced byprojectto the given set.booleanbuildForLaunch(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 voidbuildProjects(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 bybaseProjectsand all of their referenced projects.protected booleanexistsProblems(IProject proj) Returns whether the given project contains any problem markers of the specified severity.booleanfinalLaunchCheck(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 ornullif the entire workspace should be built incrementally.getLaunch(ILaunchConfiguration configuration, String mode) Returns a launch object to use when launching the given launch configuration in the given mode, ornullif 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 ornullif no search is to be done.protected booleanisLaunchProblem(IMarker problemMarker) Returns whether the given problem should potentially abort the launch.booleanpreLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) Returns whether a launch should proceed.protected booleansaveBeforeLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) Performs the scoped saving of resources before launching and returns whether the launch should continue.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.debug.core.model.ILaunchConfigurationDelegate
launch, showCommandLine
-
Field Details
-
promptStatus
Status code for which a UI prompter is registered. -
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. -
complileErrorPromptStatus
Status code for which a prompter is registered to ask the user if the want to continue launch despite existing compile errors -
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)- Since:
- 3.2
-
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. This enhances the 'compileErrorPromptStatus' by specifying which projects the errors exist in.- Since:
- 3.1
-
-
Constructor Details
-
LaunchConfigurationDelegate
public LaunchConfigurationDelegate()
-
-
Method Details
-
getLaunch
Description copied from interface:ILaunchConfigurationDelegate2Returns a launch object to use when launching the given launch configuration in the given mode, ornullif 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.- Specified by:
getLaunchin interfaceILaunchConfigurationDelegate2- Parameters:
configuration- the configuration being launchedmode- the mode the configuration is being launched in- Returns:
- a launch object or
null - Throws:
CoreException- if unable to launch
-
buildForLaunch
public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException Description copied from interface:ILaunchConfigurationDelegate2Optionally 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. Iffalseis returned the launch will proceed without further building, and iftrueis 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).- Specified by:
buildForLaunchin interfaceILaunchConfigurationDelegate2- Parameters:
configuration- the configuration being launchedmode- the mode the configuration is being launched inmonitor- progress monitor, ornull. 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.- Returns:
- whether the debug platform should perform an incremental workspace build before the launch
- Throws:
CoreException- if an exception occurs while building
-
getBuildOrder
protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException Returns the projects to build before launching the given launch configuration ornullif the entire workspace should be built incrementally. Subclasses should override as required.- Parameters:
configuration- the configuration being launchedmode- launch mode- Returns:
- projects to build, in build order, or
null - Throws:
CoreException- if an exception occurs
-
getProjectsForProblemSearch
protected IProject[] getProjectsForProblemSearch(ILaunchConfiguration configuration, String mode) throws CoreException Returns the set of projects to use when searching for errors ornullif no search is to be done.- Parameters:
configuration- the configuration being launchedmode- launch mode- Returns:
- a list of projects or
null - Throws:
CoreException- if an exception occurs
-
finalLaunchCheck
public boolean finalLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException Description copied from interface:ILaunchConfigurationDelegate2Returns whether a launch should proceed. This method is called afterpreLaunchCheck()andbuildForLaunch()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.- Specified by:
finalLaunchCheckin interfaceILaunchConfigurationDelegate2- Parameters:
configuration- the configuration being launchedmode- launch modemonitor- progress monitor, ornull. 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.- Returns:
- whether the launch should proceed
- Throws:
CoreException- if an exception occurs during final checks
-
preLaunchCheck
public boolean preLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException Description copied from interface:ILaunchConfigurationDelegate2Returns whether a launch should proceed. This method is called first in the launch sequence providing an opportunity for this launch delegate to abort the launch.- Specified by:
preLaunchCheckin interfaceILaunchConfigurationDelegate2- Parameters:
configuration- configuration being launchedmode- launch modemonitor- progress monitor, ornull. 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.- Returns:
- whether the launch should proceed
- Throws:
CoreException- if an exception occurs while performing pre-launch checks
-
saveBeforeLaunch
protected boolean saveBeforeLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException Performs the scoped saving of resources before launching and returns whether the launch should continue. By default, only resources contained within the projects which are part of the build scope are considered.Subclasses may override this method if required.
- Parameters:
configuration- the configuration being launchedmode- the launch modemonitor- progress monitor- Returns:
- whether the launch should continue
- Throws:
CoreException- if an exception occurs during the save- Since:
- 3.2
-
getBreakpoints
Returns the breakpoint collection that is relevant for this launch delegate. By default this is all the breakpoints registered with the Debug breakpoint manager.- Parameters:
configuration- the configuration to get associated breakpoints for- Returns:
- the breakpoints that are relevant for this launch delegate
- Since:
- 3.1
-
computeReferencedBuildOrder
Returns an array of projects in their suggested build order containing all of the projects specified bybaseProjectsand all of their referenced projects.- Parameters:
baseProjects- a collection of projects- Returns:
- an array of projects in their suggested build order
containing all of the projects specified by
baseProjects - Throws:
CoreException- if an error occurs while computing referenced projects
-
addReferencedProjects
protected void addReferencedProjects(IProject project, Set<IProject> references) throws CoreException Adds all projects referenced byprojectto the given set.- Parameters:
project- projectreferences- set to which referenced projects are added- Throws:
CoreException- if an error occurs while computing referenced projects
-
computeBuildOrder
Returns a list of projects in their suggested build order from the given unordered list of projects.- Parameters:
projects- the list of projects to sort into build order- Returns:
- a new array containing all projects from
projectssorted according to their build order.
-
existsProblems
Returns whether the given project contains any problem markers of the specified severity.- Parameters:
proj- the project to search- Returns:
- whether the given project contains any problems that should stop it from launching
- Throws:
CoreException- if an error occurs while searching for problem markers
-
isLaunchProblem
Returns whether the given problem should potentially abort the launch. By default if the problem has an error severity, the problem is considered a potential launch problem. Subclasses may override to specialize error detection.- Parameters:
problemMarker- candidate problem- Returns:
- whether the given problem should potentially abort the launch
- Throws:
CoreException- if any exceptions occur while accessing marker attributes
-
buildProjects
Performs an incremental build on each of the given projects.- Parameters:
projects- projects to buildmonitor- progress monitor- Throws:
CoreException- if an exception occurs while building
-