~ubuntu-branches/ubuntu/quantal/netbeans/quantal

« back to all changes in this revision

Viewing changes to projects/projectapi/src/org/netbeans/spi/project/ActionProvider.java

  • Committer: Bazaar Package Importer
  • Author(s): Marek Slama
  • Date: 2008-01-29 14:11:22 UTC
  • Revision ID: james.westby@ubuntu.com-20080129141122-fnzjbo11ntghxfu7
Tags: upstream-6.0.1
ImportĀ upstreamĀ versionĀ 6.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 
3
 *
 
4
 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
 
5
 *
 
6
 * The contents of this file are subject to the terms of either the GNU
 
7
 * General Public License Version 2 only ("GPL") or the Common
 
8
 * Development and Distribution License("CDDL") (collectively, the
 
9
 * "License"). You may not use this file except in compliance with the
 
10
 * License. You can obtain a copy of the License at
 
11
 * http://www.netbeans.org/cddl-gplv2.html
 
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
 
13
 * specific language governing permissions and limitations under the
 
14
 * License.  When distributing the software, include this License Header
 
15
 * Notice in each file and include the License file at
 
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
 
17
 * particular file as subject to the "Classpath" exception as provided
 
18
 * by Sun in the GPL Version 2 section of the License file that
 
19
 * accompanied this code. If applicable, add the following below the
 
20
 * License Header, with the fields enclosed by brackets [] replaced by
 
21
 * your own identifying information:
 
22
 * "Portions Copyrighted [year] [name of copyright owner]"
 
23
 *
 
24
 * Contributor(s):
 
25
 *
 
26
 * The Original Software is NetBeans. The Initial Developer of the Original
 
27
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
 
28
 * Microsystems, Inc. All Rights Reserved.
 
29
 *
 
30
 * If you wish your version of this file to be governed by only the CDDL
 
31
 * or only the GPL Version 2, indicate your decision by adding
 
32
 * "[Contributor] elects to include this software in this distribution
 
33
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
 
34
 * single choice of license, a recipient has the option to distribute
 
35
 * your version of this file under either the CDDL, the GPL Version 2 or
 
36
 * to extend the choice of license to its licensees as provided above.
 
37
 * However, if you add GPL Version 2 code and therefore, elected the GPL
 
38
 * Version 2 license, then the option applies only if the new code is
 
39
 * made subject to such option by the copyright holder.
 
40
 */
 
41
 
 
42
package org.netbeans.spi.project;
 
43
 
 
44
import org.openide.util.Lookup;
 
45
 
 
46
/**
 
47
 * Ability for a project to have various actions (e.g. Build) invoked on it.
 
48
 * Should be registered in a project's lookup and will be used by UI infrastructure.
 
49
 * @see org.netbeans.api.project.Project#getLookup
 
50
 * @see <a href="@org-apache-tools-ant-module@/org/apache/tools/ant/module/api/support/ActionUtils.html"><code>ActionUtils</code></a>
 
51
 * @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>
 
52
 * @author Jesse Glick
 
53
 */
 
54
public interface ActionProvider {
 
55
    
 
56
    /**
 
57
     * Standard command to incrementally build the project.
 
58
     */
 
59
    String COMMAND_BUILD = "build"; // NOI18N
 
60
    
 
61
    /** 
 
62
     * Standard command for compiling set of files
 
63
     */
 
64
    String COMMAND_COMPILE_SINGLE = "compile.single"; // NOI18N
 
65
        
 
66
    /**
 
67
     * Standard command to clean build products.
 
68
     */
 
69
    String COMMAND_CLEAN = "clean"; // NOI18N
 
70
    
 
71
    /**
 
72
     * Standard command to do a "clean" (forced) rebuild.
 
73
     */
 
74
    String COMMAND_REBUILD = "rebuild"; // NOI18N
 
75
        
 
76
    /** 
 
77
     * Standard command for running the project
 
78
     */
 
79
    String COMMAND_RUN = "run"; // NOI18N
 
80
 
 
81
    /** 
 
82
     * Standard command for running one file
 
83
     */
 
84
    String COMMAND_RUN_SINGLE = "run.single"; // NOI18N
 
85
    
 
86
    /** 
 
87
     * Standard command for running tests on given projects
 
88
     */
 
89
    String COMMAND_TEST = "test"; // NOI18N
 
90
    
 
91
    /** 
 
92
     * Standard command for running one test file
 
93
     */    
 
94
    String COMMAND_TEST_SINGLE = "test.single";  // NOI18N
 
95
    
 
96
    /**
 
97
     * Standard command for running the project in debugger
 
98
     */    
 
99
    String COMMAND_DEBUG = "debug"; // NOI18N
 
100
    
 
101
    /**
 
102
     * Standard command for running single file in debugger
 
103
     */    
 
104
    String COMMAND_DEBUG_SINGLE = "debug.single"; // NOI18N
 
105
    
 
106
    /** 
 
107
     * Standard command for running one test in debugger
 
108
     */
 
109
    String COMMAND_DEBUG_TEST_SINGLE = "debug.test.single"; // NOI18N
 
110
    
 
111
    /** 
 
112
     * Standard command for starting app in debugger and stopping at the 
 
113
     * beginning of app whatever that means.
 
114
     */
 
115
    String COMMAND_DEBUG_STEP_INTO = "debug.stepinto"; // NOI18N
 
116
    
 
117
    /**
 
118
     * Standard command for deleting the project.
 
119
     *
 
120
     * @since 1.6
 
121
     */
 
122
    String COMMAND_DELETE = "delete"; // NOI18N
 
123
    
 
124
    /**
 
125
     * Standard command for deleting the project.
 
126
     *
 
127
     * @since 1.7
 
128
     */
 
129
    String COMMAND_COPY = "copy"; // NOI18N
 
130
    
 
131
    /**
 
132
     * Standard command for moving the project.
 
133
     *
 
134
     * @since 1.7
 
135
     */
 
136
    String COMMAND_MOVE = "move"; // NOI18N
 
137
 
 
138
    /**
 
139
     * Standard command for renaming the project.
 
140
     *
 
141
     * @since 1.7
 
142
     */
 
143
    String COMMAND_RENAME = "rename"; // NOI18N
 
144
    
 
145
    /**
 
146
     * Get a list of all commands which this project supports.
 
147
     * @return a list of command names suitable for {@link #invokeAction}
 
148
     * @see #COMMAND_BUILD
 
149
     * @see #COMMAND_CLEAN
 
150
     * @see #COMMAND_REBUILD
 
151
     */
 
152
    String[] getSupportedActions();
 
153
    
 
154
    /**
 
155
     * Run a project command.
 
156
     * Will be invoked in the event thread.
 
157
     * The context may be ignored by some commands, but some may need it in order
 
158
     * to get e.g. the selected source file to build by itself, etc.
 
159
     * @param command a predefined command name (must be among {@link #getSupportedActions})
 
160
     * @param context any action context, e.g. for a node selection
 
161
     *                (as in {@link ContextAwareAction})
 
162
     * @throws IllegalArgumentException if the requested command is not supported
 
163
     */
 
164
    void invokeAction(String command, Lookup context) throws IllegalArgumentException;
 
165
    
 
166
    /**
 
167
     * Tells whether the command can be invoked in given context and thus if
 
168
     * actions representing this command should be enabled or disabled.
 
169
     * The context may be ignored by some commands, but some may need it in order
 
170
     * to get e.g. the selected source file to build by itself, etc.
 
171
     * @param command a predefined command name (must be among {@link #getSupportedActions})
 
172
     * @param context any action context, e.g. for a node selection
 
173
     *                (as in {@link ContextAwareAction})
 
174
     * @throws IllegalArgumentException if the requested command is not supported
 
175
     */
 
176
    boolean isActionEnabled(String command, Lookup context) throws IllegalArgumentException;
 
177
    
 
178
}