Search in sources :

Example 1 with ImageDescriptor

use of org.eclipse.jface.resource.ImageDescriptor in project dbeaver by serge-rider.

the class DBeaverIcons method getIconByLocation.

private static IconDescriptor getIconByLocation(String location) {
    IconDescriptor icon = imageMap.get(location);
    if (icon == null) {
        try {
            ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(new URL(location));
            icon = new IconDescriptor(location, imageDescriptor);
            if (icon.image == null) {
                log.warn("Bad image: " + location);
                return null;
            } else {
                imageMap.put(location, icon);
            }
        } catch (Exception e) {
            log.error(e);
            return null;
        }
    }
    return icon;
}
Also used : ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) URL(java.net.URL)

Example 2 with ImageDescriptor

use of org.eclipse.jface.resource.ImageDescriptor in project dbeaver by serge-rider.

the class ERDEditorPart method createPaletteRoot.

public PaletteRoot createPaletteRoot() {
    // create root
    PaletteRoot paletteRoot = new PaletteRoot();
    paletteRoot.setLabel("Entity Diagram");
    {
        // a group of default control tools
        PaletteDrawer controls = new PaletteDrawer("Tools", DBeaverIcons.getImageDescriptor(UIIcon.CONFIGURATION));
        paletteRoot.add(controls);
        // the selection tool
        ToolEntry selectionTool = new SelectionToolEntry();
        controls.add(selectionTool);
        // use selection tool as default entry
        paletteRoot.setDefaultEntry(selectionTool);
        // the marquee selection tool
        controls.add(new MarqueeToolEntry());
        if (!isReadOnly()) {
            // separator
            PaletteSeparator separator = new PaletteSeparator("tools");
            separator.setUserModificationPermission(PaletteEntry.PERMISSION_NO_MODIFICATION);
            controls.add(separator);
            final ImageDescriptor connectImage = ERDActivator.getImageDescriptor("icons/connect.png");
            controls.add(new ConnectionCreationToolEntry("Connection", "Create Connection", null, connectImage, connectImage));
            final ImageDescriptor noteImage = ERDActivator.getImageDescriptor("icons/note.png");
            controls.add(new CreationToolEntry("Note", "Create Note", new CreationFactory() {

                @Override
                public Object getNewObject() {
                    return new ERDNote("Note");
                }

                @Override
                public Object getObjectType() {
                    return RequestConstants.REQ_CREATE;
                }
            }, noteImage, noteImage));
        }
    }
    return paletteRoot;
}
Also used : CreationFactory(org.eclipse.gef.requests.CreationFactory) ERDNote(org.jkiss.dbeaver.ext.erd.model.ERDNote) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) DBPNamedObject(org.jkiss.dbeaver.model.DBPNamedObject)

Example 3 with ImageDescriptor

use of org.eclipse.jface.resource.ImageDescriptor in project dbeaver by serge-rider.

the class ApplicationWorkbenchAdvisor method declareWorkbenchImage.

private void declareWorkbenchImage(IWorkbenchConfigurer configurer, Bundle ideBundle, String symbolicName, String path, boolean shared) {
    URL url = FileLocator.find(ideBundle, new Path(path), null);
    ImageDescriptor desc = ImageDescriptor.createFromURL(url);
    configurer.declareImage(symbolicName, desc, shared);
}
Also used : Path(org.eclipse.core.runtime.Path) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) URL(java.net.URL)

Example 4 with ImageDescriptor

use of org.eclipse.jface.resource.ImageDescriptor in project meclipse by flaper87.

the class MeclipsePlugin method initializeImageRegistry.

@Override
protected void initializeImageRegistry(ImageRegistry registry) {
    super.initializeImageRegistry(registry);
    Bundle bundle = Platform.getBundle(PLUGIN_ID);
    for (String img_id : IMG_ID_LIST) {
        ImageDescriptor myImage = ImageDescriptor.createFromURL(FileLocator.find(bundle, new Path(img_id), null));
        registry.put(img_id, myImage);
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) ResourceBundle(java.util.ResourceBundle) Bundle(org.osgi.framework.Bundle) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor)

Example 5 with ImageDescriptor

use of org.eclipse.jface.resource.ImageDescriptor in project translationstudio8 by heartsome.

the class DefaultTableHeaderRenderer method getImageRegistry.

private ImageRegistry getImageRegistry() {
    if (_imageRegistry == null) {
        _imageRegistry = new ImageRegistry();
        ImageDescriptor imgDesc = new LocalResourceImageDescriptor("/de/jaret/util/ui/table/resource/smallarrow_down.gif");
        _imageRegistry.put(DOWN, imgDesc.createImage());
        imgDesc = new LocalResourceImageDescriptor("/de/jaret/util/ui/table/resource/smallarrow_up.gif");
        _imageRegistry.put(UP, imgDesc.createImage());
    }
    return _imageRegistry;
}
Also used : ImageRegistry(org.eclipse.jface.resource.ImageRegistry) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor)

Aggregations

ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)106 Image (org.eclipse.swt.graphics.Image)25 ArrayList (java.util.ArrayList)21 List (java.util.List)18 ToolEntry (org.eclipse.gef.palette.ToolEntry)14 URL (java.net.URL)12 ImageData (org.eclipse.swt.graphics.ImageData)11 ResourceImageDescriptor (de.jaret.util.ui.ResourceImageDescriptor)9 Point (org.eclipse.swt.graphics.Point)6 Node (org.talend.designer.core.ui.editor.nodes.Node)6 Path (org.eclipse.core.runtime.Path)5 JavaElementImageDescriptor (org.eclipse.jdt.ui.JavaElementImageDescriptor)5 File (java.io.File)4 HashMap (java.util.HashMap)4 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)4 IComponent (org.talend.core.model.components.IComponent)4 INode (org.talend.core.model.process.INode)4 MalformedURLException (java.net.MalformedURLException)3 Set (java.util.Set)3 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)3