Eclipse 插件 - 在对话框中获取启动配置树列表。

Eclipse Plugin - get Launch Configurations Tree List in a Dialog.

我目前正在尝试获取 "RunConfigurations..." window 的红色部分,(参见 img 1.1) 进入 TitleAreaDialog(参见 img 1.2)。 最终结果应如下所示:(参见 img 1.3)

img 1.1 img 1.2

img 1.3

通过插件 "Spy" 我找到了一些有用的信息: "Run Configurations..." window (img 1.1) 是在 class: "LaunchConfigurationsDialog" 中创建的,它有一个 "LaunchConfigurationView" 作为属性(注意:这个属性是一个 class). 在这个私有属性中,您可以找到一个 "LaunchConfigurationFilteredTree" 属性(注意:还有一个 class)。

我想,这最后一个属性正是我要找的。但是我无法弄清楚我必须重写哪些方法才能在我的 CustomTitleAreaDialog 中显示带有所有启动配置的 FilteredTreeList。

在此先感谢您的帮助!

您找到的所有 类 都在 内部 包中,因此不是 Eclipse API 的一部分(参见 Eclipse API Rules of Engagement) .这些 类 可能会随时更改,从而破坏您的插件。

视图的核心确实使用了官方APIs.

首先它得到 ILaunchManager:

ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();

树的根元素是 ILaunchConfigurationType 个条目:

ILaunchConfigurationType [] allTypes = manager.getLaunchConfigurationTypes();

ILaunchConfigurationType 的子项是实际的 ILaunchConfiguration 启动配置对象:

ILaunchConfiguration [] configs = manager.getLaunchConfigurations(configType);

如果您使用这些方法构建 TreeViewer 就没问题。