use of org.eclipse.jdt.internal.ui.text.java.JavaFieldWithCastedReceiverCompletionProposal in project che by eclipse.
the class CompletionProposalCollector method createFieldWithCastedReceiverProposal.
/**
* Creates the Java completion proposal for the JDT Core
* {@link org.eclipse.jdt.core.CompletionProposal#FIELD_REF_WITH_CASTED_RECEIVER} proposal.
*
* @param proposal the JDT Core proposal
* @return the Java completion proposal
* @since 3.4
*/
private IJavaCompletionProposal createFieldWithCastedReceiverProposal(CompletionProposal proposal) {
String completion = String.valueOf(proposal.getCompletion());
//$NON-NLS-1$
completion = CodeFormatterUtil.format(CodeFormatter.K_EXPRESSION, completion, 0, "\n", fJavaProject);
int start = proposal.getReplaceStart();
int length = getLength(proposal);
StyledString label = fLabelProvider.createStyledLabel(proposal);
Image image = getImage(fLabelProvider.createFieldImageDescriptor(proposal));
int relevance = computeRelevance(proposal);
JavaCompletionProposal javaProposal = new JavaFieldWithCastedReceiverCompletionProposal(completion, start, length, image, label, relevance, getContext().isInJavadoc(), getInvocationContext(), proposal);
if (fJavaProject != null)
javaProposal.setProposalInfo(new FieldProposalInfo(fJavaProject, proposal));
javaProposal.setTriggerCharacters(VAR_TRIGGER);
return javaProposal;
}
Aggregations