Bug 54946 Contextual launch contribution should not set adaptable=true
The contextual launch contribution sets adaptable=true (see below). This means the selection is always converted to an IResource. This results in a loss of information, since then the enablement can only be expressed in terms of IResource and not in terms of the original type. For exampe, the JUnit contextual launch needs to support launching an individual IMethod. It should be up to the enablement expression to do the adaptation. <extension point="org.eclipse.ui.popupMenus"> <objectContribution objectClass="org.eclipse.core.resources.IResource" adaptable="true" id="org.eclipse.debug.ui.contextualLaunch"> <action label="%LaunchMenu.label" style="pulldown" class="org.eclipse.debug.internal.ui.actions.ContextualLaunchObjectActionDelega te" menubarPath="additions" enablesFor="1" id="org.eclipse.debug.ui.contextualLaunch.submenu"> </action> </objectContribution> </extension>
org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/JavaTypeExtender.java
private static final String IS_TEST= "isTest"; 
	/**
	 * @inheritDoc
	 */
	public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
		IType type= (IType)receiver;
		try {
			if (IS_TEST.equals(method)) 
				return TestSearchEngine.isTestOrTestSuite(type);
		} catch (JavaModelException e) {
			return false;
		}
		return false;
	}
}