Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 819eabe48f80c948dc7ca323a3f12b4894f65b5c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*******************************************************************************
 * Copyright (c) 2000, 2007 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * 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.
 * <p>
 * A launch shortcut is defined as an extension
 * of type <code>org.eclipse.debug.ui.launchShortcuts</code>.
 * A shortcut specifies the perspectives in which is should be available
 * from the "Run/Debug" cascade menus.
 * </p>
 * <p>
 * A launch shortcut extension is defined in <code>plugin.xml</code>.
 * Following is an example definition of a launch shortcut extension.
 * </p>
 * <br>
 * <pre>
 * &lt;extension point="org.eclipse.debug.ui.launchShortcuts"&gt;
 *    &lt;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"&gt;
 *       &lt;contextualLaunch&gt;
 *         &lt;enablement&gt;
 *           &lt;with variable="selection"&gt;
 *             &lt;count value="1"/&gt;
 *              &lt;iterate&gt;
 *               &lt;and&gt;
 *                &lt;adapt type="org.eclipse.jdt.core.IJavaElement"&gt;
 *                	&lt;test property="org.eclipse.jdt.core.isInJavaProject"/&gt;
 *                &lt;/adapt&gt;
 *              	 &lt;or&gt;
 *              	   &lt;test property="org.eclipse.jdt.launching.hasMain"/&gt;
 *              	   &lt;test property="org.eclipse.jdt.launching.isContainer"/&gt;
 *              	   &lt;test property="org.eclipse.jdt.launching.isPackageFragment"/&gt;
 *              	   &lt;test property="org.eclipse.jdt.launching.isPackageFragmentRoot"/&gt;
 *              	 &lt;/or&gt;
 *               &lt;/and&gt;
 *              &lt;/iterate&gt;
 *             &lt;/with&gt;
 *         &lt;/enablement&gt;
 * 		&lt;/contextualLaunch&gt;
 *       &lt;configurationType
 *              id="org.eclipse.jdt.launching.localJavaApplication"&gt;
 *       &lt;/configurationType&gt;
 *       &lt;description
 *              description="%RunJavaLaunchShortcut.description"
 *              mode="run"&gt;
 *       &lt;/description&gt;
 *       &lt;description
 *              description="%DebugJavaLaunchShortcut.description"
 *              mode="debug"&gt;
 *       &lt;/description&gt;
 *    &lt;/shortcut&gt;
 * &lt;/extension&gt;
 * </pre>
 * <br>
 * <p>
 * The attributes are specified as follows:
 * <ul>
 * <li><code>id</code> specifies a unique identifier for this launch shortcut.</li>
 * <li><code>modes</code> specifies a comma separated list of modes this shortcut
 *  supports.</li>
 * <li><code>class</code> specifies a fully qualified name of a Java class
 *  that implements <code>ILaunchShortcut</code>.</li>
 * <li><code>label</code> specifies a label used to render this shortcut.</li>
 * <li><code>icon</code> specifies a plug-in relative path to an icon used to
 * 	render this shortcut.</li>
 * <li><code>category</code> specifies the launch configuration type category this shortcut is applicable for.
 * When unspecified, the category is <code>null</code> (default).</li>
 * <li><code>path</code> an optional menu path used to group launch shortcuts in menus.
 * Launch shortcuts are grouped alphabetically based on the <code>path</code> attribute,
 * and then sorted alphabetically within groups based on the <code>label</code> attribute.
 * When unspecified, a shortcut appears in the last group. This attribute was added in the 3.0.1 release.</li>
 * <li><code>helpContextId</code> optional attribute specifying the help context
 * identifier to associate with the launch shortcut action in a menu.</li>
 * <li><code>description</code> 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.</li>
 * <li><code>perspective</code> has been <b>deprecated</b> in the 3.1 release.
 * The top level Run/Debug/Profile cascade menus now support contextual (selection sensitive)
 * launching, and clients should provide a <code>contextualLaunch</code> element instead.</li>
 * <li><code>contextualLaunch</code> holds all descriptions for adding shortcuts to the selection sensitive
 * Run/Debug/Profile cascade menus. Only objects that provide an <code>org.eclipse.debug.ui.actions.ILaunchable</code>
 * adapter are considered for the cascade menus. The <code>org.eclipse.debug.ui.actions.ILaunchable</code>
 * interface is simply used to tag objects that support contextual launching.</li>
 * <li><code>contextLabel</code> 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).</li>
 * <li><code>configurationType</code> 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</li>
 * <li><code>description</code> allows a mode specific description(s) to be provided for this launch shortcut.</li>
 * </ul>
 * </p>
 * <p>
 * <br>
 * Clients contributing a launch shortcut are intended to implement this interface.
 * </p>
 * @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
	 */
	public 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
	 */
	public void launch(IEditorPart editor, String mode);
}

Back to the top