0

我想创建一个启动“运行配置...”对话框的按钮。我怎样才能做到这一点?我在 Spy 中看到 Active shell 类是 LaunchConfigurationsDialog 但我不知道如何使用这些信息。

4

2 回答 2

1

LaunchConfigurationsDialog是在一个内部包装,所以不应该直接使用。

提供了这个DebugUIPlugin方法来打开这个对话框:

int openLaunchConfigurationsDialog(Shell shell, IStructuredSelection selection, String groupIdentifier, boolean setDefaults)

Java 文档:

Opens the LaunchConfigurationsDialog on the given selection for the given group. A status can be provided or null and the dialog can initialize the given ILaunchConfiguration to its defaults when opening as well - as long as the specified configuration is an ILaunchConfigurationWorkingCopy.

Parameters:
shell the shell to open the dialog on
selection the non-null selection to show when the dialog opens
groupIdentifier the identifier of the launch group to open the dialog on
setDefaults if the default values should be set on the opened configuration - if there is one
Returns:
the return code from the dialog.open() call

DebugUIPlugin也在内部包装中。

“运行配置”菜单的命令 ID 是org.eclipse.debug.ui.commands.OpenRunConfigurations这样的,您可以使用以下命令执行该命令:

IHandlerService handlerService = (IHandlerService)getSite().getService(IHandlerService.class);
handlerService.executeCommand("org.eclipse.debug.ui.commands.OpenRunConfigurations", null);
于 2013-10-02T15:54:32.993 回答
0

另一种方法是使用org.eclipse.debug.ui.actions.OpenLaunchDialogAction 并且您可以在构造函数中指定组IDebugUIConstants.ID_RUN_LAUNCH_GROUP
供您参考,您也可以创建自己的组并仅显示该组。

于 2013-11-23T13:15:18.320 回答