Note that there are some explanatory texts on larger screens.

plurals
  1. POContext issue whilst adding IUndoableOperation to my EditorPart
    text
    copied!<p>I was following the example described in <a href="http://help.eclipse.org/indigo/topic/org.eclipse.platform.doc.isv/guide/wrkAdv_undo.htm" rel="nofollow">http://help.eclipse.org/indigo/topic/org.eclipse.platform.doc.isv/guide/wrkAdv_undo.htm</a></p> <p>in the <code>init()</code> method of my <code>EditorPart</code></p> <pre><code> /** * @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite, * org.eclipse.ui.IEditorInput) */ @Override public void init(IEditorSite site,IEditorInput input) throws PartInitException { ... IWorkbench workbench = getSite().getWorkbenchWindow().getWorkbench(); myUndoContext= workbench.getOperationSupport().getUndoContext(); UndoRedoActionGroup historyActionGroup = new UndoRedoActionGroup(site, myUndoContext, true); historyActionGroup.fillActionBars(site.getActionBars()); } </code></pre> <p>... I added the following to a method in my <code>EditorPart</code></p> <pre><code> IUndoableOperation operation = new MyOperation("My Action"); operation.addContext(myUndoContext); try { IStatus status = OperationHistoryFactory.getOperationHistory().execute(operation, null, null); } catch (ExecutionException e) { e.printStackTrace(); } </code></pre> <p>I was able to add undo actions but I noticed that the undo actions gets added to all files opened by my custom editor. When I make changes to a file, all other opened files gets the undo operation added to the edit menu. How can I make it only applicable to the currently active file?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload