Mercurial > projects > dwt-addons
diff dwtx/text/undo/DocumentUndoManager.d @ 161:f8d52b926852
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 27 Aug 2008 14:49:30 +0200 |
parents | 3678e4f1a766 |
children | c3583c6ec027 |
line wrap: on
line diff
--- a/dwtx/text/undo/DocumentUndoManager.d Wed Aug 27 02:07:22 2008 +0200 +++ b/dwtx/text/undo/DocumentUndoManager.d Wed Aug 27 14:49:30 2008 +0200 @@ -269,10 +269,10 @@ */ public IStatus undo(IProgressMonitor monitor, IAdaptable uiInfo) { if (isValid()) { - fDocumentUndoManager.fireDocumentUndo(fStart, fPreservedText, fText, uiInfo, DocumentUndoEvent.ABOUT_TO_UNDO, false); + fDocumentUndoManager.fireDocumentUndo(fStart, fPreservedText, fText, cast(Object)uiInfo, DocumentUndoEvent.ABOUT_TO_UNDO, false); undoTextChange(); fDocumentUndoManager.resetProcessChangeState(); - fDocumentUndoManager.fireDocumentUndo(fStart, fPreservedText, fText, uiInfo, DocumentUndoEvent.UNDONE, false); + fDocumentUndoManager.fireDocumentUndo(fStart, fPreservedText, fText, cast(Object)uiInfo, DocumentUndoEvent.UNDONE, false); return Status.OK_STATUS; } return IOperationHistory.OPERATION_INVALID_STATUS; @@ -301,10 +301,10 @@ */ public IStatus redo(IProgressMonitor monitor, IAdaptable uiInfo) { if (isValid()) { - fDocumentUndoManager.fireDocumentUndo(fStart, fText, fPreservedText, uiInfo, DocumentUndoEvent.ABOUT_TO_REDO, false); + fDocumentUndoManager.fireDocumentUndo(fStart, fText, fPreservedText, cast(Object)uiInfo, DocumentUndoEvent.ABOUT_TO_REDO, false); redoTextChange(); fDocumentUndoManager.resetProcessChangeState(); - fDocumentUndoManager.fireDocumentUndo(fStart, fText, fPreservedText, uiInfo, DocumentUndoEvent.REDONE, false); + fDocumentUndoManager.fireDocumentUndo(fStart, fText, fPreservedText, cast(Object)uiInfo, DocumentUndoEvent.REDONE, false); return Status.OK_STATUS; } return IOperationHistory.OPERATION_INVALID_STATUS; @@ -316,9 +316,9 @@ protected void updateTextChange() { fText= fDocumentUndoManager.fTextBuffer.toString(); - fDocumentUndoManager.fTextBuffer.setLength(0); + fDocumentUndoManager.fTextBuffer.clear(); fPreservedText= fDocumentUndoManager.fPreservedTextBuffer.toString(); - fDocumentUndoManager.fPreservedTextBuffer.setLength(0); + fDocumentUndoManager.fPreservedTextBuffer.clear(); } /** @@ -393,7 +393,7 @@ String delimiter= ", "; //$NON-NLS-1$ StringBuffer text= new StringBuffer(super.toString()); text.append("\n"); //$NON-NLS-1$ - text.append(this.getClass().getName()); + text.append(this.classinfo.name); text.append(" undo modification stamp: "); //$NON-NLS-1$ text.append(fUndoModificationStamp); text.append(" redo modification stamp: "); //$NON-NLS-1$ @@ -441,7 +441,7 @@ private static class UndoableCompoundTextChange : UndoableTextChange { /** The list of individual changes */ - private List fChanges= new ArrayList(); + private List fChanges; /** * Creates a new compound text change. @@ -450,6 +450,7 @@ * the undo manager for this change */ this(DocumentUndoManager manager) { + fChanges= new ArrayList(); super(manager); } @@ -472,14 +473,14 @@ UndoableTextChange c; c= cast(UndoableTextChange) fChanges.get(0); - fDocumentUndoManager.fireDocumentUndo(c.fStart, c.fPreservedText, c.fText, uiInfo, DocumentUndoEvent.ABOUT_TO_UNDO, true); + fDocumentUndoManager.fireDocumentUndo(c.fStart, c.fPreservedText, c.fText, cast(Object)uiInfo, DocumentUndoEvent.ABOUT_TO_UNDO, true); for (int i= size - 1; i >= 0; --i) { c= cast(UndoableTextChange) fChanges.get(i); c.undoTextChange(); } fDocumentUndoManager.resetProcessChangeState(); - fDocumentUndoManager.fireDocumentUndo(c.fStart, c.fPreservedText, c.fText, uiInfo, + fDocumentUndoManager.fireDocumentUndo(c.fStart, c.fPreservedText, c.fText, cast(Object)uiInfo, DocumentUndoEvent.UNDONE, true); } return Status.OK_STATUS; @@ -495,14 +496,14 @@ UndoableTextChange c; c= cast(UndoableTextChange) fChanges.get(size - 1); - fDocumentUndoManager.fireDocumentUndo(c.fStart, c.fText, c.fPreservedText, uiInfo, DocumentUndoEvent.ABOUT_TO_REDO, true); + fDocumentUndoManager.fireDocumentUndo(c.fStart, c.fText, c.fPreservedText, cast(Object)uiInfo, DocumentUndoEvent.ABOUT_TO_REDO, true); for (int i= 0; i <= size - 1; ++i) { c= cast(UndoableTextChange) fChanges.get(i); c.redoTextChange(); } fDocumentUndoManager.resetProcessChangeState(); - fDocumentUndoManager.fireDocumentUndo(c.fStart, c.fText, c.fPreservedText, uiInfo, DocumentUndoEvent.REDONE, true); + fDocumentUndoManager.fireDocumentUndo(c.fStart, c.fText, c.fPreservedText, cast(Object)uiInfo, DocumentUndoEvent.REDONE, true); } return Status.OK_STATUS; @@ -786,11 +787,11 @@ * @param document the document whose undo history is being managed. */ public this(IDocument document) { - super(); - Assert.isNotNull(document); +// super(); + Assert.isNotNull(cast(Object)document); fDocument= document; fHistory= OperationHistoryFactory.getOperationHistory(); - fUndoContext= new ObjectUndoContext(fDocument); + fUndoContext= new ObjectUndoContext(cast(Object)fDocument); fConnected= new ArrayList(); fDocumentUndoListeners= new ListenerList(ListenerList.IDENTITY); } @@ -799,14 +800,14 @@ * @see dwtx.jface.text.IDocumentUndoManager#addDocumentUndoListener(dwtx.jface.text.IDocumentUndoListener) */ public void addDocumentUndoListener(IDocumentUndoListener listener) { - fDocumentUndoListeners.add(listener); + fDocumentUndoListeners.add(cast(Object)listener); } /* * @see dwtx.jface.text.IDocumentUndoManager#removeDocumentUndoListener(dwtx.jface.text.IDocumentUndoListener) */ public void removeDocumentUndoListener(IDocumentUndoListener listener) { - fDocumentUndoListeners.remove(listener); + fDocumentUndoListeners.remove(cast(Object)listener); } /* @@ -1008,7 +1009,7 @@ if (index > -1) { char c; int length= text.length(); - for (int i= delimiters[index].length(); i < length; i++) { + for (int i= delimiters[index].length; i < length; i++) { c= text.charAt(i); if (c !is ' ' && c !is '\t') return false; @@ -1096,7 +1097,7 @@ if (length is 0) { // text will be deleted by backspace or DEL key or empty // clipboard - length= replacedText.length(); + length= replacedText.length; String[] delimiters= fDocument.getLegalLineDelimiters(); if ((length is 1) @@ -1122,7 +1123,8 @@ // repeated backspace // insert in buffer and extend edit range - fPreservedTextBuffer.insert(0, replacedText); + fPreservedTextBuffer.select(0,0); + fPreservedTextBuffer.replace(replacedText); fCurrent.fStart= modelStart; } else { @@ -1155,7 +1157,7 @@ // text will be replaced if (length is 1) { - length= replacedText.length(); + length= replacedText.length; String[] delimiters= fDocument.getLegalLineDelimiters(); if ((length is 1) @@ -1231,8 +1233,8 @@ fCurrent= null; fPreviousDelete= null; - fTextBuffer= null; - fPreservedTextBuffer= null; + fTextBuffer.clear(); + fPreservedTextBuffer.clear(); disposeUndoHistory(); }