|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2002 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.struts.actions; import org.openide.nodes.Node; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; import org.openide.util.actions.NodeAction; /** Action sensitive to the node selection that does something useful. * Consider using a cookie action instead if you can define what the * action is applicable to in terms of cookies. * @author mk115033 */ public class EditAction extends NodeAction { protected void performAction(Node[] nodes) { // do work based on the current node selection, e.g.: //MyKindOfNode node = (MyKindOfNode) nodes[0]; // ... // Note that casting to a type of node is often not the right // solution; try using a CookieAction, unless it is really the // node itself and not the underlying data that needs to be // considered. Also remember that some tests on nodes (casts // as well as reorderability of children etc.) will not work // when applied to filter nodes, whereas cookies will. } protected boolean enable(Node[] nodes) { // e.g.: //return nodes.length == 1 && nodes[0] instanceof MyKindOfNode; return true; } public String getName() { return NbBundle.getMessage(EditAction.class, "LBL_EditAction"); } protected String iconResource() { return "org/netbeans/modules/struts/actions/EditActionIcon.gif"; } public HelpCtx getHelpCtx() { return HelpCtx.DEFAULT_HELP; // If you will provide context help then use: // return new HelpCtx (EditAction.class); } /** 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 (EditAction.class, "HINT_Action")); * } */ } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.