Example usage for org.eclipse.jface.resource ImageDescriptor getMissingImageDescriptor

List of usage examples for org.eclipse.jface.resource ImageDescriptor getMissingImageDescriptor

Introduction

In this page you can find the example usage for org.eclipse.jface.resource ImageDescriptor getMissingImageDescriptor.

Prototype

public static ImageDescriptor getMissingImageDescriptor() 

Source Link

Document

Returns the shared image descriptor for a missing image.

Usage

From source file:SEURAT.editors.CandidateRationaleEditorInput.java

License:Open Source License

/**
 * Return the Icon For This File.//from   w ww .jav a2  s.  c o m
 * Method was auto-generated, but changing it doesn't seem to be necessary
 * as the program gets the icons just fine as long as the icon name is
 * specified in the plugin.xml entry for the editor.
 */
public ImageDescriptor getImageDescriptor() {
    // TODO Auto-generated method stub
    return ImageDescriptor.getMissingImageDescriptor();
}

From source file:tern.eclipse.ide.internal.ui.descriptors.TernModuleImage.java

License:Open Source License

private String getImageKey(IConfigurationElement ce, String id) {
    String iconPath = ce.getAttribute("icon");
    if (StringUtils.isEmpty(iconPath)) {
        return null;
    }/*  www . ja  v a 2  s.c o  m*/
    String name = ce.getDeclaringExtension().getContributor().getName();
    String imageKey = new StringBuilder("ternDescriptor_").append(name).append(id).toString();

    ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(name, iconPath);
    if (imageDescriptor == null && iconPath != null && iconPath.length() > 0)
        imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
    ImageResource.registerImageDescriptor(imageKey, imageDescriptor);
    return imageKey;
}

From source file:tinyos.dlrc.debug.NesCDebugIcons.java

License:Open Source License

/**
 * Declare an Image in the registry table.
 * /*from  ww w . j a  v  a  2 s.c  o  m*/
 * @param key
 *                The key to use when registering the image
 * @param path
 *                The path where the image can be found. This path is
 *                relative to where this plugin class is found (i.e.
 *                typically the packages directory)
 */
private final static void declareRegistryImage(String key, String path) {
    ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
    try {
        desc = ImageDescriptor.createFromURL(makeIconFileURL(path));
    } catch (MalformedURLException me) {
        TinyOSDebugPlugin.getDefault().log("Exception while creating image descriptor from url.", me);
    }
    desc = new DecoratableImageDescriptor(key, new int[] { 0, 0, 0, 0, 0 }, desc);
    fgImageRegistry.put("0.0.0.0.0." + key, desc);
}

From source file:tinyos.dlrc.utility.Icons.java

License:Open Source License

protected final void declareRegistryImage(String key, URL path) {
    ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();

    desc = ImageDescriptor.createFromURL(path);

    NesCImageDescriptor nesc = new NesCImageDescriptor(get(desc));
    DecoratableImageDescriptor result = new DecoratableImageDescriptor(key, false, new String[][] {}, nesc);

    getImageRegistry().put(keyOf(key, false, null), result);
}

From source file:ts.eclipse.ide.ui.TypeScriptUIImageResource.java

License:Open Source License

/**
 * Return the image with the given key./*w w w .  j  a  v  a 2s  . c  o m*/
 * 
 * @param key
 *            java.lang.String
 * @return org.eclipse.swt.graphics.Image
 */
public static Image getImage(String key, String keyIfImageNull) {
    initializeIfNeeded();
    Image image = imageRegistry.get(key);
    if (image == null) {
        if (keyIfImageNull != null) {
            return getImage(keyIfImageNull, null);
        }
        imageRegistry.put(key, ImageDescriptor.getMissingImageDescriptor());
        image = imageRegistry.get(key);
    }
    return image;
}

From source file:ts.eclipse.ide.ui.TypeScriptUIImageResource.java

License:Open Source License

/**
 * Return the image descriptor with the given key.
 * //  www  . j av a 2  s  .  c  o m
 * @param key
 *            java.lang.String
 * @return org.eclipse.jface.resource.ImageDescriptor
 */
public static ImageDescriptor getImageDescriptor(String key) {
    initializeIfNeeded();
    ImageDescriptor id = imageDescriptors.get(key);
    if (id != null)
        return id;

    return ImageDescriptor.getMissingImageDescriptor();
}

From source file:uk.ac.ucl.chime.openehr.view.ArchetypeOutlineView.java

License:Apache License

public static ImageDescriptor getImageDescriptor(String name) {
    String iconPath = "/icons/";
    try {//from  w  ww. jav a2 s .  com
        URL installURL = Activator.getDefault().getBundle().getEntry("/");
        URL url = new URL(installURL, iconPath + name);
        return ImageDescriptor.createFromURL(url);
    } catch (Exception ex) {
        // should not happen
        return ImageDescriptor.getMissingImageDescriptor();
    }
}

From source file:ummisco.gama.ui.resources.GamaIcon.java

public ImageDescriptor descriptor() {
    if (descriptor == null) {
        final Image image = GamaIcons.getInstance().getImageInCache(code);
        if (image != null) {
            descriptor = ImageDescriptor.createFromImage(image);
        } else {//from  www .  j  a  va 2 s. com
            descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(plugin,
                    GamaIcons.DEFAULT_PATH + path + ".png");
        }

        if (descriptor == null) {
            DEBUG.ERR("ERROR: Cannot find icon " + GamaIcons.DEFAULT_PATH + path + ".png in plugin: " + plugin);
            descriptor = ImageDescriptor.getMissingImageDescriptor();
        }
    }
    return descriptor;
}

From source file:x10dt.ui.launch.core.LaunchImages.java

License:Open Source License

/**
 * Creates an image descriptor for the given path in a bundle.
 * //from   ww  w  . j a  v a  2  s . co  m
 * <p>If no image could be found, <code>useMissingImageDescriptor</code> decides if either the 'missing image descriptor' 
 * is returned or <code>null</code>.
 * 
 * @param bundle The bundle of interest.
 * @param path The path to the image.
 * @param useMissingImgDescriptor True if we should the "missing image descriptor" in case we could create one for the
 * path transmitted, false otherwise.
 * @return A descriptor for the image path, or <b>null</b> if we could not create one and <i>useMissingImgDescriptor</i>
 * is set to false.
 */
public static ImageDescriptor createImageDescriptor(final Bundle bundle, final IPath path,
        boolean useMissingImgDescriptor) {
    final URL url = FileLocator.find(bundle, path, null);
    if (url != null) {
        return ImageDescriptor.createFromURL(url);
    }
    if (useMissingImgDescriptor) {
        return ImageDescriptor.getMissingImageDescriptor();
    }
    return null;
}

From source file:x10dt.ui.X10DTUIPlugin.java

License:Open Source License

public static ImageDescriptor create(String name) {
    try {/*w  w  w  . j a  v  a2s  .co  m*/
        return ImageDescriptor.createFromURL(makeIconFileURL(name));
    } catch (MalformedURLException e) {
        return ImageDescriptor.getMissingImageDescriptor();
    }
}