private SimilarElement[] process(ICompilationUnit cu, int pos) throws JavaModelException { try { cu.codeComplete(pos, this); processKeywords(); return fResult.toArray(new SimilarElement[fResult.size()]); } finally { fResult.clear(); } }
private SimilarElement[] process(ICompilationUnit cu, int pos) throws JavaModelException { try { cu.codeComplete(pos, this); processKeywords(); return (SimilarElement[]) fResult.toArray(new SimilarElement[fResult.size()]); } finally { fResult.clear(); } }
private SimilarElement[] process(ICompilationUnit cu, int pos) throws JavaModelException { try { cu.codeComplete(pos, this); processKeywords(); return fResult.toArray(new SimilarElement[fResult.size()]); } finally { fResult.clear(); } }
private SimilarElement[] process(ICompilationUnit cu, int pos) throws JavaModelException { try { cu.codeComplete(pos, this); processKeywords(); return fResult.toArray(new SimilarElement[fResult.size()]); } finally { fResult.clear(); } }
public List collect(int codeAssistOffset, ICompilationUnit compilationUnit) throws JavaModelException { Assert.isTrue(codeAssistOffset >= 0); Assert.isNotNull(compilationUnit); fVars= new ArrayList(); String source= compilationUnit.getSource(); if (source == null) return fVars; fEnclosingTypeName= getEnclosingTypeName(codeAssistOffset, compilationUnit); // find some whitespace to start our variable-finding code complete from. // this allows the VariableTracker to find all available variables (no prefix to match for the code completion) int completionOffset= getCompletionOffset(source, codeAssistOffset); compilationUnit.codeComplete(completionOffset, this); // add this, true, false int dotPos= fEnclosingTypeName.lastIndexOf('.'); String thisType; String thisPkg; if (dotPos != -1) { thisType= fEnclosingTypeName.substring(dotPos + 1); thisPkg= fEnclosingTypeName.substring(0, dotPos); } else { thisPkg= new String(); thisType= fEnclosingTypeName; } addVariable(Variable.FIELD, thisPkg.toCharArray(), thisType.toCharArray(), "this".toCharArray(), new char[] {'.'}, getFieldDescriptor(Flags.AccPublic | Flags.AccFinal)); //$NON-NLS-1$ addVariable(Variable.FIELD, NO_TRIGGERS, "boolean".toCharArray(), "true".toCharArray(), NO_TRIGGERS, null); //$NON-NLS-1$//$NON-NLS-2$ addVariable(Variable.FIELD, NO_TRIGGERS, "boolean".toCharArray(), "false".toCharArray(), NO_TRIGGERS, null); //$NON-NLS-1$//$NON-NLS-2$ return fVars; }
private CompilationUnitCompletion getCompletion() { ICompilationUnit compilationUnit= getCompilationUnit(); if (fCompletion == null) { fCompletion= new CompilationUnitCompletion(compilationUnit); if (compilationUnit != null) { try { compilationUnit.codeComplete(getStart(), fCompletion); } catch (JavaModelException e) { // ignore } } } return fCompletion; }
private CompilationUnitCompletion getCompletion() { ICompilationUnit compilationUnit= getCompilationUnit(); if (fCompletion == null) { fCompletion= new CompilationUnitCompletion(compilationUnit); if (compilationUnit != null) { try { compilationUnit.codeComplete(getStart(), fCompletion); } catch (JavaModelException e) { // ignore } } } return fCompletion; }
private CompilationUnitCompletion getCompletion() { ICompilationUnit compilationUnit= getCompilationUnit(); if (fCompletion == null) { fCompletion= new CompilationUnitCompletion(compilationUnit); if (compilationUnit != null) { try { compilationUnit.codeComplete(getStart(), fCompletion); } catch (JavaModelException e) { // ignore } } } return fCompletion; }
private List<IJavaCompletionProposal> findSubwordMatchingProposals(IProgressMonitor monitor) { final String token = getToken(); final SubwordsCompletionRequestor requestor = new SubwordsCompletionRequestor(token, ctx); final ITextViewer viewer = ctx.getViewer(); final Point selection = viewer.getSelectedRange(); if (selection.y > 0) { requestor.setReplacementLength(selection.y); } final ICompilationUnit cu = ctx.getCompilationUnit(); final int offsetBeforeTokenBegin = ctx.getInvocationOffset() - token.length(); try { // first on the original position cu.codeComplete(ctx.getInvocationOffset(), requestor, monitor); if (token.length() > 0) { // then on the 'virtual' position cu.codeComplete(offsetBeforeTokenBegin, requestor, monitor); } } catch (final Exception e) { RecommendersUtilsPlugin.logWarning(e, "Code completion failed: %s", e.getMessage()); //$NON-NLS-1$ } return requestor.getProposals(); }
newCU.codeComplete(offset, requestor);
private void requestExtendedContext() { ICompilationUnit cu = getCompilationUnit(); collector = new ProposalCollectingCompletionRequestor(javaContext); try { cu.codeComplete(getInvocationOffset(), collector, new TimeoutProgressMonitor()); } catch (final Exception e) { RecommendersPlugin.logError(e, "Exception during code completion"); } coreContext = collector.getCoreContext(); }
unit.codeComplete(15 + currentContent.length(), req); unit.discardWorkingCopy(); } catch (JavaModelException e) {
+ substring(contents, offset, contents.length()); buffer.setContents(newContents); wc.codeComplete(offset + 1, new CompletionRequestor(true) {
fCompletionRequestor.setOffsetReduction(cuPrefixLength); cu.codeComplete(cuPrefixLength + documentOffset, fCompletionRequestor);
fCompletionRequestor.setOffsetReduction(cuPrefixLength); cu.codeComplete(cuPrefixLength + documentOffset, fCompletionRequestor);
int cuPrefixLength= fCompletionContextRequestor.getBeforeString().length(); fCompletionRequestor.setOffsetReduction(cuPrefixLength); cu.codeComplete(cuPrefixLength + documentOffset, fCompletionRequestor);
unit.codeComplete(contextInfomation[0] + 1, collector, monitor); help = collector.getSignatureHelp(monitor);
unit.codeComplete(offset, collector, subMonitor); proposals.addAll(collector.getCompletionItems()); proposals.addAll(SnippetCompletionProposal.getSnippets(unit, collector.getContext(), subMonitor));
cu.codeComplete(getInvocationOffset(), collector); if (fCoreContext == null) fCoreContext= collector.getContext();
cu.codeComplete(getInvocationOffset(), collector); if (fCoreContext == null) fCoreContext= collector.getContext();