}
@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
ContentAssistant assistant = new ContentAssistant();
assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
if (apexCompletionProcessor != null) {
assistant.setContentAssistProcessor(apexCompletionProcessor, IDocument.DEFAULT_CONTENT_TYPE);
apexCompletionProcessor.setContentAssistant(assistant);
}
assistant.setContentAssistProcessor(new ApexDocCompletionProcessor(), ApexPartitionScanner.APEX_DOC);
assistant.enableAutoActivation(true);
assistant.setAutoActivationDelay(500);
assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_STACKED);
assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_BELOW);
assistant.setShowEmptyList(true); // display no proposal when code assist is triggered by ctrl+space, but display nothing when triggered by auto-activation
if (apexCodeColorProvider != null) {
assistant.setContextInformationPopupBackground(apexCodeColorProvider.getColor(new RGB(150, 150, 0)));
}
assistant.addCompletionListener(new ICompletionListener() {
public void assistSessionEnded(ContentAssistEvent event) {
((ApexCompletionProcessor) event.assistant.getContentAssistProcessor(IDocument.DEFAULT_CONTENT_TYPE))
.clearState();
}
public void assistSessionStarted(ContentAssistEvent event) {}
public void selectionChanged(ICompletionProposal proposal, boolean smartToggle) {}
});
assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
return assistant;
}