views:

546

answers:

1

Hi,

I have implemented my own editor and added a code completion functionality to it. My content assistant is registered in source viewer configuration like this:

public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
    if (assistant == null) {
        assistant = new ContentAssistant();
        assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
        assistant.setContentAssistProcessor(getMyAssistProcessor(),
                MyPartitionScanner.DESIRED_PARTITION_FOR_MY_ASSISTANCE);
        assistant.enableAutoActivation(true);
        assistant.setAutoActivationDelay(500);
  assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
  assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
    }
    return assistant;
}

When I press CTRL + SPACE inside the desired partition, the completion popup appears and works as expected.

And here's my question.. How do I implement/register a documentation popup that appears next to completion popup? (For exapmple in java editor)

Many thanks for your advice

+1  A: 

Well,

I'll answear the question myself ;-)

You have to add this line

assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));

to the configuration above. Then when creating CompletionProposals, the eighth (last) parameter called additionalProposalInfo of the constructor is the text, which will be shown in the documentation popup.

new CompletionProposal(replacementString,
                          replacementOffset,
                          replacementLength,
                          cursorPosition,
                          image,
                          displayString,
                          contextInformation,
                          additionalProposalInfo);

More information about can be found here.

Easy, isn't it.. if you know how to do it ;)

Martin Lazar