Veto Undo [message #518095] |
Wed, 03 March 2010 01:55  |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
[Updated on: Fri, 05 March 2010 16:35] by Moderator Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.04215 seconds