Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Veto Undo
Veto Undo [message #518095] Wed, 03 March 2010 01:55 Go to next message
Axel Gneiting is currently offline Axel GneitingFriend
Messages: 10
Registered: January 2010
Junior Member
I need to lock a specific region of a TextEditor from any edits.

For normal edits I can prevent this with an IAutoEditStrategy, but the problem is that I can't find a way to veto an undo from happening.

I looked at TextViewerUndoManager, but could not find a hook function or somethin like that. Is this even possible?
Re: Veto Undo [message #518171 is a reply to message #518095] Wed, 03 March 2010 11:01 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Axel,

Hopefully this isn't a stupid question, but given you can prevent a
protected region from being altered, doesn't that mean undo would never
affect such a region? Wouldn't it be exceedingly annoying to a user to
make a change and then not be able to undo it?


Axel Gneiting wrote:
> I need to lock a specific region of a TextEditor from any edits.
>
> For normal edits I can prevent this with an IAutoEditStrategy, but the
> problem is that I can't find a way to veto an undo from happening.
>
> I looked at TextViewerUndoManager, but could not find a hook function
> or somethin like that. Is this even possible?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Veto Undo [message #518201 is a reply to message #518095] Wed, 03 March 2010 13:32 Go to previous messageGo to next message
Axel Gneiting is currently offline Axel GneitingFriend
Messages: 10
Registered: January 2010
Junior Member
The undo command doesn't trigger an AutoEditStrategy, so no.

Ed Merks wrote on Wed, 03 March 2010 06:01
Wouldn't it be exceedingly annoying to a user to
make a change and then not be able to undo it?

No. This is for a theorem prover interface, that goes through the theorem statement by statement. It doesn't make sense to alter text in that processed region, so these statements should be locked from editing.

You could always reset the prover or go back a few steps and then undo things as you want.

Hard to explain, but believe me it makes perfect sense.

[Updated on: Wed, 03 March 2010 13:39]

Report message to a moderator

Re: Veto Undo [message #518940 is a reply to message #518201] Fri, 05 March 2010 14:06 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Axel Gneiting wrote:
> The undo command doesn't trigger an AutoEditStrategy, so no.
Right but given that the locked region cannot be changed, then it would
also not be affected by an undo, so why veto it? Anyway, if you really
need to do it, then simply disable the editor's undo and redo actions
(see org.eclipse.ui.texteditor.AbstractTextEditor.createUndoRedoA ctions()).

Dani
Re: Veto Undo [message #518996 is a reply to message #518095] Fri, 05 March 2010 16:17 Go to previous message
Axel Gneiting is currently offline Axel GneitingFriend
Messages: 10
Registered: January 2010
Junior Member
I want to implement a locked region and therefore I have to deny undos that affect that region.

How do I disable these actions? Wouldn't I need the action ids?

Edit: ITextEditorActionConstants.UNDO and ITextEditorActionConstants.REDO Smile

[Updated on: Fri, 05 March 2010 16:35]

Report message to a moderator

Previous Topic:cycle in classpath of two plugins results in error during feature export - not when using the plugin
Next Topic:Should I be able to create a "category" element in extension point "org.eclipse.ui.co
Goto Forum:
  


Current Time: Thu Apr 25 12:05:49 GMT 2024

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

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

Back to the top