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
Eclipse UserFriend
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
Eclipse UserFriend
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?
Re: Veto Undo [message #518201 is a reply to message #518095] Wed, 03 March 2010 13:32 Go to previous messageGo to next message
Eclipse UserFriend
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] by Moderator

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
Eclipse UserFriend
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
Eclipse UserFriend
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] by Moderator

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: Sun Feb 09 09:11:01 GMT 2025

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

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

Back to the top