package Templates.API_Support.Actions_API;

import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.CookieAction;

/** Action sensitive to some cookie that does something useful.
 *
 * @author __USER__
 */
public class __Sample_cookie__Action extends CookieAction {

    protected Class[] cookieClasses() {
        return new Class[] {/* SourceCookie.class */};
    }

    protected int mode() {
        return MODE_EXACTLY_ONE;
        // return MODE_ALL;
    }

    protected void performAction(Node[] nodes) {
        // do work based on the current node selection, e.g.:
        // SourceCookie cookie = (SourceCookie)nodes[0].getCookie(SourceCookie.class);
        // etc.
    }

    public String getName() {
        return NbBundle.getMessage(__NAME__.class, "LBL_Action");
    }

    protected String iconResource() {
        return "__PACKAGE_AND_NAME_SLASHES__Icon.gif";
    }

    public HelpCtx getHelpCtx() {
        return HelpCtx.DEFAULT_HELP;
        // If you will provide context help then use:
        // return new HelpCtx(__NAME__.class);
    }

    protected boolean asynchronous() {
        // performAction(Node[]) should run in event thread
        return false;
    }

    /** Perform special enablement check in addition to the normal one.
    protected boolean enable(Node[] nodes) {
	if (!super.enable(nodes)) return false;
	if (...) ...;
    }
    */

    /** Perform extra initialization of this action's singleton.
     * PLEASE do not use constructors for this purpose!
    protected void initialize() {
	super.initialize();
	putProperty(Action.SHORT_DESCRIPTION, NbBundle.getMessage(__NAME__.class, "HINT_Action"));
    }
    */

}
