本文整理汇总了Java中org.eclipse.jface.resource.ImageDescriptor.createImage方法的典型用法代码示例。如果您正苦于以下问题:Java ImageDescriptor.createImage方法的具体用法?Java ImageDescriptor.createImage怎么用?Java ImageDescriptor.createImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.resource.ImageDescriptor
的用法示例。
在下文中一共展示了ImageDescriptor.createImage方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getImage
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
@Override
public Image getImage(Object element) {
ImageDescriptor descriptor = getImageDescriptor(element);
if (descriptor == null) {
return null;
}
// obtain the cached image corresponding to the descriptor
Image image = imageCache.get(descriptor);
if (image == null) {
image = descriptor.createImage();
imageCache.put(descriptor, image);
}
return image;
}
示例2: getImage
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
/**
* Get image by path from image registry. If not already registered a new
* image will be created and registered. If not createable a fallback image
* is used instead
*
* @param path
* @param pluginId
* - plugin id to identify which plugin image should be loaded
* @return image
*/
public static Image getImage(String path, String pluginId) {
ImageRegistry imageRegistry = getImageRegistry();
if (imageRegistry == null) {
return null;
}
Image image = imageRegistry.get(path);
if (image == null) {
ImageDescriptor imageDesc = createImageDescriptor(path, pluginId);
image = imageDesc.createImage();
if (image == null) {
image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
}
imageRegistry.put(path, image);
}
return image;
}
示例3: testIndirectImageCaching
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
/**
* Checks the indirect {@link Image image} caching.
*/
@Test
public void testIndirectImageCaching() {
final ImageDescriptor desc1 = ImageRef.LIB_PATH.asImageDescriptor().orNull();
final ImageDescriptor desc2 = ImageRef.LIB_PATH.asImageDescriptor().orNull();
final Image img1 = desc1.createImage();
final Image img2 = desc2.createImage();
assertTrue("Expected different reference of images.", img1 != img2);
}
示例4: getSharedImage
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
static public Image getSharedImage(ImageDescriptor descriptor){
Image res = imageMap.get(descriptor);
if(res == null){
res = descriptor.createImage();
imageMap.put(descriptor, res);
}
return res;
}
示例5: getImage
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
private Image getImage() {
String path = "icons/ksp.gif";
Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
URL url = FileLocator.find(bundle, new Path(path), null);
ImageDescriptor imageDesc = ImageDescriptor.createFromURL(url);
return imageDesc.createImage();
}
示例6: getImage
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
/**
* Get image contained in the 'images' folder of the plugin
*/
static Image getImage(String name) {
Bundle bundle = Platform.getBundle(PandionJConstants.PLUGIN_ID);
URL imagePath = FileLocator.find(bundle, new Path(PandionJConstants.IMAGE_FOLDER + "/" + name), null);
ImageDescriptor imageDesc = ImageDescriptor.createFromURL(imagePath);
return imageDesc.createImage();
}
示例7: OverlayImageIcon
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
public OverlayImageIcon(Image baseImage, ImageDescriptor overlay, int corner) {
mCorner = corner;
mBase = baseImage;
if (overlay != null)
mOverlay = overlay.createImage();
}
示例8: getCreateImage
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
private void getCreateImage(String path) {
URL url = ModelActivator.getDefault().getBundle().getResource(path);
ImageDescriptor imageDesc = ImageDescriptor.createFromURL(url);
icon = imageDesc.createImage();
}
示例9: SimpleImageContentProposalLabelProvider
import org.eclipse.jface.resource.ImageDescriptor; //导入方法依赖的package包/类
/**
* Creates a new SimpleImageContentProposalLabelProvider with a given image.
*
*
* @param imageDescriptor
* The descriptor of the image which should be used
*/
public SimpleImageContentProposalLabelProvider(ImageDescriptor imageDescriptor) {
this.image = imageDescriptor.createImage();
}