在Eclipse应用程序中打开Run Configuration ...对话框

时间:2013-10-02 13:23:00

标签: eclipse plugins jface

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

2 个答案:

答案 0 :(得分:1)

LaunchConfigurationsDialog位于内部包中,因此不应直接使用。

DebugUIPlugin提供此方法来打开此对话框:

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

的Javadoc:

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);

答案 1 :(得分:0)

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