与Eclipse中的Java Content Assist接口 [英] Interface with Java Content Assist in Eclipse

查看:126
本文介绍了与Eclipse中的Java Content Assist接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为我的插件项目的一部分,我正在考虑与Eclipse在Java文件上显示的内容辅助列表的接口(我正在尝试根据一些外部数据重新排列列表)。



我看过一些关于创建新内容协助的教程,但没有任何关于更改现有内容的帮助。甚至有可能吗如果是,我应该从哪里开始修改Java的内容助手?

解决方案

您可以更改内容辅助项目的顺序可以让您注册自己的 ICompletionProposalSorter 的实现 org.eclipse.jdt.ui.javaCompletionProposalSorters p>

下面的例子是插件 org.eclipse.jdt.ui ,它提供了两个完成提案分拣机:

 < extension 
point =org.eclipse.jdt.ui.javaCompletionProposalSorters>
< proposalSorter
id =org.eclipse.jdt.ui.RelevanceSorter
name =%RelevanceSorter.name
class =org.eclipse.jdt.internal .ui.text.java.RelevanceSorter/>
< proposalSorter
id =org.eclipse.jdt.ui.AlphabeticSorter
name =%AlphabeticSorter.name
class =org.eclipse.jdt.internal .ui.text.java.AlphabeticSorter/>
< / extension>

AlphabeticSorter RelevanceSorter 可能会帮助您开始编写自己的分拣机。


As part of my plugin project, I'm thinking about interfacing with the content assist list displayed by Eclipse on Java files (I'm trying to re-order the list according to some external data).

I've seen some tutorials about creating a new content assist, but nothing about changing an existing one. Is that even possible? If it is, where should I start for modifying Java's Content Assist?

解决方案

You can change the order of the content assist items with the extionsion point org.eclipse.jdt.ui.javaCompletionProposalSorters which lets you register your own implementation of ICompletionProposalSorter.

The example below is from the plugin org.eclipse.jdt.ui which provides two completion proposal sorters:

<extension
    point="org.eclipse.jdt.ui.javaCompletionProposalSorters">
    <proposalSorter
        id="org.eclipse.jdt.ui.RelevanceSorter"
        name="%RelevanceSorter.name"
        class="org.eclipse.jdt.internal.ui.text.java.RelevanceSorter"/>
    <proposalSorter
        id="org.eclipse.jdt.ui.AlphabeticSorter"
        name="%AlphabeticSorter.name"
        class="org.eclipse.jdt.internal.ui.text.java.AlphabeticSorter"/>
</extension>

The implementations of AlphabeticSorter and RelevanceSorter might help you getting started with writing your own sorter.

这篇关于与Eclipse中的Java Content Assist接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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