Fix for ticket #358 Interpreter Tab in Mac OSX from mbowie testing and confirming...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / PrintMarginPainter.java
index f722bbc..c941e15 100644 (file)
@@ -14,45 +14,46 @@ import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.GC;
 import org.eclipse.swt.graphics.Rectangle;
 
+public class PrintMarginPainter implements IPainter, PaintListener {
 
+       private StyledText fTextWidget;
 
-public class PrintMarginPainter  implements IPainter, PaintListener {
-       
+       private int fMarginWidth = 80;
 
-       private StyledText fTextWidget;
-       
-       private int fMarginWidth= 80;
        private Color fColor;
-       private int fLineStyle= SWT.LINE_SOLID;
-       private int fLineWidth= 1;
-       
-       private int fCachedWidgetX= -1;
-       private boolean fIsActive= false;
-       
+
+       private int fLineStyle = SWT.LINE_SOLID;
+
+       private int fLineWidth = 1;
+
+       private int fCachedWidgetX = -1;
+
+       private boolean fIsActive = false;
+
        public PrintMarginPainter(ISourceViewer sourceViewer) {
-               fTextWidget= sourceViewer.getTextWidget();
+               fTextWidget = sourceViewer.getTextWidget();
        }
-       
+
        public void setMarginRulerColumn(int width) {
-               fMarginWidth= width;
+               fMarginWidth = width;
                intialize();
        }
-       
+
        public void setMarginRulerStyle(int lineStyle) {
-               fLineStyle= lineStyle;
+               fLineStyle = lineStyle;
        }
-       
+
        public void setMarginRulerWidth(int lineWidth) {
-               fLineWidth= lineWidth;
+               fLineWidth = lineWidth;
        }
-       
+
        /**
         * Must be called before <code>paint</code> is called the first time.
         */
        public void setMarginRulerColor(Color color) {
-               fColor= color;
+               fColor = color;
        }
-       
+
        /**
         * Must be called explicitly when font of text widget changes.
         */
@@ -60,32 +61,32 @@ public class PrintMarginPainter  implements IPainter, PaintListener {
                computeWidgetX();
                fTextWidget.redraw();
        }
-       
+
        private void computeWidgetX() {
-               GC gc= new GC(fTextWidget);
-               int pixels= gc.getFontMetrics().getAverageCharWidth();
+               GC gc = new GC(fTextWidget);
+               int pixels = gc.getFontMetrics().getAverageCharWidth();
                gc.dispose();
-               
-               fCachedWidgetX= pixels * fMarginWidth;
+
+               fCachedWidgetX = pixels * fMarginWidth;
        }
-       
+
        /*
         * @see IPainter#deactivate(boolean)
         */
        public void deactivate(boolean redraw) {
                if (fIsActive) {
-                       fIsActive= false;
+                       fIsActive = false;
                        fTextWidget.removePaintListener(this);
                        if (redraw)
                                fTextWidget.redraw();
-               }       
+               }
        }
 
        /*
         * @see IPainter#dispose()
         */
        public void dispose() {
-               fTextWidget= null;
+               fTextWidget = null;
        }
 
        /*
@@ -93,7 +94,7 @@ public class PrintMarginPainter  implements IPainter, PaintListener {
         */
        public void paint(int reason) {
                if (!fIsActive) {
-                       fIsActive= true;
+                       fIsActive = true;
                        fTextWidget.addPaintListener(this);
                        if (fCachedWidgetX == -1)
                                computeWidgetX();
@@ -106,15 +107,15 @@ public class PrintMarginPainter  implements IPainter, PaintListener {
         */
        public void setPositionManager(IPositionManager manager) {
        }
-       
+
        /*
         * @see PaintListener#paintControl(PaintEvent)
         */
        public void paintControl(PaintEvent e) {
                if (fTextWidget != null) {
-                       int x= fCachedWidgetX - fTextWidget.getHorizontalPixel();
+                       int x = fCachedWidgetX - fTextWidget.getHorizontalPixel();
                        if (x >= 0) {
-                               Rectangle area= fTextWidget.getClientArea();
+                               Rectangle area = fTextWidget.getClientArea();
                                e.gc.setForeground(fColor);
                                e.gc.setLineStyle(fLineStyle);
                                e.gc.setLineWidth(fLineWidth);