public class FileSensitiveActions extends Object
Modifier and Type | Method and Description |
---|---|
static Action |
fileCommandAction(String command,
String namePattern,
Icon icon)
Creates an action sensitive to the set of currently selected files.
|
static Action |
fileSensitiveAction(FileActionPerformer performer,
String namePattern,
Icon icon)
Creates an action sensitive to the set of currently selected files.
|
public static Action fileCommandAction(@NonNull String command, @NonNull String namePattern, @NullAllowed Icon icon)
ActionProvider
of
the selected project(s) and pass the proper context to it. Enablement of the
action depends on the behavior of the project's action provider.
As mentioned in ActionProvider
Javadoc, the action may also be enabled
without the participation of any project in case some globally registered ActionProvider
can provide an implementation.
(This since org.netbeans.modules.projectuiapi/1 1.37
.)
Shortcuts for actions are shared according to command, i.e. actions based on the same command will have the same shortcut.
command
- the command which should be invoked when the action is
performednamePattern
- pattern which should be used for determining the action's
name (label). It takes two parameters a la MessageFormat
: {0}
- number of selected files;
{1}
- name of the first file.icon
- icon of the action (or null)public static Action fileSensitiveAction(@NonNull FileActionPerformer performer, @NonNull String namePattern, @NullAllowed Icon icon)
FileActionPerformer.perform(org.openide.filesystems.FileObject)
on the action performer supplied
as a parameter. The action will only be enabled when exactly one
file is selected and FileActionPerformer.enable(org.openide.filesystems.FileObject)
returns true.FileActionPerformer.enable(org.openide.filesystems.FileObject)
will be called unless the file selection changes and someone is
listening to the action or explicitly asks for some of the action's values.performer
- an action performer.namePattern
- pattern which should be used for determining the action's
name (label). It takes two parameters a la MessageFormat
: {0}
- number of selected files;
{1}
- name of the first file.icon
- icon of the action (or null)