Class Actions
- java.lang.Object
-
- ca.cgjennings.apps.arkham.project.Actions
-
public final class Actions extends java.lang.ObjectA registry of allTaskActions that can be performed.- Since:
- 2.1
- Author:
- Chris Jennings
-
-
Field Summary
Fields Modifier and Type Field Description static intPRIORITY_BUILDThis priority is used by actions that relate to executing, compiling, building or debugging code or running automated processes.static intPRIORITY_BUILD_SECONDARYThis priority is used by second tier build commands.static intPRIORITY_CLIPBOARDThis priority is used by clipboard operations (copy, paste).static intPRIORITY_DEBUGGING_TOOLThis priority is used by developer tools designed to help debug project extensions.static intPRIORITY_DEFAULTThe default action priority.static intPRIORITY_FILE_MANAGEMENTThe priority used by built-in file management actions, such as delete and rename.static intPRIORITY_FILE_MANAGEMENT_SECONDARYThe priority used by secondary file management actions, such as show folder.static intPRIORITY_IMPORT_EXPORTThis priority is used by tools that import, export, or convert file formats.static intPRIORITY_MAXThe maximum (highest) possible action priority.static intPRIORITY_MINThe minimum (lowest) possible action priority.static intPRIORITY_STANDARD_FIRSTThis priority is used by built-in actions that should normally appear at the top of a command list.static intPRIORITY_STANDARD_LASTThis 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 TaskActionfindActionByName(java.lang.String name)Returns the registered action with the given name, ornullif no action has this name.static intgetPriorityForAction(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 TaskActiongetUnspecializedAction(java.lang.String name)Returns the original, unspecialized instance of an action.static voidregister(TaskAction action)Registers a new action with the default priority.static voidregister(TaskAction action, int priority)Registers a new action.static voidunregister(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- ifactionisnulljava.lang.IllegalArgumentException- ifpriorityis not in the rangePRIORITY_MIN <= priority <= PRIORITY_MAXjava.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, ornullif 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
tawas registered - Throws:
java.lang.IllegalArgumentException- iftais 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
-
-