Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-ui-dev] Macro recording capabilities

Hi All,

I'm in the process of implementing macro recording capabilities (i.e.: https://bugs.eclipse.org/bugs/show_bug.cgi?id=8519) -- I already have some working code, but I thought it'd be nice to gather some feedback before actually submitting something.

So, first, I already took a good look at the existing engines. Namely the one in https://wiki.eclipse.org/E4/Macros and http://practicalmacro.sourceforge.net and ultimately decided on a different approach which does things a bit different (learning from the issues on those implementations)...

Now, IMHO it's not possible to create a separate plugin which can take full responsibility for recording keystrokes and playing them back in the hope that things will work reliably (both plugins try to make everything from the outside and have too many issues because of that).

Things break because editor plugins were not made with this in mind (so, for instance, adding a quote in the java editor automatically adds a new quote and a record/playback with both of the passed plugins will not work and things such as code completion will utterly break the macro too as it's not possible to play back considering that -- at least not until the actual code-completion knows about the current macro record state).

So, my idea is starting the other way around: the initial plan is entering in a "dumb" mode in the editor so that all which is done can be directly replayed without any surprises (i.e.: disable code-completion, smart insert mode and everything that could interfere with the macro), only let "whiletisted" actions go through and record keystrokes for a playback later on just for the editor.

After this is in place, and things work reliably at this level, it should be possible to expand it and allow more advanced things (such as code-completion, find, etc), but this will be done as a second step after the first one works reliably and things should be implemented in the actual level that does it (for instance, the find action should be responsible for issuing a find command to the macro engine when it does a find, not the other way around).

Now, for this to work, the idea is creating::

org.eclipse.e4.core.macros
org.eclipse.e4.ui.macros

and actually making changes in the AbstractTextEditor and KeyBindingDispatcher to be aware of the macros (so, those will be changed so that they are actually responsible for providing the record and playback for the respective components, and other components may decide to participate later on as needed).

So, hopefully you'll see this as a workable approach... feedback/ideas are welcome ;)

Best Regards,

Fabio

Back to the top