简体   繁体   中英

Eclipse plugin: How to specify what launch configurations appear in a project's properties?

I have an Eclipse plugin with a launch delegate, a launch shortcut (which has enablement set to appear when a project has a certain nature), and a launch configuration tab group. They all work just as I want them to, except for one fact. When you go into a project's properties, in "Run/Debug Settings", there's a list of configurations that could apply to this project. The problem is, when it's of my project nature, the list it shows consists of ALL the configurations of my type.

My launch configurations specify what project they apply to, by storing it in a custom attribute, but there's no way for Eclipse to know this, which begs the question: How do you filter what configurations appear in "Run/Debug Settings"? The Eclipse documentation is seemingly silent on this topic.

With major thanks to greg-449, I have a solution. The problem was that the launch configuration needed to define a resource mapping. Every launch configuration has a list of resources that "belong" to the configuration, and the "Run/Debug Settings" menu only shows launch configurations that have that resource as a mapping. If there is no mapping in the launch configuration, it is assumed to be applicable to all resources.

In my custom ILaunchConfigurationTabGroup , I failed to add any resource mappings based on the project. All it took was the addition of this line to performApply :

configuration.setMappedResources(new IResource[] {project});

Where project is whatever resources you want the launch config to appear in.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM