KickJava   Java API By Example, From Geeks To Geeks.

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


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 file-sensitive actions.
28  * @author Petr Hrebejk
29  */

30 public class FileSensitiveActions {
31
32     private FileSensitiveActions() {}
33
34     /**
35      * Creates an action sensitive to the set of currently selected files.
36      * When performed the action will call the given command on the {@link org.netbeans.spi.project.ActionProvider} of
37      * the selected project(s) and pass the proper context to it. Enablement of the
38      * action depends on the behavior of the project's action provider.<BR>
39      * Shortcuts for actions are shared according to command, i.e. actions based on the same command
40      * will have the same shortcut.
41      * @param command the command which should be invoked when the action is
42      * performed
43      * @param namePattern pattern which should be used for determining the action's
44      * name (label). It takes two parameters a la {@link java.text.MessageFormat}: <code>{0}</code> - number of selected projects;
45      * <code>{1}</code> - name of the first project.
46      * @param icon icon of the action (or null)
47      * @return newly created file-sensitive action
48      */

49     public static Action JavaDoc fileCommandAction( String JavaDoc command, String JavaDoc namePattern, Icon JavaDoc icon ) {
50         return Utilities.getActionsFactory().fileCommandAction( command, namePattern, icon );
51     }
52     
53 }
54
Popular Tags