Eclipse Platform
Release 3.7

org.eclipse.debug.ui
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.gif"
           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

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

Method Detail

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:
ILaunchManager

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:
ILaunchManager

Eclipse Platform
Release 3.7

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2011. All rights reserved.