Daniel Megert a écrit :
Xavier Décoret wrote:
Hi,
I am trying to display rich text in additional info of a
CompletionProposal, but this does not work:
result.add(new
CompletionProposal(candidate,o,offset-o,candidate.length(),
null,
candidate,
null,
"Additional <em>info</em> with
<b>tags</b>"));
Does anyone know how to do this?
Either your proposal or your content assistant must use an
information control creator that can handle those tags. As a
reference take a look at
JavaSourceViewerConfiguration.getInformationControlCreator(ISourceViewer)
JavaSourceViewerConfiguration.getContentAssistant(ISourceViewer)
Dani
That's what I ended up doing:
public IContentAssistant getContentAssistant(ISourceViewer
sourceViewer) {
ContentAssistant assistance = new ContentAssistant();
MyContentAssistProcessor qcp = new MyContentAssistProcessor();
assistance.setContentAssistProcessor(qcp,IDocument.DEFAULT_CONTENT_TYPE);
assistance.setInformationControlCreator(new
IInformationControlCreator() {
@SuppressWarnings("restriction")
public IInformationControl createInformationControl(Shell
parent) {
return new DefaultInformationControl(parent, new
HTMLTextPresenter());
}
});
assistance.enableAutoActivation(true);
assistance.setAutoActivationDelay(500);
assistance.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
return assistance;
}
where I use the HTMLTextPresenter of package
org.eclipse.jface.internal.text.link.contentassist but I have two
problems:
- First Eclipse (3.2) give me a warning (hence the
@SuppressWarnings("restriction")) so I guess I am doing this wrong