use of org.eclipse.jface.resource.ImageRegistry in project meclipse by flaper87.
the class ViewLabelProvider method getImage.
public Image getImage(Object obj) {
String imageKey = ISharedImages.IMG_OBJ_ELEMENT;
ImageRegistry imgReg = MeclipsePlugin.getDefault().getImageRegistry();
if (obj instanceof Connection) {
if (((Connection) obj).getMongo() != null) {
return imgReg.get(MeclipsePlugin.CONNECTION_IMG_ID);
} else {
return imgReg.get(MeclipsePlugin.CONNECTION_ERROR_IMG_ID);
}
}
if (obj instanceof Database) {
return imgReg.get(MeclipsePlugin.DATABASE_IMG_ID);
}
if (obj instanceof Collection) {
return imgReg.get(MeclipsePlugin.COLLECTION_IMG_ID);
}
if (obj instanceof Filter) {
return imgReg.get(MeclipsePlugin.FILTER_IMG_ID);
}
if (obj instanceof TreeParent)
imageKey = ISharedImages.IMG_OBJ_FOLDER;
return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey);
}
use of org.eclipse.jface.resource.ImageRegistry in project eclipse.platform.text by eclipse.
the class XMLCompletionProcessor method getImage.
/**
* Always return the default image.
*
* @param template the template, ignored in this implementation
* @return the default template image
*/
@Override
protected Image getImage(Template template) {
ImageRegistry registry = TemplateEditorUI.getDefault().getImageRegistry();
Image image = registry.get(DEFAULT_IMAGE);
if (image == null) {
// $NON-NLS-1$
ImageDescriptor desc = TemplateEditorUI.imageDescriptorFromPlugin("org.eclipse.ui.examples.javaeditor", DEFAULT_IMAGE);
registry.put(DEFAULT_IMAGE, desc);
image = registry.get(DEFAULT_IMAGE);
}
return image;
}
use of org.eclipse.jface.resource.ImageRegistry in project knime-core by knime.
the class KNIMEUIPlugin method getImage.
/**
* Returns a (cached) image from the image registry.
*
* @param descriptor The image descriptor
* @return The image, or a default image if missing.
*/
public Image getImage(final ImageDescriptor descriptor) {
if (descriptor == null) {
return null;
}
// create the registry if needed
if (m_imageRegistry == null) {
m_imageRegistry = new ImageRegistry();
}
// try to lookup previously cached image
Image img = m_imageRegistry.get(descriptor.toString());
// requests
if (img == null) {
img = descriptor.createImage(true);
m_imageRegistry.put(descriptor.toString(), img);
}
return img;
}
use of org.eclipse.jface.resource.ImageRegistry in project knime-core by knime.
the class KNIMERepositoryPlugin method getImage.
/**
* Returns a (cached) image from the image registry.
*
* @param descriptor The image descriptor
* @return The image, or a default image if missing.
*/
public Image getImage(final ImageDescriptor descriptor) {
if (descriptor == null) {
return null;
}
// create the registry if needed
if (m_imageRegistry == null) {
// this has to be done when KNIME is started without the eclipse GUI
if (Display.getCurrent() == null) {
Display.getDefault();
assert Display.getCurrent() != null;
}
m_imageRegistry = new ImageRegistry();
}
// try to lookup previously cached image
Image img = m_imageRegistry.get(descriptor.toString());
// requests
if (img == null) {
img = descriptor.createImage(true);
m_imageRegistry.put(descriptor.toString(), img);
}
return img;
}
use of org.eclipse.jface.resource.ImageRegistry in project yamcs-studio by yamcs.
the class AutoCompleteUIPlugin method getImageFromPlugin.
/**
* Load the <code>Image</code> from the given path in the given plugin.
*
* @param pluginId
* The id of the plugin that contains the requested image.
* @param relativePath
* The resource path of the requested image.
* @return The <code>Image</code> from the given path in the given plugin.
*/
public Image getImageFromPlugin(final String pluginId, final String relativePath) {
if (imageRegistry == null) {
imageRegistry = new ImageRegistry(Display.getDefault());
}
// $NON-NLS-1$
String key = pluginId + "." + relativePath;
// does image exist
if (imageRegistry.get(key) == null) {
ImageDescriptor descr = AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, relativePath);
imageRegistry.put(key, descr);
}
return imageRegistry.get(key);
}
Aggregations