ghiotto86
ghiotto86

Reputation: 15

Open Run Configuration... dialog in a eclipse application

I want to create a button that start "Run Configuration..." dialog. How can i do this? I have seen with Spy that Active shell class is LaunchConfigurationsDialog but i don't know how use this information.

Upvotes: 0

Views: 508

Answers (2)

Jeff
Jeff

Reputation: 53

Another way, is to use org.eclipse.debug.ui.actions.OpenLaunchDialogAction and you can specify the group in the constructor IDebugUIConstants.ID_RUN_LAUNCH_GROUP
For your information, you can also create your own group and only display this group.

Upvotes: 0

greg-449
greg-449

Reputation: 111218

LaunchConfigurationsDialog is in an internal package so should not be used directly.

The DebugUIPlugin provides this method to open this dialog:

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

but DebugUIPlugin is also in an internal package.

The command id for the 'Run Configurations' menu is org.eclipse.debug.ui.commands.OpenRunConfigurations so you can execute that command using something like:

IHandlerService handlerService = (IHandlerService)getSite().getService(IHandlerService.class);
handlerService.executeCommand("org.eclipse.debug.ui.commands.OpenRunConfigurations", null);

Upvotes: 1

Related Questions