KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > spi > project > ActionProvider


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.spi.project;
21
22 import org.openide.util.Lookup;
23
24 /**
25  * Ability for a project to have various actions (e.g. Build) invoked on it.
26  * Should be registered in a project's lookup and will be used by UI infrastructure.
27  * @see org.netbeans.api.project.Project#getLookup
28  * @see <a HREF="@org-apache-tools-ant-module@/org/apache/tools/ant/module/api/support/ActionUtils.html"><code>ActionUtils</code></a>
29  * @see <a HREF="@org-netbeans-modules-projectuiapi@/org/netbeans/spi/project/ui/support/ProjectSensitiveActions.html#projectCommandAction(java.lang.String,%20java.lang.String,%20javax.swing.Icon)"><code>ProjectSensitiveActions.projectCommandAction(...)</code></a>
30  * @author Jesse Glick
31  */

32 public interface ActionProvider {
33     
34     /**
35      * Standard command to incrementally build the project.
36      */

37     String JavaDoc COMMAND_BUILD = "build"; // NOI18N
38

39     /**
40      * Standard command for compiling set of files
41      */

42     String JavaDoc COMMAND_COMPILE_SINGLE = "compile.single"; // NOI18N
43

44     /**
45      * Standard command to clean build products.
46      */

47     String JavaDoc COMMAND_CLEAN = "clean"; // NOI18N
48

49     /**
50      * Standard command to do a "clean" (forced) rebuild.
51      */

52     String JavaDoc COMMAND_REBUILD = "rebuild"; // NOI18N
53

54     /**
55      * Standard command for running the project
56      */

57     String JavaDoc COMMAND_RUN = "run"; // NOI18N
58

59     /**
60      * Standard command for running one file
61      */

62     String JavaDoc COMMAND_RUN_SINGLE = "run.single"; // NOI18N
63

64     /**
65      * Standard command for running tests on given projects
66      */

67     String JavaDoc COMMAND_TEST = "test"; // NOI18N
68

69     /**
70      * Standard command for running one test file
71      */

72     String JavaDoc COMMAND_TEST_SINGLE = "test.single"; // NOI18N
73

74     /**
75      * Standard command for running the project in debugger
76      */

77     String JavaDoc COMMAND_DEBUG = "debug"; // NOI18N
78

79     /**
80      * Standard command for running single file in debugger
81      */

82     String JavaDoc COMMAND_DEBUG_SINGLE = "debug.single"; // NOI18N
83

84     /**
85      * Standard command for running one test in debugger
86      */

87     String JavaDoc COMMAND_DEBUG_TEST_SINGLE = "debug.test.single"; // NOI18N
88

89     /**
90      * Standard command for starting app in debugger and stopping at the
91      * beginning of app whatever that means.
92      */

93     String JavaDoc COMMAND_DEBUG_STEP_INTO = "debug.stepinto"; // NOI18N
94

95     /**
96      * Standard command for deleting the project.
97      *
98      * @since 1.6
99      */

100     String JavaDoc COMMAND_DELETE = "delete"; // NOI18N
101

102     /**
103      * Standard command for deleting the project.
104      *
105      * @since 1.7
106      */

107     String JavaDoc COMMAND_COPY = "copy"; // NOI18N
108

109     /**
110      * Standard command for moving the project.
111      *
112      * @since 1.7
113      */

114     String JavaDoc COMMAND_MOVE = "move"; // NOI18N
115

116     /**
117      * Standard command for renaming the project.
118      *
119      * @since 1.7
120      */

121     String JavaDoc COMMAND_RENAME = "rename"; // NOI18N
122

123     /**
124      * Get a list of all commands which this project supports.
125      * @return a list of command names suitable for {@link #invokeAction}
126      * @see #COMMAND_BUILD
127      * @see #COMMAND_CLEAN
128      * @see #COMMAND_REBUILD
129      */

130     String JavaDoc[] getSupportedActions();
131     
132     /**
133      * Run a project command.
134      * Will be invoked in the event thread.
135      * The context may be ignored by some commands, but some may need it in order
136      * to get e.g. the selected source file to build by itself, etc.
137      * @param command a predefined command name (must be among {@link #getSupportedActions})
138      * @param context any action context, e.g. for a node selection
139      * (as in {@link ContextAwareAction})
140      * @throws IllegalArgumentException if the requested command is not supported
141      */

142     void invokeAction(String JavaDoc command, Lookup context) throws IllegalArgumentException JavaDoc;
143     
144     /**
145      * Tells whether the command can be invoked in given context and thus if
146      * actions representing this command should be enabled or disabled.
147      * The context may be ignored by some commands, but some may need it in order
148      * to get e.g. the selected source file to build by itself, etc.
149      * @param command a predefined command name (must be among {@link #getSupportedActions})
150      * @param context any action context, e.g. for a node selection
151      * (as in {@link ContextAwareAction})
152      * @throws IllegalArgumentException if the requested command is not supported
153      */

154     boolean isActionEnabled(String JavaDoc command, Lookup context) throws IllegalArgumentException JavaDoc;
155     
156 }
157
Popular Tags