public class MainProjectSensitiveActions extends Object
The precise definition of "selection" will depend on the UI implementation,
but will give preference to a main project compared to ProjectSensitiveActions
.
For example:
Project
or owner of a DataObject
)
if there is exactly one such.
(Currently adjusted to allow for loss of window focus.)
Modifier and Type | Method and Description |
---|---|
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.
|
public static Action mainProjectCommandAction(String command, String namePattern, Icon icon)
command
- the command which should be invoked when the action is
performednamePattern
- 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 iconpublic static Action mainProjectSensitiveAction(ProjectActionPerformer performer, String namePattern, Icon icon)
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.performer
- callback class for enabling and performing the actionnamePattern
- 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