Mercurial > projects > dwt-addons
diff dwtx/jface/text/source/projection/ProjectionViewer.d @ 145:02cd5f1224d3
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 22:31:00 +0200 |
parents | 53b889547456 |
children | 000f9136b8f7 |
line wrap: on
line diff
--- a/dwtx/jface/text/source/projection/ProjectionViewer.d Sun Aug 24 21:34:15 2008 +0200 +++ b/dwtx/jface/text/source/projection/ProjectionViewer.d Sun Aug 24 22:31:00 2008 +0200 @@ -99,7 +99,7 @@ public static final int EXPAND_ALL= BASE + 4; /** * Operation constant for the collapse all operation. - * + * * @since 3.2 */ public static final int COLLAPSE_ALL= BASE + 5; @@ -488,7 +488,7 @@ */ protected void fireProjectionEnabled() { if (fProjectionListeners !is null) { - Iterator e= new ArrayList(fProjectionListeners).iterator(); + Iterator e= (new ArrayList(fProjectionListeners)).iterator(); while (e.hasNext()) { IProjectionListener l= cast(IProjectionListener) e.next(); l.projectionEnabled(); @@ -502,7 +502,7 @@ */ protected void fireProjectionDisabled() { if (fProjectionListeners !is null) { - Iterator e= new ArrayList(fProjectionListeners).iterator(); + Iterator e= (new ArrayList(fProjectionListeners)).iterator(); while (e.hasNext()) { IProjectionListener l= cast(IProjectionListener) e.next(); l.projectionDisabled(); @@ -678,11 +678,11 @@ } } } - + /** * Returns the first line offset <= <code>offset</code>. If <code>testLastLine</code> * is <code>true</code> and the offset is on last line then <code>offset</code> is returned. - * + * * @param document the document * @param offset the master document offset * @param testLastLine <code>true</code> if the test for the last line should be performed @@ -693,10 +693,10 @@ private int toLineStart(IDocument document, int offset, bool testLastLine) { if (document is null) return offset; - + if (testLastLine && offset >= document.getLineInformationOfOffset(document.getLength() - 1).getOffset()) return offset; - + return document.getLineInformationOfOffset(offset).getOffset(); } @@ -834,7 +834,7 @@ /** * Makes the given range visible again while not changing the folding state of any contained * ranges. If requested, a redraw request is issued. - * + * * @param offset the offset of the range to be expanded * @param length the length of the range to be expanded * @param fireRedraw <code>true</code> if a redraw request should be issued, @@ -936,11 +936,11 @@ } } } - + /** * Tests whether the visible document's master document * is identical to this viewer's document. - * + * * @return <code>true</code> if the visible document's master is * identical to this viewer's document * @since 3.1 @@ -959,7 +959,7 @@ * @exception BadLocationException in case the annotation model event is no longer in synchronization with the document */ private void catchupWithProjectionAnnotationModel(AnnotationModelEvent event) { - + if (event is null || !isVisibleMasterDocumentSameAsDocument()) { fPendingAnnotationWorldChange= false; @@ -979,24 +979,24 @@ reinitializeProjection(); } } else { - + Annotation[] addedAnnotations= event.getAddedAnnotations(); Annotation[] changedAnnotation= event.getChangedAnnotations(); Annotation[] removedAnnotations= event.getRemovedAnnotations(); - + fCommandQueue= new ProjectionCommandQueue(); - + bool isRedrawing= redraws(); int topIndex= isRedrawing ? getTopIndex() : -1; - + processDeletions(event, removedAnnotations, true); List coverage= new ArrayList(); processChanges(addedAnnotations, true, coverage); processChanges(changedAnnotation, true, coverage); - + ProjectionCommandQueue commandQueue= fCommandQueue; fCommandQueue= null; - + if (commandQueue.passedRedrawCostsThreshold()) { setRedraw(false); try { @@ -1106,7 +1106,7 @@ IDocument document= getDocument(); if (document is null) return null; - + int line= document.getLineOfOffset(position.getOffset()); int offset= document.getLineOffset(line + 1); @@ -1144,7 +1144,7 @@ int length= position.getLength() - (offset - position.getOffset()); if (length > 0) - return new IRegion[] {new Region(offset, length)}; + return [new Region(offset, length)]; return null; } catch (BadLocationException x) { @@ -1403,7 +1403,7 @@ */ public IRegion[] getCoveredModelRanges(IRegion modelRange) { if (fInformationMapping is null) - return new IRegion[] { new Region(modelRange.getOffset(), modelRange.getLength()) }; + return [ new Region(modelRange.getOffset(), modelRange.getLength()) ]; if ( cast(IDocumentInformationMappingExtension)fInformationMapping ) { IDocumentInformationMappingExtension extension= cast(IDocumentInformationMappingExtension) fInformationMapping; @@ -1451,7 +1451,7 @@ selection= getSelectedRange(); if (exposeModelRange(new Region(selection.x, selection.y))) return; - + if (selection.y is 0) copyMarkedRegion(true); else @@ -1509,7 +1509,7 @@ if (redraws()) collapseAll(); break; - + case COLLAPSE: if (redraws()) { collapse(); @@ -1563,13 +1563,13 @@ /* * @see dwtx.jface.text.TextViewer#copyMarkedRegion(bool) */ - protected void copyMarkedRegion(bool delete) { + protected void copyMarkedRegion(bool delete_) { IRegion markedRegion= getMarkedRegion(); if (markedRegion !is null) - copyToClipboard(markedRegion.getOffset(), markedRegion.getLength(), delete, getTextWidget()); + copyToClipboard(markedRegion.getOffset(), markedRegion.getLength(), delete_, getTextWidget()); } - private void copyToClipboard(int offset, int length, bool delete, StyledText textWidget) { + private void copyToClipboard(int offset, int length, bool delete_, StyledText textWidget) { String copyText= null; @@ -1593,8 +1593,8 @@ Clipboard clipboard= new Clipboard(textWidget.getDisplay()); try { - Transfer[] dataTypes= new Transfer[] { TextTransfer.getInstance() }; - Object[] data= new Object[] { copyText }; + Transfer[] dataTypes= [ TextTransfer.getInstance() ]; + Object[] data= [ stringcast(copyText) ]; try { clipboard.setContents(data, dataTypes); } catch (DWTError e) { @@ -1613,7 +1613,7 @@ } } - if (delete) { + if (delete_) { try { deleteTextRange(offset, length, textWidget); } catch (BadLocationException x) {