Skip to main content


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 17:14 Go to next message
Eclipse UserFriend
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 14:48 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
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] Wed, 10 June 2009 02:05 Go to previous messageGo to next message
Eclipse UserFriend
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] Wed, 10 June 2009 02:15 Go to previous messageGo to next message
Eclipse UserFriend
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] Wed, 10 June 2009 02:16 Go to previous message
Eclipse UserFriend
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: Fri Apr 19 19:38:26 GMT 2024

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

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

Back to the top