Mercurial > projects > dwt-addons
diff dwtx/text/undo/DocumentUndoManager.d @ 134:51e6e63f930e
Regex fix for casts
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 01:46:20 +0200 |
parents | c4fb132a086c |
children | 6dcb0baaa031 |
line wrap: on
line diff
--- a/dwtx/text/undo/DocumentUndoManager.d Sun Aug 24 01:29:22 2008 +0200 +++ b/dwtx/text/undo/DocumentUndoManager.d Sun Aug 24 01:46:20 2008 +0200 @@ -150,7 +150,7 @@ protected void undoTextChange() { try { if (fDocumentUndoManager.fDocument instanceof IDocumentExtension4) - ((IDocumentExtension4) fDocumentUndoManager.fDocument).replace(fStart, fText + (cast(IDocumentExtension4) fDocumentUndoManager.fDocument).replace(fStart, fText .length(), fPreservedText, fUndoModificationStamp); else fDocumentUndoManager.fDocument.replace(fStart, fText.length(), @@ -165,7 +165,7 @@ public bool canUndo() { if (isValid()) { if (fDocumentUndoManager.fDocument instanceof IDocumentExtension4) { - long docStamp= ((IDocumentExtension4) fDocumentUndoManager.fDocument) + long docStamp= (cast(IDocumentExtension4) fDocumentUndoManager.fDocument) .getModificationStamp(); // Normal case: an undo is valid if its redo will restore @@ -235,7 +235,7 @@ public bool canRedo() { if (isValid()) { if (fDocumentUndoManager.fDocument instanceof IDocumentExtension4) { - long docStamp= ((IDocumentExtension4) fDocumentUndoManager.fDocument) + long docStamp= (cast(IDocumentExtension4) fDocumentUndoManager.fDocument) .getModificationStamp(); return docStamp is IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP || docStamp is getUndoModificationStamp(); @@ -284,7 +284,7 @@ protected void redoTextChange() { try { if (fDocumentUndoManager.fDocument instanceof IDocumentExtension4) - ((IDocumentExtension4) fDocumentUndoManager.fDocument).replace(fStart, fEnd - fStart, fText, fRedoModificationStamp); + (cast(IDocumentExtension4) fDocumentUndoManager.fDocument).replace(fStart, fEnd - fStart, fText, fRedoModificationStamp); else fDocumentUndoManager.fDocument.replace(fStart, fEnd - fStart, fText); } catch (BadLocationException x) { @@ -471,11 +471,11 @@ if (size > 0) { UndoableTextChange c; - c= (UndoableTextChange) fChanges.get(0); + c= cast(UndoableTextChange) fChanges.get(0); fDocumentUndoManager.fireDocumentUndo(c.fStart, c.fPreservedText, c.fText, uiInfo, DocumentUndoEvent.ABOUT_TO_UNDO, true); for (int i= size - 1; i >= 0; --i) { - c= (UndoableTextChange) fChanges.get(i); + c= cast(UndoableTextChange) fChanges.get(i); c.undoTextChange(); } fDocumentUndoManager.resetProcessChangeState(); @@ -494,11 +494,11 @@ if (size > 0) { UndoableTextChange c; - c= (UndoableTextChange) fChanges.get(size - 1); + c= cast(UndoableTextChange) fChanges.get(size - 1); fDocumentUndoManager.fireDocumentUndo(c.fStart, c.fText, c.fPreservedText, uiInfo, DocumentUndoEvent.ABOUT_TO_REDO, true); for (int i= 0; i <= size - 1; ++i) { - c= (UndoableTextChange) fChanges.get(i); + c= cast(UndoableTextChange) fChanges.get(i); c.redoTextChange(); } fDocumentUndoManager.resetProcessChangeState(); @@ -566,7 +566,7 @@ if (fStart > -1) return super.getUndoModificationStamp(); else if (fChanges.size() > 0) - return ((UndoableTextChange) fChanges.get(0)) + return (cast(UndoableTextChange) fChanges.get(0)) .getUndoModificationStamp(); return fUndoModificationStamp; @@ -579,7 +579,7 @@ if (fStart > -1) return super.getRedoModificationStamp(); else if (fChanges.size() > 0) - return ((UndoableTextChange) fChanges.get(fChanges.size() - 1)) + return (cast(UndoableTextChange) fChanges.get(fChanges.size() - 1)) .getRedoModificationStamp(); return fRedoModificationStamp; @@ -936,7 +936,7 @@ DocumentUndoEvent event= new DocumentUndoEvent(fDocument, offset, text, preservedText, eventType, source); Object[] listeners= fDocumentUndoListeners.getListeners(); for (int i= 0; i < listeners.length; i++) { - ((IDocumentUndoListener)listeners[i]).documentUndoNotification(event); + (cast(IDocumentUndoListener)listeners[i]).documentUndoNotification(event); } } @@ -1260,14 +1260,14 @@ // First replace the undo context IUndoableOperation op= operations[i]; if (op instanceof IContextReplacingOperation) { - ((IContextReplacingOperation)op).replaceContext(oldUndoContext, getUndoContext()); + (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) { - ((UndoableTextChange)op).fDocumentUndoManager= this; + (cast(UndoableTextChange)op).fDocumentUndoManager= this; } } @@ -1284,9 +1284,9 @@ cmd.fStart= cmd.fEnd= 0; cmd.fText= cmd.fPreservedText= ""; //$NON-NLS-1$ if (fDocument instanceof IDocumentExtension4) { - cmd.fRedoModificationStamp= ((IDocumentExtension4)fDocument).getModificationStamp(); + cmd.fRedoModificationStamp= (cast(IDocumentExtension4)fDocument).getModificationStamp(); if (op !is null) - cmd.fUndoModificationStamp= ((UndoableTextChange)op).fRedoModificationStamp; + cmd.fUndoModificationStamp= (cast(UndoableTextChange)op).fRedoModificationStamp; } addToOperationHistory(cmd); }