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:org.eclipse.e4.xwt.vex.VEXSharedImages.java

License:Open Source License

/**
 * Returns the image managed under the given key in this registry.
 * // ww  w.  j a v  a 2 s. co  m
 * @param key
 *            the image's key
 * @return the image managed under the given key
 */
public static Image get(String key) {
    Image image = getImageRegistry().get(key);
    if (image == null) {
        image = ImageDescriptor.getMissingImageDescriptor().createImage();
    }
    return image;
}

From source file:org.eclipse.e4.xwt.vex.VEXSharedImages.java

License:Open Source License

public static ImageDescriptor getImageDescriptor(String key) {
    ImageDescriptor des = getImageRegistry().getDescriptor(key);
    if (des == null) {
        des = ImageDescriptor.getMissingImageDescriptor();
    }/*from  ww w  .j  a  v a2  s . c o  m*/
    return des;
}

From source file:org.eclipse.eclipsemonkey.ui.scriptableView.BrowserView.java

License:Open Source License

/**
 * Retrieves the image descriptor associated with resource from the image
 * descriptor registry. If the image descriptor cannot be retrieved, attempt
 * to find and load the image descriptor at the location specified in
 * resource./* w  w w  . ja va  2  s.co  m*/
 * 
 * @param imageFilePath
 *            the image descriptor to retrieve
 * @return The image descriptor assocated with resource or the default
 *         "missing" image descriptor if one could not be found
 */
private static ImageDescriptor getImageDescriptor(String imageFilePath) {

    ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.eclipsemonkey.ui", //$NON-NLS-1$
            imageFilePath);

    if (imageDescriptor == null) {
        imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
    }

    return imageDescriptor;
}

From source file:org.eclipse.eclipsemonkey.ui.views.BrowserView.java

License:Open Source License

/**
 * Retrieves the image descriptor associated with resource from the image
 * descriptor registry. If the image descriptor cannot be retrieved, attempt
 * to find and load the image descriptor at the location specified in
 * resource.//from  ww w .ja v  a  2  s .co  m
 * 
 * @param imageFilePath
 *        the image descriptor to retrieve
 * @return The image descriptor assocated with resource or the default
 *         "missing" image descriptor if one could not be found
 */
private static ImageDescriptor getImageDescriptor(String imageFilePath) {

    ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.eclipsemonkey.ui",
            imageFilePath);

    if (imageDescriptor == null) {
        imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
    }

    return imageDescriptor;
}

From source file:org.eclipse.edt.debug.ui.launching.EGLJavaLaunchUtils.java

License:Open Source License

private final static void declareRegistryImage(String key, String path) {
    ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
    try {//from  www .j a v a  2s  .  co  m
        desc = ImageDescriptor.createFromURL(makeIconFileURL(path));
    } catch (MalformedURLException me) {
    }
    imageRegistry.put(key, desc);
}

From source file:org.eclipse.edt.ide.ui.internal.PluginImages.java

License:Open Source License

private static ImageDescriptor createManaged(String prefix, String name) {
    try {//from   ww w.  j  ava 2s. c o m
        ImageDescriptor result = ImageDescriptor
                .createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX_LENGTH)));
        if (fgAvoidSWTErrorMap == null) {
            fgAvoidSWTErrorMap = new HashMap();
        }
        fgAvoidSWTErrorMap.put(name, result);
        if (fgImageRegistry != null) {
            EDTUIPlugin.logErrorMessage("Image registry already defined"); //$NON-NLS-1$
        }
        return result;
    } catch (MalformedURLException e) {
        return ImageDescriptor.getMissingImageDescriptor();
    }
}

From source file:org.eclipse.egit.gitflow.ui.internal.UIIcons.java

License:Open Source License

private static ImageDescriptor map(final String icon) {
    if (base != null)
        try {//  w  w  w .ja  v  a  2 s.  c  om
            return ImageDescriptor.createFromURL(new URL(base, icon));
        } catch (MalformedURLException mux) {
            Activator.logError(NLS.bind(UIText.UIIcons_errorLoadingPluginImage, icon), mux);
        }
    return ImageDescriptor.getMissingImageDescriptor();
}

From source file:org.eclipse.egit.ui.internal.DecorationOverlayDescriptor.java

License:Open Source License

/**
 * Draw the overlays for the receiver./*from   w ww . j a va 2 s.c o m*/
 *
 * @param overlaysArray
 */
private void drawOverlays(ImageDescriptor[] overlaysArray) {
    for (int i = 0; i < overlays.length; i++) {
        ImageDescriptor overlay = overlaysArray[i];
        if (overlay == null)
            continue;
        ImageData overlayData = overlay.getImageData();
        // Use the missing descriptor if it is not there.
        if (overlayData == null)
            overlayData = ImageDescriptor.getMissingImageDescriptor().getImageData();

        switch (i) {
        case IDecoration.TOP_LEFT:
            drawImage(overlayData, 0, 0);
            break;
        case IDecoration.TOP_RIGHT:
            drawImage(overlayData, size.x - overlayData.width, 0);
            break;
        case IDecoration.BOTTOM_LEFT:
            drawImage(overlayData, 0, size.y - overlayData.height);
            break;
        case IDecoration.BOTTOM_RIGHT:
            drawImage(overlayData, size.x - overlayData.width, size.y - overlayData.height);
            break;
        }
    }
}

From source file:org.eclipse.egit.ui.internal.UIIcons.java

License:Open Source License

private static ImageDescriptor map(final String icon) {
    if (base != null)
        try {//from  w  w  w.  ja v a2  s  . c  o  m
            return ImageDescriptor.createFromURL(new URL(base, icon));
        } catch (MalformedURLException mux) {
            Activator.logError(UIText.UIIcons_errorLoadingPluginImage, mux);
        }
    return ImageDescriptor.getMissingImageDescriptor();
}

From source file:org.eclipse.egit.ui.UIIcons.java

License:Open Source License

private static ImageDescriptor map(final String icon) {
    if (base != null) {
        try {/*  w w w . j  a v  a  2 s. c  om*/
            return ImageDescriptor.createFromURL(new URL(base, icon));
        } catch (MalformedURLException mux) {
            Activator.logError(UIText.UIIcons_errorLoadingPluginImage, mux);
        }
    }
    return ImageDescriptor.getMissingImageDescriptor();
}