Mercurial > projects > dwt-addons
diff dwtx/text/undo/DocumentUndoManager.d @ 136:6dcb0baaa031
Regex removal of throws decls, some instanceof
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 02:20:40 +0200 |
parents | 51e6e63f930e |
children | f70d9508c95c |
line wrap: on
line diff
--- a/dwtx/text/undo/DocumentUndoManager.d Sun Aug 24 01:52:31 2008 +0200 +++ b/dwtx/text/undo/DocumentUndoManager.d Sun Aug 24 02:20:40 2008 +0200 @@ -149,8 +149,8 @@ */ protected void undoTextChange() { try { - if (fDocumentUndoManager.fDocument instanceof IDocumentExtension4) - (cast(IDocumentExtension4) fDocumentUndoManager.fDocument).replace(fStart, fText + if (auto de4 = cast(IDocumentExtension4)fDocumentUndoManager.fDocument ) + de4.replace(fStart, fText .length(), fPreservedText, fUndoModificationStamp); else fDocumentUndoManager.fDocument.replace(fStart, fText.length(), @@ -164,7 +164,7 @@ */ public bool canUndo() { if (isValid()) { - if (fDocumentUndoManager.fDocument instanceof IDocumentExtension4) { + if (cast(IDocumentExtension4)fDocumentUndoManager.fDocument) { long docStamp= (cast(IDocumentExtension4) fDocumentUndoManager.fDocument) .getModificationStamp(); @@ -210,7 +210,7 @@ && this is fDocumentUndoManager.fHistory .getUndoOperation(fDocumentUndoManager.fUndoContext) && // this is the latest operation - this instanceof UndoableCompoundTextChange + null !is cast(UndoableCompoundTextChange)this && this is fDocumentUndoManager.fCurrent && // this is the current operation this.fStart is -1 @@ -234,7 +234,7 @@ */ public bool canRedo() { if (isValid()) { - if (fDocumentUndoManager.fDocument instanceof IDocumentExtension4) { + if (cast(IDocumentExtension4)fDocumentUndoManager.fDocument ) { long docStamp= (cast(IDocumentExtension4) fDocumentUndoManager.fDocument) .getModificationStamp(); return docStamp is IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP @@ -283,7 +283,7 @@ */ protected void redoTextChange() { try { - if (fDocumentUndoManager.fDocument instanceof IDocumentExtension4) + if (cast(IDocumentExtension4)fDocumentUndoManager.fDocument) (cast(IDocumentExtension4) fDocumentUndoManager.fDocument).replace(fStart, fEnd - fStart, fText, fRedoModificationStamp); else fDocumentUndoManager.fDocument.replace(fStart, fEnd - fStart, fText); @@ -666,7 +666,7 @@ // if we are undoing/redoing an operation we generated, then // ignore // the document changes associated with this undo or redo. - if (event.getOperation() instanceof UndoableTextChange) { + if (cast(UndoableTextChange)event.getOperation() ) { listenToTextChanges(false); // in the undo case only, make sure compounds are closed @@ -858,7 +858,7 @@ /* * @see dwtx.text.undo.IDocumentUndoManager#undo() */ - public void redo() throws ExecutionException { + public void redo() { if (isConnected() && redoable()) OperationHistoryFactory.getOperationHistory().redo(getUndoContext(), null, null); } @@ -866,7 +866,7 @@ /* * @see dwtx.text.undo.IDocumentUndoManager#undo() */ - public void undo() throws ExecutionException { + public void undo() { if (undoable()) OperationHistoryFactory.getOperationHistory().undo(fUndoContext, null, null); } @@ -968,7 +968,7 @@ */ private void addToOperationHistory(UndoableTextChange edit) { if (!fFoldingIntoCompoundChange - || edit instanceof UndoableCompoundTextChange) { + || cast(UndoableCompoundTextChange)edit ) { fHistory.add(edit); fLastAddedTextEdit= edit; } @@ -1259,20 +1259,20 @@ for (int i= 0; i < operations.length; i++) { // First replace the undo context IUndoableOperation op= operations[i]; - if (op instanceof IContextReplacingOperation) { + if (cast(IContextReplacingOperation)op ) { (cast(IContextReplacingOperation)op).replaceContext(oldUndoContext, getUndoContext()); } else { op.addContext(getUndoContext()); op.removeContext(oldUndoContext); } // Now update the manager that owns the text edit. - if (op instanceof UndoableTextChange) { + if (cast(UndoableTextChange)op ) { (cast(UndoableTextChange)op).fDocumentUndoManager= this; } } IUndoableOperation op= OperationHistoryFactory.getOperationHistory().getUndoOperation(getUndoContext()); - if (op !is null && !(op instanceof UndoableTextChange)) + if (op !is null && !(cast(UndoableTextChange)op )) return; // Record the transfer itself as an undoable change. @@ -1283,7 +1283,7 @@ UndoableTextChange cmd= new UndoableTextChange(this); cmd.fStart= cmd.fEnd= 0; cmd.fText= cmd.fPreservedText= ""; //$NON-NLS-1$ - if (fDocument instanceof IDocumentExtension4) { + if (cast(IDocumentExtension4)fDocument ) { cmd.fRedoModificationStamp= (cast(IDocumentExtension4)fDocument).getModificationStamp(); if (op !is null) cmd.fUndoModificationStamp= (cast(UndoableTextChange)op).fRedoModificationStamp;