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.
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.