alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

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.CookieAction;
import org.netbeans.modules.struts.*;
/** Action sensitive to some cookie that does something useful.
 *
 * @author  mk115033
 */
public class SAXParseErrorAction 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.
        StrutsConfigDataNode node = (StrutsConfigDataNode) nodes[0].getCookie (StrutsConfigDataNode.class);
        ((StrutsConfigDataObject)node.getDataObject()).displayErrorMessage();
    }
    
    public String getName() {
        return NbBundle.getMessage(SAXParseErrorAction.class, "LBL_SAXParseErrorAction");
    }
    
    protected String iconResource() {
        return "org/netbeans/modules/struts/actions/SAXParseErrorActionIcon.gif";
    }
    
    public HelpCtx getHelpCtx() {
        return HelpCtx.DEFAULT_HELP;
        // If you will provide context help then use:
        // return new HelpCtx (SAXParseErrorAction.class);
    }
    
    /** Perform special enablement check in addition to the normal one.
    */
    protected boolean enable (Node[] nodes) {
        //if (! super.enable (nodes)) return false;
        StrutsConfigDataNode node = (StrutsConfigDataNode) nodes[0].getCookie (StrutsConfigDataNode.class);
        if (node!=null && ((StrutsConfigDataObject)node.getDataObject()).getJdomException()!=null) {
            return true;
        }
        return false;
    }
    
    /** 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 (SAXParseErrorAction.class, "HINT_Action"));
     * }
     */
    
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 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.