Can I detect when undo/redo event fired in editor?

Answered

Hello!

 

I am developing a plugin that custom editor show and edit partial string from entire xml document.
 

So, I made a Editor instance by EditorFactory.createEditor() method.

And I disabled undo/redo action of my editor with UndoUtil.disableUndoFor() method.

Because I want to undo just for original xml document, not my editor.

My scenario is that my editor pass a undo command to FileEditor connected original xml document by UndoManager.undo() method when undo event occured in my editor.

Like this:

Editor editor = EditorFactory.createEditor(...);
UndoUtil.disableUndoFor(editor.getDocument());
editor.addUndoEventListener(() -> {
  UndoManager.getInstance(project).undo(myFileEditor);
});

 

How can I detect a user execute undo/redo command in my editor?

 

I'm sorry that I'm not good at English.

Have a nice day!

0
1 comment

Hi,

I'm sorry, but I don't understand the problem.

Please describe it in detail: describe steps to reproduce and expected/actual results.

0

Please sign in to leave a comment.