Search in sources :

Example 1 with JavaFieldWithCastedReceiverCompletionProposal

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;
}
Also used : JavaFieldWithCastedReceiverCompletionProposal(org.eclipse.jdt.internal.ui.text.java.JavaFieldWithCastedReceiverCompletionProposal) StyledString(org.eclipse.jface.viewers.StyledString) StyledString(org.eclipse.jface.viewers.StyledString) Image(org.eclipse.swt.graphics.Image) JavaCompletionProposal(org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposal) LazyJavaCompletionProposal(org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal) FieldProposalInfo(org.eclipse.jdt.internal.ui.text.java.FieldProposalInfo)

Aggregations

FieldProposalInfo (org.eclipse.jdt.internal.ui.text.java.FieldProposalInfo)1 JavaCompletionProposal (org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposal)1 JavaFieldWithCastedReceiverCompletionProposal (org.eclipse.jdt.internal.ui.text.java.JavaFieldWithCastedReceiverCompletionProposal)1 LazyJavaCompletionProposal (org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal)1 StyledString (org.eclipse.jface.viewers.StyledString)1 Image (org.eclipse.swt.graphics.Image)1