running as perl

cdenney wrote on Tue Jun 24 20:33:45 MEST 2008:
Ok, I've only recently started using eclipse/epic (3.3.2 / 0.5.46) and have
a small irritation, wondering if I've done something wrong or what.
I can create a perl project tinker with it run it debug it etc. seems to
work fine.
Until I exit.
When I relaunch eclipse ever time I run or debug my perl project it insists
on popping up a window asking what I want to run the project as.
So I'm wondering if I hit a bug, or forgot to set something up right, or
I've created several different projects as tests, they all do it, and I
can't seem to find a way of fixing it. :(
(using active state perl if that matters)
jploski wrote on Tue Jun 24 20:50:55 MEST 2008:
There's an annoying default setting introduced in Eclipse 3.3 (used to be
good in 3.2) which may be related with your problem. In "Preferences"/"Run/Debug"/"Launching"
set "Always launch the previously launched application" and see if it makes
things work better.
cdenney wrote on Tue Jun 24 20:56:47 MEST 2008:
Ah yes, annoying is a reasonable word for that.
Still doesn't explain why it behaves differently between when the project
is created and when it's loaded later, but cures my current irritation.

 Thanks, that worked.
secretcode wrote on Tue Jul  1 22:35:16 MEST 2008:
I'm not sure if this is related, but it's similar so I'm joining this thread...

Whenever I open Eclipse, with a saved Perl perspective, the Run as... menu
includes a number of Java options (usually JUnit plugin test / JUnit test,
sometimes also Java Applet / Java Application.

If I switch to the Java perspective and back to Perl, this is cleared up
- the run menu only shows 'Perl local'.

Am I missing something or is Eclipse confused?

(Setting "Always launch the previously launched application" does not resolve
this, and in any case, I much prefer to launch the currently open resource.)

Eclipse 3.3.1, EPIC 0.6.24, on Windows
jploski wrote on Mon Aug  4 20:45:53 MEST 2008:
In the case you described Eclipse is indeed getting "confused".

When the "Run As" menu is about to be displayed, all different plugins are
queried for possible menu item contributions. Whether or not a menu item
("launch shortcut") is added depends on a so called enablement expression,
which is defined by each potential contributor plugin. In particular, the
enablement expression might check whether the selected element can be adapted
to an expected type, such as IJavaElement. However, for this check to be
executable at all, the contributor plugin (the JDT debug UI plugin in your
case) must have been loaded previously. As a matter of policy, Eclipse tries
to delay loading plugins as long as possible. When the plugin has not been
loaded yet when its launch shortcuts are examined, their enablement expression
will evaluate to NOT_LOADED (rather than FALSE).

The documentation of class org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutExtension,
method evalEnablementExpression(IEvaluationContext, Expression) tells us
that this method serves to

"Evaluate the given expression within the given context and return the result.
Returns true iff result is either TRUE or NOT_LOADED. This
allows optimistic inclusion of shortcuts before plugins are loaded."

What you are experiencing is just this "optimistic inclusion of shortcuts"
and I'm afraid there's nothing you can do short of hacking your Eclipse.
secretcode wrote on Mon Aug  4 21:47:16 MEST 2008:
Thanks for detail Jan! 

If I wanted to do some hacking - not in a distributable plugin, but just
in my own installation of Eclipse, where would I begin looking for the settings
and calls that affect this? There is a more serious issue with the PHP plugin
"PDT" which I'd like to resolve (in case I do not get any joy from the people
at PDT).

I've tried searching for the text "launchShortcut" and such line in the
eclipse directory files, but nothing seems applicable.
jploski wrote on Mon Aug  4 22:01:02 MEST 2008:
If your goal is to keep JDT (or some other plugin) from contributing its
launch shortcuts to your files, I think that your best bet would be to modify
the enablement expression of the contributor plugin to make it more restrictive
(e.g. explicitly evaluate to false on '*.pl' files). I think this sort of
name-based or property-based expression can be evaluated without having
to load code from the contributor plugin. Read more about enablement expressions
in the reference documentation of the "org.eclipse.debug.ui.launchShortcuts"
extension point (in Eclipse's online help). To keep "Run As Java" from being
added, you'd need to hack plugin.xml of the org.eclipse.jdt.debug.ui plugin,
which contains by default:

secretcode wrote on Mon Aug  4 18:08:33 MEST 2008:
Is there any response regarding the "Run as" menu showing Java Application,
etc? Does anyone else see this?

I have not learnt enough about how Eclipse manages this menu to resolve
the question myself.
alexfrancis wrote on Wed Sep  3 19:31:09 MEST 2008:
(Might be irrelevant, but)

You can set up a keyboard shortcut (Window -> Preferences -> General ->
Keys) for "Run Last Launched External Tool". I have it set to ctrl-shift-F11
(not sure if I chose this or it was a default). Saves having to click the
one you want.

(I'm on eclipse 3.3.2, epic 0.6.24)

Note: The above is an archived snapshot of a forum thread. Use the original thread at to post comments.