Class Actions
- java.lang.Object
-
- ca.cgjennings.apps.arkham.project.Actions
-
public final class Actions extends java.lang.Object
A registry of allTaskAction
s that can be performed.- Since:
- 2.1
- Author:
- Chris Jennings
-
-
Field Summary
Fields Modifier and Type Field Description static int
PRIORITY_BUILD
This priority is used by actions that relate to executing, compiling, building or debugging code or running automated processes.static int
PRIORITY_BUILD_SECONDARY
This priority is used by second tier build commands.static int
PRIORITY_CLIPBOARD
This priority is used by clipboard operations (copy, paste).static int
PRIORITY_DEBUGGING_TOOL
This priority is used by developer tools designed to help debug project extensions.static int
PRIORITY_DEFAULT
The default action priority.static int
PRIORITY_FILE_MANAGEMENT
The priority used by built-in file management actions, such as delete and rename.static int
PRIORITY_FILE_MANAGEMENT_SECONDARY
The priority used by secondary file management actions, such as show folder.static int
PRIORITY_IMPORT_EXPORT
This priority is used by tools that import, export, or convert file formats.static int
PRIORITY_MAX
The maximum (highest) possible action priority.static int
PRIORITY_MIN
The minimum (lowest) possible action priority.static int
PRIORITY_STANDARD_FIRST
This priority is used by built-in actions that should normally appear at the top of a command list.static int
PRIORITY_STANDARD_LAST
This priority is used by built-in actions that should normally appear at the bottom of a command list.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TaskAction
findActionByName(java.lang.String name)
Returns the registered action with the given name, ornull
if no action has this name.static int
getPriorityForAction(TaskAction ta)
Returns the current priority of a registered action.static TaskAction[]
getRootActions()
Return an array of all actions registered at the root level (that is, the root of action trees and the most specialized of specialized actions).static TaskAction
getUnspecializedAction(java.lang.String name)
Returns the original, unspecialized instance of an action.static void
register(TaskAction action)
Registers a new action with the default priority.static void
register(TaskAction action, int priority)
Registers a new action.static void
unregister(TaskAction action)
Unregisters a registered task action.
-
-
-
Field Detail
-
PRIORITY_MAX
public static final int PRIORITY_MAX
The maximum (highest) possible action priority.- See Also:
- Constant Field Values
-
PRIORITY_DEFAULT
public static final int PRIORITY_DEFAULT
The default action priority.- See Also:
- Constant Field Values
-
PRIORITY_MIN
public static final int PRIORITY_MIN
The minimum (lowest) possible action priority.- See Also:
- Constant Field Values
-
PRIORITY_FILE_MANAGEMENT
public static final int PRIORITY_FILE_MANAGEMENT
The priority used by built-in file management actions, such as delete and rename.- See Also:
- Constant Field Values
-
PRIORITY_FILE_MANAGEMENT_SECONDARY
public static final int PRIORITY_FILE_MANAGEMENT_SECONDARY
The priority used by secondary file management actions, such as show folder.- See Also:
- Constant Field Values
-
PRIORITY_STANDARD_FIRST
public static final int PRIORITY_STANDARD_FIRST
This priority is used by built-in actions that should normally appear at the top of a command list. (Use a higher value to ensure your action has greater priority.) This is usually the default "Open" action, if it applies.- See Also:
- Constant Field Values
-
PRIORITY_BUILD
public static final int PRIORITY_BUILD
This priority is used by actions that relate to executing, compiling, building or debugging code or running automated processes. The built-in commands to run and debug scripts use this priority.- See Also:
- Constant Field Values
-
PRIORITY_BUILD_SECONDARY
public static final int PRIORITY_BUILD_SECONDARY
This priority is used by second tier build commands. For example, Make Deck uses this so that it falls after the factory automation commands.- See Also:
- Constant Field Values
-
PRIORITY_CLIPBOARD
public static final int PRIORITY_CLIPBOARD
This priority is used by clipboard operations (copy, paste).- See Also:
- Constant Field Values
-
PRIORITY_IMPORT_EXPORT
public static final int PRIORITY_IMPORT_EXPORT
This priority is used by tools that import, export, or convert file formats.- See Also:
- Constant Field Values
-
PRIORITY_STANDARD_LAST
public static final int PRIORITY_STANDARD_LAST
This priority is used by built-in actions that should normally appear at the bottom of a command list.- See Also:
- Constant Field Values
-
PRIORITY_DEBUGGING_TOOL
public static final int PRIORITY_DEBUGGING_TOOL
This priority is used by developer tools designed to help debug project extensions.- See Also:
- Constant Field Values
-
-
Method Detail
-
register
public static void register(TaskAction action)
Registers a new action with the default priority. Equivalent toregister( action, Actions.PRIORITY_DEFAULT )
.- Parameters:
action
- the action to register
-
register
public static void register(TaskAction action, int priority)
Registers a new action. If the action was already registered, it will be re-registered at the new priority. An action cannot be registered if it has the same name (as returned byTaskAction.getActionName()
) as an already-registered action.- Parameters:
action
- the action to be registeredpriority
- the priority at which to register the action- Throws:
java.lang.NullPointerException
- ifaction
isnull
java.lang.IllegalArgumentException
- ifpriority
is not in the rangePRIORITY_MIN <= priority <= PRIORITY_MAX
java.lang.IllegalArgumentException
- if an action with this action's name is already registered (other than this action)
-
unregister
public static void unregister(TaskAction action)
Unregisters a registered task action. If the action is not registered, this method does nothing.- Parameters:
action
- the action to be unregistered
-
findActionByName
public static TaskAction findActionByName(java.lang.String name)
Returns the registered action with the given name, ornull
if no action has this name. Each action must have a unique name, which is returned byTaskAction.getActionName()
.- Parameters:
name
- the action name to search for- Returns:
- the registered action with the given name, or
null
-
getUnspecializedAction
public static TaskAction getUnspecializedAction(java.lang.String name)
Returns the original, unspecialized instance of an action. If no action with the given name is registered, returnsnull
. This is useful if you need to call a method on a task action by casting it to its actual type. For example:((Open) Actions.getUnspecializedAction( "open" )).registerOpener( myOpener );
- Parameters:
name
- the name of the action to find the unspecialized instance of- Returns:
- the originally registered action with the given name, or
null
-
getPriorityForAction
public static int getPriorityForAction(TaskAction ta)
Returns the current priority of a registered action.- Parameters:
ta
- the action to look up the priority of- Returns:
- the priority at which
ta
was registered - Throws:
java.lang.IllegalArgumentException
- ifta
is not a registered action
-
getRootActions
public static TaskAction[] getRootActions()
Return an array of all actions registered at the root level (that is, the root of action trees and the most specialized of specialized actions).- Returns:
- an array of the basic actions available for project users
-
-