Bug 449915 - [xtend] 3 nonsensical "Run As" menus are added to context menu for *all* files in package explorer
Summary: [xtend] 3 nonsensical "Run As" menus are added to context menu for *all* file...
Status: NEW
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.7.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-04 05:47 EST by Andrey Loskutov CLA
Modified: 2015-08-06 06:28 EDT (History)
3 users (show)

See Also:


Attachments
Example of "Run As" menu on .project file (80.60 KB, image/png)
2014-11-04 05:47 EST, Andrey Loskutov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Loskutov CLA 2014-11-04 05:47:34 EST
Created attachment 248352 [details]
Example of "Run As" menu on .project file

1 The org.eclipse.xtend.ide plugin contains launch shortcuts which provide the "Run As > Java Application" (and similar) menu entries for xtend/xbase files (in theory).
 
2 These contributions are properly guarded by enablement expressions which make them invisible for selections where they don't make sense.

3 However, when the org.eclipse.xtend.ide plugin is not started, these enablement expression evaluate to NOT_LOADED (because the adapt expression inside them returns NOT_LOADED) and org.eclipse.debug.ui optimistically adds them to the menu of *each* file in xtext based projects. 

4 As soon as the org.eclipse.xtend.ide plugin is started, the menu entries disappear, because now the adapt expression can be evaluated and returns false

As a result, *each and every* file in the xtext based project has now three extra context menus 
"Run As -> Java Application"
"Run As JUnit Plug-in Test"
"Run As JUnit Test"

This is at least confusing, and adds extra issues for "stupid" customers not really knowing what they can actually "Run".

I think playing around with the order of constraints and adding somewhere on xtend related contribution "forcePluginActivation=true" should fix the issue.
Comment 1 Sebastian Zarnekow CLA 2014-11-04 05:49:45 EST
The xtend.ide plugin is expensive to enable. That wouldn't an option, though we could factor the xml stuff into an own bundle.
Comment 2 Andrey Loskutov CLA 2014-11-04 08:08:39 EST
(In reply to Sebastian Zarnekow from comment #1)
> The xtend.ide plugin is expensive to enable. That wouldn't an option, though
> we could factor the xml stuff into an own bundle.

OK, I see. Just curious: why is there no file filter added? Isn't this intended to be used only for .xtend files?
Comment 3 Jan Koehnlein CLA 2014-11-04 08:10:38 EST
You could also create your own JVM language with Xbase and you'd get Run As... support automatically, if a main method is inferred.