Wednesday, June 29, 2011

Find ImageDescriptor

public static ImageDescriptor findImageDescriptor(String path) {
  final IPath p = new Path(path);
  if (p.isAbsolute() && p.segmentCount() > 1) {
   return AbstractUIPlugin.imageDescriptorFromPlugin(p.segment(0), p
     .removeFirstSegments(1).makeAbsolute().toString());
  } else {
   return getBundledImageDescriptor(p.makeAbsolute().toString());
  }
 }

Blogger Syntax Highliter