Addition of previous bugfix. Added project based path to search-path.
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / PrintMarginPainter.java
index ad9fd45..c941e15 100644 (file)
@@ -5,6 +5,7 @@ package net.sourceforge.phpeclipse.phpeditor;
  * All Rights Reserved.
  */
 
+import org.eclipse.jface.text.source.ISourceViewer;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.StyledText;
 import org.eclipse.swt.events.PaintEvent;
@@ -13,47 +14,46 @@ import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.GC;
 import org.eclipse.swt.graphics.Rectangle;
 
-import org.eclipse.jface.text.source.ISourceViewer;
-
+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.
         */
@@ -61,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;
        }
 
        /*
@@ -94,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();
@@ -107,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);