Archive for February, 2010

Eclipse plugins – Programatically get the image associated with a file extension

February 11, 2010

Well this is extremely easy.

String extension="bmp"
Image img = PlatformUI.getWorkbench().getEditorRegistry().getImageDescriptor("test."+extension).createImage();

Or if the file is in the workspace

IContentType ct=IDE.getContentType(iFileObject);
 

then use the IContentType object to get the image.
 

Advertisements