aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRuediger Herrmann2013-10-01 15:46:06 (EDT)
committerPaul Webster2013-10-04 13:44:40 (EDT)
commitff2dc4ff81c73089a84e5cf8b434dd5c08dde9b0 (patch)
treeea1170e8ce3c78dd32552347b4d5687ad79be1e2
parent5aacec6526f95c6da600acbf109b9b35af9348b0 (diff)
downloadeclipse.platform.ui-ff2dc4ff81c73089a84e5cf8b434dd5c08dde9b0.zip
eclipse.platform.ui-ff2dc4ff81c73089a84e5cf8b434dd5c08dde9b0.tar.gz
eclipse.platform.ui-ff2dc4ff81c73089a84e5cf8b434dd5c08dde9b0.tar.bz2
Bug 418420 - [Decorators] ControlDecoration tooltip is shown even though
decoration image is invisible Signed-off-by: Ruediger Herrmann <ruediger.herrmann@gmx.de>
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/fieldassist/ControlDecoration.java7
-rw-r--r--tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/fieldassist/ControlDecorationTests.java13
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 02d5a15..87a0309 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 655112b..1d86471 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()
*/