/** * Open the launch configuration dialog with the specified initial selection. * The selection may be <code>null</code>, or contain any mix of * <code>ILaunchConfiguration</code> or <code>ILaunchConfigurationType</code> * elements. * <p> * Before opening a new dialog, this method checks if there is an existing open * launch configuration dialog. If there is, this dialog is used with the * specified selection. If there is no existing dialog, a new one is created. * </p> * <p> * Note that if an existing dialog is reused, the <code>mode</code> argument is ignored * and the existing dialog keeps its original mode. * </p> * * @param shell the parent shell for the launch configuration dialog * @param selection the initial selection for the dialog * @param groupIdentifier the identifier of the launch group to display (corresponds to * the identifier of a launch group extension) * @return The return code from opening the launch configuration dialog - * one of <code>Window.OK</code> or <code>Window.CANCEL</code>. <code>Window.CANCEL</code> * is returned if an invalid launch group identifier is provided. * @see ILaunchGroup * @since 2.1 */ public static int openLaunchConfigurationDialogOnGroup(Shell shell, IStructuredSelection selection, String groupIdentifier) { return openLaunchConfigurationDialogOnGroup(shell, selection, groupIdentifier, null); }
/** * Open the launch configuration dialog, passing in the current workbench selection. */ private void openLaunchConfigurationDialog() { IWorkbenchWindow dwindow= DebugUIPlugin.getActiveWorkbenchWindow(); if (dwindow == null) { return; } DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell(), new StructuredSelection(), fLaunchGroupIdentifier); }
private static void handleInvocationTargetException(InvocationTargetException e, ILaunchConfiguration configuration, String mode) { Throwable targetException = e.getTargetException(); Throwable t = e; if (targetException instanceof CoreException) { t = targetException; } if (t instanceof CoreException) { CoreException ce = (CoreException)t; IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(ce.getStatus()); if (handler != null) { ILaunchGroup group = DebugUITools.getLaunchGroup(configuration, mode); if (group != null) { DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell(), new StructuredSelection(configuration), group.getIdentifier(), ce.getStatus()); return; } } if ((ce.getStatus().getSeverity() & (IStatus.ERROR | IStatus.WARNING)) == 0) { // If the exception is a CoreException with a status other // than ERROR or WARNING, don't open an error dialog. return; } } DebugUIPlugin.errorDialog(DebugUIPlugin.getShell(), DebugUIMessages.DebugUITools_Error_1, DebugUIMessages.DebugUITools_Exception_occurred_during_launch_2, t); // }
ILaunchGroup group = groups[i]; if (group.getMode().equals(mode) && group.getCategory() == null) { return openLaunchConfigurationDialogOnGroup(shell, selection, group.getIdentifier());
private static void generateErrorDialog(final String title, final String message, final ILaunchConfiguration launchConfig, final String mode) { getDisplay().syncExec(() -> { Shell parentShell = getActiveShell(); MessageDialog dialog = new MessageDialog(parentShell, title, null, message, MessageDialog.ERROR, 1, PDEUIMessages.LauncherUtils_edit, PDEUIMessages.LauncherUtils_cancelLaunch); int res = dialog.open(); if (res == 0) { IStructuredSelection selection = new StructuredSelection(launchConfig); ILaunchGroup group = DebugUITools.getLaunchGroup(launchConfig, mode); String groupIdentifier = group == null ? IDebugUIConstants.ID_RUN_LAUNCH_GROUP : group.getIdentifier(); IStatus status = new Status(IStatus.OK, PDELaunchingPlugin.getPluginId(), LauncherUtils.SELECT_WORKSPACE_FIELD, "", null); //$NON-NLS-1$ DebugUITools.openLaunchConfigurationDialogOnGroup(parentShell, selection, groupIdentifier, status); } }); }
/** * @see org.eclipse.jface.action.IAction#run() */ @Override public void run() { LaunchHistory history = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchHistory(fIdentifier); ILaunchConfiguration configuration = history.getRecentLaunch(); IStructuredSelection selection = null; if (configuration == null) { selection = new StructuredSelection(); } else { selection = new StructuredSelection(configuration); } int result = DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell(), selection, fIdentifier); notifyResult(result == Window.OK); }
return status; Runnable r = () -> DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell(), new StructuredSelection(configuration), group.getIdentifier(), status); DebugUIPlugin.getStandardDisplay().asyncExec(r);
DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell(), selection, groupid);
@Override public void runWithEvent(Event event) { if ((event.stateMask & SWT.MOD1) > 0) { try { ILaunchGroup group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(fConfig.getType(), fMode); if(group != null) { DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell(), new StructuredSelection(fConfig), group.getIdentifier()); } else { runInternal(((event.stateMask & SWT.SHIFT) > 0) ? true : false); } } catch(CoreException ce) {} } else { runInternal(((event.stateMask & SWT.SHIFT) > 0) ? true : false); } }
@Override protected void runInternal(IAction action, boolean isShift) { //always ignore external tools during context launching if(LaunchingResourceManager.isContextLaunchEnabled(getLaunchGroupIdentifier())) { ContextRunner.getDefault().launch(DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(getLaunchGroupIdentifier()), isShift); } else { ILaunchConfiguration configuration = getLastLaunch(); if (configuration == null) { DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell(), new StructuredSelection(), getLaunchGroupIdentifier()); } else { DebugUITools.launch(configuration, getMode(), isShift); } } } }
ILaunchGroup group = DebugUITools.getLaunchGroup(fConfiguration, fMode); if(group != null) { DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell(), new StructuredSelection(fConfiguration), group.getIdentifier());