KickJava   Java API By Example, From Geeks To Geeks.

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


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 javax.swing.Icon JavaDoc;
24 import org.netbeans.modules.project.uiapi.Utilities;
25
26 /**
27  * Factory for creating actions sensitive to the project selected
28  * as the main project in the UI.
29  * @author Petr Hrebejk
30  */

31 public class MainProjectSensitiveActions {
32
33     private MainProjectSensitiveActions() {}
34
35     /**
36      * Creates an action sensitive to the project currently selected as main in the UI.
37      * The action will invoke the given command on the main project. The action
38      * may be disabled when no project is marked as main, or it may prompt the user
39      * to select a main project, etc.
40      * @param command the command which should be invoked when the action is
41      * performed
42      * @param name display name of the action
43      * @param icon icon of the action; may be null, in which case the action will
44      * not have an icon
45      * @return an action sensitive to the main project
46      */

47     public static Action JavaDoc mainProjectCommandAction( String JavaDoc command, String JavaDoc name, Icon JavaDoc icon ) {
48         return Utilities.getActionsFactory().mainProjectCommandAction( command, name, icon );
49     }
50         
51     /**
52      * Creates an action sensitive to the project currently selected as main in the UI.
53      * When the action is invoked the supplied {@link ProjectActionPerformer#perform}
54      * will be called. The {@link ProjectActionPerformer#enable} method will
55      * be consulted when the main project changes to determine whether the
56      * action should or should not be enabled. If no main project is selected the
57      * project parameter in the callback will be null.
58      * @param performer callback class for enabling and performing the action
59      * @param name display name of the action
60      * @param icon icon of the action; may be null, in which case the action will
61      * not have an icon
62      * @return an action sensitive to the main project
63      */

64     public static Action JavaDoc mainProjectSensitiveAction( ProjectActionPerformer performer, String JavaDoc name, Icon JavaDoc icon ) {
65         return Utilities.getActionsFactory().mainProjectSensitiveAction( performer, name, icon );
66     }
67     
68 }
69
Popular Tags