diff options
| author | Ruediger Herrmann | 2013-10-01 19:46:06 +0000 |
|---|---|---|
| committer | Paul Webster | 2013-10-04 17:44:40 +0000 |
| commit | ff2dc4ff81c73089a84e5cf8b434dd5c08dde9b0 (patch) | |
| tree | ea1170e8ce3c78dd32552347b4d5687ad79be1e2 | |
| parent | 5aacec6526f95c6da600acbf109b9b35af9348b0 (diff) | |
| download | eclipse.platform.ui-ff2dc4ff81c73089a84e5cf8b434dd5c08dde9b0.tar.gz eclipse.platform.ui-ff2dc4ff81c73089a84e5cf8b434dd5c08dde9b0.tar.xz eclipse.platform.ui-ff2dc4ff81c73089a84e5cf8b434dd5c08dde9b0.zip | |
Bug 418420 - [Decorators] ControlDecoration tooltip is shown even though
decoration image is invisible
Signed-off-by: Ruediger Herrmann <ruediger.herrmann@gmx.de>
2 files changed, 20 insertions, 0 deletions
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/fieldassist/ControlDecoration.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/fieldassist/ControlDecoration.java index 02d5a15ffae..87a03096958 100644 --- a/bundles/org.eclipse.jface/src/org/eclipse/jface/fieldassist/ControlDecoration.java +++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/fieldassist/ControlDecoration.java @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Rüdiger Herrmann - fix for bug 418420 *******************************************************************************/ package org.eclipse.jface.fieldassist; @@ -1075,6 +1076,12 @@ public class ControlDecoration { if (!visible) { return; } + + // If the decoration is hidden, don't show the hover. + if (showOnlyOnFocus && !control.isFocusControl()) { + return; + } + // If there is no text, any existing hover should be hidden, and // there is nothing more to do. if (text == null || text.length() == 0) { diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/fieldassist/ControlDecorationTests.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/fieldassist/ControlDecorationTests.java index 655112bbbd5..1d864716511 100644 --- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/fieldassist/ControlDecorationTests.java +++ b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/fieldassist/ControlDecorationTests.java @@ -75,6 +75,19 @@ public class ControlDecorationTests extends AbstractFieldAssistTestCase { assertTwoShellsUp(); } + public void testBug418420() { + AbstractFieldAssistWindow window = getFieldAssistWindow(); + window.open(); + ControlDecoration decoration = new ControlDecoration(window.getFieldAssistControl(), SWT.RIGHT); + decoration.setImage(FieldDecorationRegistry.getDefault() + .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage()); + decoration.setDescriptionText("foo"); + decoration.setShowOnlyOnFocus(true); + anotherControl.forceFocus(); + decoration.showHoverText("Show me"); + assertOneShellUp(); + } + /* (non-Javadoc) * @see org.eclipse.jface.tests.fieldassist.AbstractFieldAssistTestCase#createFieldAssistWindow() */ |
