@Override
public List<ICompletionProposal> computeCompletionProposals(ContentAssistInvocationContext context,
IProgressMonitor monitor) {
if (context instanceof JavaContentAssistInvocationContext) {
JavaContentAssistInvocationContext javaContext = (JavaContentAssistInvocationContext) context;
// check if project is a spring project
if (SpringCoreUtils.isSpringProject(javaContext.getProject().getProject())) {
ICompilationUnit cu = javaContext.getCompilationUnit();
try {
List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
int invocationOffset = context.getInvocationOffset();
IJavaElement element = cu.getElementAt(invocationOffset);
cu.makeConsistent(monitor);
// check for type/method/field specific annotation
// proposal computers
if (element instanceof SourceRefElement
&& ((SourceRefElement) element).getElementInfo() instanceof AnnotatableInfo) {
SourceRefElement sourceRefElement = (SourceRefElement) element;
IAnnotation[] annotations = sourceRefElement.getAnnotations();
for (IAnnotation annotation : annotations) {
String annotationName = annotation.getElementName();
if (javaContext.getViewer() instanceof SourceViewer) {
// SourceViewer sourceViewer = (SourceViewer)
// javaContext.getViewer();
// AssistContext assistContext = new
// AssistContext(cu, sourceViewer,
// invocationOffset, 0);