Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Keller2010-05-20 11:01:49 +0000
committerMarkus Keller2010-05-20 11:01:49 +0000
commita58cd023d3a27e51ebe4cc48dda06a669a61fab6 (patch)
tree43bbab2cdf5c1ef1c544d615c44c125666e234f9
parent095534d3bf82d370393ff65424c720101cc2f4cc (diff)
downloadeclipse.platform.text-a58cd023d3a27e51ebe4cc48dda06a669a61fab6.tar.gz
eclipse.platform.text-a58cd023d3a27e51ebe4cc48dda06a669a61fab6.tar.xz
eclipse.platform.text-a58cd023d3a27e51ebe4cc48dda06a669a61fab6.zip
Bug 312966: [hovering] Some text in Javadoc hover/view not visible using Ubuntu 10.04v20100520-0800
-rw-r--r--org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java46
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java16
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/SourceViewerInformationControl.java46
3 files changed, 98 insertions, 10 deletions
diff --git a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java
index 92882fccd13..5683bd14b07 100644
--- a/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java
+++ b/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,6 +22,7 @@ import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -31,6 +32,8 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.core.runtime.Assert;
+
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.Document;
@@ -67,6 +70,12 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio
private Label fSeparator;
/** The font of the optional status text label.*/
private Font fStatusTextFont;
+ /**
+ * The color of the optional status text label or <code>null</code> if none.
+ *
+ * @since 3.6
+ */
+ private Color fStatusTextForegroundColor;
/** The maximal widget width. */
private int fMaxWidth;
/** The maximal widget height. */
@@ -158,8 +167,8 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio
GridData gd2= new GridData(GridData.FILL_VERTICAL | GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
fStatusField.setLayoutData(gd2);
- // Regarding the color see bug 41128
- fStatusField.setForeground(display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
+ fStatusTextForegroundColor= new Color(fStatusField.getDisplay(), blend(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB(), display.getSystemColor(SWT.COLOR_INFO_FOREGROUND).getRGB(), 0.56f));
+ fStatusField.setForeground(fStatusTextForegroundColor);
fStatusField.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
}
@@ -168,6 +177,32 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio
}
/**
+ * Returns an RGB that lies between the given foreground and background
+ * colors using the given mixing factor. A <code>factor</code> of 1.0 will produce a
+ * color equal to <code>fg</code>, while a <code>factor</code> of 0.0 will produce one
+ * equal to <code>bg</code>.
+ * @param bg the background color
+ * @param fg the foreground color
+ * @param factor the mixing factor, must be in [0,&nbsp;1]
+ *
+ * @return the interpolated color
+ * @since 3.6
+ */
+ private static RGB blend(RGB bg, RGB fg, float factor) {
+ // copy of org.eclipse.jface.internal.text.revisions.Colors#blend(..)
+ Assert.isLegal(bg != null);
+ Assert.isLegal(fg != null);
+ Assert.isLegal(factor >= 0f && factor <= 1f);
+
+ float complement= 1f - factor;
+ return new RGB(
+ (int) (complement * bg.red + factor * fg.red),
+ (int) (complement * bg.green + factor * fg.green),
+ (int) (complement * bg.blue + factor * fg.blue)
+ );
+ }
+
+ /**
* @see org.eclipse.jface.text.IInformationControlExtension2#setInput(java.lang.Object)
* @param input the input object
*/
@@ -204,8 +239,11 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio
public void widgetDisposed(DisposeEvent event) {
if (fStatusTextFont != null && !fStatusTextFont.isDisposed())
fStatusTextFont.dispose();
-
fStatusTextFont= null;
+ if (fStatusTextForegroundColor != null && !fStatusTextForegroundColor.isDisposed())
+ fStatusTextForegroundColor.dispose();
+ fStatusTextForegroundColor= null;
+
fTextFont= null;
fShell= null;
fText= null;
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java
index 545e716866d..861d2a02dd6 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java
@@ -44,6 +44,7 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.internal.text.revisions.Colors;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.util.Geometry;
@@ -86,6 +87,12 @@ public abstract class AbstractInformationControl implements IInformationControl,
* @since 3.4.2
*/
private Font fStatusLabelFont;
+ /**
+ * Color for the label in the status line or <code>null</code> if none.
+ *
+ * @since 3.6
+ */
+ private Color fStatusLabelForeground;
/** The toolbar manager used by the toolbar or <code>null</code> if none. */
private final ToolBarManager fToolBarManager;
/** Status line toolbar or <code>null</code> if none. */
@@ -232,8 +239,9 @@ public abstract class AbstractInformationControl implements IInformationControl,
}
fStatusLabelFont= new Font(fStatusLabel.getDisplay(), fontDatas);
fStatusLabel.setFont(fStatusLabelFont);
-
- fStatusLabel.setForeground(fStatusLabel.getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
+
+ fStatusLabelForeground= new Color(fStatusLabel.getDisplay(), Colors.blend(background.getRGB(), foreground.getRGB(), 0.56f));
+ fStatusLabel.setForeground(fStatusLabelForeground);
fStatusLabel.setBackground(background);
setColor(fStatusComposite, foreground, background);
}
@@ -517,6 +525,10 @@ public abstract class AbstractInformationControl implements IInformationControl,
fStatusLabelFont.dispose();
fStatusLabelFont= null;
}
+ if (fStatusLabelForeground != null) {
+ fStatusLabelForeground.dispose();
+ fStatusLabelForeground= null;
+ }
}
/*
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/SourceViewerInformationControl.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/SourceViewerInformationControl.java
index 0c6c559827c..5de5b32d4cd 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/SourceViewerInformationControl.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/SourceViewerInformationControl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,6 +22,7 @@ import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -31,6 +32,8 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.core.runtime.Assert;
+
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.BadLocationException;
@@ -73,6 +76,12 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio
private Label fSeparator;
/** The font of the optional status text label.*/
private Font fStatusTextFont;
+ /**
+ * The color of the optional status text label or <code>null</code> if none.
+ *
+ * @since 3.6
+ */
+ private Color fStatusTextForegroundColor;
/** The maximal widget width. */
private int fMaxWidth;
/** The maximal widget height. */
@@ -167,8 +176,8 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio
GridData gd2= new GridData(GridData.FILL_VERTICAL | GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
fStatusField.setLayoutData(gd2);
- // Regarding the color see bug 41128
- fStatusField.setForeground(display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
+ fStatusTextForegroundColor= new Color(fStatusField.getDisplay(), blend(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB(), display.getSystemColor(SWT.COLOR_INFO_FOREGROUND).getRGB(), 0.56f));
+ fStatusField.setForeground(fStatusTextForegroundColor);
fStatusField.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
}
@@ -176,6 +185,32 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio
addDisposeListener(this);
}
+ /**
+ * Returns an RGB that lies between the given foreground and background
+ * colors using the given mixing factor. A <code>factor</code> of 1.0 will produce a
+ * color equal to <code>fg</code>, while a <code>factor</code> of 0.0 will produce one
+ * equal to <code>bg</code>.
+ * @param bg the background color
+ * @param fg the foreground color
+ * @param factor the mixing factor, must be in [0,&nbsp;1]
+ *
+ * @return the interpolated color
+ * @since 3.6
+ */
+ private static RGB blend(RGB bg, RGB fg, float factor) {
+ // copy of org.eclipse.jface.internal.text.revisions.Colors#blend(..)
+ Assert.isLegal(bg != null);
+ Assert.isLegal(fg != null);
+ Assert.isLegal(factor >= 0f && factor <= 1f);
+
+ float complement= 1f - factor;
+ return new RGB(
+ (int) (complement * bg.red + factor * fg.red),
+ (int) (complement * bg.green + factor * fg.green),
+ (int) (complement * bg.blue + factor * fg.blue)
+ );
+ }
+
/*
* @see org.eclipse.jface.text.IInformationControlExtension2#setInput(java.lang.Object)
*/
@@ -217,8 +252,11 @@ class SourceViewerInformationControl implements IInformationControl, IInformatio
public void widgetDisposed(DisposeEvent event) {
if (fStatusTextFont != null && !fStatusTextFont.isDisposed())
fStatusTextFont.dispose();
-
fStatusTextFont= null;
+ if (fStatusTextForegroundColor != null && !fStatusTextForegroundColor.isDisposed())
+ fStatusTextForegroundColor.dispose();
+ fStatusTextForegroundColor= null;
+
fTextFont= null;
fShell= null;
fText= null;

Back to the top