将鼠标悬停在Eclipse插件中的Marker文本 [英] Hover text for Marker in Eclipse plugin
问题描述
标记在问题视图中正确显示,带有图标,位置和文本,问题图标在编辑器的左边距正确显示。
当悬停在边距中的问题标记图标时,我想在弹出窗口中显示相同的错误消息文本,就像在Java编辑器中发生的一样。现在没有弹出窗口。
有没有一个简单的方法来实现?
答案:
好的,它看起来不像功能是内置在标记系统。似乎已经提交了一个补丁,所以它可能会被添加到更高的版本中,但直到此为止也很容易创建。
- 创建一个实现
IAnnotationHover
并实现getHoverInfo()
的类。 - 在
SourceViewerConfiguration
中返回getAnnotationHover()
方法中的类。 / li>
- 在
getHoverInfo()
方法中,调用ISourceViewer.getAnnotationModel()。getAnnotationIterator()
获取所有标记。 - 选择与行号对应的标记,并返回标记文本。
eclipse插件xtext中的这个错误提出了一个补丁,用于在悬停和状态行上显示一个标记工具提示。如果您看附件,您可以找到所需的答案。
I have a custom editor with problem markers. The markers display correctly in the "problems" view with icon, location and text, and the problem icons display correctly in the left margin of the editor.
I would like to display the same error message text in a popup when hovering over the problem marker icon in the margin, just as it happens in the Java editor. Right now there in no popup.
Is there an easy way to achieve this?
Answer :
OK, it doesn't look like the functionality is built-in in the marker-system. It seems a patch have been submitted, so it will probably be added in a later version, but until then it is also pretty easy create by hand.
- Create an class that implements
IAnnotationHover
and implementgetHoverInfo()
. - Return the class in
getAnnotationHover()
method in theSourceViewerConfiguration
. - In
getHoverInfo()
method, callISourceViewer.getAnnotationModel().getAnnotationIterator()
to get all markers. - Select the marker(s) that correspond to the line number, and return the marker text.
This bug in eclipse plug-in xtext proposes a patch to show a marker tooltip on hover and status line. If you look at the attached patches you could find the answers you need.
这篇关于将鼠标悬停在Eclipse插件中的Marker文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!