Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Undo/Redo keyboard shortcuts in a JFace dialog
Undo/Redo keyboard shortcuts in a JFace dialog [message #1385882] Wed, 11 June 2014 22:52 Go to next message
Marian Schedenig is currently offline Marian SchedenigFriend
Messages: 18
Registered: July 2012
Junior Member
I have a plug-in that uses the workbench's operation history for operations affecting its model, so undo/redo works nicely in the plugin's own view.

But in certain situations, the plugin opens a modal dialog (via a command handler triggered by a keyboard shortcut), and that dialog should provide undo and redo as well. I can *call* the operations just fine via the operation history, but I have trouble binding them to the correct keyboard shortcuts, since I haven't found a way to hook into the global undo/redo actions from a dialog, or grab the configured shortcuts from the config.

I could of course just hardcode the keys. That works reasonably well for M1+Z as the undo shortcut, but redo already gets more complicated as it differs between platforms. Plus if the user reconfigured his shortcuts, my hardcoded key combinations would of course be blissfully ignorant of it.

Is there a standard way to deal with this? Or if not, is there any way I can, from inside a plugin's Activator, grab the configured keyboard shortcuts for these operations?
Re: Undo/Redo keyboard shortcuts in a JFace dialog [message #1396638 is a reply to message #1385882] Tue, 08 July 2014 15:33 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 876
Registered: January 2012
Senior Member

Hi Marian.

The undo/redo handlers are configured on a per-part basis. You'll need to provide your own custom handlers for the org.eclipse.ui.edit.undo and .redo that are applicable for your dialog.

Brian.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: Undo/Redo keyboard shortcuts in a JFace dialog [message #1818271 is a reply to message #1396638] Wed, 11 December 2019 09:38 Go to previous message
Tamas Miklossy is currently offline Tamas MiklossyFriend
Messages: 104
Registered: February 2016
Senior Member
I also encountered this problem recently.

Is there any examples / detailed description how to add Undo/Redo functionality with keyboard shortcuts (CTRL+Z CTRL+Y) to JFace dialogs?

Thanks for your answer in advance!
Tamás
Previous Topic:Can not register multiple widget for the same menuContribution ID
Next Topic:move RuleBasedScanner to org.eclipse.text?
Goto Forum:
  


Current Time: Fri Aug 14 18:30:52 GMT 2020

Powered by FUDForum. Page generated in 0.02124 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top