Your plug-in can add launch configuration types to the platform using the org.eclipse.debug.core.launchConfigurationTypes extension point. This extension point allows you to declare a configuration type using a unique id. You must provide a corresponding implementation of ILaunchConfigurationDelegate in your plug-in. You can also specify which modes (run and/or debug) are supported by your launcher and a name that should be used when showing launchers of this type to the user.
The following markup shows how the Java tools declare a Java launch configuration for launching local Java programs:
<extension point = "org.eclipse.debug.core.launchConfigurationTypes"> <launchConfigurationType id="org.eclipse.jdt.launching.localJavaApplication" name="%localJavaApplication" delegate="org.eclipse.jdt.internal.launching.JavaLocalApplicationLaunchConfigurationDelegate" modes= "run, debug"> </launchConfigurationType> </extension>
For each type of launch configuration that supports debug mode, it is important to define a way to find the source code that corresponds with the current execution point in the code. ISourceLocator and IPersistableSourceLocator define an interface for mapping from an executing program back to the source code.
Source locators are typically implemented to work with a corresponding launch configuration and launch configuration delegate. Since launch configurations can be persisted, source locators may also be stored with the launch configuration. This is accomplished by setting an attribute of the launch configuration to an id of a source locator. When a launch configuration is read from disk, the id of the source locator must be mapped back to the implementation class. This is achieved using the org.eclipse.debug.core.sourceLocators extension point.
The extension point allows you to register your class that implements IPersistableSourceLocator and associate it with an id that will be stored with the launch configuration. This allows the debug plug-in to look up source locator classes by id when it's time to instantiate a launch configuration.
The following markup is from the Java tooling:
<extension point = "org.eclipse.debug.core.sourceLocators"> <sourceLocator id = "org.eclipse.jdt.debug.ui.javaSourceLocator" class="org.eclipse.jdt.debug.ui.JavaUISourceLocator" name="%javaSourceLocator"/> </extension>
Plug-ins use named attributes and values to store important data with a launch configuration. Since the interpretation of any attribute is not known by the platform, an extension point is provided that allows you to supply a comparator for a specific attribute. This comparator is used to determine whether attributes of the specified name are equal. In many cases, the simple string compare provided by java.lang.Object.equals(Object) is suitable for comparing attributes. This method will be used if no comparator has been provided. However, some attribute values may require special handling, such as stripping white space values from text before comparing for equality.
Comparators are contributed using the org.eclipse.debug.core.launchConfigurationComparators extension point.
The Java tools supply launch configuration comparators for comparing program source paths and class paths.
<extension point = "org.eclipse.debug.core.launchConfigurationComparators"> <launchConfigurationComparator id = "org.eclipse.jdt.launching.classpathComparator" class = "org.eclipse.jdt.internal.launching.RuntimeClasspathEntryListComparator" attribute = "org.eclipse.jdt.launching.CLASSPATH"/> <launchConfigurationComparator id = "org.eclipse.jdt.launching.sourcepathComparator" class = "org.eclipse.jdt.internal.launching.RuntimeClasspathEntryListComparator" attribute = "org.eclipse.jdt.launching.SOURCE_PATH"/> </extension>