Class MergeSettings
- java.lang.Object
-
- ca.cgjennings.apps.arkham.project.TaskAction
-
- ca.cgjennings.apps.arkham.project.TaskActionTree
-
- ca.cgjennings.apps.arkham.project.MergeSettings
-
- All Implemented Interfaces:
IconProvider
,java.lang.Iterable<TaskAction>
public class MergeSettings extends TaskActionTree
A task action that loads settings from a settings file into the shared settings or a game's settings. Useful when developing plug-ins that require certain settings to be available, such as DIY component scripts.- Since:
- 3.0
- Author:
- Chris Jennings
-
-
Constructor Summary
Constructors Constructor Description MergeSettings()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, TaskAction ta)
boolean
appliesToSelection(Member[] members)
Returnstrue
if this action is applicable to any of the specifiedMember
s.TaskAction
get(int index)
java.lang.String
getLabel()
Returns the human-readable name of this action.protected boolean
isAppliesToShortCircuited()
If this method returnstrue
, then the evaluation ofTaskActionTree.appliesToSelection(ca.cgjennings.apps.arkham.project.Member[])
andTaskActionTree.appliesTo(ca.cgjennings.apps.arkham.project.Project, ca.cgjennings.apps.arkham.project.Task, ca.cgjennings.apps.arkham.project.Member)
will assume that every child action performs the same test.java.util.Iterator<TaskAction>
iterator()
int
size()
-
Methods inherited from class ca.cgjennings.apps.arkham.project.TaskActionTree
add, appliesTo, findActionByName, getSectionIndex, indexOf, perform, remove, remove
-
Methods inherited from class ca.cgjennings.apps.arkham.project.TaskAction
applyToChildren, getActionName, getDescription, getIcon, performOnSelection, resolveTarget, toString
-
-
-
-
Method Detail
-
getLabel
public java.lang.String getLabel()
Description copied from class:TaskAction
Returns the human-readable name of this action.- Specified by:
getLabel
in classTaskAction
- Returns:
- the name used to create menu items for this action, localized if possible
-
add
public void add(int index, TaskAction ta)
- Overrides:
add
in classTaskActionTree
-
get
public TaskAction get(int index)
- Overrides:
get
in classTaskActionTree
-
iterator
public java.util.Iterator<TaskAction> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<TaskAction>
- Overrides:
iterator
in classTaskActionTree
-
size
public int size()
- Overrides:
size
in classTaskActionTree
-
appliesToSelection
public boolean appliesToSelection(Member[] members)
Description copied from class:TaskAction
Returnstrue
if this action is applicable to any of the specifiedMember
s. By overriding this, you can modify whether an action is listed depending on which other members are selected. For example, you could create a command that can only be applied to a singleton selection by checking the length ofmembers
and returningfalse
if it is not 1, and otherwise calling the super implementation.- Overrides:
appliesToSelection
in classTaskActionTree
- Parameters:
members
- a list of zero or more members- Returns:
true
is the action can be applied to at least one member
-
isAppliesToShortCircuited
protected boolean isAppliesToShortCircuited()
If this method returnstrue
, then the evaluation ofTaskActionTree.appliesToSelection(ca.cgjennings.apps.arkham.project.Member[])
andTaskActionTree.appliesTo(ca.cgjennings.apps.arkham.project.Project, ca.cgjennings.apps.arkham.project.Task, ca.cgjennings.apps.arkham.project.Member)
will assume that every child action performs the same test. Therefore, if the first child action tested does not apply, none of them can apply and the search ends immediately. Otherwise, every child action will be tested to see if it applies until at least one is found that does or they all fail.The base class returns
false
.This action tree returns true since all of its children represent settings instances with which a settings file could be merged.
- Overrides:
isAppliesToShortCircuited
in classTaskActionTree
- Returns:
true
-
-