Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Undo / Redo limit operation on each Editor/View
Undo / Redo limit operation on each Editor/View [message #336990] Mon, 20 July 2009 09:21 Go to next message
MarcP is currently offline MarcPFriend
Messages: 8
Registered: July 2009
Junior Member
Hello everyone,

I'm developing an application using the Eclipse plug-ins system. One of
the client's desiderata is to have an undo/redo stack limited to the five
latest operations for each Editors and Views of the application.
To this end, I created an UndoContext in the createPartControl method of
my Editors and Views. Then I attach this context to the
UndoRedoActionGroup :
(with the required getViewSite(), getEditorSite() method according to the
Part concerned)
UndoRedoActionGroup undoRedoActions = new UndoRedoActionGroup(getSite(),
undoContext, true);
undoRedoActions.fillActionBars(getEditorSite().getActionBars ());
Once this is done, I set the limit of operation in the OperationHistory :
IOperationHistory operationHistory =
OperationHistoryFactory.getOperationHistory();
operationHistory.setLimit(undoContext, 5);

And then I create an OperationHistoryListener for each part and had it to
the operationHistory.
When an edition operation is done in an Editor, I associate its
undoContext to the operation. But, when I have 3 Editors opened and I
perform an edition operation, the first operation doesn't update the undo
label in the Edit menu... And when a second operation is performed on a
second Editor, the undo label is updated for all the Editors. In other
word I can "cancel" the edition operation on the second Editor from all
the opened Editors.

Any idea of something I'm doing wrong?
Marc
Re: Undo / Redo limit operation on each Editor/View [message #468177 is a reply to message #336990] Tue, 04 August 2009 13:08 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3801
Registered: July 2009
Senior Member
Marc wrote:
> Hello everyone,
>
> I'm developing an application using the Eclipse plug-ins system. One
> of the client's desiderata is to have an undo/redo stack limited to
> the five latest operations for each Editors and Views of the application.
> To this end, I created an UndoContext in the createPartControl method
> of my Editors and Views. Then I attach this context to the
> UndoRedoActionGroup :
> (with the required getViewSite(), getEditorSite() method according to
> the Part concerned)
> UndoRedoActionGroup undoRedoActions = new
> UndoRedoActionGroup(getSite(), undoContext, true);
> undoRedoActions.fillActionBars(getEditorSite().getActionBars ());
> Once this is done, I set the limit of operation in the OperationHistory :
> IOperationHistory operationHistory =
> OperationHistoryFactory.getOperationHistory();
> operationHistory.setLimit(undoContext, 5);
>
> And then I create an OperationHistoryListener for each part and had it
> to the operationHistory. When an edition operation is done in an
> Editor, I associate its undoContext to the operation. But, when I have
> 3 Editors opened and I perform an edition operation, the first
> operation doesn't update the undo label in the Edit menu... And when a
> second operation is performed on a second Editor, the undo label is
> updated for all the Editors. In other word I can "cancel" the edition
> operation on the second Editor from all the opened Editors.
>
> Any idea of something I'm doing wrong?
Make sure that you really use different undo contexts.

Dani
> Marc
>
Previous Topic:Intercepting: "Close Editor + Don't Save"
Next Topic:Viewpart vs. Editorpart, proxy Editorpart, common Eclipse design question
Goto Forum:
  


Current Time: Fri Nov 28 22:15:07 GMT 2014

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

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