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.springframework.ide.eclipse.data.internal.DataCoreImages.java

License:Open Source License

private static ImageDescriptor createManaged(String prefix, String name) {
    try {//from www .  ja va2 s  .  com
        ImageDescriptor result = ImageDescriptor
                .createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX_LENGTH)));
        if (imageDescriptors == null) {
            imageDescriptors = new HashMap<String, ImageDescriptor>();
        }
        imageDescriptors.put(name, result);
        return result;
    } catch (MalformedURLException e) {
        DataCorePlugin.log(e);
        return ImageDescriptor.getMissingImageDescriptor();
    }
}

From source file:org.springframework.ide.eclipse.metadata.MetadataUIImages.java

License:Open Source License

private static ImageDescriptor createManaged(String prefix, String name) {
    try {//ww w.  j  a  v  a2 s  . c om
        ImageDescriptor result = ImageDescriptor
                .createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX_LENGTH)));
        if (imageDescriptors == null) {
            imageDescriptors = new HashMap<String, ImageDescriptor>();
        }
        imageDescriptors.put(name, result);
        return result;
    } catch (MalformedURLException e) {
        return ImageDescriptor.getMissingImageDescriptor();
    }
}

From source file:org.springframework.ide.eclipse.ui.ImageDescriptorRegistry.java

License:Open Source License

/**
 * Returns the image associated with the given image descriptor.
 * //from  ww w.ja  v  a  2 s .c om
 * @param descriptor  the image descriptor for which the registry manages
 *                   an image
 * @return the image associated with the image descriptor or
 *         <code>null</code> if the image descriptor can't create the
 *         requested image.
 */
public Image get(ImageDescriptor descriptor) {
    if (descriptor == null) {
        descriptor = ImageDescriptor.getMissingImageDescriptor();
    }
    Image result = registry.get(descriptor);
    if (result != null) {
        return result;
    }
    Assert.isTrue(display == SpringUIUtils.getStandardDisplay(),
            SpringUIMessages.ImageDescriptorRegistry_wrongDisplay);
    result = descriptor.createImage();
    if (result != null) {
        registry.put(descriptor, result);
    }
    return result;
}

From source file:org.springframework.ide.eclipse.ui.SpringUIImages.java

License:Open Source License

private static ImageDescriptor createManaged(String prefix, String name) {
    try {// w ww.  j a v a  2s  .co m
        ImageDescriptor result = ImageDescriptor
                .createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX_LENGTH)));
        if (imageDescriptors == null) {
            imageDescriptors = new HashMap<String, ImageDescriptor>();
        }
        imageDescriptors.put(name, result);
        return result;
    } catch (MalformedURLException e) {
        SpringUIPlugin.log(e);
        return ImageDescriptor.getMissingImageDescriptor();
    }
}

From source file:org.springframework.ide.eclipse.ui.SpringUIImages.java

License:Open Source License

private static ImageDescriptor create(String prefix, String name) {
    try {/*from www .  jav  a 2 s.c om*/
        return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));
    } catch (MalformedURLException e) {
        SpringUIPlugin.log(e);
        return ImageDescriptor.getMissingImageDescriptor();
    }
}

From source file:org.springframework.ide.eclipse.webflow.ui.graph.WebflowImages.java

License:Open Source License

/**
 * /*  w w w  . j  av  a 2 s . c  o m*/
 * 
 * @param prefix 
 * @param name 
 * 
 * @return 
 */
@SuppressWarnings("unchecked")
private static ImageDescriptor createManaged(String prefix, String name) {
    try {
        ImageDescriptor result = ImageDescriptor
                .createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX_LENGTH)));
        if (imageDescriptors == null) {
            imageDescriptors = new HashMap();
        }
        imageDescriptors.put(name, result);
        if (imageRegistry != null) {
            Activator.log("Image registry already defined", null);
        }
        return result;
    } catch (MalformedURLException e) {
        Activator.log(e);
        return ImageDescriptor.getMissingImageDescriptor();
    }
}

From source file:org.springframework.ide.eclipse.webflow.ui.graph.WebflowImages.java

License:Open Source License

/**
 * /* w w w  .  j  a v  a 2 s . c o  m*/
 * 
 * @param prefix 
 * @param name 
 * 
 * @return 
 */
private static ImageDescriptor create(String prefix, String name) {
    try {
        return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));
    } catch (MalformedURLException e) {
        Activator.log(e);
        return ImageDescriptor.getMissingImageDescriptor();
    }
}

From source file:org.springframework.tooling.ls.eclipse.commons.LanguageServerCommonsActivator.java

License:Open Source License

public final static ImageDescriptor getImageDescriptor(String path) {
    ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
    Bundle bundle = Platform.getBundle(PLUGIN_ID);
    URL url = null;/*from  w  w  w. j  a  va2  s.com*/
    if (bundle != null) {
        url = FileLocator.find(bundle, new Path(path), null);
        if (url != null) {
            desc = ImageDescriptor.createFromURL(url);
        }
    }
    return desc;
}

From source file:org.springsource.ide.eclipse.commons.ui.ImageDescriptorRegistry.java

License:Open Source License

/**
 * Returns the image associated with the given image descriptor.
 *
 * @param descriptor the image descriptor for which the registry manages an image
 * @return the image associated with the image descriptor or <code>null</code>
 *  if the image descriptor can't create the requested image.
 *///  w  w  w.j  a v a  2s .c  om
public Image get(ImageDescriptor descriptor) {
    if (descriptor == null) {
        descriptor = ImageDescriptor.getMissingImageDescriptor();
    }

    Image result = fRegistry.get(descriptor);
    if (result != null) {
        return result;
    }

    Assert.isTrue(fDisplay == SpringUIUtils.getStandardDisplay(),
            CommonsUIMessages.ImageDescriptorRegistry_wrongDisplay);
    result = descriptor.createImage();
    if (result != null) {
        fRegistry.put(descriptor, result);
    }
    return result;
}

From source file:org.springsource.ide.eclipse.dashboard.internal.ui.IdeUiPlugin.java

License:Open Source License

public static Image getImage(String path) {
    ImageRegistry imageRegistry = getDefault().getImageRegistry();
    Image image = imageRegistry.get(path);
    if (image == null) {
        // Add support for loading and creating images from remote URLs
        if (path.startsWith("http")) {
            try {
                ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(new URL(path));
                if (imageDescriptor == null) {
                    imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
                }//from  ww  w .ja  v  a2s  .co  m
                image = imageDescriptor.createImage(true);
                imageRegistry.put(path, image);
            } catch (Exception e) {
                // make sure to ignore all here
                ImageDescriptor imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
                image = imageDescriptor.createImage(true);
                imageRegistry.put(path, image);
            }
        } else {
            ImageDescriptor imageDescriptor = getImageDescriptor(path);
            if (imageDescriptor == null) {
                imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
            }
            image = imageDescriptor.createImage(true);
            imageRegistry.put(path, image);
        }
    }
    return image;
}