Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Non-undoable document edits
Non-undoable document edits [message #336253] Wed, 03 June 2009 13:14 Go to next message
Eclipse User
Originally posted by: jcarroll.us.ibm.com

Hello,

I have a RCP app which uses a customised TextEditor for editing
certain types of files. For some calls I make to Document.replace() I
would like to make this text replacement non-undoable.

I have tried using an extension of AbstractOperation to execute my
non-undoable text replacement within the document and then made the
AbstractOperation return false for canUndo(), but I can still right
click within the TextEditor and select "Undo Typing" which undoes my
text replacement which is not what I want.

So is there a way for me to call Document.replace() to replace text
which can not be undone via the global undo/redo mechanism?

thanks,

John.
Re: Non-undoable document edits [message #336300 is a reply to message #336253] Fri, 05 June 2009 10:48 Go to previous messageGo to next message
Dani Megert is currently offline Dani Megert
Messages: 3801
Registered: July 2009
Senior Member
John Carroll wrote:
> Hello,
>
> I have a RCP app which uses a customised TextEditor for editing
> certain types of files. For some calls I make to Document.replace() I
> would like to make this text replacement non-undoable.
Try to get the document undo manager via:
org.eclipse.text.undo.DocumentUndoManagerRegistry.getDocumen tUndoManager(IDocument)
and then call reset() on it.

Dani
>
> I have tried using an extension of AbstractOperation to execute my
> non-undoable text replacement within the document and then made the
> AbstractOperation return false for canUndo(), but I can still right
> click within the TextEditor and select "Undo Typing" which undoes my
> text replacement which is not what I want.
>
> So is there a way for me to call Document.replace() to replace text
> which can not be undone via the global undo/redo mechanism?
>
> thanks,
>
> John.
Re: Non-undoable document edits [message #336381 is a reply to message #336300] Tue, 09 June 2009 22:05 Go to previous messageGo to next message
Eclipse User
Originally posted by: jcarroll.us.ibm.com

That works great, thanks very much!

John.
> John Carroll wrote:
>> Hello,
>>
>> I have a RCP app which uses a customised TextEditor for editing
>> certain types of files. For some calls I make to Document.replace() I
>> would like to make this text replacement non-undoable.
> Try to get the document undo manager via:
> org.eclipse.text.undo.DocumentUndoManagerRegistry.getDocumen tUndoManager(IDocument)
>
> and then call reset() on it.
>
> Dani
>>
>> I have tried using an extension of AbstractOperation to execute my
>> non-undoable text replacement within the document and then made the
>> AbstractOperation return false for canUndo(), but I can still right
>> click within the TextEditor and select "Undo Typing" which undoes my
>> text replacement which is not what I want.
>>
>> So is there a way for me to call Document.replace() to replace text
>> which can not be undone via the global undo/redo mechanism?
>>
>> thanks,
>>
>> John.
Re: Non-undoable document edits [message #336383 is a reply to message #336300] Tue, 09 June 2009 22:15 Go to previous messageGo to next message
Eclipse User
Originally posted by: jcarroll.us.ibm.com

That works great, thanks very much!

John.
> John Carroll wrote:
>> Hello,
>>
>> I have a RCP app which uses a customised TextEditor for editing
>> certain types of files. For some calls I make to Document.replace() I
>> would like to make this text replacement non-undoable.
> Try to get the document undo manager via:
> org.eclipse.text.undo.DocumentUndoManagerRegistry.getDocumen tUndoManager(IDocument)
>
> and then call reset() on it.
>
> Dani
>>
>> I have tried using an extension of AbstractOperation to execute my
>> non-undoable text replacement within the document and then made the
>> AbstractOperation return false for canUndo(), but I can still right
>> click within the TextEditor and select "Undo Typing" which undoes my
>> text replacement which is not what I want.
>>
>> So is there a way for me to call Document.replace() to replace text
>> which can not be undone via the global undo/redo mechanism?
>>
>> thanks,
>>
>> John.
Re: Non-undoable document edits [message #336385 is a reply to message #336300] Tue, 09 June 2009 22:16 Go to previous message
Eclipse User
Originally posted by: jcarroll.us.ibm.com

That works great, thanks very much!

John.
> John Carroll wrote:
>> Hello,
>>
>> I have a RCP app which uses a customised TextEditor for editing
>> certain types of files. For some calls I make to Document.replace() I
>> would like to make this text replacement non-undoable.
> Try to get the document undo manager via:
> org.eclipse.text.undo.DocumentUndoManagerRegistry.getDocumen tUndoManager(IDocument)
>
> and then call reset() on it.
>
> Dani
>>
>> I have tried using an extension of AbstractOperation to execute my
>> non-undoable text replacement within the document and then made the
>> AbstractOperation return false for canUndo(), but I can still right
>> click within the TextEditor and select "Undo Typing" which undoes my
>> text replacement which is not what I want.
>>
>> So is there a way for me to call Document.replace() to replace text
>> which can not be undone via the global undo/redo mechanism?
>>
>> thanks,
>>
>> John.
Previous Topic:Closing customized XML editor (MultiPageEditorPart) if error on XML when opening
Next Topic:Automatic updates fail: No repository found containing ...
Goto Forum:
  


Current Time: Wed Jul 23 18:12:10 EDT 2014

Powered by FUDForum. Page generated in 0.01673 seconds