如何在eclipse中获取外部工具列表

时间:2018-06-04 21:51:56

标签: eclipse eclipse-plugin eclipse-pde

Eclipse知道外部工具(菜单运行 - >外部工具),我想在我的视图中右键单击显示外部工具列表,以便用户可以选择我随后执行的工具。

但是我根本找不到外部工具 我现在的代码转储命令(并且有很多),但我找不到我创建的外部工具。

ICommandService commandService=PlatformUI.getWorkbench().getService(ICommandService.class);
Command[] allCommands = commandService.getDefinedCommands();
for(Command curCommand :allCommands) {
    Category cat = curCommand.getCategory();
    System.out.print(cat.getName()+"  ");
    System.out.println(curCommand.getName());
}

在哪里可以找到外部工具列表?

1 个答案:

答案 0 :(得分:0)

根据greg的信息,我发现以下内容适用于我的情况。

ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type =     manager.getLaunchConfigurationType("org.eclipse.ui.externaltools.ProgramLaunchConfigurationType"); //$NON-NLS-1$
ILaunchConfiguration[] lcs = manager.getLaunchConfigurations(type);

这适用于程序启动配置,因为我使用了键(" org.eclipse.ui.externaltools.ProgramLaunchConfigurationType"。
如果您不知道您的命令是哪种类型,请使用getLaunchConfigurationTypes()查找所有类型并列出名称以查找所需的类型。
有很多。

相关问题