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:com.googlecode.osde.internal.Activator.java

License:Apache License

private ImageDescriptor createSystemImageDescriptor(String path) {
    ImageDescriptor descriptor;/*from  w ww .j  av a  2s .c o m*/
    try {
        URL installUrl = getInstallUrl();
        descriptor = ImageDescriptor.createFromURL(new URL(installUrl, path));
    } catch (MalformedURLException e) {
        descriptor = ImageDescriptor.getMissingImageDescriptor();
    }
    return descriptor;
}

From source file:com.inavare.maven.platform.LocalMavenRepostory.java

License:Open Source License

public LocalMavenRepostory() {
    setDialogSettings(Activator.getDefault().getDialogSettings());
    setWindowTitle("Test Title");
    setDefaultPageImageDescriptor(ImageDescriptor.getMissingImageDescriptor());
    setNeedsProgressMonitor(true);/* w  ww.j av a  2s . c om*/
}

From source file:com.iw.plugins.spindle.Images.java

License:Mozilla Public License

static private ImageRegistry getImageRegistry() {
    if (Registry == null) {
        Registry = UIPlugin.getDefault().getImageRegistry();
        Registry.put("missing", ImageDescriptor.getMissingImageDescriptor().createImage());
    }/*www. ja v  a2  s  .com*/
    return Registry;
}

From source file:com.iw.plugins.spindle.Images.java

License:Mozilla Public License

/**
 * Utility method to create an <code>ImageDescriptor</code> from a path to a
 * file./* ww w  .  j a  va2 s. co  m*/
 */
public static ImageDescriptor createImageDescriptor(URL imageURL) {
    if (imageURL == null) {
        return ImageDescriptor.getMissingImageDescriptor();
    }
    return ImageDescriptor.createFromURL(imageURL);
}

From source file:com.iw.plugins.spindle.TapestryImages.java

License:Mozilla Public License

static private ImageRegistry getImageRegistry() {
    if (Registry == null) {
        Registry = TapestryPlugin.getDefault().getImageRegistry();
        Registry.put("missing", ImageDescriptor.getMissingImageDescriptor().createImage());
    }//  w  w  w .j  av  a 2 s  . c o m
    return Registry;
}

From source file:com.javadude.antxr.eclipse.ui.AntxrUIPluginImages.java

License:Open Source License

private static ImageDescriptor createManaged(String aPrefix, String aName) {
    ImageDescriptor result;//w w  w  .  j ava 2s.  c o m
    try {
        result = ImageDescriptor.createFromURL(AntxrUIPluginImages.makeIconFileURL(aPrefix,
                aName.substring(AntxrUIPluginImages.NAME_PREFIX_LENGTH)));
        AntxrUIPluginImages.IMAGE_REGISTRY.put(aName, result);
    } catch (MalformedURLException e) {
        result = ImageDescriptor.getMissingImageDescriptor();
    }
    return result;
}

From source file:com.javadude.antxr.eclipse.ui.AntxrUIPluginImages.java

License:Open Source License

private static ImageDescriptor create(String aPrefix, String aName) {
    ImageDescriptor result;//from w  w  w  .ja  v a  2s.c om
    try {
        result = ImageDescriptor.createFromURL(AntxrUIPluginImages.makeIconFileURL(aPrefix, aName));
    } catch (MalformedURLException e) {
        result = ImageDescriptor.getMissingImageDescriptor();
    }
    return result;
}

From source file:com.lmpessoa.sonarview.ui.Images.java

License:Open Source License

private static ImageDescriptor createImageDescriptor(String key) {
    ImageRegistry imageRegistry = getImageRegistry();
    if (imageRegistry != null) {
        ImageDescriptor imageDescriptor = imageRegistry.getDescriptor(key);
        if (imageDescriptor == null) {
            try {
                imageDescriptor = ImageDescriptor.createFromURL(getUrl(key));
            } catch (MalformedURLException e) {
                imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
            }/*w w  w . jav  a2s  .  c o  m*/
            imageRegistry.put(key, imageDescriptor);
        }
        return imageDescriptor;
    }
    return null;
}

From source file:com.mentor.nucleus.bp.core.CorePlugin.java

License:Open Source License

/**
 * Returns the ImageDescriptor instance identified by the passed
 * string./*  w ww.  j ava 2  s.com*/
 */
public static ImageDescriptor getImageDescriptor(String name) {
    String iconPath = "icons/";
    try {
        CorePlugin plugin = getDefault();
        if (plugin == null) {
            RuntimeException rtException = new RuntimeException(
                    "Unable to acquire the CorePlugin therefore the icon " + iconPath + name
                            + " can not be loaded.");
            throw rtException;
        }
        URL installURL = plugin.getBundle().getEntry("/");
        URL url = new URL(installURL, iconPath + name);

        InputStream check = null;
        try {
            check = url.openStream();
        } catch (IOException e1) {
            logError("Can not load the icon: " + iconPath + name, e1);
        } finally {
            if (check != null) {
                try {
                    check.close();
                } catch (IOException e2) {

                }
            }
        }

        ImageDescriptor imageDescriptor = getStaticImageRegistry().getDescriptor(name);
        if (imageDescriptor == null) {
            imageDescriptor = ImageDescriptor.createFromURL(url);
            if ((!name.equals("InterfaceOperation_c")) && (!name.equals("InterfaceSignal_c")
                    && (!name.equals("ProvidedOperation_c")) && (!name.equals("ProvidedSignal_c"))
                    && (!name.equals("RequiredOperation_c")) && (!name.equals("RequiredSignal_c")))) {
                getStaticImageRegistry().put(name, imageDescriptor);
            }
        }
        return imageDescriptor;
    } catch (RuntimeException e) {
        // this can happen if we fail to acquire a model builder license.
        return ImageDescriptor.getMissingImageDescriptor();
    } catch (MalformedURLException e) {
        // this can happen if we fail to acquire a model builder license.
        return ImageDescriptor.getMissingImageDescriptor();
    }
}

From source file:com.mentor.nucleus.bp.ui.canvas.CanvasPlugin.java

License:Open Source License

public static ImageDescriptor getImageDescriptor(String name) {
    String iconPath = "icons/";
    try {//  ww w.ja  v a 2s .c o  m
        URL installURL = getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
        URL url = new URL(installURL, iconPath + name);
        return ImageDescriptor.createFromURL(url);
    } catch (MalformedURLException e) {
        // should not happen
        return ImageDescriptor.getMissingImageDescriptor();
    }
}