diff options
author | Markus Keller | 2011-08-22 19:32:45 +0000 |
---|---|---|
committer | Markus Keller | 2011-08-22 19:32:45 +0000 |
commit | 496894aea4fa8c3549475be987eb536f458d686a (patch) | |
tree | 3669cc98098911684660954270dfea1cf3913b34 | |
parent | 921f883635fd9b3da598e3b2a08ddfa22261023f (diff) | |
download | eclipse.platform.text-496894aea4fa8c3549475be987eb536f458d686a.tar.gz eclipse.platform.text-496894aea4fa8c3549475be987eb536f458d686a.tar.xz eclipse.platform.text-496894aea4fa8c3549475be987eb536f458d686a.zip |
Bug 352990: [10.7] [rulers] The right vertical ruler is missing after Mac OS X Lion installation...
-rw-r--r-- | org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewer.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewer.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewer.java index 87b2a78f4a4..72b7fdacdf7 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewer.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/SourceViewer.java @@ -127,6 +127,7 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi Rectangle trim= textWidget.computeTrim(0, 0, 0, 0); int topTrim= - trim.y; int scrollbarHeight= trim.height - topTrim; // horizontal scroll bar is only under the client area + int measuredScrollbarHeight= scrollbarHeight; int x= clArea.x; int width= clArea.width; @@ -143,7 +144,7 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi int verticalRulerWidth= fVerticalRuler.getWidth(); final Control verticalRulerControl= fVerticalRuler.getControl(); int oldWidth= verticalRulerControl.getBounds().width; - verticalRulerControl.setBounds(clArea.x, clArea.y + topTrim, verticalRulerWidth, clArea.height - scrollbarHeight - topTrim); + verticalRulerControl.setBounds(clArea.x, clArea.y + topTrim, verticalRulerWidth, clArea.height - measuredScrollbarHeight - topTrim); if (flushCache && getVisualAnnotationModel() != null && oldWidth == verticalRulerWidth) verticalRulerControl.redraw(); @@ -161,7 +162,7 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi fOverviewRuler.getControl().setBounds(overviewRulerX, clArea.y + arrowHeights[0], overviewRulerWidth, clArea.height - arrowHeights[0] - arrowHeights[1] - scrollbarHeight); Control headerControl= fOverviewRuler.getHeaderControl(); - boolean noArrows= arrowHeights[0] == 0 && arrowHeights[1] == 0; + boolean noArrows= arrowHeights[0] < 6 && arrowHeights[1] < 6; if (noArrows || arrowHeights[0] < arrowHeights[1] && arrowHeights[0] < scrollbarHeight && arrowHeights[1] > scrollbarHeight) { // // not enough space for header at top => move to bottom int headerHeight= noArrows ? scrollbarHeight : arrowHeights[1]; @@ -188,7 +189,7 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi return new int[] { 0, 0 }; int[] arrowHeights= computeScrollArrowHeights(textWidget, bottomOffset); - if (arrowHeights[0] > 0 || arrowHeights[1] > 0) { + if (arrowHeights[0] >= 0 || arrowHeights[1] >= 0) { fScrollArrowHeights= arrowHeights; } else if (fScrollArrowHeights != null) { return fScrollArrowHeights; @@ -221,6 +222,9 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi private int[] computeScrollArrowHeights(StyledText textWidget, int bottomOffset) { ScrollBar verticalBar= textWidget.getVerticalBar(); Rectangle thumbTrackBounds= verticalBar.getThumbTrackBounds(); + if (thumbTrackBounds.height == 0) // SWT returns bogus values on Cocoa in this case, see https://bugs.eclipse.org/352990 + return new int[] { 0, 0 }; + int topArrowHeight= thumbTrackBounds.y; int bottomArrowHeight= bottomOffset - (thumbTrackBounds.y + thumbTrackBounds.height); return new int[] { topArrowHeight, bottomArrowHeight }; |