Eclipse(ctrl + space)内容辅助钩子 [英] Eclipse (ctrl+space) content assist hook

查看:159
本文介绍了Eclipse(ctrl + space)内容辅助钩子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个插件,从Java编辑器获取用户输入,进行一些计算,并将结果写入我的视图。我开始上述计算过程的方式是通过上下文菜单,我讨厌它。我希望它从ctrl +空格开始,即内容辅助。它更快,更直观w.r.t.插件做什么有没有办法这样做?



更新:
例如,当用户按ctrl + space时,该怎么做获取当前光标位置?我会使用该位置信息并将其打印到我的视图。这是我基本需要的最简单的插件。

解决方案

您可以参加Ctrl-Space的内容助理计算扩展 javaCompletionProposalComputer 。但是,如果要对Java文件进行任意修改操作,则可以通过提供快速帮助



如果你感到困惑通过术语:快速帮助的示例是Invert if statement的建议,您可以在使用光标置于if上的情况下按Ctrl-1可以看到。


I wrote a plugin that gets user input from Java editor, makes some computation, and writes the results to my view. The way I start the process of aforementioned computation is via context menu and I hate it. I would like it to start on ctrl+space, i.e. content assist. It is faster, more intuitive w.r.t. what the plugin does. Is there a way to do so?

Update: For example, what should I do to get the current cursor position when user presses ctrl+space? I would use that position info and print it to my view. This is the most simplistic plugin that I basically need.

解决方案

You could take part in the content assistent calculation of Ctrl-Space by extending javaCompletionProposalComputer. However, if you want to trigger some arbitrary modification operation on the Java file, you are better suited by providing a quick assist instead.

If you are confused by the terms: An example for quick assist is the suggestion "Invert if statement", which you can see when pressing Ctrl-1 with the cursor placed on an "if".

这篇关于Eclipse(ctrl + space)内容辅助钩子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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