Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » RCP Testing Tool » RCP add Undo/Redo in the FormEditor(when i add undo/redo with the same type of my FormEditor,the first FormEditor can't use the undo/redo tools)
RCP add Undo/Redo in the FormEditor [message #1800433] Fri, 28 December 2018 06:31
Zhang Mengfan is currently offline Zhang MengfanFriend
Messages: 1
Registered: December 2018
Junior Member
hi
I want to use undo/redo in my FormEditor,so i create an undoContext within my FormPage,at the first time i binding the undo/redo actions with handler when i connect my undomanager.the code like this:
--
public void connect(TableApprover natTable) {
if (!isConnected() && natTable != null) {
this.natTable = natTable;
if (undoContext == null) {
undoContext = new ObjectUndoContext(this);
}
if (actionBars != null && site != null) {
//TODO binding the undo/redo actions
undoRedoGroup = new UndoRedoActionGroup(site, undoContext, true);
undoRedoGroup.fillActionBars(actionBars);
}
opHistory.setLimit(undoContext, undoLevel);
opHistory.dispose(undoContext, true, true, false);
}
}
--
it looks like well,however,when i create two FormPage with the same FormEditor,the first FormPage 's undo/redo couldn't worked,i guess the problem is those code:
--
undoRedoGroup.fillActionBars(actionBars);
@Override
public void fillActionBars(IActionBars actionBars) {
super.fillActionBars(actionBars);
if (undoActionHandler != null) {
actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(),
undoActionHandler);
actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(),
redoActionHandler);
}
}
--
the actionBars' create :actionBars = getEditorSite().getActionBars();
when a FormPage opens,EditorReference will create a ActionBars for the new FormPage,but the rule is the FormEditor can just use the same actionBars,so i guess that
undoRedoGroup.fillActionBars(actionBars) can cover teh first's handler when the second FormPage connect.
so how can i use undo/redo in my FormEditor when there is more than one FormPages as the same type(FormEditor),can anyone help me,thank very much!
Previous Topic:RCPTT Maven plugin and Tycho
Next Topic:NatTable
Goto Forum:
  


Current Time: Sun Oct 13 22:49:29 GMT 2024

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

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

Back to the top