use of org.eclipse.jdt.internal.ui.text.java.AnonymousTypeProposalInfo in project che by eclipse.
the class CompletionProposalCollector method createAnonymousTypeProposal.
private IJavaCompletionProposal createAnonymousTypeProposal(CompletionProposal proposal, JavaContentAssistInvocationContext invocationContext) {
if (fCompilationUnit == null || fJavaProject == null)
return null;
char[] declarationKey = proposal.getDeclarationKey();
if (declarationKey == null)
return null;
try {
IJavaElement element = fJavaProject.findElement(new String(declarationKey), null);
if (!(element instanceof IType))
return null;
IType type = (IType) element;
String completion = String.valueOf(proposal.getCompletion());
int start = proposal.getReplaceStart();
int length = getLength(proposal);
int relevance = computeRelevance(proposal);
StyledString label = fLabelProvider.createAnonymousTypeLabel(proposal);
JavaCompletionProposal javaProposal = new AnonymousTypeCompletionProposal(fJavaProject, fCompilationUnit, invocationContext, start, length, completion, label, String.valueOf(proposal.getDeclarationSignature()), type, relevance);
javaProposal.setProposalInfo(new AnonymousTypeProposalInfo(fJavaProject, proposal));
return javaProposal;
} catch (JavaModelException e) {
return null;
}
}
Aggregations