use of org.eclipse.jdt.ui.text.java.CompletionProposalCollector in project tdi-studio-se by Talend.
the class TalendJavaCompletionProcessor method createContext.
/*
* (non-Javadoc)
*
* @see
* org.eclipse.jdt.internal.ui.text.java.JavaCompletionProcessor#createContext(org.eclipse.jface.text.ITextViewer,
* int)
*/
@Override
protected ContentAssistInvocationContext createContext(ITextViewer viewer, int offset) {
if (viewer instanceof TalendJavaSourceViewer) {
((TalendJavaSourceViewer) viewer).updateContents();
ICompilationUnit compilationUnit = ((TalendJavaSourceViewer) viewer).getCompilationUnit();
if (compilationUnit != null) {
CompletionProposalCollector cpc = new CompletionProposalCollector(compilationUnit);
// set an empty editor Part as it's the only constructor where the viewer can be used.
JavaContentAssistInvocationContext invocContext = new JavaContentAssistInvocationContext(viewer, offset, new NullEditorPart());
cpc.setInvocationContext(invocContext);
return invocContext;
} else {
return null;
}
} else {
return null;
}
}
Aggregations