# HG changeset patch # User Frank Benoit # Date 1219841370 -7200 # Node ID f8d52b92685214c0119943dd3f7ff251b4034e94 # Parent 3678e4f1a7663b26bf8238d3a4df370ff0f88187 ... diff -r 3678e4f1a766 -r f8d52b926852 dwtx/dwtxhelper/Collection.d --- a/dwtx/dwtxhelper/Collection.d Wed Aug 27 02:07:22 2008 +0200 +++ b/dwtx/dwtxhelper/Collection.d Wed Aug 27 14:49:30 2008 +0200 @@ -2160,7 +2160,14 @@ } return EMPTY_SET_; } - + static int binarySearch(List list, Object key){ + implMissing( __FILE__, __LINE__ ); + return 0; + } + static int binarySearch(List list, Object key, Comparator c){ + implMissing( __FILE__, __LINE__ ); + return 0; + } public static List unmodifiableList( List list ){ implMissing( __FILE__, __LINE__ ); return null; diff -r 3678e4f1a766 -r f8d52b926852 dwtx/jface/text/AbstractInformationControl.d --- a/dwtx/jface/text/AbstractInformationControl.d Wed Aug 27 02:07:22 2008 +0200 +++ b/dwtx/jface/text/AbstractInformationControl.d Wed Aug 27 14:49:30 2008 +0200 @@ -60,7 +60,7 @@ import dwtx.jface.text.IDocumentExtension4; // packageimport import dwtx.jface.text.IDocumentExtension2; // packageimport import dwtx.jface.text.IDocumentPartitionerExtension2; // packageimport -import dwtx.jface.text.Assert; // packageimport +// import dwtx.jface.text.Assert; // packageimport import dwtx.jface.text.DefaultInformationControl; // packageimport import dwtx.jface.text.IWidgetTokenOwnerExtension; // packageimport import dwtx.jface.text.DocumentClone; // packageimport @@ -153,12 +153,8 @@ import dwtx.jface.text.ITextViewerExtension4; // packageimport import dwtx.jface.text.ITypedRegion; // packageimport - import dwt.dwthelper.utils; - - - import dwt.DWT; import dwt.events.DisposeListener; import dwt.events.FocusEvent; @@ -236,7 +232,7 @@ /** Listener for shell activation and deactivation. */ private Listener fShellListener; /** All focus listeners registered to this information control. */ - private ListenerList fFocusListeners= new ListenerList(ListenerList.IDENTITY); + private ListenerList fFocusListeners; /** Size constraints, x is the maxWidth and y is the maxHeight, or null if not set. */ private Point fSizeConstraints; @@ -305,6 +301,9 @@ * @deprecated clients should use one of the public constructors */ this(Shell parentShell, int shellStyle, String statusFieldText, ToolBarManager toolBarManager) { + + fFocusListeners= new ListenerList(ListenerList.IDENTITY); + Assert.isTrue(statusFieldText is null || toolBarManager is null); fResizeHandleSize= -1; fToolBarManager= toolBarManager; @@ -811,7 +810,7 @@ fShell.addListener(DWT.Deactivate, fShellListener); fShell.addListener(DWT.Activate, fShellListener); } - fFocusListeners.add(listener); + fFocusListeners.add(cast(Object)listener); } /** @@ -819,7 +818,7 @@ * This method is not intended to be overridden by subclasses. */ public void removeFocusListener(FocusListener listener) { - fFocusListeners.remove(listener); + fFocusListeners.remove(cast(Object)listener); if (fFocusListeners.isEmpty()) { fShell.removeListener(DWT.Activate, fShellListener); fShell.removeListener(DWT.Deactivate, fShellListener); diff -r 3678e4f1a766 -r f8d52b926852 dwtx/jface/text/AbstractInformationControlManager.d --- a/dwtx/jface/text/AbstractInformationControlManager.d Wed Aug 27 02:07:22 2008 +0200 +++ b/dwtx/jface/text/AbstractInformationControlManager.d Wed Aug 27 14:49:30 2008 +0200 @@ -63,7 +63,7 @@ import dwtx.jface.text.IDocumentExtension4; // packageimport import dwtx.jface.text.IDocumentExtension2; // packageimport import dwtx.jface.text.IDocumentPartitionerExtension2; // packageimport -import dwtx.jface.text.Assert; // packageimport +// import dwtx.jface.text.Assert; // packageimport import dwtx.jface.text.DefaultInformationControl; // packageimport import dwtx.jface.text.IWidgetTokenOwnerExtension; // packageimport import dwtx.jface.text.DocumentClone; // packageimport @@ -339,7 +339,11 @@ * Anchor representing the middle of the subject control * @since 2.1 */ - public const static Anchor ANCHOR_GLOBAL= new Anchor(DWT.CENTER); + public static Anchor ANCHOR_GLOBAL_; + public static Anchor ANCHOR_GLOBAL(){ + if( ANCHOR_GLOBAL_ is null ) ANCHOR_GLOBAL_ = new Anchor(DWT.CENTER); + return ANCHOR_GLOBAL_; + } /** * Dialog store constant for the location's x-coordinate. @@ -538,7 +542,7 @@ protected this(IInformationControlCreator creator) { fAnchor= ANCHOR_BOTTOM(); fFallbackAnchors= ANCHORS(); - Assert.isNotNull(creator); + Assert.isNotNull(cast(Object)creator); fInformationControlCreator= creator; } @@ -559,7 +563,7 @@ * @param subjectArea the subject area, or null if none is available */ protected final void setInformation(String information, Rectangle subjectArea) { - setInformation(cast(Object)information, subjectArea); + setInformation(stringcast(information), subjectArea); } /** @@ -1182,7 +1186,7 @@ do { upperLeft= computeLocation(subjectArea, controlSize, testAnchor); - Monitor monitor= getClosestMonitor(subjectAreaDisplayRelative, testAnchor); + dwt.widgets.Monitor.Monitor monitor= getClosestMonitor(subjectAreaDisplayRelative, testAnchor); if (updateLocation(upperLeft, controlSize, monitor.getClientArea(), testAnchor)) return upperLeft; @@ -1216,7 +1220,7 @@ * anchor * @since 3.3 */ - private Monitor getClosestMonitor(Rectangle area, Anchor anchor) { + private dwt.widgets.Monitor.Monitor getClosestMonitor(Rectangle area, Anchor anchor) { Point center; if (ANCHOR_GLOBAL is anchor) center= Geometry.centerPoint(area); @@ -1235,15 +1239,15 @@ * @return the monitor closest to the given point * @since 3.3 */ - private Monitor getClosestMonitor(Display display, Rectangle rectangle) { + private dwt.widgets.Monitor.Monitor getClosestMonitor(Display display, Rectangle rectangle) { int closest = Integer.MAX_VALUE; Point toFind= Geometry.centerPoint(rectangle); - Monitor[] monitors = display.getMonitors(); - Monitor result = monitors[0]; + dwt.widgets.Monitor.Monitor[] monitors = display.getMonitors(); + dwt.widgets.Monitor.Monitor result = monitors[0]; for (int idx = 0; idx < monitors.length; idx++) { - Monitor current = monitors[idx]; + dwt.widgets.Monitor.Monitor current = monitors[idx]; Rectangle clientArea = current.getClientArea(); @@ -1288,8 +1292,8 @@ */ protected void presentInformation() { bool hasContents= false; - if ( cast(String)fInformation ) - hasContents= (cast(String)fInformation).trim().length() > 0; + if ( stringcast(fInformation) ) + hasContents= (stringcast(fInformation)).trim().length() > 0; else hasContents= (fInformation !is null); diff -r 3678e4f1a766 -r f8d52b926852 dwtx/jface/text/BadPartitioningException.d --- a/dwtx/jface/text/BadPartitioningException.d Wed Aug 27 02:07:22 2008 +0200 +++ b/dwtx/jface/text/BadPartitioningException.d Wed Aug 27 14:49:30 2008 +0200 @@ -181,6 +181,7 @@ * Creates a new bad partitioning exception. */ public this() { + super(""); } /** diff -r 3678e4f1a766 -r f8d52b926852 dwtx/jface/text/DefaultPositionUpdater.d --- a/dwtx/jface/text/DefaultPositionUpdater.d Wed Aug 27 02:07:22 2008 +0200 +++ b/dwtx/jface/text/DefaultPositionUpdater.d Wed Aug 27 14:49:30 2008 +0200 @@ -194,7 +194,7 @@ * Remembers the original state of the investigated position * @since 2.1 */ - protected Position fOriginalPosition= new Position(0, 0); + protected Position fOriginalPosition; /** Caches the offset of the replaced text */ protected int fOffset; /** Caches the length of the replaced text */ @@ -211,6 +211,7 @@ * @param category the category the updater is responsible for */ public this(String category) { + fOriginalPosition= new Position(0, 0); fCategory= category; } diff -r 3678e4f1a766 -r f8d52b926852 dwtx/jface/text/DefaultTextHover.d --- a/dwtx/jface/text/DefaultTextHover.d Wed Aug 27 02:07:22 2008 +0200 +++ b/dwtx/jface/text/DefaultTextHover.d Wed Aug 27 14:49:30 2008 +0200 @@ -180,7 +180,7 @@ * @param sourceViewer this hover's annotation model */ public this(ISourceViewer sourceViewer) { - Assert.isNotNull(sourceViewer); + dwtx.core.runtime.Assert.Assert.isNotNull(cast(Object)sourceViewer); fSourceViewer= sourceViewer; } @@ -238,10 +238,12 @@ int start= -2; int end= -1; +implMissing(__FILE__,__LINE__); +// DWT FIXME: unicode +/+ try { - int pos= offset; - char c; + wchar c; while (pos >= 0) { c= document.getChar(pos); @@ -275,7 +277,7 @@ else return new Region(start + 1, end - start - 1); } - ++/ return null; } } diff -r 3678e4f1a766 -r f8d52b926852 dwtx/jface/text/Document.d --- a/dwtx/jface/text/Document.d Wed Aug 27 02:07:22 2008 +0200 +++ b/dwtx/jface/text/Document.d Wed Aug 27 14:49:30 2008 +0200 @@ -178,7 +178,7 @@ * See {@link GapTextStore} and TreeLineTracker for algorithmic behavior of the used * document structures. *

- * + * * @see dwtx.jface.text.GapTextStore * @see dwtx.jface.text.CopyOnWriteTextStore */ @@ -220,7 +220,7 @@ /** * Checks whether the line information needs to be repaired. - * + * * @param text the text to check * @return true if the line information must be repaired * @since 3.4 @@ -250,18 +250,18 @@ if (defaultLD is null) return false; - + defaultLD= getDefaultLineDelimiter(); - if (defaultLD.length() is 1) { + if (defaultLD.length is 1) { if (rIndex !is -1 && !"\r".equals(defaultLD)) //$NON-NLS-1$ return true; if (nIndex !is -1 && !"\n".equals(defaultLD)) //$NON-NLS-1$ return true; - } else if (defaultLD.length() is 2) + } else if (defaultLD.length is 2) return rIndex is -1 || nIndex - rIndex !is 1; - + return false; } - + } diff -r 3678e4f1a766 -r f8d52b926852 dwtx/jface/text/TextUtilities.d --- a/dwtx/jface/text/TextUtilities.d Wed Aug 27 02:07:22 2008 +0200 +++ b/dwtx/jface/text/TextUtilities.d Wed Aug 27 14:49:30 2008 +0200 @@ -60,7 +60,7 @@ import dwtx.jface.text.IDocumentExtension4; // packageimport import dwtx.jface.text.IDocumentExtension2; // packageimport import dwtx.jface.text.IDocumentPartitionerExtension2; // packageimport -import dwtx.jface.text.Assert; // packageimport +// import dwtx.jface.text.Assert; // packageimport import dwtx.jface.text.DefaultInformationControl; // packageimport import dwtx.jface.text.IWidgetTokenOwnerExtension; // packageimport import dwtx.jface.text.DocumentClone; // packageimport @@ -221,7 +221,7 @@ */ public static int[] indexOf(String[] searchStrings, String text, int offset) { - int[] result= { -1, -1 }; + int[] result= [ -1, -1 ]; int zeroIndex= -1; for (int i= 0; i < searchStrings.length; i++) { @@ -233,7 +233,7 @@ continue; } - int index= text.indexOf(searchStrings[i], offset); + int index= .indexOf( text, searchStrings[i], offset); if (index >= 0) { if (result[0] is -1) { @@ -242,7 +242,7 @@ } else if (index < result[0]) { result[0]= index; result[1]= i; - } else if (index is result[0] && length > searchStrings[result[1]].length()) { + } else if (index is result[0] && length > searchStrings[result[1]].length) { result[0]= index; result[1]= i; } @@ -270,7 +270,7 @@ int index= -1; for (int i= 0; i < searchStrings.length; i++) { - if (text.endsWith(searchStrings[i])) { + if (.endsWith(text, searchStrings[i])) { if (index is -1 || searchStrings[i].length() > searchStrings[index].length()) index= i; } @@ -292,7 +292,7 @@ int index= -1; for (int i= 0; i < searchStrings.length; i++) { - if (text.startsWith(searchStrings[i])) { + if (.startsWith(text, searchStrings[i])) { if (index is -1 || searchStrings[i].length() > searchStrings[index].length()) index= i; } @@ -311,7 +311,7 @@ */ public static int equals(String[] compareStrings, String text) { for (int i= 0; i < compareStrings.length; i++) { - if (text.equals(compareStrings[i])) + if (.equals(text,compareStrings[i])) return i; } return -1; @@ -361,8 +361,10 @@ // event is left from merged event } else if (eventOffset + eventLength < offset) { final String string= document.get(eventOffset + eventLength, offset - (eventOffset + eventLength)); - text.insert(0, string); - text.insert(0, eventText); + text.select(0,0); + text.replace(string); + text.select(0,0); + text.replace(eventText); length= offset + length - eventOffset; offset= eventOffset; @@ -371,10 +373,11 @@ } else { final int start= Math.max(0, eventOffset - offset); final int end= Math.min(text.length(), eventLength + eventOffset - offset); - text.replace(start, end, eventText); + text.select(start, end); + text.replace(eventText); offset= Math.min(offset, eventOffset); - final int totalDelta= delta + eventText.length() - eventLength; + final int totalDelta= delta + eventText.length - eventLength; length= text.length() - totalDelta; } } @@ -404,7 +407,7 @@ final IDocument document= firstEvent.getDocument(); int offset= firstEvent.getOffset(); int length= firstEvent.getLength(); - int textLength= firstEvent.getText() is null ? 0 : firstEvent.getText().length(); + int textLength= firstEvent.getText() is null ? 0 : firstEvent.getText().length; while (iterator.hasPrevious()) { @@ -413,7 +416,7 @@ final DocumentEvent event= cast(DocumentEvent) iterator.previous(); final int eventOffset= event.getOffset(); final int eventLength= event.getLength(); - final int eventTextLength= event.getText() is null ? 0 : event.getText().length(); + final int eventTextLength= event.getText() is null ? 0 : event.getText().length; // event is right from merged event if (eventOffset > offset + textLength + delta) { @@ -460,7 +463,7 @@ if (partitioner !is null) { extension3.setDocumentPartitioner(partitionings[i], null); partitioner.disconnect(); - partitioners.put(partitionings[i], partitioner); + partitioners.put(stringcast(partitionings[i]), cast(Object)partitioner); } } } else { @@ -468,7 +471,7 @@ if (partitioner !is null) { document.setDocumentPartitioner(null); partitioner.disconnect(); - partitioners.put(IDocumentExtension3.DEFAULT_PARTITIONING, partitioner); + partitioners.put(stringcast(IDocumentExtension3.DEFAULT_PARTITIONING), cast(Object)partitioner); } } return partitioners; @@ -487,7 +490,7 @@ IDocumentExtension3 extension3= cast(IDocumentExtension3) document; Iterator e= partitioners.keySet().iterator(); while (e.hasNext()) { - String partitioning= cast(String) e.next(); + String partitioning= stringcast( e.next() ); IDocumentPartitioner partitioner= cast(IDocumentPartitioner) partitioners.get(partitioning); partitioner.connect(document); extension3.setDocumentPartitioner(partitioning, partitioner); @@ -606,9 +609,7 @@ } } } - String[] result= new String[categories.size()]; - categories.toArray(result); - return result; + return stringcast(categories.toArray()); } } return null; @@ -642,7 +643,7 @@ String[] delimiters= document.getLegalLineDelimiters(); Assert.isTrue(delimiters.length > 0); for (int i= 0; i < delimiters.length; i++) { - if (delimiters[i].equals(sysLineDelimiter)) { + if (.equals(delimiters[i], sysLineDelimiter)) { lineDelimiter= sysLineDelimiter; break; } diff -r 3678e4f1a766 -r f8d52b926852 dwtx/jface/text/TextViewer.d --- a/dwtx/jface/text/TextViewer.d Wed Aug 27 02:07:22 2008 +0200 +++ b/dwtx/jface/text/TextViewer.d Wed Aug 27 14:49:30 2008 +0200 @@ -2295,6 +2295,9 @@ protected ITextHover getTextHover(int offset) { return getTextHover(offset, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK); } + package ITextHover getTextHover_package(int offset) { + return getTextHover(offset); + } /** * Returns the text hover for a given offset and a given state mask. @@ -2304,6 +2307,9 @@ * @return the text hover for the given offset and state mask * @since 2.1 */ + package ITextHover getTextHover_package(int offset, int stateMask) { + return getTextHover(offset,stateMask); + } protected ITextHover getTextHover(int offset, int stateMask) { if (fTextHovers is null) return null; diff -r 3678e4f1a766 -r f8d52b926852 dwtx/jface/text/TextViewerHoverManager.d --- a/dwtx/jface/text/TextViewerHoverManager.d Wed Aug 27 02:07:22 2008 +0200 +++ b/dwtx/jface/text/TextViewerHoverManager.d Wed Aug 27 14:49:30 2008 +0200 @@ -227,11 +227,13 @@ public this(TextViewer textViewer, IInformationControlCreator creator) { super(creator); fTextViewer= textViewer; - fStopper= new class() ITextListener { + fStopper= new class() ITextListener { public void textChanged(TextEvent event) { synchronized (fMutex) { if (fThread !is null) { - fThread.interrupt(); +implMissing(__FILE__,__LINE__); +// DWT FIXME: how to handle Thread.interrupt? +// fThread.interrupt(); fThread= null; } } @@ -264,37 +266,37 @@ protected void computeInformation() { if (!fProcessMouseHoverEvent) { - setInformation(null, null); + setInformation(cast(Object)null, null); return; } Point location= getHoverEventLocation(); int offset= computeOffsetAtLocation(location.x, location.y); if (offset is -1) { - setInformation(null, null); + setInformation(cast(Object)null, null); return; } - final ITextHover hover= fTextViewer.getTextHover(offset, getHoverEventStateMask()); + final ITextHover hover= fTextViewer.getTextHover_package(offset, getHoverEventStateMask()); if (hover is null) { - setInformation(null, null); + setInformation(cast(Object)null, null); return; } final IRegion region= hover.getHoverRegion(fTextViewer, offset); if (region is null) { - setInformation(null, null); + setInformation(cast(Object)null, null); return; } final Rectangle area= JFaceTextUtil.computeArea(region, fTextViewer); if (area is null || area.isEmpty()) { - setInformation(null, null); + setInformation(cast(Object)null, null); return; } if (fThread !is null) { - setInformation(null, null); + setInformation(cast(Object)null, null); return; } @@ -308,7 +310,7 @@ if ( cast(ITextHoverExtension2)hover ) information= (cast(ITextHoverExtension2)hover).getHoverInfo2(fTextViewer, region); else - information= hover.getHoverInfo(fTextViewer, region); + information= stringcast(hover.getHoverInfo(fTextViewer, region)); } catch (ArrayIndexOutOfBoundsException x) { /* * This code runs in a separate thread which can @@ -327,7 +329,7 @@ if (information !is null) fTextHover= hover; } else { - setInformation(null, null); + setInformation(cast(Object)null, null); } hasFinished= true; } catch (RuntimeException ex) { @@ -341,7 +343,7 @@ fThread= null; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=44756 if (!hasFinished) - setInformation(null, null); + setInformation(cast(Object)null, null); } } } diff -r 3678e4f1a766 -r f8d52b926852 dwtx/text/edits/TextEdit.d --- a/dwtx/text/edits/TextEdit.d Wed Aug 27 02:07:22 2008 +0200 +++ b/dwtx/text/edits/TextEdit.d Wed Aug 27 14:49:30 2008 +0200 @@ -130,8 +130,8 @@ } } - private static const TextEdit[] EMPTY_ARRAY= new TextEdit[0]; - private static const InsertionComparator INSERTION_COMPARATOR= new InsertionComparator(); + private static const TextEdit[] EMPTY_ARRAY; + private static /+const+/ InsertionComparator INSERTION_COMPARATOR; private static const int DELETED_VALUE= -1; @@ -151,6 +151,7 @@ * @param length the edit's length */ protected this(int offset, int length) { + if( INSERTION_COMPARATOR is null ) INSERTION_COMPARATOR= new InsertionComparator(); Assert.isTrue(offset >= 0 && length >= 0); fOffset= offset; fLength= length; @@ -163,6 +164,7 @@ * @param source the source to copy form */ protected this(TextEdit source) { + if( INSERTION_COMPARATOR is null ) INSERTION_COMPARATOR= new InsertionComparator(); fOffset= source.fOffset; fLength= source.fLength; fDelta= 0; @@ -540,7 +542,7 @@ buffer.append(" "); //$NON-NLS-1$ } buffer.append("{"); //$NON-NLS-1$ - String name= getClass().getName(); + String name= this.classinfo.name; int index= name.lastIndexOf('.'); if (index !is -1) { buffer.append(name.substring(index + 1)); @@ -880,7 +882,7 @@ result= Math.max(result, child.traverseConsistencyCheck(processor, document, sourceEdits)); } } - if (processor.considerEdit(this)) { + if (processor.considerEdit_package(this)) { performConsistencyCheck(processor, document); } return result; @@ -904,7 +906,7 @@ childDocumentUpdated(); } } - if (processor.considerEdit(this)) { + if (processor.considerEdit_package(this)) { if (delta !is 0) adjustLength(delta); int r= performDocumentUpdating(document); diff -r 3678e4f1a766 -r f8d52b926852 dwtx/text/edits/TextEditProcessor.d --- a/dwtx/text/edits/TextEditProcessor.d Wed Aug 27 02:07:22 2008 +0200 +++ b/dwtx/text/edits/TextEditProcessor.d Wed Aug 27 14:49:30 2008 +0200 @@ -188,6 +188,10 @@ protected bool considerEdit(TextEdit edit) { return true; } + package bool considerEdit_package(TextEdit edit) { + return considerEdit(edit); + } + //---- checking -------------------------------------------------------------------- diff -r 3678e4f1a766 -r f8d52b926852 dwtx/text/undo/DocumentUndoEvent.d --- a/dwtx/text/undo/DocumentUndoEvent.d Wed Aug 27 02:07:22 2008 +0200 +++ b/dwtx/text/undo/DocumentUndoEvent.d Wed Aug 27 14:49:30 2008 +0200 @@ -98,7 +98,7 @@ */ this(IDocument doc, int offset, String text, String preservedText, int eventType, Object source) { - Assert.isNotNull(doc); + Assert.isNotNull(cast(Object)doc); Assert.isTrue(offset >= 0); fDocument= doc; diff -r 3678e4f1a766 -r f8d52b926852 dwtx/text/undo/DocumentUndoManager.d --- 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(); } diff -r 3678e4f1a766 -r f8d52b926852 dwtx/text/undo/DocumentUndoManagerRegistry.d --- a/dwtx/text/undo/DocumentUndoManagerRegistry.d Wed Aug 27 02:07:22 2008 +0200 +++ b/dwtx/text/undo/DocumentUndoManagerRegistry.d Wed Aug 27 14:49:30 2008 +0200 @@ -54,7 +54,11 @@ private IDocumentUndoManager undoManager; } - private static Map fgFactory= new HashMap(); + private static Map fgFactory_; + private static Map fgFactory(){ + if( fgFactory_ is null ) fgFactory_ = new HashMap(); + return fgFactory_; + } private this() { // Do not instantiate @@ -71,11 +75,11 @@ * @param document the document to be connected */ public static synchronized void connect(IDocument document) { - Assert.isNotNull(document); - Record record= cast(Record)fgFactory.get(document); + Assert.isNotNull(cast(Object)document); + Record record= cast(Record)fgFactory.get(cast(Object)document); if (record is null) { record= new Record(document); - fgFactory.put(document, record); + fgFactory.put(cast(Object)document, record); } record.count++; } @@ -86,11 +90,11 @@ * @param document the document to be disconnected */ public static synchronized void disconnect(IDocument document) { - Assert.isNotNull(document); - Record record= cast(Record)fgFactory.get(document); + Assert.isNotNull(cast(Object)document); + Record record= cast(Record)fgFactory.get(cast(Object)document); record.count--; if (record.count is 0) - fgFactory.remove(document); + fgFactory.remove(cast(Object)document); } @@ -108,8 +112,8 @@ * @return the document undo manager or null */ public static synchronized IDocumentUndoManager getDocumentUndoManager(IDocument document) { - Assert.isNotNull(document); - Record record= cast(Record)fgFactory.get(document); + Assert.isNotNull(cast(Object)document); + Record record= cast(Record)fgFactory.get(cast(Object)document); if (record is null) return null; return record.undoManager;