fastcodejava
fastcodejava

Reputation: 41127

How to get icons for entities from eclipse?

I am writing an eclipse plugin. How do I get the various images from eclipse library? So I don't have have keep a local set of images for the standard entities, e.g classes, interfaces, junits, etc.

EDIT : I used PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE) from the article : http://www.eclipse.org/articles/Article-Using%20Images%20In%20Eclipse/Using%20Images%20In%20Eclipse.html. That did not work.

Upvotes: 2

Views: 1010

Answers (3)

Chandrayya G K
Chandrayya G K

Reputation: 8859

You can use Image browser view. See here Refer this post for using eclipse standard images/icons in your plugin

Upvotes: 1

Lamb
Lamb

Reputation: 11

You can do it like this method:

public Image getImage() {
    ImageDescriptor descriptor =
        Activator.getImageDescriptor("$nl$/icons/xxx.png");
    return descriptor.createImage();

}

Upvotes: 1

Zoltán Ujhelyi
Zoltán Ujhelyi

Reputation: 13858

The code is correct (AFAIK), but not all Shared Images are available like that. I suggest experimenting with various constants (e.g. IMG_ELCL_REMOVEALL works in a project of mine).

Upvotes: 1

Related Questions