public class ActionUtils
extends java.lang.Object
Action
related functions.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_ACCELERATOR_KEY
Action key to store the default shortcut. |
static java.lang.String |
NO_SHORTCUT
The shortcut description for actions without shortcuts.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getActionCategory(javax.swing.Action action)
Returns an
Action 's category. |
static java.lang.String |
getActionDescription(javax.swing.Action action)
Returns the description for an
Action . |
static javax.swing.Icon |
getActionIcon(javax.swing.Action action)
Returns an
Icon associated with the action. |
static java.lang.String |
getActionId(javax.swing.Action action)
Returns an
Action 's ID string. |
static java.lang.String |
getActionName(javax.swing.Action action)
Returns the name of an
Action . |
static javax.swing.KeyStroke |
getAlternativeShortcut(javax.swing.Action action)
Returns the alternative shortcut of an
Action . |
static javax.swing.KeyStroke |
getShortcut(javax.swing.Action action)
Returns the shortcut of an
Action . |
static java.lang.String |
getShortcutDescription(javax.swing.Action action,
java.lang.String key)
Returns a description of the shortcut of an
Action . |
static javax.swing.Action |
newAction(net.sf.japi.swing.action.ActionBuilder actionBuilder,
java.lang.String category,
EditorAction editorAction,
java.lang.String key)
Creates a new
Action instance. |
static javax.swing.Action |
newToggleAction(net.sf.japi.swing.action.ActionBuilder actionBuilder,
java.lang.String category,
EditorAction editorAction,
java.lang.String key)
Creates a new
Action instance. |
static void |
setActionShortcut(javax.swing.Action action,
javax.swing.KeyStroke shortcut)
Sets the shortcut of an
Action . |
@NotNull public static final java.lang.String NO_SHORTCUT
@NotNull public static final java.lang.String DEFAULT_ACCELERATOR_KEY
Action
key to store the default shortcut.@NotNull public static java.lang.String getActionName(@NotNull javax.swing.Action action)
Action
.action
- the action@NotNull public static java.lang.String getActionId(@NotNull javax.swing.Action action)
Action
's ID string.action
- the actionjava.lang.IllegalArgumentException
- if the action does not define an ID
string@NotNull public static java.lang.String getActionDescription(@NotNull javax.swing.Action action)
Action
.action
- the action@Nullable public static javax.swing.KeyStroke getShortcut(@NotNull javax.swing.Action action)
Action
.action
- the actionnull
@Nullable public static javax.swing.KeyStroke getAlternativeShortcut(@NotNull javax.swing.Action action)
Action
.action
- the actionnull
public static void setActionShortcut(@NotNull javax.swing.Action action, @Nullable javax.swing.KeyStroke shortcut)
Action
.action
- the actionshortcut
- the shortcut or null
to remove it@NotNull public static java.lang.String getShortcutDescription(@NotNull javax.swing.Action action, @NotNull java.lang.String key)
Action
. Returns
NO_SHORTCUT
if the action defines no shortcut.action
- the actionkey
- the action key to query@Nullable public static javax.swing.Icon getActionIcon(@NotNull javax.swing.Action action)
Icon
associated with the action.action
- the actionnull
@NotNull public static javax.swing.Action newAction(@NotNull net.sf.japi.swing.action.ActionBuilder actionBuilder, @NotNull java.lang.String category, @NotNull EditorAction editorAction, @NotNull java.lang.String key)
Action
instance. It is basically the same as ActionBuilder.createAction(boolean, String, Object)
except that the
category is set.actionBuilder
- the action builder to usecategory
- the category to seteditorAction
- the object which defines the action methodkey
- the action's key@NotNull public static javax.swing.Action newToggleAction(@NotNull net.sf.japi.swing.action.ActionBuilder actionBuilder, @NotNull java.lang.String category, @NotNull EditorAction editorAction, @NotNull java.lang.String key)
Action
instance. It is basically the same as ActionBuilder.createToggle(boolean, String, Object)
except that the
category is set.actionBuilder
- the action builder to usecategory
- the category to seteditorAction
- the object which defines the action methodkey
- the action's key@NotNull public static java.lang.String getActionCategory(@NotNull javax.swing.Action action)
Action
's category.action
- the action