Community
Participate
Working Groups
Build Identifier: 20100917-0705 i got a little plain java project with a main method. hitting Run->Run does not simply run my project, but pops open a dialog asking to "Run on Server" or "Java Application". the project has no connections to a server whatsoever, hence i completely fail to understand why such an entry appears. after hitting "ok" for "Run on Server" quite rightly a message pops up, saying "The selection did not contain any resources that can run on a server" or something to that effect (as usual it is impossible to simply copy the message, after many years of using eclipse i still do not understand what harebrained rationale is behind that). it should be easy for eclipse to recognizes that beforehand. i have WST installed, not sure if WST simply grabs everithing it can get or if JDT/Platform simply puts everything into the list that is capable to do something ... Reproducible: Always Steps to Reproduce: 1. create a plain java project with a main method 2. hit Run->Run (or the matching shortcut) 3. watch a meaningless question dialog pop up
WST team, please have a look at your contribution to the org.eclipse.debug.ui.launchShortcuts extension point. org.eclipse.jdt.junit is in a similar situation, and we solved it using the following enablement expression: <contextualLaunch> <enablement> <with variable="selection"> <count value="1"/> <iterate> <adapt type="org.eclipse.jdt.core.IJavaElement"> <test property="org.eclipse.jdt.core.isInJavaProject"/> <test property="org.eclipse.jdt.core.hasTypeOnClasspath" value="junit.framework.Test"/> <test property="org.eclipse.jdt.junit.canLaunchAsJUnit" forcePluginActivation="true"/> </adapt> </iterate> </with> </enablement> </contextualLaunch> The custom property "canLaunchAsJUnit" forces plug-in activation, that's why we only test it at the end.
I opened bug 34351 with an alternate approach to preventing the launch shortcut appearing everywhere. You could use the newly available variable from platform debug from bug 338576: <enablement> <with variable="selection"> <count value="1"/> <iterate> <and> <test property="org.eclipse.wst.server.ui.isRunnable" value="true"/> <with variable="org.eclipse.core.runtime.Platform"> <test args="org.eclipse.wst.server.ui" property="org.eclipse.core.runtime.bundleState" value="ACTIVE"> </test> </with> </and> </iterate> </with> </enablement>
I meant bug 343751
Bug 343751 talks about pretty much the same problem