Class CutSelectedCommand
java.lang.Object
fr.istic.aco.editor.commands.CutSelectedCommand
- All Implemented Interfaces:
Command,CommandOriginator,Originator
The
CutSelectedCommand class implements the functionality for cutting the
currently selected text into the clipboard.-
Constructor Summary
ConstructorsConstructorDescriptionCutSelectedCommand(Engine engine, Recorder recorder, UndoManager undoManager) Constructs aCutSelectedCommandwith the specified dependencies. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()Executes the command by cutting the selected text into the clipboard.Returnsnullsince this command does not require saving state for the Memento pattern.voidsetMemento(Memento memento) Does nothing since there is no state to restore for this command.
-
Constructor Details
-
CutSelectedCommand
Constructs aCutSelectedCommandwith the specified dependencies.- Parameters:
engine- the text editing engine responsible for text editing actionsrecorder- the command recorder for saving and replaying the commandundoManager- the undo manager for handling undo and redo functionality
-
-
Method Details
-
getMemento
Returnsnullsince this command does not require saving state for the Memento pattern.- Specified by:
getMementoin interfaceOriginator- Returns:
- always
null, as this command does not save state
-
setMemento
Does nothing since there is no state to restore for this command.- Specified by:
setMementoin interfaceOriginator- Parameters:
memento- the memento object (ignored)
-
execute
public void execute()Executes the command by cutting the selected text into the clipboard.Before executing, the current state of the
Engineis stored in theUndoManageras a memento. The command is also saved in theRecorderfor replay functionality.
-