Bug 516420: Problem hover status color should be the same as for normal
content
Adding missing set*Color() calls to fix reported bug.
Cause:
AbstractAnnotationHover extends AbstractInformationControl and does
some setColoring for it's private child composite without updating the
color of the parent structure.
Test:
- Change information hover colors in preference
- Hover over snippet described in bug description
Before: Strip at the bottom was of different color.
After: Strip at the bottom is the same color as inner content.
(see attached screenshot in bug).
Reviewer note:
- I investigated private setColorAndFont(..). It is only used
for coloring of child elements, and only in deferredCreateContent().
As such, there is no situation where setColorAndFont(..) would be
called without set*Color() being called first.
This ensures consistent colors for this class.
Note, after doing a root-cause analysis, I found the same sort-of
issue in a few other classes that extend AbstractInformationControl,
namely:
- BrowserInformationControl
- ExpressionInformationControl
- LinkListInformationControl
I will address those in separate bug because they
1) need the new INFORMATION_ api (instead of further using HOVER_)
2) some are in separate repositories. (jdt/platform)
Change-Id: I837eceaf00b8ab8162f8490a1b48425bfc38210d
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=516420
Signed-off-by: Leo Ufimtsev <lufimtse@redhat.com>
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/hover/AbstractAnnotationHover.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/hover/AbstractAnnotationHover.java
index b86a83a..6c4f3d2 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/hover/AbstractAnnotationHover.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/hover/AbstractAnnotationHover.java
@@ -293,7 +293,10 @@
if (background == null) {
background= fParent.getBackground();
}
- setColorAndFont(fParent, foreground, background, JFaceResources.getDialogFont());
+
+ setForegroundColor(foreground); // For main composite.
+ setBackgroundColor(background);
+ setColorAndFont(fParent, foreground, background, JFaceResources.getDialogFont()); // For child elements.
ICompletionProposal[] proposals= getAnnotationInfo().getCompletionProposals();
if (proposals.length > 0)