如何通过命令在RCP应用程序中打开启动配置对话框(如在项目上按mouse_right - 运行 - 运行配置)?或任何其他方式,但命令首选。
如果您在'创建,管理和运行配置'上键入'ALT+SHIFT+F1
',plug-in Spy会告诉您它是LaunchConfigurationsDialog
Eclipse源代码中的快速搜索表明它是通过DebugUITools.openLaunchConfigurationDialogOnGroup()
创建的
final int[] result = new int[1];
Runnable JavaDoc r = new Runnable JavaDoc() {
/**
* @see java.lang.Runnable#run()
*/
public void run() {
LaunchConfigurationsDialog dialog = (LaunchConfigurationsDialog) LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog();
if (dialog != null) {
dialog.setInitialSelection(selection);
dialog.doInitialTreeSelection();
if (status != null) {
dialog.handleStatus(status);
}
result[0] = Window.OK;
} else {
dialog = new LaunchConfigurationsDialog(shell, DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(groupIdentifier));
dialog.setOpenMode(LaunchConfigurationsDialog.LAUNCH_CONFIGURATION_DIALOG_OPEN_ON_SELECTION);
dialog.setInitialSelection(selection);
dialog.setInitialStatus(status);
result[0] = dialog.open();
}
}
};
BusyIndicator.showWhile(DebugUIPlugin.getStandardDisplay(), r);
return result[0];
这应该给你足够的材料来开始。
(来源:eclipse.org)
基于VonC的回答我做了以下,其中config
只是我的ILaunchConfigurationWorkingCopy
和mode
的实例是"run"
:
DebugUITools.openLaunchConfigurationDialog(
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
config,
DebugUITools.getLaunchGroup(savedConfig, mode).getIdentifier(),
null);