public UndoManager2() { fOperationHistroy= OperationHistoryFactory.getOperationHistory(); }
public UndoManager2() { fOperationHistory= OperationHistoryFactory.getOperationHistory(); }
/** * Creates a new undo manager who remembers the specified number of edit commands. * * @param undoLevel the length of this manager's history */ public DefaultUndoManager(int undoLevel) { fHistory= OperationHistoryFactory.getOperationHistory(); setMaximalUndoLevel(undoLevel); }
/** * Creates a new undo manager who remembers the specified number of edit commands. * * @param undoLevel the length of this manager's history */ public DefaultUndoManager(int undoLevel) { fHistory= OperationHistoryFactory.getOperationHistory(); setMaximalUndoLevel(undoLevel); }
@Override public boolean redoable() { return OperationHistoryFactory.getOperationHistory().canRedo(fUndoContext); }
@Override public boolean undoable() { return OperationHistoryFactory.getOperationHistory().canUndo(fUndoContext); }
@Override public boolean undoable() { return OperationHistoryFactory.getOperationHistory().canUndo(fUndoContext); }
@Override public boolean redoable() { return OperationHistoryFactory.getOperationHistory().canRedo(fUndoContext); }
@Override public void disconnect() { if (fReferenceCount > 0) { fManagerCache.clear(); fReferenceCount--; } if (fReferenceCount == 0) { if (fOperationListener != null) OperationHistoryFactory.getOperationHistory().removeOperationHistoryListener(fOperationListener); if (fResourceListener != null) ResourcesPlugin.getWorkspace().removeResourceChangeListener(fResourceListener); fOperationListener= null; } }
@Override public void disconnect() { if (fReferenceCount > 0) { fManagerCache.clear(); fReferenceCount--; } if (fReferenceCount == 0) { if (fOperationListener != null) OperationHistoryFactory.getOperationHistory().removeOperationHistoryListener(fOperationListener); if (fResourceListener != null) ResourcesPlugin.getWorkspace().removeResourceChangeListener(fResourceListener); fOperationListener= null; } }
@Override public void undo() throws ExecutionException { if (undoable()) OperationHistoryFactory.getOperationHistory().undo(fUndoContext, null, null); }
@Override public void undo() throws ExecutionException { if (undoable()) OperationHistoryFactory.getOperationHistory().undo(fUndoContext, null, null); }
public static IUndoContext getUndoContext() { if (fRefactoringUndoContext == null) { fRefactoringUndoContext= new RefactoringUndoContext(); IUndoContext workspaceContext= ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class); if (workspaceContext instanceof ObjectUndoContext) { ((ObjectUndoContext)workspaceContext).addMatch(fRefactoringUndoContext); } IOperationHistory operationHistory= OperationHistoryFactory.getOperationHistory(); operationHistory.setLimit(fRefactoringUndoContext, 5); } return fRefactoringUndoContext; }
public static IUndoContext getUndoContext() { if (fRefactoringUndoContext == null) { fRefactoringUndoContext= new RefactoringUndoContext(); IUndoContext workspaceContext= ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class); if (workspaceContext instanceof ObjectUndoContext) { ((ObjectUndoContext)workspaceContext).addMatch(fRefactoringUndoContext); } IOperationHistory operationHistory= OperationHistoryFactory.getOperationHistory(); operationHistory.setLimit(fRefactoringUndoContext, 5); } return fRefactoringUndoContext; }
public static IUndoContext getUndoContext() { if (fRefactoringUndoContext == null) { fRefactoringUndoContext= new RefactoringUndoContext(); IUndoContext workspaceContext= (IUndoContext)ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class); if (workspaceContext instanceof ObjectUndoContext) { ((ObjectUndoContext)workspaceContext).addMatch(fRefactoringUndoContext); } IOperationHistory operationHistory= OperationHistoryFactory.getOperationHistory(); operationHistory.setLimit(fRefactoringUndoContext, 5); } return fRefactoringUndoContext; }
@Override public void redo() throws ExecutionException { if (isConnected() && redoable()) OperationHistoryFactory.getOperationHistory().redo(getUndoContext(), null, null); }
private void deactivateHandlers() { if (quickAssistHandlerActivation != null) { handlerService.deactivateHandler(quickAssistHandlerActivation); quickAssistHandlerActivation = null; } if (contentAssistHandlerActivation != null) { handlerService.deactivateHandler(contentAssistHandlerActivation); contentAssistHandlerActivation = null; } undoRedoListener.setViewer(null); OperationHistoryFactory.getOperationHistory().removeOperationHistoryListener(undoRedoListener); }
@Override public void redo() throws ExecutionException { if (isConnected() && redoable()) OperationHistoryFactory.getOperationHistory().redo(getUndoContext(), null, null); }
public void startRecording(XtextEditor editor) { this.editor = editor; ISourceViewer viewer = editor.getInternalSourceViewer(); if (viewer instanceof ITextViewerExtension6) { IUndoManager undoManager = ((ITextViewerExtension6) viewer).getUndoManager(); if (undoManager instanceof IUndoManagerExtension) { IUndoManagerExtension undoManagerExtension = (IUndoManagerExtension) undoManager; IUndoContext undoContext = undoManagerExtension.getUndoContext(); IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory(); startingUndoOperation = operationHistory.getUndoOperation(undoContext); } } }
private void activateHandlers(TextViewer viewer, boolean spellCheck) { deactivateHandlers(); if (spellCheck) { quickAssistHandlerActivation = activateHandler(viewer, ISourceViewer.QUICK_ASSIST, ITextEditorActionDefinitionIds.QUICK_ASSIST); } contentAssistHandlerActivation = activateHandler(viewer, ISourceViewer.CONTENTASSIST_PROPOSALS, ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); undoRedoListener.setViewer(viewer); OperationHistoryFactory.getOperationHistory().addOperationHistoryListener(undoRedoListener); }