1.获取图片
public static Image getImage(String key) {
Image img = getDefault().getImageRegistry().get(key);
if (img == null) {
getDefault().getImageRegistry().put(key,
getImageDescriptor(key).createImage());
img = getDefault().getImageRegistry().get(key);
}
return img;
}
/**
* Returns an image descriptor for the image file at the given plug-in
* relative path
*
* @param path
* the path
* @return the image descriptor
*/
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
2.获取颜色
public static Color getColor(RGB rgb) {
if (color == null) {
color = ColorCache.open();
}
return color.getColor(rgb);
}