Mercurial > projects > dwt-addons
diff dwtx/jface/text/source/projection/ProjectionViewer.d @ 138:b6bad70d540a
Regex instanceof changes
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 02:26:23 +0200 |
parents | 6dcb0baaa031 |
children | 53b889547456 |
line wrap: on
line diff
--- a/dwtx/jface/text/source/projection/ProjectionViewer.d Sun Aug 24 02:22:48 2008 +0200 +++ b/dwtx/jface/text/source/projection/ProjectionViewer.d Sun Aug 24 02:26:23 2008 +0200 @@ -343,7 +343,7 @@ * @param model the model to which the projection annotation model is added */ private void addProjectionAnnotationModel(IAnnotationModel model) { - if (model instanceof IAnnotationModelExtension) { + if ( cast(IAnnotationModelExtension)model ) { IAnnotationModelExtension extension= cast(IAnnotationModelExtension) model; extension.addAnnotationModel(ProjectionSupport.PROJECTION, fProjectionAnnotationModel); model.addAnnotationModelListener(fAnnotationModelListener); @@ -357,7 +357,7 @@ * @return the removed projection annotation model or <code>null</code> if there was none */ private IAnnotationModel removeProjectionAnnotationModel(IAnnotationModel model) { - if (model instanceof IAnnotationModelExtension) { + if ( cast(IAnnotationModelExtension)model ) { model.removeAnnotationModelListener(fAnnotationModelListener); IAnnotationModelExtension extension= cast(IAnnotationModelExtension) model; return extension.removeAnnotationModel(ProjectionSupport.PROJECTION); @@ -402,7 +402,7 @@ */ public ProjectionAnnotationModel getProjectionAnnotationModel() { IAnnotationModel model= getVisualAnnotationModel(); - if (model instanceof IAnnotationModelExtension) { + if ( cast(IAnnotationModelExtension)model ) { IAnnotationModelExtension extension= cast(IAnnotationModelExtension) model; return cast(ProjectionAnnotationModel) extension.getAnnotationModel(ProjectionSupport.PROJECTION); } @@ -420,7 +420,7 @@ * @see dwtx.jface.text.TextViewer#updateSlaveDocument(dwtx.jface.text.IDocument, int, int) */ protected bool updateSlaveDocument(IDocument slaveDocument, int modelRangeOffset, int modelRangeLength) { - if (slaveDocument instanceof ProjectionDocument) { + if ( cast(ProjectionDocument)slaveDocument ) { ProjectionDocument projection= cast(ProjectionDocument) slaveDocument; int offset= modelRangeOffset; @@ -805,12 +805,12 @@ ProjectionDocument projection= null; IDocument visibleDocument= getVisibleDocument(); - if (visibleDocument instanceof ProjectionDocument) + if ( cast(ProjectionDocument)visibleDocument ) projection= cast(ProjectionDocument) visibleDocument; else { IDocument master= getDocument(); IDocument slave= createSlaveDocument(getDocument()); - if (slave instanceof ProjectionDocument) { + if ( cast(ProjectionDocument)slave ) { projection= cast(ProjectionDocument) slave; addMasterDocumentRange(projection, 0, master.getLength()); replaceVisibleDocument(projection); @@ -843,7 +843,7 @@ */ private void expand(int offset, int length, bool fireRedraw) { IDocument slave= getVisibleDocument(); - if (slave instanceof ProjectionDocument) { + if ( cast(ProjectionDocument)slave ) { ProjectionDocument projection= cast(ProjectionDocument) slave; // expand @@ -947,7 +947,7 @@ */ private bool isVisibleMasterDocumentSameAsDocument() { IDocument visibleDocument= getVisibleDocument(); - return (visibleDocument instanceof ProjectionDocument) && (cast(ProjectionDocument)visibleDocument).getMasterDocument() is getDocument(); + return ( cast(ProjectionDocument)visibleDocument ) && (cast(ProjectionDocument)visibleDocument).getMasterDocument() is getDocument(); } /** @@ -1134,7 +1134,7 @@ if (document is null) return null; - if (position instanceof IProjectionPosition) { + if ( cast(IProjectionPosition)position ) { IProjectionPosition projPosition= cast(IProjectionPosition) position; return projPosition.computeProjectionRegions(document); } @@ -1168,7 +1168,7 @@ return null; int captionOffset= position.getOffset(); - if (position instanceof IProjectionPosition) + if ( cast(IProjectionPosition)position ) captionOffset+= (cast(IProjectionPosition) position).computeCaptionOffset(document); IRegion lineInfo= document.getLineInformationOfOffset(captionOffset); @@ -1225,7 +1225,7 @@ IDocument master= getDocument(); if (master !is null) { IDocument slave= manager.createSlaveDocument(master); - if (slave instanceof ProjectionDocument) { + if ( cast(ProjectionDocument)slave ) { projection= cast(ProjectionDocument) slave; addMasterDocumentRange(projection, 0, master.getLength()); } @@ -1270,7 +1270,7 @@ */ public void addVerticalRulerColumn(IVerticalRulerColumn column) { IVerticalRuler ruler= getVerticalRuler(); - if (ruler instanceof CompositeRuler) { + if ( cast(CompositeRuler)ruler ) { CompositeRuler compositeRuler= cast(CompositeRuler) ruler; compositeRuler.addDecorator(99, column); } @@ -1283,7 +1283,7 @@ */ public void removeVerticalRulerColumn(IVerticalRulerColumn column) { IVerticalRuler ruler= getVerticalRuler(); - if (ruler instanceof CompositeRuler) { + if ( cast(CompositeRuler)ruler ) { CompositeRuler compositeRuler= cast(CompositeRuler) ruler; compositeRuler.removeDecorator(column); } @@ -1405,7 +1405,7 @@ if (fInformationMapping is null) return new IRegion[] { new Region(modelRange.getOffset(), modelRange.getLength()) }; - if (fInformationMapping instanceof IDocumentInformationMappingExtension) { + if ( cast(IDocumentInformationMappingExtension)fInformationMapping ) { IDocumentInformationMappingExtension extension= cast(IDocumentInformationMappingExtension) fInformationMapping; try { return extension.getExactCoverage(modelRange);