KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > spi > project > ui > support > CommonProjectActions


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.ui.support;
21
22 import javax.swing.Action JavaDoc;
23 import org.netbeans.modules.project.uiapi.Utilities;
24
25 /**
26  * Factory for commonly needed generic project actions.
27  * @author Jesse Glick, Petr Hrebejk
28  */

29 public class CommonProjectActions {
30
31     /**
32      * {@link org.openide.filesystems.FileObject} value honored by {@link #newProjectAction}
33      * that defines initial value for existing sources directory choosers.
34      *
35      * @since org.netbeans.modules.projectuiapi/1 1.3
36      */

37     public static final String JavaDoc EXISTING_SOURCES_FOLDER = "existingSourcesFolder";
38     
39     private CommonProjectActions() {}
40         
41     /**
42      * Create an action "Set As Main Project".
43      * It should be invoked with an action context containing
44      * one {@link org.netbeans.api.project.Project}.
45      * <p class="nonnormative">
46      * You might include this in the context menu of a logical view.
47      * </p>
48      * @return an action
49      */

50     public static Action JavaDoc setAsMainProjectAction() {
51         return Utilities.getActionsFactory().setAsMainProjectAction();
52     }
53     
54     /**
55      * Create an action "Customize Project".
56      * It should be invoked with an action context containing
57      * one {@link org.netbeans.api.project.Project}.
58      * <p class="nonnormative">
59      * You might include this in the context menu of a logical view.
60      * </p>
61      * @return an action
62      */

63     public static Action JavaDoc customizeProjectAction() {
64         return Utilities.getActionsFactory().customizeProjectAction();
65     }
66     
67     /**
68      * Create an action "Open Subprojects".
69      * It should be invoked with an action context containing
70      * one or more {@link org.netbeans.api.project.Project}s.
71      * <p class="nonnormative">
72      * You might include this in the context menu of a logical view.
73      * </p>
74      * @return an action
75      * @see org.netbeans.spi.project.SubprojectProvider
76      */

77     public static Action JavaDoc openSubprojectsAction() {
78         return Utilities.getActionsFactory().openSubprojectsAction();
79     }
80     
81     /**
82      * Create an action "Close Project".
83      * It should be invoked with an action context containing
84      * one or more {@link org.netbeans.api.project.Project}s.
85      * <p class="nonnormative">
86      * You might include this in the context menu of a logical view.
87      * </p>
88      * @return an action
89      */

90     public static Action JavaDoc closeProjectAction() {
91         return Utilities.getActionsFactory().closeProjectAction();
92     }
93     
94     /**
95      * Create an action project dependent "New File" action.
96      * <p class="nonnormative">
97      * You might include this in the context menu of a logical view.
98      * </p>
99      * @return an action
100      * @see org.netbeans.spi.project.ui.PrivilegedTemplates
101      * @see org.netbeans.spi.project.ui.RecommendedTemplates
102      */

103     public static Action JavaDoc newFileAction() {
104         return Utilities.getActionsFactory().newFileAction();
105     }
106     
107     /**
108      * Create an action "Delete Project".
109      * It should be invoked with an action context containing
110      * one or more {@link org.netbeans.api.project.Project}s.
111      * <p class="nonnormative">
112      * You might include this in the context menu of a logical view.
113      * </p>
114      * @since 1.8
115      * @return an action
116      */

117     public static Action JavaDoc deleteProjectAction() {
118         return Utilities.getActionsFactory().deleteProjectAction();
119     }
120
121     /**
122      * Create an action "Copy Project".
123      * It should be invoked with an action context containing
124      * one or more {@link org.netbeans.api.project.Project}s.
125      * <p class="nonnormative">
126      * You might include this in the context menu of a logical view.
127      * </p>
128      * @since 1.10
129      * @return an action
130      */

131     public static Action JavaDoc copyProjectAction() {
132         return Utilities.getActionsFactory().copyProjectAction();
133     }
134     
135     /**
136      * Create an action "Move Project".
137      * It should be invoked with an action context containing
138      * one or more {@link org.netbeans.api.project.Project}s.
139      * <p class="nonnormative">
140      * You might include this in the context menu of a logical view.
141      * </p>
142      * @since 1.10
143      * @return an action
144      */

145     public static Action JavaDoc moveProjectAction() {
146         return Utilities.getActionsFactory().moveProjectAction();
147     }
148     
149     /**
150      * Create an action "Rename Project".
151      * It should be invoked with an action context containing
152      * one or more {@link org.netbeans.api.project.Project}s.
153      * <p class="nonnormative">
154      * You might include this in the context menu of a logical view.
155      * </p>
156      * @since 1.10
157      * @return an action
158      */

159     public static Action JavaDoc renameProjectAction() {
160         return Utilities.getActionsFactory().renameProjectAction();
161     }
162     
163     /**
164      * Creates action that invokes <b>New Project</b> wizard.
165      *
166      * <p>{@link #EXISTING_SOURCES_FOLDER} keyed action
167      * value can carry {@link org.openide.filesystems.FileObject} that points
168      * to existing sources folder. {@link Action#putValue Set this value}
169      * if you open the wizard and you know user
170      * expectations about initial value for wizard
171      * choosers that refers to existing sources location.
172      *
173      * @return an action
174      *
175      * @since org.netbeans.modules.projectuiapi/1 1.3
176      */

177     public static Action JavaDoc newProjectAction() {
178         return Utilities.getActionsFactory().newProjectAction();
179     }
180
181     /**
182      * Creates an action that sets the configuration of the selected project.
183      * It should be displayed with an action context containing
184      * exactly one {@link org.netbeans.api.project.Project}.
185      * The action itself should not be invoked but you may use its popup presenter.
186      * <p class="nonnormative">
187      * You might include this in the context menu of a logical view.
188      * </p>
189      * @return an action
190      * @since org.netbeans.modules.projectuiapi/1 1.17
191      * @see org.netbeans.spi.project.ProjectConfigurationProvider
192      */

193     public static Action JavaDoc setProjectConfigurationAction() {
194         return Utilities.getActionsFactory().setProjectConfigurationAction();
195     }
196
197 }
198
Popular Tags