Interface ILaunchShortcut

All Known Subinterfaces:
ILaunchShortcut2

public interface ILaunchShortcut
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:

  • id specifies a unique identifier for this launch shortcut.
  • modes specifies a comma separated list of modes this shortcut supports.
  • class specifies a fully qualified name of a Java class that implements ILaunchShortcut.
  • label specifies a label used to render this shortcut.
  • icon specifies a plug-in relative path to an icon used to render this shortcut.
  • category specifies the launch configuration type category this shortcut is applicable for. When unspecified, the category is null (default).
  • path an optional menu path used to group launch shortcuts in menus. Launch shortcuts are grouped alphabetically based on the path attribute, and then sorted alphabetically within groups based on the label attribute. When unspecified, a shortcut appears in the last group. This attribute was added in the 3.0.1 release.
  • helpContextId optional attribute specifying the help context identifier to associate with the launch shortcut action in a menu.
  • description Provides a human readable description of what the shortcut does (or will do) if the user selects it. A Description provided in this field will apply as the default description for all of the modes listed in the modes attribute.
  • perspective has been deprecated in the 3.1 release. The top level Run/Debug/Profile cascade menus now support contextual (selection sensitive) launching, and clients should provide a contextualLaunch element instead.
  • contextualLaunch holds all descriptions for adding shortcuts to the selection sensitive Run/Debug/Profile cascade menus. Only objects that provide an org.eclipse.debug.ui.actions.ILaunchable adapter are considered for the cascade menus. The org.eclipse.debug.ui.actions.ILaunchable interface is simply used to tag objects that support contextual launching.
  • contextLabel zero or more context menu labels. For shortcuts that pass their filter tests, the specified label will appear in the "Run ->" context menu and be bound to a launch action of the specified mode (e.g. run,debug,profile).
  • configurationType allows more that one associated launch configuration type to be specified for this launch shortcut. That way consumers of launch shortcut information can know what kinds of launch configurations your short is associated with/creates
  • description allows a mode specific description(s) to be provided for this launch shortcut.


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

Since:
2.0
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    launch(ISelection selection, String mode)
    Locates a launchable entity in the given selection and launches an application in the specified mode.
    void
    launch(IEditorPart editor, String mode)
    Locates a launchable entity in the given active editor, and launches an application in the specified mode.
  • Method Details

    • launch

      void launch(ISelection selection, String mode)
      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.
      Parameters:
      selection - workbench selection
      mode - one of the launch modes defined by the launch manager
      See Also:
    • launch

      void launch(IEditorPart editor, 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.
      Parameters:
      editor - the active editor in the workbench
      mode - one of the launch modes defined by the launch manager
      See Also: