Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 346794 - Inappropriate "Run As" options for Java class
Summary: Inappropriate "Run As" options for Java class
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: m2e (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-21 13:16 EDT by Wayne Beaton CLA
Modified: 2021-04-19 13:24 EDT (History)
2 users (show)

See Also:


Attachments
"Run As" menu showing Maven options. (14.77 KB, image/png)
2011-05-21 13:16 EDT, Wayne Beaton CLA
no flags Details
proposed fix (12.50 KB, patch)
2011-05-21 23:06 EDT, Igor Fedorenko CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wayne Beaton CLA 2011-05-21 13:16:52 EDT
Created attachment 196273 [details]
"Run As" menu showing Maven options.

The context menu in the Java Editor shows a bunch of Maven options under "Run As..." that don't make sense to me. These feel really out of place. Shouldn't they only be presented when a pom.xml file is selected? 

Steps to repeat:

1. Download "Eclipse IDE for Java Developers" Indigo, RC1 [1]. Install, and run with a new workspace.

2. Create a Java Project, and Java class.

3. Right click in the Java Editor, select "Run As >" or "Debug As >" or, highlight the class in the Package Explorer with similar results.

I'll post a screen shot.

[1] http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/RC1/eclipse-java-indigo-RC1-linux-gtk.tar.gz
Comment 1 Igor Fedorenko CLA 2011-05-21 21:45:06 EDT
This is a bug, m2e launch actions should only be enabled for pom.xml files and their immediate IContainers.

and I swear I tested this exact scenario and did not have these menu items. but now they are there. a mystery.
Comment 2 Igor Fedorenko CLA 2011-05-21 23:06:20 EDT
Created attachment 196284 [details]
proposed fix

The problem only happens when m2e was not activated and this is why I missed it in my tests. Attached patch changes Maven launch shortcut enablement to behave correctly regardless of m2e bundles activation state. See patch comment for more details about the problem and the solution.


Also opened follow-up bug 346803 to review other possible cases where enablement may behave unexpectedly when m2e bundles are not active.
Comment 3 Snjezana Peco CLA 2011-05-22 11:15:28 EDT
You could solve that problem using the forcePluginActivation argument.
For instance:
...
<test property="org.eclipse.m2e.launchable" forcePluginActivation="true"/>
...

See https://bugs.eclipse.org/bugs/show_bug.cgi?id=130338
Comment 4 Igor Fedorenko CLA 2011-05-22 11:43:27 EDT
No. This would force pretty much unconditional eager activation of m2e.core.ui and possibly m2e.core bundles. We don't want that.
Comment 6 Denis Roy CLA 2021-04-19 13:24:05 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/