Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 315501

Summary: [doc] update API documentation for ILaunchable
Product: [Eclipse Project] Platform Reporter: Angel Vera <arvera>
Component: DebugAssignee: Platform-Debug-Inbox <platform-debug-inbox>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: darin.eclipse, tjwatson
Version: 3.6   
Target Milestone: 3.7 M1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Angel Vera CLA 2010-06-02 17:31:55 EDT
I am on the fence with who owns this bugs.. so feel free to pass it to the PDE if you think is their bug. 

On implementing a adapter of type ILaunchable for a class I found that the ILauchable JavaDoc says: 

/**
 * Interface used to tag objects as launchable. Objects that provide
 * an adapter of this type will be considered by the contextual
 * launch support. 
 * <p>
 * Clients may contribute an adapter of this type for launchable objects
 * via the <code>org.eclipse.core.runtime.adapters</code> extension
 * point. A factory and implementation of this interface are not actually
 * required.
 * </p>
 * @see org.eclipse.debug.ui.actions.ContextualLaunchAction
 * @since 3.0
 */


It very clearly at the end says "A factory and implementation of this interface are not actually required."

... yet the attribute from the adapters extension point says that the attribute class is required. 

The reason why I say feel free to pass it to the PDE team is because this was not flag as an error during my development and therefore it broke during the build of our adopter product.
Comment 1 Angel Vera CLA 2010-06-02 17:32:25 EDT
Here is the url from HEAD of the schema of the adapters extension point. 
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.equinox/components/bundles/org.eclipse.equinox.registry/schema/adapters.exsd?root=RT_Project&view=markup
Comment 2 Thomas Watson CLA 2010-06-02 17:44:44 EDT
Moving to debug for comment.

I'm not sure I understand what the javadoc is stating.  To me it seems to indicate that this interface does not need to be implemented in order to contribute to the adapters extension point.  That part is true.  But to contribute to the adapters extension point you must define a class, I think the javadoc is just stating that that class does not need to implement ILaunchable.
Comment 3 Darin Wright CLA 2010-06-03 16:13:19 EDT
Debug uses the ILaunchable interface as a tag for objects that are launchable via the context launching support (clicking the run/debug toolbar buttons to launch the selection/active editor).

Debug checks if an ILaunchable adapter is available from the selection/active editor to determine if it should be considered for launching. However, the platform never actually retrieves the adapater or calls to any methods on it (the interface is, in fact, empty).

i.e. the debug platform does this test:

Platform.getAdapterManager().hasAdapter(X, ILaunchable.class.getName());

So objects register ILaunchable adatpers, but don't actually provide them. There is also no harm in implementing the interface or providing the adapter.

For example, JDT contribute launchable adapters like:

<extension point="org.eclipse.core.runtime.adapters">
     	 <factory 
            class="" 
            adaptableType="org.eclipse.jdt.core.IJavaElement">
            <adapter type="org.eclipse.debug.ui.actions.ILaunchable"/>
         </factory>
...


So no factory is actually provided, but the platform will answer true to #hasAdapter(...)
Comment 4 Angel Vera CLA 2010-06-04 14:24:43 EDT
(In reply to comment #3)
Darin, that is all good documentation that perhaps should be added to the javadoc or some sort of ILaunchable wiki FAQ.
Thanks for clarifying. 

Thomas, 
It sounds like technically it is possible and in somecases correct to provide a IAdapater extension point with no factory, could we then make the adapters extension point have the class as optional?
Comment 5 Darin Wright CLA 2010-07-21 17:01:19 EDT
Fixed. Updated Javadoc for ILaunchable.
Comment 6 Darin Wright CLA 2010-08-03 14:40:10 EDT
Verified.