diff options
author | Leo Ufimtsev | 2017-04-28 20:10:23 +0000 |
---|---|---|
committer | Leo Ufimtsev | 2017-04-28 20:11:43 +0000 |
commit | 73ff2c16d11d91e0ca6c479cf07cb665309d3bbd (patch) | |
tree | 8fff18f13efe4ffa2c2e9e9e4fd62da6ed024b92 | |
parent | d68c3b21d24ab313e97359beeb42205bce4a31e7 (diff) | |
download | eclipse.platform.text-73ff2c16d11d91e0ca6c479cf07cb665309d3bbd.tar.gz eclipse.platform.text-73ff2c16d11d91e0ca6c479cf07cb665309d3bbd.tar.xz eclipse.platform.text-73ff2c16d11d91e0ca6c479cf07cb665309d3bbd.zip |
Bug 515972: Javadoc hover shows mix of Info and Javadoc colorsI20170502-2000I20170501-2000
Part 1:
For the HoverControl used by Javadoc hover, set Statusbar colors when
foreground/background is set (but only if statusBar is used).
Note:
- StatusbarLabel isn't always created, sometimes it's not used. We guard
against that with null-check.
- StatusBarLabel foreground is a blend of background and foreground, to
make it slightly 'lighter' than the main foreground. To account for
that, we re-blend when we either do background or foreground change.
Since color is created, it's lifecycle is treated carefully such that
we have no memory leaks.
Tests:
- With this patch alone, you won't see any changes. You need to apply
"Part 2" patch for javadoc to see changes to Javadoc. (See bug)
- Tested with child eclipse. No breakage for various popups like
- Javadoc hover
- jdt.debug.ui's expression viewer
- editor markers
- Problem info hover
This patch should be good for merging.
Change-Id: I6b13e06bbb27f49f28a56c4c05d65c2c65c150da
Signed-off-by: Leo Ufimtsev <lufimtse@redhat.com>
-rw-r--r-- | org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java | 22 |
1 files changed, 20 insertions, 2 deletions
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 2a9a5b05714..374ad6108f5 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 @@ -244,8 +244,7 @@ public abstract class AbstractInformationControl implements IInformationControl, fStatusLabelFont= new Font(fStatusLabel.getDisplay(), fontDatas); fStatusLabel.setFont(fStatusLabelFont); - fStatusLabelForeground= new Color(fStatusLabel.getDisplay(), Colors.blend(background.getRGB(), foreground.getRGB(), 0.56f)); - setColor(fStatusLabel, fStatusLabelForeground, background); + setStatusLabelColors(foreground, background); setColor(fStatusComposite, foreground, background); } @@ -632,11 +631,30 @@ public abstract class AbstractInformationControl implements IInformationControl, @Override public void setForegroundColor(Color foreground) { fContentComposite.setForeground(foreground); + if (fStatusLabel != null) { + setStatusLabelColors(foreground, fStatusLabel.getBackground()); + } } @Override public void setBackgroundColor(Color background) { fContentComposite.setBackground(background); + if (fStatusComposite != null){ + fStatusComposite.setBackground(background); + } + if (fStatusLabel != null) { + setStatusLabelColors(fStatusLabel.getForeground(), background); + } + } + + private void setStatusLabelColors(Color foreground, Color background) { + if (foreground == null || background == null) return; + if (fStatusLabelForeground != null) { + fStatusLabelForeground.dispose(); + } + fStatusLabelForeground = new Color(fStatusLabel.getDisplay(), Colors.blend(background.getRGB(), foreground.getRGB(), 0.56f)); + fStatusLabel.setForeground(fStatusLabelForeground); + fStatusLabel.setBackground(background); } /** |