Mercurial > projects > dwt-addons
diff dwtx/jface/text/source/AnnotationRulerColumn.d @ 159:7926b636c282
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 27 Aug 2008 01:57:58 +0200 |
parents | f70d9508c95c |
children | 1a5b8f8129df |
line wrap: on
line diff
--- a/dwtx/jface/text/source/AnnotationRulerColumn.d Tue Aug 26 02:46:34 2008 +0200 +++ b/dwtx/jface/text/source/AnnotationRulerColumn.d Wed Aug 27 01:57:58 2008 +0200 @@ -210,7 +210,7 @@ /** The buffer for double buffering */ private Image fBuffer; /** The internal listener */ - private InternalListener fInternalListener= new InternalListener(); + private InternalListener fInternalListener; /** The width of this vertical ruler */ private int fWidth; /** Switch for enabling/disabling the setModel method. */ @@ -219,14 +219,14 @@ * The list of annotation types to be shown in this ruler. * @since 3.0 */ - private Set fConfiguredAnnotationTypes= new HashSet(); + private Set fConfiguredAnnotationTypes; /** * The list of allowed annotation types to be shown in this ruler. * An allowed annotation type maps to <code>true</code>, a disallowed * to <code>false</code>. * @since 3.0 */ - private Map fAllowedAnnotationTypes= new HashMap(); + private Map fAllowedAnnotationTypes; /** * The annotation access extension. * @since 3.0 @@ -241,12 +241,12 @@ * The cached annotations. * @since 3.0 */ - private List fCachedAnnotations= new ArrayList(); + private List fCachedAnnotations; /** * The comparator for sorting annotations according to the offset of their position. * @since 3.0 */ - private Comparator fTupleComparator= new TupleComparator(); + private Comparator fTupleComparator; /** * The hit detection cursor. * @since 3.0 @@ -263,6 +263,13 @@ */ private MouseListener fMouseListener; + private void instanceInit(){ + fInternalListener= new InternalListener(); + fConfiguredAnnotationTypes= new HashSet(); + fAllowedAnnotationTypes= new HashMap(); + fCachedAnnotations= new ArrayList(); + fTupleComparator= new TupleComparator(); + } /** * Constructs this column with the given arguments. * @@ -286,6 +293,7 @@ * @since 3.0 */ public this(int width, IAnnotationAccess annotationAccess) { + instanceInit(); fWidth= width; if ( cast(IAnnotationAccessExtension)annotationAccess ) fAnnotationAccessExtension= cast(IAnnotationAccessExtension) annotationAccess; @@ -298,6 +306,7 @@ * @param width the width of the vertical ruler */ public this(IAnnotationModel model, int width) { + instanceInit(); fWidth= width; fAllowSetModel= false; fModel= model; @@ -310,6 +319,7 @@ * @param width the width of the vertical ruler */ public this(int width) { + instanceInit(); fWidth= width; } @@ -489,7 +499,7 @@ IDocument d= fCachedTextViewer.getDocument(); if (d is null) return false; - + line= d.getLineInformation(lineNumber); } catch (BadLocationException ex) { return false; @@ -600,11 +610,11 @@ protected int getInclusiveTopIndexStartOffset() { if (fCachedTextWidget is null || fCachedTextWidget.isDisposed()) return -1; - + IDocument document= fCachedTextViewer.getDocument(); if (document is null) return -1; - + int top= JFaceTextUtil.getPartialTopIndex(fCachedTextViewer); try { return document.getLineOffset(top); @@ -622,11 +632,11 @@ private int getExclusiveBottomIndexEndOffset() { if (fCachedTextWidget is null || fCachedTextWidget.isDisposed()) return -1; - + IDocument document= fCachedTextViewer.getDocument(); if (document is null) return -1; - + int bottom= JFaceTextUtil.getPartialBottomIndex(fCachedTextViewer); try { if (bottom >= document.getNumberOfLines()) @@ -725,10 +735,10 @@ r.x= 0; r.y= JFaceTextUtil.computeLineHeight(fCachedTextWidget, 0, startLine, startLine) - fScrollPos; - + r.width= dimension.x; int lines= endLine - startLine; - + r.height= JFaceTextUtil.computeLineHeight(fCachedTextWidget, startLine, endLine + 1, lines + 1); if (r.y < dimension.y && fAnnotationAccessExtension !is null) // annotation within visible area @@ -824,7 +834,7 @@ r.x= 0; r.y= JFaceTextUtil.computeLineHeight(fCachedTextWidget, 0, startLine, startLine) - fScrollPos; - + r.width= dimension.x; int lines= endLine - startLine; r.height= JFaceTextUtil.computeLineHeight(fCachedTextWidget, startLine, endLine + 1, lines + 1); @@ -933,7 +943,7 @@ public int toDocumentLineNumber(int y_coordinate) { return fParentRuler.toDocumentLineNumber(y_coordinate); } - + /** * Removes the given annotation type from this annotation ruler column. * Annotations of the given type are no longer shown in this annotation