Search in sources :

Example 1 with CompletionProposalLabelProvider

use of org.eclipse.jdt.ui.text.java.CompletionProposalLabelProvider in project Pydev by fabioz.

the class JavaElementToken method getImage.

@Override
public IImageHandle getImage() {
    if (this.image != null) {
        return this.image;
    }
    CompletionProposalLabelProvider provider = new CompletionProposalLabelProvider();
    CompletionProposal generatedProposal = CompletionProposal.create(completionProposalKind, 0);
    generatedProposal.setFlags(completionProposalFlags);
    if (HAS_ADDITIONAL_FLAGS) {
        generatedProposal.setAdditionalFlags(completionProposalAdditionalFlags);
    }
    generatedProposal.setDeclarationSignature(completionPropsoalSignature);
    generatedProposal.setSignature(completionPropsoalSignature);
    // uses: kind, flags, signature to create an image.
    ImageDescriptor descriptor = provider.createImageDescriptor(generatedProposal);
    Image computed = descriptor.createImage();
    return new IImageHandle() {

        @Override
        public Object getImageData() {
            return computed.getImageData();
        }

        @Override
        public Object getImage() {
            return computed;
        }
    };
}
Also used : IImageHandle(org.python.pydev.shared_core.image.IImageHandle) CompletionProposal(org.eclipse.jdt.core.CompletionProposal) CompletionProposalLabelProvider(org.eclipse.jdt.ui.text.java.CompletionProposalLabelProvider) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) Image(org.eclipse.swt.graphics.Image)

Aggregations

CompletionProposal (org.eclipse.jdt.core.CompletionProposal)1 CompletionProposalLabelProvider (org.eclipse.jdt.ui.text.java.CompletionProposalLabelProvider)1 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)1 Image (org.eclipse.swt.graphics.Image)1 IImageHandle (org.python.pydev.shared_core.image.IImageHandle)1