问题
I'm currently trying to get the red part of the "RunConfigurations..." window, (see img 1.1) into an TitleAreaDialog (see img 1.2). The final result should look like this: (see img 1.3)
img 1.1 img 1.2
img 1.3
With the plugin "Spy" I found some useful information: The "Run Configurations..." window (img 1.1) is created in the class: "LaunchConfigurationsDialog" which has a "LaunchConfigurationView" as an attribute (note: this attribute is a class). Within this private attribute you find a "LaunchConfigurationFilteredTree" attribute (note: yet another class).
I think, that this last attribute is what I'm looking for. But I can't figure out which methods I have to override to be able to show this FilteredTreeList with all Launch Configurations in my CustomTitleAreaDialog.
Thanks in advance for your help!
回答1:
All the classes you have found are in internal packages and are therefore not part of the Eclipse API (see Eclipse API Rules of Engagement). These classes may be changed at any time breaking your plug-in.
The core of the view does use official APIs.
First it gets the ILaunchManager
:
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
The root elements of the tree are the ILaunchConfigurationType
entries:
ILaunchConfigurationType [] allTypes = manager.getLaunchConfigurationTypes();
The children of ILaunchConfigurationType
are the actual ILaunchConfiguration
launch configuration objects:
ILaunchConfiguration [] configs = manager.getLaunchConfigurations(configType);
If you build a TreeViewer
using these methods you will be OK.
来源:https://stackoverflow.com/questions/39052708/eclipse-plugin-get-launch-configurations-tree-list-in-a-dialog