简体   繁体   English

如何使用IContentAssistProcessor在自动完成中显示addicional信息弹出窗口

[英]How to show addicional information popup in auto-complete using IContentAssistProcessor

I created a custom eclipse editor ( AbstractDecoratedTextEditor ) and I implemented an auto-complete feature using IContentAssistProcessor . 我创建了一个自定义eclipse编辑器( AbstractDecoratedTextEditor ),并使用IContentAssistProcessor实现了一个自动完成功能。

In the class thats extends IContentAssistProcessor , I overrided the method computeCompletionProposals that returns a list of ICompletionProposal . 在扩展IContentAssistProcessor的类中,我重写了返回ICompletionProposal列表的computeCompletionProposals方法。

But when the auto-complete dialog is running, I cant show the additional information in yellow dialog like in Java. 但是当自动完成对话框运行时,我无法像在Java中那样在黄色对话框中显示其他信息。

For example, in Java I have the Javadoc dialog: 例如,在Java中我有Javadoc对话框:

在此输入图像描述

But in my custom auto-complete I cant create this yellow dialog to show additional information. 但在我的自定义自动完成中,我无法创建此黄色对话框以显示其他信息。

How can I create this dialog? 如何创建此对话框?

For the additional information popup to show, you need two things: 要显示附加信息弹出窗口 ,您需要两件事:

  1. ICompletionProposal#getAdditionalProposalInfo() must return a string that contains the information, that's what you probably already have. ICompletionProposal#getAdditionalProposalInfo()必须返回包含信息的字符串,这是您可能已经拥有的信息。
  2. the ContentAssistant that is used to show the proposals must have an IInformationControlCreator set. 用于显示提案的ContentAssistant必须设置IInformationControlCreator Use contentAssistant.setInformationControlCreator() to assign one. 使用contentAssistant.setInformationControlCreator()来分配一个。 Here is an example of an information control creator: 以下是信息控件创建者的示例:
class SimpleInformationControlCreator implements IInformationControlCreator {
  public IInformationControl createInformationControl( Shell shell ) {
    return new DefaultInformationControl( shell, true );
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM