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.jst.jsp.ui.internal.java.views.ImageDescriptorRegistry.java

License:Open Source License

public static synchronized Image getImage(ImageDescriptor descriptor) {
    if (descriptor == null) {
        descriptor = ImageDescriptor.getMissingImageDescriptor();
    }/*from   ww  w  .ja va 2s.  c o  m*/

    Image image = (Image) registry.get(descriptor);
    if (image != null) {
        return image;
    }
    image = descriptor.createImage();
    if (image != null) {
        registry.put(descriptor, image);
    }
    return image;
}

From source file:org.eclipse.jubula.client.inspector.ui.constants.IconConstants.java

License:Open Source License

/**
 * @param imageName The filename of the image for which to get the 
 *                  descriptor.//from  w ww.  j a  va 2  s. com
 * @return an image descriptor for the given filename, or the "mising" 
 *         image descriptor if the image could not be found. 
 *         Will not return <code>null</code>. 
 */
private static ImageDescriptor getImageDescriptor(String imageName) {
    StringBuilder sb = new StringBuilder("icons/"); //$NON-NLS-1$
    sb.append(imageName);
    ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, sb.toString());
    return descriptor != null ? descriptor : ImageDescriptor.getMissingImageDescriptor();
}

From source file:org.eclipse.jubula.client.ui.editors.TestResultEditorInput.java

License:Open Source License

/**
 * {@inheritDoc}
 */
public ImageDescriptor getImageDescriptor() {
    return ImageDescriptor.getMissingImageDescriptor();
}

From source file:org.eclipse.languageserver.LSPImages.java

License:Open Source License

private final static void declareRegistryImage(String key, String path) {
    ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
    Bundle bundle = Platform.getBundle(LanguageServerPluginActivator.PLUGIN_ID);
    URL url = null;//from  w  w w. j a  v  a 2  s  .c o  m
    if (bundle != null) {
        url = FileLocator.find(bundle, new Path(path), null);
        if (url != null) {
            desc = ImageDescriptor.createFromURL(url);
        }
    }
    imageRegistry.put(key, desc);
}

From source file:org.eclipse.linuxtools.dataviewers.abstractviewers.STDataViewersImages.java

License:Open Source License

/**
 * Declare an Image in the registry table.
 * @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)
 *//*from   w w w.  ja  v a2 s  .co  m*/
private final static void declareRegistryImage(String key, URL path) {
    ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
    desc = ImageDescriptor.createFromURL(path);
    imageRegistry.put(key, desc);
    imageDescriptors.put(key, desc);
}

From source file:org.eclipse.lsp4e.ui.LSPImages.java

License:Open Source License

private final static void declareRegistryImage(String key, String path) {
    ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
    Bundle bundle = Platform.getBundle(LanguageServerPlugin.PLUGIN_ID);
    URL url = null;/*from   w w  w.jav a2 s.c  o m*/
    if (bundle != null) {
        url = FileLocator.find(bundle, new Path(path), null);
        if (url != null) {
            desc = ImageDescriptor.createFromURL(url);
        }
    }
    imageRegistry.put(key, desc);
}

From source file:org.eclipse.m2e.internal.discovery.MavenDiscoveryIcons.java

License:Open Source License

private static ImageDescriptor create(String string) {
    try {/*from   w  ww .ja  v a 2  s  .c  om*/
        return ImageDescriptor.createFromURL(new URL(baseURL, string));
    } catch (MalformedURLException e) {
        return ImageDescriptor.getMissingImageDescriptor();
    }
}

From source file:org.eclipse.m2m.atl.core.ui.ATLConsole.java

License:Open Source License

/**
 * Find or create the ATLConsole.// w w w  .  ja v  a  2s  . co  m
 * 
 * @return the ATLConsole
 */
public static ATLConsole findConsole() {
    IConsoleManager consoleMgr = ConsolePlugin.getDefault().getConsoleManager();
    IConsole[] existing = consoleMgr.getConsoles();
    for (int i = 0; i < existing.length; i++) {
        if (CONSOLE_NAME.equals(existing[i].getName())) {
            return (ATLConsole) existing[i];
        }
    }
    // no console found, so create a new one
    String pluginDir = ATLCoreUIPlugin.getDefault().getBundle().getEntry("/").toString(); //$NON-NLS-1$
    ImageDescriptor imageDescriptor = null;
    try {
        imageDescriptor = ImageDescriptor.createFromURL(new URL(pluginDir + "icons/atl_logo.gif")); //$NON-NLS-1$
    } catch (MalformedURLException mfe) {
        imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
    }
    ATLConsole myConsole = new ATLConsole(imageDescriptor);
    consoleMgr.addConsoles(new IConsole[] { myConsole });
    return myConsole;
}

From source file:org.eclipse.m2m.atl.core.ui.ATLCoreUIPlugin.java

License:Open Source License

/**
 * Returns the image descriptor with the given relative path.
 * /*from  w w w.  j  a  va 2  s.c  o m*/
 * @param name
 *            the image name
 * @return the image descriptor
 */
public static ImageDescriptor getImageDescriptor(String name) {
    String pluginDir = plugin.getBundle().getEntry("/").toString(); //$NON-NLS-1$
    String iconPath = "icons/"; //$NON-NLS-1$
    try {
        return ImageDescriptor.createFromURL(new URL(pluginDir + iconPath + name));
    } catch (MalformedURLException mfe) {
        return ImageDescriptor.getMissingImageDescriptor();
    }
}

From source file:org.eclipse.m2m.atl.profiler.ui.activators.ExecutionViewerActivator.java

License:Open Source License

/**
 * Returns an image descriptor for the image file at the given plug-in relative path.
 * /* w w w .j  a v a  2s  .c o  m*/
 * @param path
 *            the path
 * @return the image descriptor
 */
public static ImageDescriptor getImageDescriptor(String path) {
    ExecutionViewerActivator uiPlugin = ExecutionViewerActivator.getDefault();
    String pluginDir = uiPlugin.getBundle().getEntry("/").toString(); //$NON-NLS-1$
    String iconPath = "icons/"; //$NON-NLS-1$
    try {
        return ImageDescriptor.createFromURL(new URL(pluginDir + iconPath + path));
    } catch (MalformedURLException mfe) {
        return ImageDescriptor.getMissingImageDescriptor();
    }
}