Description: Backported fix for hover text visability problem.
Origin: Upstream, https://bugs.eclipse.org/bugs/show_bug.cgi?id=312966
Bug-Ubuntu: https://launchpad.net/bugs/540332

--- a/eclipse/plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/hover/SourceViewerInformationControl.java
+++ b/eclipse/plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/hover/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
@@ -48,7 +48,9 @@
 import org.eclipse.jface.text.source.ISourceViewer;
 import org.eclipse.jface.text.source.SourceViewer;
 
+import org.eclipse.jdt.ui.JavaUI;
 import org.eclipse.jdt.ui.PreferenceConstants;
+import org.eclipse.jdt.ui.text.IJavaColorConstants;
 import org.eclipse.jdt.ui.text.IJavaPartitions;
 
 import org.eclipse.jdt.internal.ui.JavaPlugin;
@@ -90,6 +92,11 @@
 	 */
 	private Font fStatusTextFont;
 	/**
+	 * The color of the optional status text label or <code>null</code> if none.
+	 * @since 3.6
+	 */
+	private Color fStatusTextForegroundColor;
+	/**
 	 * The width size constraint.
 	 * @since 3.2
 	 */
@@ -198,15 +205,42 @@
 			fStatusField.setFont(fStatusTextFont);
 			GridData gd2= new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
 			fStatusField.setLayoutData(gd2);
-
-			// Regarding the color see bug 41128
-			fStatusField.setForeground(display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
+			
+			RGB javaDefaultColor= JavaUI.getColorManager().getColor(IJavaColorConstants.JAVA_DEFAULT).getRGB();
+			fStatusTextForegroundColor= new Color(fStatusField.getDisplay(), blend(fBackgroundColor.getRGB(), javaDefaultColor, 0.56f));
+			fStatusField.setForeground(fStatusTextForegroundColor);
 			fStatusField.setBackground(fBackgroundColor);
 		}
 
 		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)
+		);
+	}
+	
 	private void initializeColors() {
 		RGB bgRGB= getHoverBackgroundColorRGB();
 		if (bgRGB != null) {
@@ -274,8 +308,12 @@
 	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;
--- a/eclipse/plugins/org.eclipse.jface/src/org/eclipse/jface/dialogs/PopupDialog.java
+++ b/eclipse/plugins/org.eclipse.jface/src/org/eclipse/jface/dialogs/PopupDialog.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -14,6 +14,7 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.eclipse.core.runtime.Assert;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.GroupMarker;
 import org.eclipse.jface.action.IAction;
@@ -36,9 +37,11 @@
 import org.eclipse.swt.graphics.Font;
 import org.eclipse.swt.graphics.FontData;
 import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.RGB;
 import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Listener;
@@ -321,6 +324,12 @@
 	private Control titleSeparator, infoSeparator;
 
 	/**
+	 * Color to be used for the info area text.
+	 * @since 3.6
+	 */
+	private Color infoColor;
+	
+	/**
 	 * Font to be used for the info area text. Computed based on the dialog's
 	 * font.
 	 */
@@ -856,12 +865,42 @@
 		
 		GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL,
 				SWT.BEGINNING).applyTo(infoLabel);
-		infoLabel.setForeground(parent.getDisplay().getSystemColor(
-				SWT.COLOR_WIDGET_DARK_SHADOW));
+		Display display = parent.getDisplay();
+		infoColor = new Color(display, blend(
+				display.getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB(),
+				display.getSystemColor(SWT.COLOR_INFO_FOREGROUND).getRGB(),
+				0.56f));
+		infoLabel.setForeground(infoColor);
 		return infoLabel;
 	}
 
 	/**
+	 * 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)
+		);
+	}
+	
+	/**
 	 * Create a horizontal separator for the given parent.
 	 * 
 	 * @param parent
@@ -1586,6 +1625,10 @@
 	 * 
 	 */
 	private void handleDispose() {
+		if (infoColor != null && !infoColor.isDisposed()) {
+			infoColor.dispose();
+		}
+		infoColor = null;
 		if (infoFont != null && !infoFont.isDisposed()) {
 			infoFont.dispose();
 		}
--- a/eclipse/plugins/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/SourceViewerInformationControl.java
+++ b/eclipse/plugins/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.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.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,11 @@
 	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 +166,8 @@
 			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 +176,32 @@
 	}
 
 	/**
+	 * 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 +238,11 @@
 	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;
--- a/eclipse/plugins/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java
+++ b/eclipse/plugins/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java
@@ -43,6 +43,7 @@
 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;
 
@@ -85,6 +86,11 @@
 	 * @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. */
@@ -224,8 +230,9 @@
 		}
 		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);
 	}
@@ -672,6 +679,10 @@
 			fShell.removeListener(SWT.Deactivate, fShellListener);
 			fShellListener= null;
 		}
+		if (fStatusLabelForeground != null) {
+			fStatusLabelForeground.dispose();
+			fStatusLabelForeground= null;
+		}
 	}
 
 	/**
--- a/eclipse/plugins/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/SourceViewerInformationControl.java
+++ b/eclipse/plugins/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.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.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,11 @@
 	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 +175,8 @@
 			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 +184,32 @@
 		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 +251,11 @@
 	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;
