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

/*
 *                 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-2000 Sun
 * Microsystems, Inc. All Rights Reserved.
 */

package org.netbeans.modules.vcscore.actions;

import org.openide.filesystems.FileObject;

/**
 *  OBject that needs to be return as an attribute of all fileobjects that 
 * support the Abstract/GeneralCommandAction framework and all the actions that subclass these two classes.
 * The name of the attribute is in AbstractCommandAction.VCS_ACTION_ATTRIBUTE.
 * @author  Milos Kleint
 */
public abstract class CommandActionSupporter {

    /** Creates new CommandActionSupporter */
    public CommandActionSupporter() {
    }

    /**
     * GeneralCommandAction asks the supporter during the enabled(Node[] nodes) method.
     * The supporter should return if the specified fileobjects are supported for the specified action.
     * @param action The action that initiated this request.
     * @param fileObjects Array of fileObjects extracted from the Activated nodes.
     */
    public abstract boolean isEnabled(GeneralCommandAction action, FileObject[] fileObjects);
    
    /**
     * GeneralCommandAction tells the supporter during the performsAction(Node[] nodes) method to perform the action on the specified FileObjects.
     * This is called from GeneralCommandAction in AWT thread.
     * RequestProcessor needs to be used to leave the AWT thread if necessary.
     * @param action The action that initiated this request.
     * @param fileObjects Array of fileObjects extracted from the Activated nodes.
     */
    public abstract void performAction(GeneralCommandAction action, FileObject[] fileObjects);
    
    /**
     * If the supporter enables the action, it can then add supporter-specific 
     * description to the toolbar tooltip. (use with caution.) Experimental
     */
    public String getToolBarDisplayName(GeneralCommandAction action) {
        return action.getName();
    }

    /**
     * If the supporter enables the action, it can then add supporter-specific 
     * description to the menu name. (use with caution.) Experimental
     */
    
    public String getMenuDisplayName(GeneralCommandAction action) {
        return action.getName();
    }

    /**
     * If the supporter enables the action, it can then add supporter-specific 
     * description to the popup menu name. (use with caution.) Experimental
     */
    
    public String getPopupDisplayName(GeneralCommandAction action) {
        return action.getName();
    }
    
    
}
... 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.