public String peekUndoName() { IUndoableOperation op= fOperationHistroy.getUndoOperation(RefactoringCorePlugin.getUndoContext()); if (op == null) return null; return op.getLabel(); }
@Override IUndoableOperation getOperation() { return getHistory().getUndoOperation(getUndoContext()); }
@Override public String peekUndoName() { IUndoableOperation op= fOperationHistory.getUndoOperation(RefactoringCorePlugin.getUndoContext()); if (op == null) return null; return op.getLabel(); }
@Override public String peekUndoName() { IUndoableOperation op= fOperationHistory.getUndoOperation(RefactoringCorePlugin.getUndoContext()); if (op == null) return null; return op.getLabel(); }
@Override public final IStatus proceedUndoing(IUndoableOperation operation, IOperationHistory history, IAdaptable info) { IUndoContext[] contexts = operation.getContexts(); for (IUndoContext context : contexts) { if (history.getUndoOperation(context) != operation) { IStatus status = allowLinearUndoViolation(operation, context, history, info); if (!status.isOK()) { return status; } } } return Status.OK_STATUS; } }
@Override public final IStatus proceedUndoing(IUndoableOperation operation, IOperationHistory history, IAdaptable info) { IUndoContext[] contexts = operation.getContexts(); for (int i = 0; i < contexts.length; i++) { IUndoContext context = contexts[i]; if (history.getUndoOperation(context) != operation) { IStatus status = allowLinearUndoViolation(operation, context, history, info); if (!status.isOK()) { return status; } } } return Status.OK_STATUS; } }
public void performUndo(IValidationCheckResultQuery query, IProgressMonitor pm) throws CoreException { IUndoableOperation undo= fOperationHistroy.getUndoOperation(RefactoringCorePlugin.getUndoContext()); UndoableOperation2ChangeAdapter changeOperation= getUnwrappedOperation(undo); if (changeOperation == null) throw new CoreException(new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR, RefactoringCoreMessages.UndoManager2_no_change, null)); if (query == null) query= new NullQuery(); try { fOperationHistroy.undoOperation(undo, pm, new QueryAdapter(query)); } catch (ExecutionException e) { handleException(e); } }
@Override public final IStatus proceedUndoing(IUndoableOperation operation, IOperationHistory history, IAdaptable info) { IUndoContext[] contexts = operation.getContexts(); for (int i = 0; i < contexts.length; i++) { IUndoContext context = contexts[i]; if (history.getUndoOperation(context) != operation) { IStatus status = allowLinearUndoViolation(operation, context, history, info); if (!status.isOK()) { return status; } } } return Status.OK_STATUS; } }
@Override public void performUndo(IValidationCheckResultQuery query, IProgressMonitor pm) throws CoreException { IUndoableOperation undo= fOperationHistory.getUndoOperation(RefactoringCorePlugin.getUndoContext()); UndoableOperation2ChangeAdapter changeOperation= getUnwrappedOperation(undo); if (changeOperation == null) throw new CoreException(new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR, RefactoringCoreMessages.UndoManager2_no_change, null)); if (query == null) query= new NullQuery(); try { fOperationHistory.undoOperation(undo, pm, new QueryAdapter(query)); } catch (ExecutionException e) { handleException(e); } }
@Override public void performUndo(IValidationCheckResultQuery query, IProgressMonitor pm) throws CoreException { IUndoableOperation undo= fOperationHistory.getUndoOperation(RefactoringCorePlugin.getUndoContext()); UndoableOperation2ChangeAdapter changeOperation= getUnwrappedOperation(undo); if (changeOperation == null) throw new CoreException(new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR, RefactoringCoreMessages.UndoManager2_no_change, null)); if (query == null) query= new NullQuery(); try { fOperationHistory.undoOperation(undo, pm, new QueryAdapter(query)); } catch (ExecutionException e) { handleException(e); } }
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); } } }
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { 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(); while (undoManager.undoable()) { if (startingUndoOperation != null && startingUndoOperation.equals(operationHistory.getUndoOperation(undoContext))) return; undoManager.undo(); } } } } });
@Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { 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(); while (undoManager.undoable()) { if (fStartingUndoOperation != null && fStartingUndoOperation.equals(operationHistory.getUndoOperation(undoContext))) return; undoManager.undo(); } } } } });
@Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { 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(); while (undoManager.undoable()) { if (fStartingUndoOperation != null && fStartingUndoOperation.equals(operationHistory.getUndoOperation(undoContext))) return; undoManager.undo(); } } } } });
while (operation != history.getUndoOperation(context)) { try { IStatus status = history.undo(context, null, uiInfo);
@Override public void documentChanged(DocumentEvent event) { fPreservedRedoModificationStamp= event.getModificationStamp(); // record the current valid state for the top operation in case it remains the // top operation but changes state. IUndoableOperation op= fHistory.getUndoOperation(fUndoContext); boolean wasValid= false; if (op != null) wasValid= op.canUndo(); // Process the change, providing the before and after timestamps processChange(event.getOffset(), event.getOffset() + event.getLength(), event.getText(), fReplacedText, fPreservedUndoModificationStamp, fPreservedRedoModificationStamp); // now update fCurrent with the latest buffers from the document change. fCurrent.pretendCommit(); if (op == fCurrent) { // if the document change did not cause a new fCurrent to be created, then we should // notify the history that the current operation changed if its validity has changed. if (wasValid != fCurrent.isValid()) fHistory.operationChanged(op); } else { // if the change created a new fCurrent that we did not yet add to the // stack, do so if it's valid and we are not in the middle of a compound change. if (fCurrent != fLastAddedCommand && fCurrent.isValid()) { addToCommandStack(fCurrent); } } } }
@Override public void documentChanged(DocumentEvent event) { fPreservedRedoModificationStamp= event.getModificationStamp(); // record the current valid state for the top operation in case it remains the // top operation but changes state. IUndoableOperation op= fHistory.getUndoOperation(fUndoContext); boolean wasValid= false; if (op != null) wasValid= op.canUndo(); // Process the change, providing the before and after timestamps processChange(event.getOffset(), event.getOffset() + event.getLength(), event.getText(), fReplacedText, fPreservedUndoModificationStamp, fPreservedRedoModificationStamp); // now update fCurrent with the latest buffers from the document change. fCurrent.pretendCommit(); if (op == fCurrent) { // if the document change did not cause a new fCurrent to be created, then we should // notify the history that the current operation changed if its validity has changed. if (wasValid != fCurrent.isValid()) fHistory.operationChanged(op); } else { // if the change created a new fCurrent that we did not yet add to the // stack, do so if it's valid and we are not in the middle of a compound change. if (fCurrent != fLastAddedCommand && fCurrent.isValid()) { addToCommandStack(fCurrent); } } } }
IUndoableOperation op= fHistory.getUndoOperation(fUndoContext); boolean wasValid= false; if (op != null)
IUndoableOperation op= OperationHistoryFactory.getOperationHistory().getUndoOperation(getUndoContext()); if (op != null && !(op instanceof UndoableTextChange)) return;
IUndoableOperation op= OperationHistoryFactory.getOperationHistory().getUndoOperation(getUndoContext()); if (op != null && !(op instanceof UndoableTextChange)) return;