Search in sources :

Example 21 with ImageRegistry

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;
}
Also used : ImageRegistry(org.eclipse.jface.resource.ImageRegistry) Image(org.eclipse.swt.graphics.Image)

Example 22 with ImageRegistry

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();
}
Also used : EJRWTApplicationContainer(org.entirej.applicationframework.rwt.application.EJRWTApplicationContainer) EJRWTGraphicsProvider(org.entirej.applicationframework.rwt.application.EJRWTGraphicsProvider) IOException(java.io.IOException) EJRWTApplicationManager(org.entirej.applicationframework.rwt.application.EJRWTApplicationManager) Image(org.eclipse.swt.graphics.Image) Section(org.eclipse.ui.forms.widgets.Section) Font(org.eclipse.swt.graphics.Font) ImageRegistry(org.eclipse.jface.resource.ImageRegistry) Shell(org.eclipse.swt.widgets.Shell) EJMessenger(org.entirej.framework.core.interfaces.EJMessenger) GC(org.eclipse.swt.graphics.GC) File(java.io.File) EJCoreLayoutContainer(org.entirej.framework.core.properties.EJCoreLayoutContainer) Display(org.eclipse.swt.widgets.Display)

Example 23 with ImageRegistry

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());
}
Also used : ImageRegistry(org.eclipse.jface.resource.ImageRegistry) Image(org.eclipse.swt.graphics.Image)

Example 24 with ImageRegistry

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;
}
Also used : ImageRegistry(org.eclipse.jface.resource.ImageRegistry)

Example 25 with ImageRegistry

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;
}
Also used : ImageRegistry(org.eclipse.jface.resource.ImageRegistry)

Aggregations

ImageRegistry (org.eclipse.jface.resource.ImageRegistry)63 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)25 Image (org.eclipse.swt.graphics.Image)22 URL (java.net.URL)4 ResourceBundle (java.util.ResourceBundle)4 Before (org.junit.Before)4 CoreRuntimePlugin (org.talend.core.runtime.CoreRuntimePlugin)4 CompositeMultiImageDescriptor (com.archimatetool.editor.ui.components.CompositeMultiImageDescriptor)3 ResourceImageDescriptor (de.jaret.util.ui.ResourceImageDescriptor)3 CompositeImageDescriptor (org.eclipse.jface.resource.CompositeImageDescriptor)3 Label (org.eclipse.swt.widgets.Label)3 RepositoryContext (org.talend.core.context.RepositoryContext)3 Project (org.talend.core.model.general.Project)3 User (org.talend.core.model.properties.User)3 IRepositoryFactory (org.talend.core.repository.model.IRepositoryFactory)3 ProxyRepositoryFactory (org.talend.core.repository.model.ProxyRepositoryFactory)3 XmiResourceManager (org.talend.core.repository.utils.XmiResourceManager)3 IRepositoryNodeConfiguration (org.talend.mdm.repository.core.IRepositoryNodeConfiguration)3 IRepositoryNodeResourceProvider (org.talend.mdm.repository.core.IRepositoryNodeResourceProvider)3 RecycleBinNodeConfiguration (org.talend.mdm.repository.core.impl.recyclebin.RecycleBinNodeConfiguration)3