0

In my current project I am working with a specific implementation of the jface ProjectionViewer attached to a TextEditor nested in a MultiPageEditor. My task is now to implement a custom reaction to Ctrl-Z, and from what I get this is best done by attaching a specific implementation of IUndoHandler to the Viewer, all of that would be no problem.

But, pressing Ctrl-Z while having that TextEditor focused fails to cause any reaction that would be expected. While clicking "Undo Typing" in the context menu, which displays the associated key combination Ctrl-Z causes the TextViewerUndoManager.DocumentUndoListener's notification method is called, no line of code in the TextViewerUndoManager is touched when pressing Ctrl-Z.

As a possible source of this problem I assumed that maybe a handler might be defined for this key combination in an extension point, since I had previously experimented with this mechanism, but the plugin.xml does not define any key combinations nor undo handlers apart from one that is associated with a special context menu for a different widget.

It might be worth to note that Ctrl-C and Ctrl-V work as intended.

I need to find out what happens when Ctrl-Z is pressed and why nothing is relayed to the TextViewerUndoManager.

It would be very helpful if someone could describe the progress how eclipse handles these key combinations normally and decides which command is appropriate.

Thanks in advance

Sevi Vöst
  • 55
  • 3

1 Answers1

0

Cntrl+Z- undo is processed using OperationHistorySupport. Look at UndoActionHandler class.

Binding support is implemented using keydown event filter using WorkbenchKeyboard ( all keydown events first filtered using this class. this is how BindingService was implemented). This will figure out correspond command for the key binding.

DocumentUndoManager.UndoableTextChange is where undo operation is handled.

sambi reddy
  • 3,065
  • 1
  • 13
  • 10
  • Regarding the key binding, it seems like an old extension was still overriding it. The hint to the UndoActionHandler did the trick. Thank you very much. – Sevi Vöst Sep 03 '12 at 12:17