JFace TableViewer显示了两个工具提示-自定义和默认 [英] JFace TableViewer shows two tooltips - custom and default

查看:57
本文介绍了JFace TableViewer显示了两个工具提示-自定义和默认的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这里我需要帮助。

我使用 TableViewer 。当您什么都不做时,您会看到以下行为:当单元格的文本太大时,短暂的等待后会出现一个显示完整文本的工具提示。这是正常现象,我想原生控件会绘制这些工具提示。

I create a fairly simple JFace Table using a TableViewer. When you do nothing more, you can see the following behavior: when a cell's text is too large, a tooltip showing the complete text will appear after a short wait. That's normal behavior and I guess that the native controls draw these tooltips.

现在,我使用

ColumnViewerToolTipSupport.enableFor( tableViewer, ToolTip.NO_RECREATE );

并使用 getToolTipText()标签提供者的方法。

And delivering a (different) text using getToolTipText() method of a label provider.

行之有效-差不多。我遇到一个问题:有时(并非始终如此!)首先,出现本机工具提示,然后不久,在其顶部绘制了我的自定义工具提示,如以下屏幕快照所示:

That works - almost. I got one problem: sometimes (not all the times!) first, the native tooltip appears and shortly thereafter my custom tooltip is drawn on top of it, like shown in this screenshot:

我有不知道如何有效地禁用每个单元格想要绘制的本机工具提示。

I have no idea how to effectively disable the native tooltips each cell wants to draw. It's ugly as hell the way it is...

对我来说有什么线索吗?

Any clues for me?

推荐答案

您可以像这样有效地禁用本机表工具提示:

You can effectively disable the native table tooltip like this:

viewer.getTable().setToolTipText("");

另请参阅...

  • answer below from Rüdiger, adding some important hints and details missing in my answer
  • this Eclipse Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=218471
  • and this Eclipse code snippet http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet125.java

供参考。

这篇关于JFace TableViewer显示了两个工具提示-自定义和默认的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆