Editor actions - e-ucm/ead GitHub Wiki
An editor action encapsulates an editor task which can be invoked from different contexts. For example, "undo", "redo", "save as", "open" and "run" will all be actions. Notice that the some actions may require additional input from the user before actually doing much; for instance, "save as" will likely pop up a dialog before saving anything.
Actions are the only first line of interaction, exposing editor APIs to the GUI user. They delegate all the actual heavy lifting to the actual editor APIs.
All actions extend EditorAction, and must implement void perform(Object... args);, which contains the code to execute the action. Each action can accept an undetermined number of arguments.
All actions invocations must be done through the controller, using the method Controller#action(String, Object...), where the first argument is the name of the action and the second is an array with arguments for the action.
Actions can be serialized, and a stack of SerializedActions is kept on memory. See this article for more details.
You can see the full list of actions in the package actions. However, here you have the list grouped logically:
Game project properties
Project management
- Delete a project from disk - used in mockup only
- Create a new project
- Load a project from disk
- Save the project to disk. When this action is invoked, all json files are deleted from the game project and they are saved clean afterwards.
Scenes
- Add a new scene. Adds a blank scene to the list and opens it for edition (see change the scene edited).
- Delete a scene.
- Set the initial scene. This is the scene the game starts with. On the editor, it is currently marked with an orange "1".
- Edit contents of a scene note. Currently only used in mockup. Edit the contents of the note attached to a scene.
- Rename a scene. Edits the "name" of a scene, which is not its id, but a simple String the editor uses for a user-friendly presentation. Has no actual effect in the game whatsoever.
- Reorder scenes in the list. Changes the order in which the scenes are presented in the editor. Has no effect in how scenes actually appear on the game.
Scene elements
- Add a scene element to a scene
- Delete scene element
- Place the scene element in a different location. Changes the x,y transformation of the scene element in the scene.
- Rotate a scene element
- Scale a scene element
- Change the internal coordinates origin for this scene element. The "origin" is the point used as a reference for transformations of the scene element (e.g. rotation).
Edit operations
UI and application operations
System operations
These actions are not user-triggered but automatically generated by the system.
- Choosing a file. It is created every time the user is requested to select a file (for example, when Open Game or Export Game are invoked).
- Choose a folder. Similar to the previous one, but for folder selection.
- Changes the current view. This type of action is not user-triggered, it is just created every time the current view changes (see more details on Views here).
- Show a dialog
- Show view. Don't know the difference between this and ChangeView.
- Change a user preference.
- Change the scene being edited
- Update recents