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 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 XLIFFEditor method init.
/**
* 启动编辑器。
*
* @param site
* the site
* @param input
* the input
* @throws PartInitException
* the part init exception
* @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite,
* org.eclipse.ui.IEditorInput)
*/
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("init(IEditorSite site, IEditorInput input)");
}
setSite(site);
setInput(input);
// 设置Editor标题栏的显示名称,否则名称用plugin.xml中的name属性
setPartName(input.getName());
Image oldTitleImage = titleImage;
if (input != null) {
IEditorRegistry editorRegistry = PlatformUI.getWorkbench().getEditorRegistry();
IEditorDescriptor editorDesc = editorRegistry.findEditor(getSite().getId());
ImageDescriptor imageDesc = editorDesc != null ? editorDesc.getImageDescriptor() : null;
titleImage = imageDesc != null ? imageDesc.createImage() : null;
}
setTitleImage(titleImage);
if (oldTitleImage != null && !oldTitleImage.isDisposed()) {
oldTitleImage.dispose();
}
getSite().setSelectionProvider(this);
}
use of org.eclipse.jface.resource.ImageDescriptor in project translationstudio8 by heartsome.
the class ImageCellRender method addRessourceNameMapping.
/**
* Add a mapping between object instance and an image ressource.
* @param o
* object instance
* @param key
* string key (has to be non null an unique for this renderer) to identfy the object
* @param ressourceName
* ressource path
*/
public void addRessourceNameMapping(Object o, String key, String ressourceName) {
ImageDescriptor imgDesc = new ResourceImageDescriptor(ressourceName, this.getClass());
addImageDescriptorMapping(o, key, imgDesc);
}
use of org.eclipse.jface.resource.ImageDescriptor in project tdi-studio-se by Talend.
the class ImageLib method addImage.
/**
* store the image with special name(the name with suffix,such as "sample.gif").
*
* @param iconName
*/
public static void addImage(String iconName) {
try {
ImageDescriptor descriptor = ImageDescriptor.createFromURL(new URL(iconURL, iconName));
imageRegistry.put(iconName, descriptor);
} catch (MalformedURLException e) {
// skip, but try to go on to the next one...
}
}
Aggregations