KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > ui > ILaunchShortcut


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.debug.ui;
12
13
14 import org.eclipse.jface.viewers.ISelection;
15 import org.eclipse.ui.IEditorPart;
16
17 /**
18  * A launch shortcut is capable of launching a selection
19  * or active editor in the workbench. The delegate is responsible for
20  * interpreting the selection or active editor (if it applies), and launching
21  * an application. This may require creating a new launch configuration
22  * with default values, or re-using an existing launch configuration.
23  * <p>
24  * A launch shortcut is defined as an extension
25  * of type <code>org.eclipse.debug.ui.launchShortcuts</code>.
26  * A shortcut specifies the perspectives in which is should be available
27  * from the "Run/Debug" cascade menus.
28  * </p>
29  * <p>
30  * A launch shortcut extension is defined in <code>plugin.xml</code>.
31  * Following is an example definition of a launch shortcut extension.
32  * <pre>
33  * &lt;extension point="org.eclipse.debug.ui.launchShortcuts"&gt;
34  * &lt;launchShortcut
35  * id="com.example.ExampleLaunchShortcut"
36  * class="com.example.ExampleLaunchShortcutClass"
37  * filterClass="com.example.ExampleLaunchShortcutFilterClass"
38  * label="Example Label"
39  * icon="\icons\exampleshortcut.gif"
40  * helpContextId="com.example.shortcut_context"
41  * modes="run, debug"&gt;
42  * &lt;perspective id="com.example.perspectiveId1"/&gt;
43  * &lt;perspective id="com.example.perspectiveId2"/&gt;
44  * &lt;filter
45  * name="NameMatches"
46  * value="*.java"/&gt;
47  * &lt;filter
48  * name="ContextualLaunchActionFilter"
49  * value="supportsContextualLaunch"/&gt;
50  * &lt;contextLabel
51  * mode="run"
52  * label="%RunJavaApplet.label"/&gt;
53  * &lt;contextLabel
54  * mode="debug"
55  * label="%DebugJavaApplet.label"/&gt;
56  * ...
57  * &lt;/launchShortcut&gt;
58  * &lt;/extension&gt;
59  * </pre>
60  * The attributes are specified as follows:
61  * <ul>
62  * <li><code>id</code> specifies a unique identifier for this launch shortcut.</li>
63  * <li><code>class</code> specifies a fully qualified name of a Java class
64  * that implements <code>ILaunchShortcut</code>.</li><li>
65  * <code>filterClass</code> optionally specifies a fully qualified name of a Java class
66  * that implements <code>ILaunchFilter</code> for context menu filtering.</li>
67  * <li><code>label</code> specifies a label used to render this shortcut.</li>
68  * <li><code>icon</code> specifies a plug-in relative path to an icon used to
69  * render this shortcut.</li>
70  * <li><code>helpContextId</code> optional attribute specifying the help context
71  * identifier to associate with the launch shortcut action in a menu.</li>
72  * <li><code>modes</code> specifies a comma separated list of modes this shortcut
73  * supports.</li>
74  * <li><code>perspective</code> one or more perspective entries enumerate the
75  * perspectives that this shortcut is available in, from the run/debug cascade
76  * menus.</li>
77  * <li><code>filter</code> zero or more filter entries specify the attribute
78  * <code>name</code> and attribute <code>value</code> that will be supplied to
79  * the <code>testAttribute</code> method implemented by the <code>filterClass</code>
80  * Java Class. If all filters in this list return <code>true</code> when applied
81  * to a selection target, the shortcut will be available in the run/debug context menu.
82  * menu.</li>
83  * <li><code>contextLabel</code> zero or more context menu labels. For
84  * shortcuts that pass their filter tests, the specified label will appear
85  * in the "Run ->" context menu and be bound to a launch action of the
86  * specified mode (e.g. run,debug,profile).</li>
87  * </ul>
88  * </p>
89  * <p>
90  * Clients contributing a launch shortcut are intended to implement this interface.
91  * </p>
92  * @since 2.0
93  */

94 public interface ILaunchShortcut {
95
96     /**
97      * Locates a launchable entity in the given selection and launches
98      * an application in the specified mode. This launch configuration
99      * shortcut is responsible for progress reporting as well
100      * as error handling, in the event that a launchable entity cannot
101      * be found, or launching fails.
102      *
103      * @param selection workbench selection
104      * @param mode one of the launch modes defined by the
105      * launch manager
106      * @see org.eclipse.debug.core.ILaunchManager
107      */

108     public void launch(ISelection selection, String JavaDoc mode);
109     
110     /**
111      * Locates a launchable entity in the given active editor, and launches
112      * an application in the specified mode. This launch configuration
113      * shortcut is responsible for progress reporting as well as error
114      * handling, in the event that a launchable entity cannot be found,
115      * or launching fails.
116      *
117      * @param editor the active editor in the workbench
118      * @param mode one of the launch modes defined by the launch
119      * manager
120      * @see org.eclipse.debug.core.ILaunchManager
121      */

122     public void launch(IEditorPart editor, String JavaDoc mode);
123 }
124
Popular Tags