1

I'm writting a custom launcher in my eclipse plugin. The purpose is to display options via the "Run As" and "Debug As" menu on the toolbar.

According to the answer from How do I use "org.eclipse.debug.ui.launchShortcuts"? , I can add static options in "Run As" and "Debug As" menu.

How can I add dynamic options in theses menus. For example , according to the number of runtime server displayed in the server view , I know to display some options or not in the "Run As" and "Debug As" menu.

Community
  • 1
  • 1
bwnyasse
  • 591
  • 1
  • 10
  • 15
  • Before getting downvoted more for being helpful... :-P OP: Can you please specifiy what you mean by "add dynamic options to the Launch Menu ? What information does your user need to see in the Launch Menu beside the type of config which can be launched? –  Sep 30 '15 at 14:17
  • I need to earn a total of 15 reputation to downvote :) . I'm not the one who downvoted ur answer. My user need to see the list of available server into the launch Menu . I can't write a launchShortcut for each available server. The purpose is to automatically discover the list of available server and populate it in the launch Menu – bwnyasse Oct 01 '15 at 14:05
  • But you have implemented a custom launcher, which can handle to run/debug your servers, right? –  Oct 02 '15 at 06:35
  • Yes I've implemented a custom launcher to do it. But we've changed our strategy to provide a dynamic options because it's not possible with "org.eclipse.debug.ui.launchShortcuts". As we are abled to auto discover the list of available server , we've created a preference page where the user can specific the default server to use for our custom launcher. So we don't need to display a dynamic options via "Run/Debug As" – bwnyasse Oct 02 '15 at 13:31

1 Answers1

1

The enablement configuration of your launch shortcut extension point declaration can be any valid Eclipse core expression. That also allows you to use property testers, which are basically callbacks into your code to answer whether the launch config is enabled or not.

You can see an example implementation in How to check if project contains specific file for launch shortcuts, which you can modify to answer the property test depending on your available servers.

Community
  • 1
  • 1
Bananeweizen
  • 21,797
  • 8
  • 68
  • 88