下面列出了怎么用org.eclipse.jface.text.contentassist.ICompletionProposalSorter的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* Content assistant
*/
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer)
{
ContentAssistant assistant = new ContentAssistant();
assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
assistant.setContentAssistProcessor(new TLACompletionProcessor(), IDocument.DEFAULT_CONTENT_TYPE);
assistant.setContentAssistProcessor(new PCalCompletionProcessor(), TLAPartitionScanner.TLA_PCAL);
assistant.enableColoredLabels(true);
assistant.enableAutoActivation(true);
assistant.setAutoActivationDelay(500);
assistant.setInformationControlCreator(new IInformationControlCreator() {
public IInformationControl createInformationControl(final Shell parent) {
return new DefaultInformationControl(parent, (DefaultInformationControl.IInformationPresenter) null);
}
});
assistant.setSorter(new ICompletionProposalSorter() {
public int compare(ICompletionProposal p1, ICompletionProposal p2) {
return 0;
}
});
assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
assistant.setContextInformationPopupBackground(TLAEditorActivator.getDefault().getTLAColorProvider().getColor(
TLAColorProvider.CONTENT_ASSIST_BACKGROUND_KEY));
return assistant;
}
public TypeScriptCompletionProcessor(ITextEditor editor, ContentAssistant assistant, String partition) {
super(editor, assistant, partition);
this.editor = editor;
assistant.setSorter(new ICompletionProposalSorter() {
@Override
public int compare(ICompletionProposal p1, ICompletionProposal p2) {
return RELEVANCE_SORTER.compare(p1, p2);
}
});
}