@Override public List<ICompletionProposal> computeCompletionProposals(ContentAssistInvocationContext context, IProgressMonitor monitor) { return Arrays.asList(fProcessor.computeCompletionProposals(context.getViewer(), context.getInvocationOffset())); }
/** * Creates the context that is passed to the completion proposal * computers. * * @param viewer the viewer that content assist is invoked on * @param offset the content assist offset * @return the context to be passed to the computers */ protected ContentAssistInvocationContext createContext(ITextViewer viewer, int offset) { return new ContentAssistInvocationContext(viewer, offset); }
/** * Computes the identifier (as specified by {@link Character#isJavaIdentifierPart(char)}) that * immediately precedes the invocation offset. * * @return the prefix preceding the content assist invocation offset, <code>null</code> if * there is no document * @throws BadLocationException if accessing the document fails */ public CharSequence computeIdentifierPrefix() throws BadLocationException { if (fPrefix == null) { IDocument document= getDocument(); if (document == null) return null; int end= getInvocationOffset(); int start= end; while (--start >= 0) { if (!Character.isJavaIdentifierPart(document.getChar(start))) break; } start++; fPrefix= document.get(start, end - start); } return fPrefix; }
protected int guessContextInformationPosition(ContentAssistInvocationContext context) { return context.getInvocationOffset(); }
JavaContentAssistInvocationContext javaContext= (JavaContentAssistInvocationContext) context; try { if (types.size() > 0 && context.computeIdentifierPrefix().length() == 0) { IType expectedType= javaContext.getExpectedType(); if (expectedType != null) {
/** * Computes the identifier (as specified by {@link Character#isJavaIdentifierPart(char)}) that * immediately precedes the invocation offset. * * @return the prefix preceding the content assist invocation offset, <code>null</code> if * there is no document * @throws BadLocationException if accessing the document fails */ public CharSequence computeIdentifierPrefix() throws BadLocationException { if (fPrefix == null) { IDocument document= getDocument(); if (document == null) return null; int end= getInvocationOffset(); int start= end; while (--start >= 0) { if (!Character.isJavaIdentifierPart(document.getChar(start))) break; } start++; fPrefix= document.get(start, end - start); } return fPrefix; }
protected int guessContextInformationPosition(ContentAssistInvocationContext context) { return context.getInvocationOffset(); }
if (types.size() > 0 && context.computeIdentifierPrefix().length() == 0) { IType expectedType= javaContext.getExpectedType(); if (expectedType != null) {
/** * Computes the identifier (as specified by {@link Character#isJavaIdentifierPart(char)}) that * immediately precedes the invocation offset. * * @return the prefix preceding the content assist invocation offset, <code>null</code> if * there is no document * @throws BadLocationException if accessing the document fails */ public CharSequence computeIdentifierPrefix() throws BadLocationException { if (fPrefix == null) { IDocument document= getDocument(); if (document == null) return null; int end= getInvocationOffset(); int start= end; while (--start >= 0) { if (!Character.isJavaIdentifierPart(document.getChar(start))) break; } start++; fPrefix= document.get(start, end - start); } return fPrefix; }
@Override public List<IContextInformation> computeContextInformation(ContentAssistInvocationContext context, IProgressMonitor monitor) { return Arrays.asList(fProcessor.computeContextInformation(context.getViewer(), context.getInvocationOffset())); }
protected int guessContextInformationPosition(ContentAssistInvocationContext context) { return context.getInvocationOffset(); }
String prefix = context.computeIdentifierPrefix().toString(); Set<String> existingMethods = ASTUtil.getMethodSignatures(mockType);
/** * Creates the context that is passed to the completion proposal * computers. * * @param viewer the viewer that content assist is invoked on * @param offset the content assist offset * @return the context to be passed to the computers */ protected ContentAssistInvocationContext createContext(ITextViewer viewer, int offset) { return new ContentAssistInvocationContext(viewer, offset); }
protected final int guessMethodContextInformationPosition(ContentAssistInvocationContext context) { final int contextPosition= context.getInvocationOffset(); IDocument document= context.getDocument(); JavaHeuristicScanner scanner= new JavaHeuristicScanner(document); int bound= Math.max(-1, contextPosition - 2000); // try the innermost scope of parentheses that looks like a method call int pos= contextPosition - 1; do { int paren= scanner.findOpeningPeer(pos, bound, '(', ')'); if (paren == JavaHeuristicScanner.NOT_FOUND) break; int token= scanner.previousToken(paren - 1, bound); // next token must be a method name (identifier) or the closing angle of a // constructor call of a parameterized type. if (token == Symbols.TokenIDENT || token == Symbols.TokenGREATERTHAN) return paren + 1; pos= paren - 1; } while (true); return contextPosition; }
public List computeContextInformation(ContentAssistInvocationContext context, IProgressMonitor monitor) { return Arrays.asList(fProcessor.computeContextInformation(context.getViewer(), context.getInvocationOffset())); }
@Override public List<ICompletionProposal> computeCompletionProposals(ContentAssistInvocationContext context, IProgressMonitor monitor) { if (context instanceof JavaContentAssistInvocationContext) { JavaContentAssistInvocationContext javaContext= (JavaContentAssistInvocationContext) context; return internalComputeCompletionProposals(context.getInvocationOffset(), javaContext); } return Collections.emptyList(); }
if (types.size() > 0 && context.computeIdentifierPrefix().length() == 0) { IType expectedType= javaContext.getExpectedType(); if (expectedType != null) {
/** * Creates the context that is passed to the completion proposal * computers. * * @param viewer the viewer that content assist is invoked on * @param offset the content assist offset * @return the context to be passed to the computers */ protected ContentAssistInvocationContext createContext(ITextViewer viewer, int offset) { return new ContentAssistInvocationContext(viewer, offset); }
protected final int guessMethodContextInformationPosition(ContentAssistInvocationContext context) { final int contextPosition= context.getInvocationOffset(); IDocument document= context.getDocument(); JavaHeuristicScanner scanner= new JavaHeuristicScanner(document); int bound= Math.max(-1, contextPosition - 2000); // try the innermost scope of parentheses that looks like a method call int pos= contextPosition - 1; do { int paren= scanner.findOpeningPeer(pos, bound, '(', ')'); if (paren == JavaHeuristicScanner.NOT_FOUND) break; int token= scanner.previousToken(paren - 1, bound); // next token must be a method name (identifier) or the closing angle of a // constructor call of a parameterized type. if (token == Symbols.TokenIDENT || token == Symbols.TokenGREATERTHAN) return paren + 1; pos= paren - 1; } while (true); return contextPosition; }
public List computeCompletionProposals(ContentAssistInvocationContext context, IProgressMonitor monitor) { return Arrays.asList(fProcessor.computeCompletionProposals(context.getViewer(), context.getInvocationOffset())); }