KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > spi > palette > PaletteActions


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
21 package org.netbeans.spi.palette;
22
23 import javax.swing.Action JavaDoc;
24 import org.openide.util.Lookup;
25
26 /**
27  * <p>An interface implemented by palette clients to provide custom actions
28  * for popup menus and actions for import of new items.</p>
29  *
30  * @author S. Aubrecht.
31  */

32 public abstract class PaletteActions {
33
34     /**
35      * @return An array of action that will be used to construct buttons for import
36      * of new palette item in palette manager window.
37      *
38      */

39     public abstract Action JavaDoc[] getImportActions();
40     
41     /**
42      * @return Custom actions to be added to the top of palette's default popup menu.
43      */

44     public abstract Action JavaDoc[] getCustomPaletteActions();
45     
46     /**
47      * @param category Lookup representing palette's category.
48      *
49      * @return Custom actions to be added to the top of default popup menu for the given category.
50      */

51     public abstract Action JavaDoc[] getCustomCategoryActions( Lookup category );
52     
53     /**
54      * @param item Lookup representing palette's item.
55      *
56      * @return Custom actions to be added to the top of the default popup menu for the given palette item.
57      */

58     public abstract Action JavaDoc[] getCustomItemActions( Lookup item );
59     
60     
61     /**
62      * @param item Lookup representing palette's item.
63      *
64      * @return An action to be invoked when user double-clicks the item in the
65      * palette (e.g. insert item at editor's default location).
66      * Return null to disable preferred action for this item.
67      */

68     public abstract Action JavaDoc getPreferredAction( Lookup item );
69     
70     /**
71      * An action that will be invoked as part of the palette refresh logic,
72      * for example when user chooses "Refresh" in palette's popup menu. Can be null.
73      * The action properties (label, icon) are not displayed to the user, the Palette module
74      * will provide its own.
75      * @return Custom refresh action or null.
76      * @since 1.9
77      */

78     public Action JavaDoc getRefreshAction() {
79         return null;
80 }
81 }
82
Popular Tags