improved color settings through Preference page
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / OverviewRuler.java
index dfd4408..e59e385 100644 (file)
@@ -20,6 +20,9 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import net.sourceforge.phpdt.ui.text.JavaTextTools;
+import net.sourceforge.phpeclipse.PHPeclipsePlugin;
+
 import org.eclipse.jface.text.BadLocationException;
 import org.eclipse.jface.text.IDocument;
 import org.eclipse.jface.text.IRegion;
@@ -68,9 +71,7 @@ public class OverviewRuler implements IVerticalRulerInfo {
      * @see ITextListener#textChanged
      */
     public void textChanged(TextEvent e) {
-      if (fTextViewer != null
-        && e.getDocumentEvent() == null
-        && e.getViewerRedrawState()) {
+      if (fTextViewer != null && e.getDocumentEvent() == null && e.getViewerRedrawState()) {
         // handle only changes of visible document
         redraw();
       }
@@ -368,29 +369,23 @@ public class OverviewRuler implements IVerticalRulerInfo {
           Annotation a = (Annotation) e.next();
           Position p = fModel.getPosition(a);
 
-          if (p == null
-            || !p.overlapsWith(visible.getOffset(), visible.getLength()))
+          if (p == null || !p.overlapsWith(visible.getOffset(), visible.getLength()))
             continue;
 
           int problemOffset = Math.max(p.getOffset(), visible.getOffset());
-          int problemEnd =
-            Math.min(
-              p.getOffset() + p.getLength(),
-              visible.getOffset() + visible.getLength());
+          int problemEnd = Math.min(p.getOffset() + p.getLength(), visible.getOffset() + visible.getLength());
           int problemLength = problemEnd - problemOffset;
 
           try {
             if (PROBLEM_HEIGHT_SCALABLE) {
-              int numbersOfLines =
-                document.getNumberOfLines(problemOffset, problemLength);
+              int numbersOfLines = document.getNumberOfLines(problemOffset, problemLength);
               hh = (numbersOfLines * size.y) / maxLines;
               if (hh < PROBLEM_HEIGHT_MIN)
                 hh = PROBLEM_HEIGHT_MIN;
             }
             fProblemHeight = hh;
 
-            int startLine =
-              textWidget.getLineAtOffset(problemOffset - visible.getOffset());
+            int startLine = textWidget.getLineAtOffset(problemOffset - visible.getOffset());
             yy = Math.min((startLine * size.y) / maxLines, size.y - hh);
 
             if (fill != null) {
@@ -458,24 +453,20 @@ public class OverviewRuler implements IVerticalRulerInfo {
           if (p == null)
             continue;
 
-          IRegion widgetRegion =
-            extension.modelRange2WidgetRange(
-              new Region(p.getOffset(), p.getLength()));
+          IRegion widgetRegion = extension.modelRange2WidgetRange(new Region(p.getOffset(), p.getLength()));
           if (widgetRegion == null)
             continue;
 
           try {
             if (PROBLEM_HEIGHT_SCALABLE) {
-              int numbersOfLines =
-                document.getNumberOfLines(p.getOffset(), p.getLength());
+              int numbersOfLines = document.getNumberOfLines(p.getOffset(), p.getLength());
               hh = (numbersOfLines * size.y) / maxLines;
               if (hh < PROBLEM_HEIGHT_MIN)
                 hh = PROBLEM_HEIGHT_MIN;
             }
             fProblemHeight = hh;
 
-            int startLine =
-              textWidget.getLineAtOffset(widgetRegion.getOffset());
+            int startLine = textWidget.getLineAtOffset(widgetRegion.getOffset());
             yy = Math.min((startLine * size.y) / maxLines, size.y - hh);
 
             if (fill != null) {
@@ -556,8 +547,7 @@ public class OverviewRuler implements IVerticalRulerInfo {
     } else {
       try {
         IRegion visible = fTextViewer.getVisibleRegion();
-        int lineNumber =
-          fTextViewer.getDocument().getLineOfOffset(visible.getOffset());
+        int lineNumber = fTextViewer.getDocument().getLineOfOffset(visible.getOffset());
         lines[0] += lineNumber;
         lines[1] += lineNumber;
       } catch (BadLocationException x) {
@@ -704,9 +694,8 @@ public class OverviewRuler implements IVerticalRulerInfo {
   }
 
   private static Color getColor(RGB rgb) {
-    //         PHPTextTools textTools= PHPeclipsePlugin.getDefault().getPHPTextTools();
-    //         return textTools.getColorManager().getColor(rgb);
-    return PHPEditorEnvironment.getPHPColorProvider().getColor(rgb);
+    JavaTextTools textTools = PHPeclipsePlugin.getDefault().getJavaTextTools();
+    return textTools.getColorManager().getColor(rgb);
   }
 
   private Color getColor(AnnotationType annotationType, double scale) {
@@ -727,15 +716,11 @@ public class OverviewRuler implements IVerticalRulerInfo {
     return getColor(interpolate(baseRGB, background, scale));
   }
 
-  private Color getStrokeColor(
-    AnnotationType annotationType,
-    boolean temporary) {
+  private Color getStrokeColor(AnnotationType annotationType, boolean temporary) {
     return getColor(annotationType, temporary ? 0.5 : 0.2);
   }
 
-  private Color getFillColor(
-    AnnotationType annotationType,
-    boolean temporary) {
+  private Color getFillColor(AnnotationType annotationType, boolean temporary) {
     return getColor(annotationType, temporary ? 0.9 : 0.6);
   }