private void acceptPotentialMethodDeclaration(CompletionProposal proposal) { try { DartElement enclosingElement = null; if (getContext().isExtended()) { enclosingElement = getContext().getEnclosingElement(); } else if (fCompilationUnit != null) { enclosingElement = fCompilationUnit.getElementAt(proposal.getCompletionLocation() + 1); } if (enclosingElement == null) { return; } Type type = enclosingElement.getAncestor(Type.class); if (type != null) { String prefix = String.valueOf(proposal.getName()); int completionStart = proposal.getReplaceStart(); int completionEnd = proposal.getReplaceEnd(); int relevance = computeRelevance(proposal); GetterSetterCompletionProposal.evaluateProposals( type, prefix, completionStart, completionEnd - completionStart, proposal.getReplaceEndIdentifier() - completionStart, relevance + 2, fSuggestedMethodNames, fDartProposals); MethodDeclarationCompletionProposal.evaluateProposals( type, prefix, completionStart, completionEnd - completionStart, proposal.getReplaceEndIdentifier() - completionStart, relevance, fSuggestedMethodNames, fDartProposals); } } catch (CoreException e) { DartToolsPlugin.log(e); } }
private int getLengthIdentifier(CompletionProposal proposal) { return proposal.getReplaceEndIdentifier() - proposal.getReplaceStart(); }