Search in sources :

Example 1 with FieldProposalInfo

use of org.eclipse.jdt.internal.ui.text.java.FieldProposalInfo in project che by eclipse.

the class CompletionProposalCollector method createFieldProposal.

private IJavaCompletionProposal createFieldProposal(CompletionProposal proposal) {
    String completion = String.valueOf(proposal.getCompletion());
    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 JavaCompletionProposal(completion, start, length, image, label, relevance, getContext().isInJavadoc(), getInvocationContext());
    if (fJavaProject != null)
        javaProposal.setProposalInfo(new FieldProposalInfo(fJavaProject, proposal));
    javaProposal.setTriggerCharacters(VAR_TRIGGER);
    return javaProposal;
}
Also used : 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)

Example 2 with FieldProposalInfo

use of org.eclipse.jdt.internal.ui.text.java.FieldProposalInfo 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)2 JavaCompletionProposal (org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposal)2 LazyJavaCompletionProposal (org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal)2 StyledString (org.eclipse.jface.viewers.StyledString)2 Image (org.eclipse.swt.graphics.Image)2 JavaFieldWithCastedReceiverCompletionProposal (org.eclipse.jdt.internal.ui.text.java.JavaFieldWithCastedReceiverCompletionProposal)1