Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-debug-dev] Changes to contextual launch

Those that are interested in contextual launching, read on....

We discovered some limitations with our current implementation of 
contextual launching (see 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=54946).

* Launching is limited to IResources, since our contextual launch action 
is an object contribution for an IResource. This means that other elements 
such as methods, which do not have an IResource adapter, can not be 
launched directly.
* Having one contextual launch action, "Run", for all launch modes is 
awkward/unfriendly. It would be more desirable to have seperate context 
actions for Run, Debug, Profile, etc.

To address these limitations we have experimented with the following 
approach, which we intend to release to HEAD shortly.

* A context launch action is contributed for each launch mode, as an 
object contribution for IAdaptable, and a property tester is used
to ensure that the context action is only enabled if the each selected 
element adapts to an ILaunchable
* ILaunchable is a new interface that is simply used to tag objects as 
capable of being launching - there are no methods in the new interface, so 
it is safe for more than one client to contribute an ILaunchable adapter 
for an object
* Clients need to contribute ILaunchable adapters for their launchable 
objects via the org.eclipse.core.runtime.adpaters extension point
* The rest works the same, except property testers for launch shortcuts 
are passed the (raw) selected objects, rather than IResources

Since a context action is present for each mode, mode specific labels 
generally do not need to be used, but are still supported. When a mode 
specific label is not specified, the shortcut's label is used. For 
example, the menu used to look like this for Java applications.

        Run     >       Debug Java Application 
                        Run Java Application

And the two menus now look like this

        Run     >       Java Application
        Debug   >       Java Application 

As launch modes are extensible, a context action must be contributed for 
each launch mode. The debug platform contributes context launch actions 
for Run/Debug/Profile. The actions only appear if at least one launch 
config supports a mode (so, Profile does not appear in the SDK by 
default). We will provide a class that can be subclassed for other launch 
modes requiring contextual launching.

Please let us know if there are any concerns.

Darin


Back to the top