Jump to: navigation, search

E4/Macros

< E4

Keyboard macros provide a way to record and replay keyboard sequences. Keyboard macros are distinct from scripting and UI event replay. For a scripting solution for Eclipse, please see the Eclipse Advanced Scripting Environment (EASE), and for UI event replay see SWTBot.

Installation

The plugin is currently hosted in the E4 incubator and the latest snapshot is available from the p2 repository at:

http://download.eclipse.org/e4/snapshots/org.eclipse.e4.ui/

The implementation is specific to the Eclipse 4.x stream and has only been tested with Eclipse 4.7 (Oxygen).

Usage

A macro is recorded by using the record button in the toolbar and replayed using the playback button (alternatively, bind the commands 'Toggle Macro Record' and 'Playback Last Macro' to some keybinding in the Keys preferences page).

Macro recording is only available for the editor which was active when record started -- likewise, it is only replayed to the editor active when playback was initialized.

All keyboard input in the editor is recorded, although if the key combination activates an Eclipse Command, the command is recorded instead.

Features

  • Action for toggle record and playback last macro (added to toolbar).
  • Record and playback Eclipse Commands triggered in the KeyBindingDispatcher.
  • Record and playback keystrokes in the text editor.
  • Persist and load the last recorded macro to/from disk.
  • Other plugins may participate in the record/playback (through the org.eclipse.e4.core.macros.macroStateListeners extension point).
  • Clients may skip the recording of eclipse commands through the org.eclipse.e4.core.macros.commandHandling extension point.
  • Visual feedback on what's being recorded done through the status bar.
  • Notify that the recording is not working if the user changes to another editor or tries to use the find dialog.

Limitations

Scope

Macros only target the current editor, so, if some action would require interacting with another widget (such as a dialog or pop up), such interaction will not be recorded and the command may not be recorded at all if the result of the command opens a different editor.

Mouse interaction

No mouse interaction is recorded, although if the mouse interaction results in some eclipse command, that command will be recorded (provided that the current editor doesn't change).

Dialogs and pop ups

No dialog/pop up interaction is recorded, although if the interaction results in some eclipse command, that command will be recorded (provided that the current editor doesn't change).

Find Dialog

Currently using the find dialog will not work (as any other dialog) -- as actions in the find dialog don't generate eclipse commands, users should use the Incremental Find (Ctrl+J) and Find Next (Ctrl+K) commands instead.

Code completion

Code completion is disabled in the editor where the macro record/playback takes place.

Future work

  • Make dialogs aware of the macro record mode (for instance, the for the find dialog to have actions that can be replayed, either it needs to issue Eclipse commands, provide callbacks for listener to record commands or be macro aware itself, likewise, applying a code-completion could simply save the result of applying the code-completion in the macro).
  • Persist macros under a given name and playback such macros.
  • Replay a macro X times (or until the end of the file is reached).
  • Edit a saved macro.

Contributing Fixes and Improvements

The source is available at:

http://git.eclipse.org/c/e4/org.eclipse.e4.ui.git/

in the master branch as

 bundles/org.eclipse.e4.core.macros
 bundles/org.eclipse.e4.ui.macros
 bundles/org.eclipse.ui.workbench.texteditor.macros
 tests/org.eclipse.e4.ui.macros.tests
 features/org.eclipse.e4.ui.macros.feature

Please submit change requests using Gerrit; see the Platform/UI "How to Contribute" page for details.

Please submit bugs via Bugzilla against e4/UI with "[macros]" in the description (link).

Please direct questions to the e4-dev mailing list.