Mercurial > projects > dwt-addons
diff dwtx/jface/text/source/ChangeRulerColumn.d @ 159:7926b636c282
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 27 Aug 2008 01:57:58 +0200 |
parents | 75302ef3f92f |
children | 1a5b8f8129df |
line wrap: on
line diff
--- a/dwtx/jface/text/source/ChangeRulerColumn.d Tue Aug 26 02:46:34 2008 +0200 +++ b/dwtx/jface/text/source/ChangeRulerColumn.d Wed Aug 27 01:57:58 2008 +0200 @@ -182,16 +182,16 @@ } } - + /** - * The view(port) listener. + * The view(port) listener. */ - private const InternalListener fInternalListener= new InternalListener(); + private const InternalListener fInternalListener; /** * The mouse handler. * @since 3.2 */ - private const MouseHandler fMouseHandler= new MouseHandler(); + private const MouseHandler fMouseHandler; /** * The revision painter. * @since 3.2 @@ -217,7 +217,7 @@ private IAnnotationModel fAnnotationModel; /** The width of the change ruler column. */ private const int fWidth= 5; - + /** Cache for the actual scroll position in pixels */ private int fScrollPos; /** The buffer for double buffering */ @@ -225,28 +225,34 @@ /** Indicates whether this column reacts on text change events */ private bool fSensitiveToTextChanges= false; + private void instanceInit(){ + fInternalListener= new InternalListener(); + fMouseHandler= new MouseHandler(); + } /** * Creates a new ruler column. - * + * * @deprecated since 3.2 use {@link #ChangeRulerColumn(ISharedTextColors)} instead */ public this() { + instanceInit(); fRevisionPainter= null; fDiffPainter= new DiffPainter(this, null); } - + /** * Creates a new revision ruler column. - * + * * @param sharedColors the colors to look up RGBs * @since 3.2 */ public this(ISharedTextColors sharedColors) { + instanceInit(); Assert.isNotNull(sharedColors); fRevisionPainter= new RevisionPainter(this, sharedColors); fDiffPainter= new DiffPainter(this, null); // no shading } - + /** * Returns the System background color for list widgets. * @@ -293,7 +299,7 @@ fCachedTextViewer.addViewportListener(fInternalListener); fCachedTextViewer.addTextListener(fInternalListener); } - + fRevisionPainter.setParentRuler(parentRuler); fDiffPainter.setParentRuler(parentRuler); @@ -355,7 +361,7 @@ /** * Returns the view port height in lines. - * + * * @return the view port height in lines * @deprecated as of 3.2 the number of lines in the viewport cannot be computed because * StyledText supports variable line heights @@ -368,7 +374,7 @@ /** * Returns <code>true</code> if the viewport displays the entire viewer contents, i.e. the * viewer is not vertically scrollable. - * + * * @return <code>true</code> if the viewport displays the entire contents, <code>false</code> otherwise * @since 3.2 */ @@ -553,10 +559,10 @@ public void removeVerticalRulerListener(IVerticalRulerListener listener) { throw new UnsupportedOperationException(); } - + /** * Computes the document based line range visible in the text widget. - * + * * @return the document based line range visible in the text widget * @since 3.2 */ @@ -564,35 +570,35 @@ IDocument doc= fCachedTextViewer.getDocument(); if (doc is null) return null; - + int topLine; IRegion coverage; - + if ( cast(ITextViewerExtension5)fCachedTextViewer ) { ITextViewerExtension5 extension= cast(ITextViewerExtension5) fCachedTextViewer; - + // ITextViewer.getTopIndex returns the fully visible line, but we want the partially // visible one int widgetTopLine= JFaceTextUtil.getPartialTopIndex(fCachedTextWidget); topLine= extension.widgetLine2ModelLine(widgetTopLine); - + coverage= extension.getModelCoverage(); - + } else { - topLine= JFaceTextUtil.getPartialTopIndex(fCachedTextViewer); + topLine= JFaceTextUtil.getPartialTopIndex(fCachedTextViewer); coverage= fCachedTextViewer.getVisibleRegion(); } - + int bottomLine= fCachedTextViewer.getBottomIndex(); if (bottomLine !is -1) ++ bottomLine; - + // clip by coverage window try { int firstLine= doc.getLineOfOffset(coverage.getOffset()); if (firstLine > topLine) topLine= firstLine; - + int lastLine= doc.getLineOfOffset(coverage.getOffset() + coverage.getLength()); if (lastLine < bottomLine || bottomLine is -1) bottomLine= lastLine; @@ -600,11 +606,11 @@ x.printStackTrace(); return null; } - + ILineRange visibleModelLines= new LineRange(topLine, bottomLine - topLine + 1); return visibleModelLines; } - + /* * @see dwtx.jface.text.revisions.IRevisionRulerColumn#setRevisionInformation(dwtx.jface.text.revisions.RevisionInformation) */ @@ -615,7 +621,7 @@ /** * Returns the revision selection provider. - * + * * @return the revision selection provider * @since 3.2 */