use of org.eclipse.jdt.internal.codeassist.complete.CompletionOnKeyword2 in project eclipse.jdt.ls by eclipse.
the class SnippetCompletionProposal method accept.
private static boolean accept(ICompilationUnit cu, CompletionContext completionContext, boolean acceptClass) {
if (completionContext != null && completionContext.isExtended()) {
if (completionContext.isInJavadoc()) {
return false;
}
if (completionContext instanceof InternalCompletionContext) {
InternalCompletionContext internalCompletionContext = (InternalCompletionContext) completionContext;
ASTNode node = internalCompletionContext.getCompletionNode();
if (node instanceof CompletionOnKeyword2) {
return true;
}
if (node instanceof CompletionOnFieldType) {
return true;
}
if (acceptClass && node instanceof CompletionOnSingleNameReference) {
if (completionContext.getEnclosingElement() instanceof IMethod) {
CompilationUnit ast = CoreASTProvider.getInstance().getAST(cu, CoreASTProvider.WAIT_YES, null);
org.eclipse.jdt.core.dom.ASTNode astNode = ASTNodeSearchUtil.getAstNode(ast, completionContext.getTokenStart(), completionContext.getTokenEnd() - completionContext.getTokenStart() + 1);
return (astNode == null || (astNode.getParent() instanceof ExpressionStatement));
}
return true;
}
}
}
return false;
}
Aggregations