use of org.eclipse.jface.resource.ImageRegistry in project jbosstools-hibernate by jbosstools.
the class HibernateJptUIPlugin method getImage.
public Image getImage(String key) {
ImageRegistry registry = getImageRegistry();
if (registry == null) {
registry = createImageRegistry();
}
Image image = registry.get(key);
if (image == null) {
// a bad image descriptor will result in a "default" image
// $NON-NLS-1$//$NON-NLS-2$
registry.put(key, getImageDescriptor("icons" + File.separatorChar + key + ".gif"));
image = registry.get(key);
}
return image;
}
use of org.eclipse.jface.resource.ImageRegistry in project rap by entirej.
the class EJRWTRCPApplication method run.
public void run() {
final Display display = new Display();
EJRWTImageRetriever.setGraphicsProvider(new EJRWTGraphicsProvider() {
private final ImageRegistry PLUGIN_REGISTRY = new ImageRegistry();
public Image getImage(String name, ClassLoader loader) {
Image image = PLUGIN_REGISTRY.get(name);
if (image == null || image.isDisposed()) {
if (name.startsWith("/") || name.startsWith("\\")) {
image = new Image(display, loader.getResourceAsStream(name.substring(1)));
} else
image = new Image(display, loader.getResourceAsStream(name));
PLUGIN_REGISTRY.put(name, image);
}
return image;
}
@Override
public void open(String output, String name) {
try {
Desktop.getDesktop().open(new File(output));
} catch (IOException e) {
e.printStackTrace();
}
}
public float getAvgCharWidth(Font font) {
GC gc = new GC(display);
try {
gc.setFont(font);
return gc.getFontMetrics().getAverageCharWidth();
} finally {
gc.dispose();
}
}
public int getCharHeight(Font font) {
if (font.getFontData().length > 0) {
return font.getFontData()[0].getHeight();
}
return 13;
}
public void rendererSection(Section section) {
// IGNOTE
}
});
EJRWTApplicationManager applicationManager = null;
if (this.getClass().getClassLoader().getResource("application.ejprop") != null) {
applicationManager = (EJRWTApplicationManager) EJFrameworkInitialiser.initialiseFramework("application.ejprop");
} else if (this.getClass().getClassLoader().getResource("EntireJApplication.properties") != null) {
applicationManager = (EJRWTApplicationManager) EJFrameworkInitialiser.initialiseFramework("EntireJApplication.properties");
} else {
throw new RuntimeException("application.ejprop not found");
}
EJCoreLayoutContainer layoutContainer = EJCoreProperties.getInstance().getLayoutContainer();
// Now build the application container
EJRWTApplicationContainer appContainer = new EJRWTApplicationContainer(layoutContainer);
// Add the application menu and status bar to the app
// container
EJMessenger messenger = applicationManager.getApplicationMessenger();
if (messenger == null) {
throw new NullPointerException("The ApplicationComponentProvider must provide an Messenger via method: getApplicationMessenger()");
}
Shell shell = new Shell(display);
shell.setImage(EJRWTImageRetriever.get(getShellIcon()));
shell.setText(layoutContainer.getTitle());
preApplicationBuild(applicationManager);
applicationManager.buildApplication(appContainer, shell);
postApplicationBuild(applicationManager);
shell.layout();
shell.pack();
shell.setMaximized(true);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
use of org.eclipse.jface.resource.ImageRegistry in project statecharts by Yakindu.
the class PathToImageResolver method toImage.
public static Image toImage(URL path) {
if (path == null)
return null;
ImageRegistry imageRegistry = SGenActivator.getInstance().getImageRegistry();
Image image = imageRegistry.get(path.toString());
if (image == null)
imageRegistry.put(path.toString(), ImageDescriptor.createFromURL(path).createImage());
return imageRegistry.get(path.toString());
}
use of org.eclipse.jface.resource.ImageRegistry in project ecf by eclipse.
the class Activator method createImageRegistry.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.plugin.AbstractUIPlugin#createImageRegistry()
*/
protected ImageRegistry createImageRegistry() {
ImageRegistry registry = super.createImageRegistry();
registry.put(SharedImages.IMG_USER_AVAILABLE, AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IImageFiles.USER_AVAILABLE).createImage());
registry.put(SharedImages.IMG_USER_AWAY, AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IImageFiles.USER_AWAY).createImage());
registry.put(SharedImages.IMG_USER_DND, AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IImageFiles.USER_DND).createImage());
registry.put(SharedImages.IMG_GROUP, AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IImageFiles.GROUP).createImage());
registry.put(SharedImages.IMG_USER_UNAVAILABLE, AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IImageFiles.USER_UNAVAILABLE).createImage());
registry.put(SharedImages.IMG_SEND, PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_UNDO));
registry.put(SharedImages.IMG_DISCONNECT_DISABLED, AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IImageFiles.DISCONNECT_DISABLED).createImage());
registry.put(SharedImages.IMG_DISCONNECT, AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IImageFiles.DISCONNECT_ENABLED).createImage());
registry.put(SharedImages.IMG_ADD_GROUP, AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IImageFiles.ADD_GROUP).createImage());
registry.put(SharedImages.IMG_ADD_BUDDY, AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IImageFiles.ADD_BUDDY).createImage());
registry.put(SharedImages.IMG_ADD_CHAT, AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IImageFiles.ADD_CHAT).createImage());
registry.put(SharedImages.IMG_MESSAGE, AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IImageFiles.SEND_MESSAGE).createImage());
registry.put(SharedImages.IMG_ADD, AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IImageFiles.ADD).createImage());
registry.put(SharedImages.IMG_MESSAGES, AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IImageFiles.MESSAGES).createImage());
registry.put(SharedImages.IMG_CHAT_WIZARD, AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IImageFiles.CHAT_WIZARD).createImage());
registry.put(SharedImages.IMG_COLLABORATION_WIZARD, AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IImageFiles.COLLABORATION_WIZARD).createImage());
registry.put(SharedImages.IMG_IDENTITY, AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IImageFiles.IDENTITY).createImage());
registry.put(SharedImages.IMG_COMMUNICATIONS, AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IImageFiles.COMMUNICATIONS).createImage());
registry.put(SharedImages.IMG_ADD_CONNECTION, AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IImageFiles.ADD_CONNECTION).createImage());
return registry;
}
use of org.eclipse.jface.resource.ImageRegistry in project ecf by eclipse.
the class Activator method createImageRegistry.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.plugin.AbstractUIPlugin#createImageRegistry()
*/
protected ImageRegistry createImageRegistry() {
ImageRegistry registry = super.createImageRegistry();
// $NON-NLS-1$
registry.put(CONTACTS_IMAGE, AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, "icons/contacts.gif").createImage());
// $NON-NLS-1$
registry.put(COLLABORATION_IMAGE, AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, "icons/collaboration.gif").createImage());
return registry;
}
Aggregations