use of org.eclipse.jface.resource.ImageDescriptor in project translationstudio8 by heartsome.
the class ClassImageRenderer method addClassRessourceNameMapping.
/**
* Add a mapping between a class and an image ressource.
*
* @param clazz class
* @param key string key (has to be non null an unique for this renderer) to identfy the object
* @param ressourceName ressource path
*/
public void addClassRessourceNameMapping(Class<?> clazz, String key, String ressourceName) {
ImageDescriptor imgDesc = new ResourceImageDescriptor(ressourceName, this.getClass());
addClassImageDescriptorMapping(clazz, key, imgDesc);
}
use of org.eclipse.jface.resource.ImageDescriptor in project translationstudio8 by heartsome.
the class ClassImageRenderer method createPrintRenderer.
/**
* {@inheritDoc}
*/
public ICellRenderer createPrintRenderer(Printer printer) {
ClassImageRenderer renderer = new ClassImageRenderer(printer);
for (Class<?> clazz : _keyMap.keySet()) {
String key = _keyMap.get(clazz);
ImageDescriptor imageDesc = getImageRegistry().getDescriptor(key);
renderer.addClassImageDescriptorMapping(clazz, key, imageDesc);
}
return renderer;
}
use of org.eclipse.jface.resource.ImageDescriptor in project translationstudio8 by heartsome.
the class ObjectImageRenderer method createPrintRenderer.
/**
* {@inheritDoc}
*/
public ICellRenderer createPrintRenderer(Printer printer) {
ObjectImageRenderer renderer = new ObjectImageRenderer(printer);
for (Object o : _keyMap.keySet()) {
String key = _keyMap.get(o);
ImageDescriptor imageDesc = getImageRegistry().getDescriptor(key);
renderer.addObjectImageDescriptorMapping(o, key, imageDesc);
}
return renderer;
}
use of org.eclipse.jface.resource.ImageDescriptor in project translationstudio8 by heartsome.
the class Activator method getIconDescriptor.
/**
* 提供一个图片文件对插件的相对路径,返回该图片被伸缩变换为16*16像素的描述信息。
* @param path
* the path
* @return the icon descriptor
*/
public static ImageDescriptor getIconDescriptor(String path) {
ImageDescriptor image = getImageDescriptor(path);
ImageData data = image.getImageData();
data = data.scaledTo(16, 16);
image = ImageDescriptor.createFromImageData(data);
return image;
}
use of org.eclipse.jface.resource.ImageDescriptor in project translationstudio8 by heartsome.
the class GUIHelper method getImage.
public static Image getImage(String key) {
Image image = JFaceResources.getImage(key);
if (image == null) {
URL imageUrl = getImageUrl(key);
if (imageUrl != null) {
ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(imageUrl);
JFaceResources.getImageRegistry().put(key, imageDescriptor.createImage());
image = JFaceResources.getImage(key);
}
}
return image;
}
Aggregations