Search in sources :

Example 1 with JavaCompletionProposal

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

the class CompletionProposalCollector method createMethodDeclarationProposal.

private IJavaCompletionProposal createMethodDeclarationProposal(CompletionProposal proposal) {
    if (fCompilationUnit == null || fJavaProject == null)
        return null;
    String name = String.valueOf(proposal.getName());
    String[] paramTypes = Signature.getParameterTypes(String.valueOf(proposal.getSignature()));
    for (int index = 0; index < paramTypes.length; index++) paramTypes[index] = Signature.toString(paramTypes[index]);
    int start = proposal.getReplaceStart();
    int length = getLength(proposal);
    StyledString label = fLabelProvider.createOverrideMethodProposalLabel(proposal);
    JavaCompletionProposal javaProposal = new OverrideCompletionProposal(fJavaProject, fCompilationUnit, name, paramTypes, start, length, label, String.valueOf(proposal.getCompletion()));
    javaProposal.setImage(getImage(fLabelProvider.createMethodImageDescriptor(proposal)));
    javaProposal.setProposalInfo(new MethodProposalInfo(fJavaProject, proposal));
    javaProposal.setRelevance(computeRelevance(proposal));
    fSuggestedMethodNames.add(new String(name));
    return javaProposal;
}
Also used : OverrideCompletionProposal(org.eclipse.jdt.internal.ui.text.java.OverrideCompletionProposal) MethodProposalInfo(org.eclipse.jdt.internal.ui.text.java.MethodProposalInfo) StyledString(org.eclipse.jface.viewers.StyledString) StyledString(org.eclipse.jface.viewers.StyledString) JavaCompletionProposal(org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposal) LazyJavaCompletionProposal(org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal)

Example 2 with JavaCompletionProposal

use of org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposal 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 3 with JavaCompletionProposal

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

the class CompletionProposalCollector method createLabelProposal.

private IJavaCompletionProposal createLabelProposal(CompletionProposal proposal) {
    String completion = String.valueOf(proposal.getCompletion());
    int start = proposal.getReplaceStart();
    int length = getLength(proposal);
    StyledString label = fLabelProvider.createSimpleLabel(proposal);
    int relevance = computeRelevance(proposal);
    return new JavaCompletionProposal(completion, start, length, null, label, relevance);
}
Also used : StyledString(org.eclipse.jface.viewers.StyledString) StyledString(org.eclipse.jface.viewers.StyledString) JavaCompletionProposal(org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposal) LazyJavaCompletionProposal(org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal)

Example 4 with JavaCompletionProposal

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

the class CompletionProposalCollector method createKeywordProposal.

private IJavaCompletionProposal createKeywordProposal(CompletionProposal proposal) {
    String completion = String.valueOf(proposal.getCompletion());
    int start = proposal.getReplaceStart();
    int length = getLength(proposal);
    StyledString label = fLabelProvider.createSimpleLabel(proposal);
    int relevance = computeRelevance(proposal);
    return new JavaCompletionProposal(completion, start, length, null, label, relevance);
}
Also used : StyledString(org.eclipse.jface.viewers.StyledString) StyledString(org.eclipse.jface.viewers.StyledString) JavaCompletionProposal(org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposal) LazyJavaCompletionProposal(org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal)

Example 5 with JavaCompletionProposal

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

the class CompletionProposalCollector method createAnnotationAttributeReferenceProposal.

private IJavaCompletionProposal createAnnotationAttributeReferenceProposal(CompletionProposal proposal) {
    StyledString displayString = fLabelProvider.createLabelWithTypeAndDeclaration(proposal);
    ImageDescriptor descriptor = fLabelProvider.createMethodImageDescriptor(proposal);
    String completion = String.valueOf(proposal.getCompletion());
    JavaCompletionProposal javaProposal = new JavaCompletionProposal(completion, proposal.getReplaceStart(), getLength(proposal), getImage(descriptor), displayString, computeRelevance(proposal));
    if (fJavaProject != null)
        javaProposal.setProposalInfo(new AnnotationAtttributeProposalInfo(fJavaProject, proposal));
    return javaProposal;
}
Also used : AnnotationAtttributeProposalInfo(org.eclipse.jdt.internal.ui.text.java.AnnotationAtttributeProposalInfo) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) StyledString(org.eclipse.jface.viewers.StyledString) StyledString(org.eclipse.jface.viewers.StyledString) JavaCompletionProposal(org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposal) LazyJavaCompletionProposal(org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal)

Aggregations

JavaCompletionProposal (org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposal)10 LazyJavaCompletionProposal (org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal)8 StyledString (org.eclipse.jface.viewers.StyledString)8 Image (org.eclipse.swt.graphics.Image)3 JavaModelException (org.eclipse.jdt.core.JavaModelException)2 SourceField (org.eclipse.jdt.internal.core.SourceField)2 FieldProposalInfo (org.eclipse.jdt.internal.ui.text.java.FieldProposalInfo)2 ICompletionProposal (org.eclipse.jface.text.contentassist.ICompletionProposal)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 IJavaElement (org.eclipse.jdt.core.IJavaElement)1 IType (org.eclipse.jdt.core.IType)1 AnnotationAtttributeProposalInfo (org.eclipse.jdt.internal.ui.text.java.AnnotationAtttributeProposalInfo)1 AnonymousTypeCompletionProposal (org.eclipse.jdt.internal.ui.text.java.AnonymousTypeCompletionProposal)1 AnonymousTypeProposalInfo (org.eclipse.jdt.internal.ui.text.java.AnonymousTypeProposalInfo)1 JavaCompletionProcessor (org.eclipse.jdt.internal.ui.text.java.JavaCompletionProcessor)1 JavaFieldWithCastedReceiverCompletionProposal (org.eclipse.jdt.internal.ui.text.java.JavaFieldWithCastedReceiverCompletionProposal)1 MethodProposalInfo (org.eclipse.jdt.internal.ui.text.java.MethodProposalInfo)1 OverrideCompletionProposal (org.eclipse.jdt.internal.ui.text.java.OverrideCompletionProposal)1 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)1