Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Plug-in Developer Guide
Previous Page Home Next Page

Launch shortcuts

Once a launch configuration has been defined using the dialog, it can be shown directly in the appropriate menu, rather than having to open the launch configuration dialog again. When a launch configuration is shown directly in a menu, we refer to it as a launch shortcut. The org.eclipse.debug.ui.launchShortcuts extension point is used to register these shortcuts. In the extension definition, you can specify in which modes the shortcuts are shown. For each shortcut, you must specify an implementation of ILaunchShortcut. This class is used to launch a program given a particular selection in a view or editor.

You may also specify when the shortcut should be shown. The contexttualLaunch element allows you to describe applicable modes and enabling conditions for the shortcut. This is best demonstrated by example. The following markup registers shortcuts for launching a Java application:

  <extension
         point="org.eclipse.debug.ui.launchShortcuts">
      <shortcut
            label="%JavaApplicationShortcut.label"
            icon="icons/full/etool16/java_app.png"
            helpContextId="org.eclipse.jdt.debug.ui.shortcut_local_java_application"
            modes="run, debug"
            class="org.eclipse.jdt.internal.debug.ui.launcher.JavaApplicationLaunchShortcut"
            id="org.eclipse.jdt.debug.ui.localJavaShortcut">
         <contextualLaunch>
           <enablement>
             <with variable="selection">
               <count value="1"/>
               <iterate>
                 <or>
                   <test property="org.eclipse.debug.ui.matchesPattern" value="*.java"/>
                   <test property="org.eclipse.debug.ui.matchesPattern" value="*.class"/>
                   <instanceof value="org.eclipse.jdt.core.IJavaElement"/>
                 </or>
                 <test property="org.eclipse.jdt.debug.ui.hasMainType"/>
               </iterate>
             </with>
           </enablement>
  		 </contextualLaunch>
         ...
      </shortcut>
      ...

See Boolean expressions and action filters for an explanation of the XML syntax for enabling conditions. The complete syntax is described in the documentation for org.eclipse.debug.ui.launchShortcuts.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire