if (!(context instanceof JavaContentAssistInvocationContext)) {
return super.computeCompletionProposals(context, monitor);
}
JavaContentAssistInvocationContext javaContext = (JavaContentAssistInvocationContext) context;
CompletionContext coreContext = javaContext.getCoreContext();
if (coreContext != null) {
int tokenLocation = coreContext.getTokenLocation();
if ((tokenLocation & CompletionContext.TL_MEMBER_START) == 0) {
return super.computeCompletionProposals(context, monitor);
}
}
if (!SpringCoreUtils.isSpringProject(javaContext.getProject().getProject())) {
return super.computeCompletionProposals(context, monitor);
}
ITextViewer viewer = context.getViewer();
IDocument document = viewer.getDocument();
try {
int invocationOffset = context.getInvocationOffset();
int start = invocationOffset;
int end = invocationOffset;
while (start != 0 && Character.isUnicodeIdentifierPart(document.getChar(start - 1))) {
start--;
}
if (start < 0) {
return super.computeCompletionProposals(context, monitor);
}
String prefix = document.get(start, end - start);
if (!"findby".startsWith(prefix.toLowerCase())) {
return super.computeCompletionProposals(context, monitor);
}
if (!(viewer instanceof ISourceViewer)) {
return super.computeCompletionProposals(context, monitor);
}
IType expectedType = javaContext.getExpectedType();
if (expectedType == null) {
expectedType = javaContext.getCompilationUnit().findPrimaryType();
}
if (expectedType == null) {
return super.computeCompletionProposals(javaContext, monitor);
}
if (!isSpringDataRepository(expectedType, javaContext.getProject())) {
return super.computeCompletionProposals(javaContext, monitor);
}
List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();