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.aptana.ide.ui.io.CoreIOImages.java

License:Open Source License

/**
 * Declare an Image in the registry table.
 * // w w w  .  j  a  va 2s  . 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 static void declareRegistryImage(String key, String path) {
    ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
    Bundle bundle = Platform.getBundle(IOUIPlugin.PLUGIN_ID);
    URL url = null;
    if (bundle != null) {
        url = FileLocator.find(bundle, new Path(path), null);
        desc = ImageDescriptor.createFromURL(url);
    }
    fgImageRegistry.put(key, desc);
}

From source file:com.aptana.ide.views.outline.BaseAction.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 w  w  w  .  j  av a2  s  .  c  o m
 * 
 * @param imageFilePath
 *            the image descriptor to retrieve
 * @return The image descriptor associated with resource or the default "missing" image descriptor if one could not
 *         be found
 */
protected static ImageDescriptor getImageDescriptor(String imageFilePath) {
    ImageDescriptor imageDescriptor = UnifiedEditorsPlugin.getImageDescriptor(imageFilePath);

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

    return imageDescriptor;
}

From source file:com.aptana.js.debug.ui.internal.DebugUIImages.java

License:Open Source License

/**
 * Declare an Image in the registry table.
 * //from   w  ww .j  ava2s  . c om
 * @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 static void declareRegistryImage(String key, String path) {
    ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
    Bundle bundle = Platform.getBundle(JSDebugUIPlugin.PLUGIN_ID);
    URL url = null;
    if (bundle != null) {
        url = FileLocator.find(bundle, new Path(path), null);
        desc = ImageDescriptor.createFromURL(url);
    }
    fgImageRegistry.put(key, desc);
}

From source file:com.atlassian.connector.eclipse.internal.crucible.ui.CrucibleImages.java

License:Open Source License

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

From source file:com.axmor.eclipse.typescript.editor.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,
 *  or <code>null</code> for a missing image descriptor
 * @return the image associated with the image descriptor or <code>null</code>
 *  if the image descriptor can't create the requested image.
 *//*from   ww  w.  j  a  v  a  2s . com*/
public Image get(ImageDescriptor descriptor) {
    if (descriptor == null) {
        descriptor = ImageDescriptor.getMissingImageDescriptor();
    }

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

    result = descriptor.createImage();
    if (result != null) {
        fRegistry.put(descriptor, result);
    }
    return result;
}

From source file:com.axmor.eclipse.typescript.editor.TypeScriptUIImages.java

License:Open Source License

/**
 * Declare an Image in the registry table.
 * /*from ww w .  j a v a2s .  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 static void declareRegistryImage(String key, String path) {
    ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
    Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
    URL url = null;
    if (bundle != null) {
        url = FileLocator.find(bundle, new Path(path), null);
        desc = ImageDescriptor.createFromURL(url);
    }
    imageRegistry.put(key, desc);
}

From source file:com.breskeby.eclipse.gradle.GradleImages.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 .  j  a  v  a 2 s  .  c  o  m*/
private final static void declareRegistryImage(String key, String path) {
    ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
    Bundle bundle = Platform.getBundle(GradlePlugin.PLUGIN_ID);
    URL url = null;
    if (bundle != null) {
        url = FileLocator.find(bundle, new Path(path), null);
        desc = ImageDescriptor.createFromURL(url);
    }
    imageRegistry.put(key, desc);
}

From source file:com.breskeby.eclipse.gradle.ImageDescriptorRegistry.java

License:Open Source License

/**
 * Returns the image associated with the given image descriptor.
 * /*from   ww w  .j  a  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 = (Image) fRegistry.get(descriptor);
    if (result != null)
        return result;

    Assert.isTrue(fDisplay == GradlePlugin.getStandardDisplay(),
            GradleModelMessages.ImageDescriptorRegistry_Allocating_image_for_wrong_display_1);
    result = descriptor.createImage();
    if (result != null)
        fRegistry.put(descriptor, result);
    return result;
}

From source file:com.cisco.yangide.ext.refactoring.ui.RefactoringImages.java

License:Open Source License

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

From source file:com.cisco.yangide.ui.internal.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 2 s  . c o m
public Image get(ImageDescriptor descriptor) {
    if (descriptor == null) {
        descriptor = ImageDescriptor.getMissingImageDescriptor();
    }

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

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