@Override public boolean canUndo() { if (triggeringOperation != null) { return triggeringOperation.canUndo(); } return false; }
@Override public boolean canUndo() { if (triggeringOperation != null) { return triggeringOperation.canUndo(); } return false; }
@Override public boolean canUndo() { if (triggeringOperation != null) { return triggeringOperation.canUndo(); } return false; }
public boolean canUndo() { for (final Iterator it = _stepOperations.iterator(); it.hasNext();) { IUndoableOperation op = (IUndoableOperation) it.next(); // fail fast if (!op.canUndo()) { return false; } } return true; }
@Override public boolean canUndo(IUndoContext context) { // null context is allowed and passed through IUndoableOperation operation = getUndoOperation(context); return (operation != null && operation.canUndo()); }
@Override public boolean canUndo(IUndoContext context) { // null context is allowed and passed through IUndoableOperation operation = getUndoOperation(context); return (operation != null && operation.canUndo()); }
@Override public boolean canUndo(IUndoContext context) { // null context is allowed and passed through IUndoableOperation operation = getUndoOperation(context); return (operation != null && operation.canUndo()); }
@Override public IStatus undoOperation(IUndoableOperation operation, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { Assert.isNotNull(operation); IStatus status; if (operation.canUndo()) { status = doUndo(monitor, info, operation); } else { if (DEBUG_OPERATION_HISTORY_UNEXPECTED) { Tracing.printTrace("OPERATIONHISTORY", "Undo operation not valid - " + operation); //$NON-NLS-1$//$NON-NLS-2$ } status = IOperationHistory.OPERATION_INVALID_STATUS; } return status; }
@Override public IStatus undoOperation(IUndoableOperation operation, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { Assert.isNotNull(operation); IStatus status; if (operation.canUndo()) { status = doUndo(monitor, info, operation); } else { if (DEBUG_OPERATION_HISTORY_UNEXPECTED) { Tracing.printTrace("OPERATIONHISTORY", "Undo operation not valid - " + operation); //$NON-NLS-1$//$NON-NLS-2$ } status = IOperationHistory.OPERATION_INVALID_STATUS; } return status; }
@Override public IStatus undoOperation(IUndoableOperation operation, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { Assert.isNotNull(operation); IStatus status; if (operation.canUndo()) { status = doUndo(monitor, info, operation); } else { if (DEBUG_OPERATION_HISTORY_UNEXPECTED) { Tracing.printTrace("OPERATIONHISTORY", "Undo operation not valid - " + operation); //$NON-NLS-1$//$NON-NLS-2$ } status = IOperationHistory.OPERATION_INVALID_STATUS; } return status; }
@Override public IStatus undo(IUndoContext context, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { Assert.isNotNull(context); IUndoableOperation operation = getUndoOperation(context); // info if there is no operation if (operation == null) { return IOperationHistory.NOTHING_TO_UNDO_STATUS; } // error if operation is invalid if (!operation.canUndo()) { if (DEBUG_OPERATION_HISTORY_UNEXPECTED) { Tracing.printTrace("OPERATIONHISTORY", "Undo operation not valid - " + operation); //$NON-NLS-1$ //$NON-NLS-2$ } return IOperationHistory.OPERATION_INVALID_STATUS; } return doUndo(monitor, info, operation); }
@Override public IStatus undo(IUndoContext context, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { Assert.isNotNull(context); IUndoableOperation operation = getUndoOperation(context); // info if there is no operation if (operation == null) { return IOperationHistory.NOTHING_TO_UNDO_STATUS; } // error if operation is invalid if (!operation.canUndo()) { if (DEBUG_OPERATION_HISTORY_UNEXPECTED) { Tracing.printTrace("OPERATIONHISTORY", "Undo operation not valid - " + operation); //$NON-NLS-1$ //$NON-NLS-2$ } return IOperationHistory.OPERATION_INVALID_STATUS; } return doUndo(monitor, info, operation); }
@Override public IStatus undo(IUndoContext context, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { Assert.isNotNull(context); IUndoableOperation operation = getUndoOperation(context); // info if there is no operation if (operation == null) { return IOperationHistory.NOTHING_TO_UNDO_STATUS; } // error if operation is invalid if (!operation.canUndo()) { if (DEBUG_OPERATION_HISTORY_UNEXPECTED) { Tracing.printTrace("OPERATIONHISTORY", "Undo operation not valid - " + operation); //$NON-NLS-1$ //$NON-NLS-2$ } return IOperationHistory.OPERATION_INVALID_STATUS; } return doUndo(monitor, info, operation); }
if (!currentOp.canUndo()) { flushWorkspaceHistory(currentOp); return;
@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); } } } }
boolean wasValid= false; if (op != null) wasValid= op.canUndo();
boolean wasValid= false; if (op != null) wasValid= op.canUndo();