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

Bug 318409

Summary: Run as context menu vanishes in project explorer
Product: [Eclipse Project] Platform Reporter: Christian Pontesegger <christian.pontesegger>
Component: DebugAssignee: Platform-Debug-Inbox <platform-debug-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: darin.eclipse
Version: 3.4.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Christian Pontesegger CLA 2010-06-30 01:36:16 EDT
Build Identifier: I20100608-0911

This is a reopening of bug 261545.

Now switching to Helios brought back this one for me.

Immediately after starting my RCP I can access the context menus "run as", "debug as", and "profile as". At this time org.eclipse.debug.core has its status set to LAZY.

After running my launch shortcut for the first time (or simply starting org.eclipse.debug.core via the OSGI console) the launch context menu entries disappear.

I see that the debug framework needs sn adapter for ILaunchable, so I added this as described in Bug 191586. I was crosschecking for this adapter with

final IFile file = ResourcesPlugin.getWorkspace().getRoot().getProject(..).getFile(...);
final boolean hasProperty = Platform.getAdapterManager().hasAdapter(file,					"org.eclipse.debug.ui.actions.ILaunchable");

which resolves to true.

Stopping org.eclipse.debug.core bundle makes the context menu entries reappear.

Bug 261545 seemed to work for me. When switching to Helios I did some cleanup of my bundle dependencies. Maybe some other eclipse bundle (which I am missing now) fixes this issue?

Reproducible: Always
Comment 1 Christian Pontesegger CLA 2010-06-30 02:29:12 EDT
Found the solution for myself:

LaunchablePropertyTester failed at
if (((LaunchManager)(DebugPlugin.getDefault().getLaunchManager())).launchModeAvailable((String)expectedValue))

This happened because I only had a LaunchShortcut registered. The check above needs at least 1 launchConfigurationType for the specific mode (run, debug profile) where we want to see the context menu entry.

So adding a launchConfigurationType fixes this issue.

Maybe something for the documentation?
Comment 2 Darin Wright CLA 2010-06-30 12:13:23 EDT
(In reply to comment #1)
> Found the solution for myself:
> LaunchablePropertyTester failed at
> if
> (((LaunchManager)(DebugPlugin.getDefault().getLaunchManager())).launchModeAvailable((String)expectedValue))
> This happened because I only had a LaunchShortcut registered. The check above
> needs at least 1 launchConfigurationType for the specific mode (run, debug
> profile) where we want to see the context menu entry.
> So adding a launchConfigurationType fixes this issue.
> Maybe something for the documentation?

In this case it looks like there were no launch configuration types at all... i.e. nothing to support the launch mode.

This sounds rare... usually a launch shortcut and a launch configuration type go together. What is the use case where you would have a launch shortcut, but not launch configuration types?
Comment 3 Christian Pontesegger CLA 2010-06-30 15:45:04 EDT
(In reply to comment #2)
> In this case it looks like there were no launch configuration types at all...
> i.e. nothing to support the launch mode.

Correct. There were no launch configurations provided by my plugins and obviously no framework bundle providing one.

> What is the use case where you would have a launch shortcut, but
> not launch configuration types?

I was playing around with Rhino.Therefore II added a launch shortcut for JavaScript files. Thats all.

I agree, might be a rare use case. Still I ran into it and maybe others will too. Now it's documented here, maybe it should go to launch shortcut documentation too - thats up to you :)
Comment 4 Darin Wright CLA 2010-06-30 15:58:01 EDT
Marking as works for me for now. If there are no launch configration types contributed, there is nothing to launch (from the debug platform's perspective), and thus the actions should not appear.

However, I did add the folllowing text to the extension point doc:

"No launch shortcuts are provided by the platform. Note that although launch shortcuts do not have to be associated with a specific launch configuration type, launch shortcut menus will not appear unless there is at least one launch configuration type that supports a shortcut's launch mode(s)."