org.netbeans.modules.projectuiapi/1 1.51.1 8

org.netbeans.spi.project.ui.support
Class MainProjectSensitiveActions

java.lang.Object
  extended by org.netbeans.spi.project.ui.support.MainProjectSensitiveActions

public class MainProjectSensitiveActions
extends Object

Factory for creating actions sensitive to the project selected as the main project in the UI.

The precise definition of "selection" will depend on the UI implementation, but will give preference to a main project compared to ProjectSensitiveActions. For example:

  1. The main project, if one is set.
  2. The project mentioned in the global selection (as Project or owner of a DataObject) if there is exactly one such. (Currently adjusted to allow for loss of window focus.)
  3. The open project, if there is just one.


Method Summary
static Action mainProjectCommandAction(String command, String namePattern, Icon icon)
          Creates an action sensitive to the project currently selected as main in the UI.
static Action mainProjectSensitiveAction(ProjectActionPerformer performer, String namePattern, Icon icon)
          Creates an action sensitive to the project currently selected as main in the UI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

mainProjectCommandAction

public static Action mainProjectCommandAction(String command,
                                              String namePattern,
                                              Icon icon)
Creates an action sensitive to the project currently selected as main in the UI. The action will invoke the given command on the main project. The action may be disabled when no project is marked as main, or it may prompt the user to select a main project, etc.

Parameters:
command - the command which should be invoked when the action is performed
namePattern - a pattern which should be used for determining the action's name (label). It takes two parameters a la MessageFormat: {0} - number of selected projects (or -1 if a main project is set); {1} - name of the first project (if >0).
icon - icon of the action; may be null, in which case the action will not have an icon
Returns:
an action sensitive to the main project

mainProjectSensitiveAction

public static Action mainProjectSensitiveAction(ProjectActionPerformer performer,
                                                String namePattern,
                                                Icon icon)
Creates an action sensitive to the project currently selected as main in the UI. When the action is invoked the supplied ProjectActionPerformer.perform(org.netbeans.api.project.Project) will be called. The ProjectActionPerformer.enable(org.netbeans.api.project.Project) method will be consulted when the main project changes to determine whether the action should or should not be enabled. If no main project is selected the project parameter in the callback may be null.

Parameters:
performer - callback class for enabling and performing the action
namePattern - a pattern which should be used for determining the action's name (label). It takes two parameters a la MessageFormat: {0} - number of selected projects (or -1 if a main project is set); {1} - name of the first project (if >0).
icon - icon of the action; may be null, in which case the action will not have an icon
Returns:
an action sensitive to the main project

org.netbeans.modules.projectuiapi/1 1.51.1 8

Built on December 5 2011.  |  Portions Copyright 1997-2011 Sun Microsystems, Inc. All rights reserved.