Mercurial > projects > dwt-addons
diff dwtx/jface/text/source/projection/ProjectionViewer.d @ 134:51e6e63f930e
Regex fix for casts
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 01:46:20 +0200 |
parents | 7d818bd32d63 |
children | 65801ad2b265 |
line wrap: on
line diff
--- a/dwtx/jface/text/source/projection/ProjectionViewer.d Sun Aug 24 01:29:22 2008 +0200 +++ b/dwtx/jface/text/source/projection/ProjectionViewer.d Sun Aug 24 01:46:20 2008 +0200 @@ -276,7 +276,7 @@ ProjectionCommand command; Iterator e= fList.iterator(); while (e.hasNext()) { - command= (ProjectionCommand) e.next(); + command= cast(ProjectionCommand) e.next(); fExpectedExecutionCosts += command.computeExpectedCosts(); if (fExpectedExecutionCosts > max_costs) break; @@ -344,7 +344,7 @@ */ private void addProjectionAnnotationModel(IAnnotationModel model) { if (model instanceof IAnnotationModelExtension) { - IAnnotationModelExtension extension= (IAnnotationModelExtension) model; + IAnnotationModelExtension extension= cast(IAnnotationModelExtension) model; extension.addAnnotationModel(ProjectionSupport.PROJECTION, fProjectionAnnotationModel); model.addAnnotationModelListener(fAnnotationModelListener); } @@ -359,7 +359,7 @@ private IAnnotationModel removeProjectionAnnotationModel(IAnnotationModel model) { if (model instanceof IAnnotationModelExtension) { model.removeAnnotationModelListener(fAnnotationModelListener); - IAnnotationModelExtension extension= (IAnnotationModelExtension) model; + IAnnotationModelExtension extension= cast(IAnnotationModelExtension) model; return extension.removeAnnotationModel(ProjectionSupport.PROJECTION); } return null; @@ -403,8 +403,8 @@ public ProjectionAnnotationModel getProjectionAnnotationModel() { IAnnotationModel model= getVisualAnnotationModel(); if (model instanceof IAnnotationModelExtension) { - IAnnotationModelExtension extension= (IAnnotationModelExtension) model; - return (ProjectionAnnotationModel) extension.getAnnotationModel(ProjectionSupport.PROJECTION); + IAnnotationModelExtension extension= cast(IAnnotationModelExtension) model; + return cast(ProjectionAnnotationModel) extension.getAnnotationModel(ProjectionSupport.PROJECTION); } return null; } @@ -421,7 +421,7 @@ */ protected bool updateSlaveDocument(IDocument slaveDocument, int modelRangeOffset, int modelRangeLength) throws BadLocationException { if (slaveDocument instanceof ProjectionDocument) { - ProjectionDocument projection= (ProjectionDocument) slaveDocument; + ProjectionDocument projection= cast(ProjectionDocument) slaveDocument; int offset= modelRangeOffset; int length= modelRangeLength; @@ -490,7 +490,7 @@ if (fProjectionListeners !is null) { Iterator e= new ArrayList(fProjectionListeners).iterator(); while (e.hasNext()) { - IProjectionListener l= (IProjectionListener) e.next(); + IProjectionListener l= cast(IProjectionListener) e.next(); l.projectionEnabled(); } } @@ -504,7 +504,7 @@ if (fProjectionListeners !is null) { Iterator e= new ArrayList(fProjectionListeners).iterator(); while (e.hasNext()) { - IProjectionListener l= (IProjectionListener) e.next(); + IProjectionListener l= cast(IProjectionListener) e.next(); l.projectionDisabled(); } } @@ -558,7 +558,7 @@ Annotation bestMatch= null; Point selection= getSelectedRange(); for (Iterator e= fProjectionAnnotationModel.getAnnotationIterator(); e.hasNext();) { - ProjectionAnnotation annotation= (ProjectionAnnotation) e.next(); + ProjectionAnnotation annotation= cast(ProjectionAnnotation) e.next(); if (annotation.isCollapsed()) { Position position= fProjectionAnnotationModel.getPosition(annotation); // take the first most fine grained match @@ -587,7 +587,7 @@ Annotation bestMatch= null; Point selection= getSelectedRange(); for (Iterator e= fProjectionAnnotationModel.getAnnotationIterator(); e.hasNext();) { - ProjectionAnnotation annotation= (ProjectionAnnotation) e.next(); + ProjectionAnnotation annotation= cast(ProjectionAnnotation) e.next(); if (!annotation.isCollapsed()) { Position position= fProjectionAnnotationModel.getPosition(annotation); // take the first most fine grained match @@ -806,12 +806,12 @@ IDocument visibleDocument= getVisibleDocument(); if (visibleDocument instanceof ProjectionDocument) - projection= (ProjectionDocument) visibleDocument; + projection= cast(ProjectionDocument) visibleDocument; else { IDocument master= getDocument(); IDocument slave= createSlaveDocument(getDocument()); if (slave instanceof ProjectionDocument) { - projection= (ProjectionDocument) slave; + projection= cast(ProjectionDocument) slave; addMasterDocumentRange(projection, 0, master.getLength()); replaceVisibleDocument(projection); } @@ -844,7 +844,7 @@ private void expand(int offset, int length, bool fireRedraw) throws BadLocationException { IDocument slave= getVisibleDocument(); if (slave instanceof ProjectionDocument) { - ProjectionDocument projection= (ProjectionDocument) slave; + ProjectionDocument projection= cast(ProjectionDocument) slave; // expand addMasterDocumentRange(projection, offset, length); @@ -914,7 +914,7 @@ synchronized (fLock) { if (fPendingRequests.size() is 0) return; - ame= (AnnotationModelEvent) fPendingRequests.remove(0); + ame= cast(AnnotationModelEvent) fPendingRequests.remove(0); } catchupWithProjectionAnnotationModel(ame); } @@ -947,7 +947,7 @@ */ private bool isVisibleMasterDocumentSameAsDocument() { IDocument visibleDocument= getVisibleDocument(); - return (visibleDocument instanceof ProjectionDocument) && ((ProjectionDocument)visibleDocument).getMasterDocument() is getDocument(); + return (visibleDocument instanceof ProjectionDocument) && (cast(ProjectionDocument)visibleDocument).getMasterDocument() is getDocument(); } /** @@ -1024,7 +1024,7 @@ ProjectionCommand command; Iterator e= commandQueue.iterator(); while (e.hasNext()) { - command= (ProjectionCommand) e.next(); + command= cast(ProjectionCommand) e.next(); switch (command.fType) { case ProjectionCommand.ADD: addMasterDocumentRange(command.fProjection, command.fOffset, command.fLength); @@ -1052,7 +1052,7 @@ List annotations= new ArrayList(5); Iterator e= fProjectionAnnotationModel.getAnnotationIterator(); while (e.hasNext()) { - ProjectionAnnotation annotation= (ProjectionAnnotation) e.next(); + ProjectionAnnotation annotation= cast(ProjectionAnnotation) e.next(); if (annotation.isCollapsed()) { Position position= fProjectionAnnotationModel.getPosition(annotation); if (position is null) { @@ -1086,7 +1086,7 @@ */ private void processDeletions(AnnotationModelEvent event, Annotation[] removedAnnotations, bool fireRedraw) throws BadLocationException { for (int i= 0; i < removedAnnotations.length; i++) { - ProjectionAnnotation annotation= (ProjectionAnnotation) removedAnnotations[i]; + ProjectionAnnotation annotation= cast(ProjectionAnnotation) removedAnnotations[i]; if (annotation.isCollapsed()) { Position expanded= event.getPositionOfRemovedAnnotation(annotation); expand(expanded.getOffset(), expanded.getLength(), fireRedraw); @@ -1135,7 +1135,7 @@ return null; if (position instanceof IProjectionPosition) { - IProjectionPosition projPosition= (IProjectionPosition) position; + IProjectionPosition projPosition= cast(IProjectionPosition) position; return projPosition.computeProjectionRegions(document); } @@ -1169,7 +1169,7 @@ int captionOffset= position.getOffset(); if (position instanceof IProjectionPosition) - captionOffset+= ((IProjectionPosition) position).computeCaptionOffset(document); + captionOffset+= (cast(IProjectionPosition) position).computeCaptionOffset(document); IRegion lineInfo= document.getLineInformationOfOffset(captionOffset); return new Position(lineInfo.getOffset() + lineInfo.getLength(), 0); @@ -1180,7 +1180,7 @@ private void processChanges(Annotation[] annotations, bool fireRedraw, List coverage) throws BadLocationException { for (int i= 0; i < annotations.length; i++) { - ProjectionAnnotation annotation= (ProjectionAnnotation) annotations[i]; + ProjectionAnnotation annotation= cast(ProjectionAnnotation) annotations[i]; Position position= fProjectionAnnotationModel.getPosition(annotation); if (position is null) @@ -1203,7 +1203,7 @@ private bool covers(List coverage, Position position) { Iterator e= coverage.iterator(); while (e.hasNext()) { - Position p= (Position) e.next(); + Position p= cast(Position) e.next(); if (p.getOffset() <= position.getOffset() && position.getOffset() + position.getLength() <= p.getOffset() + p.getLength()) return true; } @@ -1226,7 +1226,7 @@ if (master !is null) { IDocument slave= manager.createSlaveDocument(master); if (slave instanceof ProjectionDocument) { - projection= (ProjectionDocument) slave; + projection= cast(ProjectionDocument) slave; addMasterDocumentRange(projection, 0, master.getLength()); } } @@ -1235,7 +1235,7 @@ if (projection !is null) { Iterator e= fProjectionAnnotationModel.getAnnotationIterator(); while (e.hasNext()) { - ProjectionAnnotation annotation= (ProjectionAnnotation) e.next(); + ProjectionAnnotation annotation= cast(ProjectionAnnotation) e.next(); if (annotation.isCollapsed()) { Position position= fProjectionAnnotationModel.getPosition(annotation); if (position !is null) { @@ -1271,7 +1271,7 @@ public void addVerticalRulerColumn(IVerticalRulerColumn column) { IVerticalRuler ruler= getVerticalRuler(); if (ruler instanceof CompositeRuler) { - CompositeRuler compositeRuler= (CompositeRuler) ruler; + CompositeRuler compositeRuler= cast(CompositeRuler) ruler; compositeRuler.addDecorator(99, column); } } @@ -1284,7 +1284,7 @@ public void removeVerticalRulerColumn(IVerticalRulerColumn column) { IVerticalRuler ruler= getVerticalRuler(); if (ruler instanceof CompositeRuler) { - CompositeRuler compositeRuler= (CompositeRuler) ruler; + CompositeRuler compositeRuler= cast(CompositeRuler) ruler; compositeRuler.removeDecorator(column); } } @@ -1314,7 +1314,7 @@ // expand the immediate effected collapsed regions Iterator iterator= fProjectionAnnotationModel.getAnnotationIterator(); while (iterator.hasNext()) { - ProjectionAnnotation annotation= (ProjectionAnnotation)iterator.next(); + ProjectionAnnotation annotation= cast(ProjectionAnnotation)iterator.next(); if (annotation.isCollapsed() && willAutoExpand(fProjectionAnnotationModel.getPosition(annotation), offset, length)) expand.add(annotation); } @@ -1322,7 +1322,7 @@ if (!expand.isEmpty()) { Iterator e= expand.iterator(); while (e.hasNext()) - fProjectionAnnotationModel.expand((Annotation)e.next()); + fProjectionAnnotationModel.expand(cast(Annotation)e.next()); } } super.setRangeIndication(offset, length, moveCursor); @@ -1354,7 +1354,7 @@ */ protected void handleVisibleDocumentChanged(DocumentEvent event) { if (fHandleProjectionChanges && event instanceof ProjectionDocumentEvent && isProjectionMode()) { - ProjectionDocumentEvent e= (ProjectionDocumentEvent) event; + ProjectionDocumentEvent e= cast(ProjectionDocumentEvent) event; DocumentEvent master= e.getMasterEvent(); if (master !is null) @@ -1406,7 +1406,7 @@ return new IRegion[] { new Region(modelRange.getOffset(), modelRange.getLength()) }; if (fInformationMapping instanceof IDocumentInformationMappingExtension) { - IDocumentInformationMappingExtension extension= (IDocumentInformationMappingExtension) fInformationMapping; + IDocumentInformationMappingExtension extension= cast(IDocumentInformationMappingExtension) fInformationMapping; try { return extension.getExactCoverage(modelRange); } catch (BadLocationException x) { @@ -1712,7 +1712,7 @@ private Position[] computeOverlappingAnnotationPositions(IRegion modelSelection) { List positions= new ArrayList(); for (Iterator e= fProjectionAnnotationModel.getAnnotationIterator(); e.hasNext();) { - ProjectionAnnotation annotation= (ProjectionAnnotation) e.next(); + ProjectionAnnotation annotation= cast(ProjectionAnnotation) e.next(); Position position= fProjectionAnnotationModel.getPosition(annotation); if (position !is null && position.overlapsWith(modelSelection.getOffset(), modelSelection.getLength()) && modelRange2WidgetRange(position) !is null) positions.add(position);