Modifier and Type | Field and Description |
---|---|
private CommandQueue |
commandQueue
The command queue for executing commands.
|
private java.io.File |
file
The backing file.
|
private EventListenerList2<ShortcutsListener> |
listeners
The listeners to be notified.
|
private boolean |
modified
Whether the contents of
shortcuts have been modified from the
last saved state. |
private java.util.List<Shortcut> |
shortcuts
The shortcuts.
|
private SpellsManager |
spellsManager
The
SpellsManager instance to watch. |
Constructor and Description |
---|
Shortcuts(CommandQueue commandQueue,
SpellsManager spellsManager)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addShortcutsListener(ShortcutsListener listener)
Adds a
ShortcutsListener . |
void |
clearShortcuts()
Clears all defined shortcuts.
|
void |
executeShortcut(int index)
Executes a shortcut.
|
java.io.File |
getFile()
Returns the backing file.
|
private Shortcut |
getShortcut(int index)
Returns a shortcut.
|
boolean |
isModified()
Returns whether the shortcuts have been modified since creation or last
call to
resetModified() . |
java.util.Iterator<Shortcut> |
iterator() |
void |
removeShortcutsListener(ShortcutsListener listener)
Removes a
ShortcutsListener . |
void |
resetModified()
Resets the modified state.
|
void |
setCommandShortcut(int index,
java.lang.String command)
Sets a
Shortcut to a command. |
void |
setFile(java.io.File file)
Sets the backing file.
|
void |
setShortcut(int index,
Shortcut shortcut)
Sets a
Shortcut . |
void |
setSpellShortcut(int index,
Spell spell,
boolean cast)
Sets a
Shortcut to a spell. |
void |
setSpellShortcut(int index,
java.lang.String spellName,
boolean cast)
Sets a
Shortcut to a spell. |
void |
unsetShortcut(int index)
Unsets a
Shortcut . |
@NotNull private final CommandQueue commandQueue
@Nullable private java.io.File file
@NotNull private final EventListenerList2<ShortcutsListener> listeners
private boolean modified
shortcuts
have been modified from the
last saved state.@NotNull private final java.util.List<Shortcut> shortcuts
Shortcut
. Unset entries are set to
null
.@NotNull private final SpellsManager spellsManager
SpellsManager
instance to watch.public Shortcuts(@NotNull CommandQueue commandQueue, @NotNull SpellsManager spellsManager)
commandQueue
- the command queue for executing commandsspellsManager
- the instance to watchpublic void addShortcutsListener(@NotNull ShortcutsListener listener)
ShortcutsListener
.listener
- the listener to addpublic void clearShortcuts()
public void executeShortcut(int index)
index
- the shortcut index@Nullable public java.io.File getFile()
null
if unknown@Nullable private Shortcut getShortcut(int index)
index
- the shortcut indexnull
if the shortcut is unsetpublic boolean isModified()
resetModified()
.public java.util.Iterator<Shortcut> iterator()
iterator
in interface java.lang.Iterable<Shortcut>
public void removeShortcutsListener(@NotNull ShortcutsListener listener)
ShortcutsListener
.listener
- the listener to removepublic void resetModified()
public void setCommandShortcut(int index, @NotNull java.lang.String command)
Shortcut
to a command.index
- the shortcut indexcommand
- the command to executepublic void setFile(@Nullable java.io.File file)
file
- the backing file or null
if unknownpublic void setShortcut(int index, @Nullable Shortcut shortcut)
Shortcut
.index
- the shortcut indexshortcut
- the shortcut to set or null
to unsetpublic void setSpellShortcut(int index, @NotNull Spell spell, boolean cast)
Shortcut
to a spell.index
- the shortcut indexspell
- the spell to cast or invokecast
- whether the spell should be cast (true
) or invoked
(false
)public void setSpellShortcut(int index, @NotNull java.lang.String spellName, boolean cast)
Shortcut
to a spell.index
- the shortcut indexspellName
- the spell name to cast or invokecast
- whether the spell should be cast (true
) or invoked
(false
)public void unsetShortcut(int index)
Shortcut
.index
- the shortcut index