Eclipse Plugin - get Launch Configurations Tree Li

2019-07-26 19:59发布

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.1 Run Configurations window img 1.2

img 1.2 Title Area Dialog

img 1.3

img 1.3 final result

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条回答
疯言疯语
2楼-- · 2019-07-26 21:02

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.

查看更多
登录 后发表回答