/******************************************************************************* * Copyright (c) 2000, 2007 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.debug.ui; import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.IEditorPart; /** * A launch shortcut is capable of launching a selection or active editor in the * workbench. The delegate is responsible for interpreting the selection or * active editor (if it applies), and launching an application. This may require * creating a new launch configuration with default values, or re-using an * existing launch configuration. *

* A launch shortcut is defined as an extension of type * org.eclipse.debug.ui.launchShortcuts. A shortcut specifies the * perspectives in which is should be available from the "Run/Debug" cascade * menus. *

*

* A launch shortcut extension is defined in plugin.xml. Following * is an example definition of a launch shortcut extension. *

* *
 * <extension point="org.eclipse.debug.ui.launchShortcuts">
 *    <shortcut
 *           class="org.eclipse.jdt.internal.debug.ui.launcher.JavaApplicationLaunchShortcut"
 *           description="%JavaLaunchShortcut.description"
 *           helpContextId="org.eclipse.jdt.debug.ui.shortcut_local_java_application"
 *           icon="$nl$/icons/full/etool16/java_app.png"
 *           id="org.eclipse.jdt.debug.ui.localJavaShortcut"
 *           label="%JavaApplicationShortcut.label"
 *           modes="run, debug">
 *       <contextualLaunch>
 *         <enablement>
 *           <with variable="selection">
 *             <count value="1"/>
 *              <iterate>
 *               <and>
 *                <adapt type="org.eclipse.jdt.core.IJavaElement">
 *                	<test property="org.eclipse.jdt.core.isInJavaProject"/>
 *                </adapt>
 *              	 <or>
 *              	   <test property="org.eclipse.jdt.launching.hasMain"/>
 *              	   <test property="org.eclipse.jdt.launching.isContainer"/>
 *              	   <test property="org.eclipse.jdt.launching.isPackageFragment"/>
 *              	   <test property="org.eclipse.jdt.launching.isPackageFragmentRoot"/>
 *              	 </or>
 *               </and>
 *              </iterate>
 *             </with>
 *         </enablement>
 * 		</contextualLaunch>
 *       <configurationType
 *              id="org.eclipse.jdt.launching.localJavaApplication">
 *       </configurationType>
 *       <description
 *              description="%RunJavaLaunchShortcut.description"
 *              mode="run">
 *       </description>
 *       <description
 *              description="%DebugJavaLaunchShortcut.description"
 *              mode="debug">
 *       </description>
 *    </shortcut>
 * </extension>
 * 
*

* The attributes are specified as follows: *

* *

*
* Clients contributing a launch shortcut are intended to implement this * interface. *

* * @since 2.0 */ public interface ILaunchShortcut { /** * Locates a launchable entity in the given selection and launches * an application in the specified mode. This launch configuration * shortcut is responsible for progress reporting as well * as error handling, in the event that a launchable entity cannot * be found, or launching fails. * * @param selection workbench selection * @param mode one of the launch modes defined by the * launch manager * @see org.eclipse.debug.core.ILaunchManager */ void launch(ISelection selection, String mode); /** * Locates a launchable entity in the given active editor, and launches * an application in the specified mode. This launch configuration * shortcut is responsible for progress reporting as well as error * handling, in the event that a launchable entity cannot be found, * or launching fails. * * @param editor the active editor in the workbench * @param mode one of the launch modes defined by the launch * manager * @see org.eclipse.debug.core.ILaunchManager */ void launch(IEditorPart editor, String mode); }