将鼠标悬停在Eclipse插件中的Marker文本 [英] Hover text for Marker in Eclipse plugin

查看:146
本文介绍了将鼠标悬停在Eclipse插件中的Marker文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有问题标记的自定义编辑器。
标记在问题视图中正确显示,带有图标,位置和文本,问题图标在编辑器的左边距正确显示。



当悬停在边距中的问题标记图标时,我想在弹出窗口中显示相同的错误消息文本,就像在Java编辑器中发生的一样。现在没有弹出窗口。



有没有一个简单的方法来实现?






答案:



好的,它看起来不像功能是内置在标记系统。似乎已经提交了一个补丁,所以它可能会被添加到更高的版本中,但直到此为止也很容易创建。


  1. 创建一个实现 IAnnotationHover 并实现 getHoverInfo()的类。

  2. SourceViewerConfiguration 中返回 getAnnotationHover()方法中的类。 / li>
  3. getHoverInfo()方法中,调用 ISourceViewer.getAnnotationModel()。getAnnotationIterator()获取所有标记。

  4. 选择与行号对应的标记,并返回标记文本。


解决方案

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.

  1. Create an class that implements IAnnotationHover and implement getHoverInfo().
  2. Return the class in getAnnotationHover() method in the SourceViewerConfiguration.
  3. In getHoverInfo() method, call ISourceViewer.getAnnotationModel().getAnnotationIterator() to get all markers.
  4. 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屋!

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