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:edu.cmu.cs.crystal.internal.UserConsoleView.java

License:Open Source License

/**
 * Called by the framework to open the view.
 *///w  w  w . j  a v  a  2s. c  om
public void createPartControl(Composite parent) {
    ioConsole = new IOConsole("Crystal User Console", ImageDescriptor.getMissingImageDescriptor());
    viewer = new TextConsoleViewer(parent, ioConsole);
    viewer.setInput(getViewSite());

    ioConsoleOutputStream = ioConsole.newOutputStream();

    PrintWriter pw = getPrintWriter();
    pw.println("[userOut]");
}

From source file:edu.ohio_state.khatchad.refactoring.ui.RefactoringPluginImages.java

License:Open Source License

private static ImageDescriptor createUnManaged(String prefix, String name) {
    IPath path = ICONS_PATH.append(prefix).append(name);
    URL url = FileLocator.find(ConvertConstantsToEnumRefactoringPlugin.getDefault().getBundle(), path, null);
    if (url != null) {
        return ImageDescriptor.createFromURL(url);
    }//from   w ww  . ja  v  a2 s .c  om
    return ImageDescriptor.getMissingImageDescriptor();
}

From source file:edu.utah.cdmcc.views.drools.DroolsPluginImages.java

License:Apache 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 static void declareRegistryImage(final String key, final String path) {
    ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
    try {
        desc = ImageDescriptor.createFromURL(makeIconFileURL(path));
    } catch (MalformedURLException e) {
        //DroolsEclipsePlugin.log(e);
    }
    imageRegistry.put(key, desc);
}

From source file:edu.wpi.cs.jburge.SEURAT.SEURATPlugin.java

License:Open Source License

/**
 * Gets the image descriptor for the icons used in SEURAT. This is
 * where the icon path is set up as well. The image descriptor is
 * an empty URL and the icon directory./* w  w  w.ja  v  a 2s  . c  o  m*/
 * @param name - the name of the icon
 * @return - the image descriptor
 */
//From the tree view plugin article, 
public static ImageDescriptor getImageDescriptor(String name) {
    String iconPath = "icons/";
    try {
        URL installURL = getDefault().getBundle().getEntry("/");
        //URL installURL = getDefault().getBundle().getEntry("edu.wpi.cs.jburge.SEURAT.SEURATPluginResources");

        URL url = new URL(installURL, iconPath + name);
        return ImageDescriptor.createFromURL(url);
    } catch (MalformedURLException e) {
        // should not happen
        return ImageDescriptor.getMissingImageDescriptor();
    }
}

From source file:etomica.plugin.editors.ImageDescriptorRegistry.java

License:Open Source License

/**
 * Returns the image assiciated with the given image descriptor.
 * /*ww  w.  j av a  2  s. co  m*/
 * @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 == getStandardDisplay(), "Allocating image for wrong display."); //$NON-NLS-1$
    result = descriptor.createImage();
    if (result != null)
        fRegistry.put(descriptor, result);
    return result;
}

From source file:eu.scasefp7.eclipse.servicecomposition.toolbar.FillToolbar.java

private static ImageDescriptor getImageDescriptor(String relativePath) {

    try {/*from   w w w.  java 2 s. c o  m*/
        // return
        // ImageDescriptor.createFromURL(FileLocator.find(Platform.getBundle(Activator.PLUGIN_ID),
        // new Path("icons/imageFileName.xxx"),null);
        Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
        URL fullPathString = BundleUtility.find(bundle, relativePath);
        return ImageDescriptor.createFromURL(fullPathString);
    } catch (Exception e) {
        // should not happen
        return ImageDescriptor.getMissingImageDescriptor();
    }
}

From source file:ext.org.eclipse.jdt.internal.ui.compare.JavaCompareUtilities.java

License:Open Source License

static ImageDescriptor getImageDescriptor(int type) {
    switch (type) {
    case IJavaElement.INITIALIZER:
    case IJavaElement.METHOD:
        return getImageDescriptor("obj16/compare_method.gif"); //$NON-NLS-1$
    case IJavaElement.FIELD:
        return getImageDescriptor("obj16/compare_field.gif"); //$NON-NLS-1$
    case IJavaElement.PACKAGE_DECLARATION:
        return JavaPluginImages.DESC_OBJS_PACKDECL;
    case IJavaElement.IMPORT_DECLARATION:
        return JavaPluginImages.DESC_OBJS_IMPDECL;
    case IJavaElement.IMPORT_CONTAINER:
        return JavaPluginImages.DESC_OBJS_IMPCONT;
    case IJavaElement.COMPILATION_UNIT:
        return JavaPluginImages.DESC_OBJS_CUNIT;
    }//from   w ww. j a va  2  s.  c om
    return ImageDescriptor.getMissingImageDescriptor();
}

From source file:ext.org.eclipse.jdt.internal.ui.viewsupport.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   w w  w . ja  va2s. c om*/
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:fr.inria.atlanmod.decision.ui.DecisionPlugin.java

License:Open Source License

public static ImageDescriptor getImage(String relativePath) {
    URL url = DecisionPlugin.getInstallURL();
    ImageDescriptor descriptor = null;/* ww  w . j  a v  a  2  s.  co m*/
    try {
        descriptor = ImageDescriptor
                .createFromURL(FileLocator.find(getDefault().getBundle(), new Path(relativePath), null));
        //descriptor = ImageDescriptor.createFromURL(new URL(url, relativePath)); 
    } catch (Exception e) {
        descriptor = ImageDescriptor.getMissingImageDescriptor();
    }
    return descriptor;
}

From source file:fr.inria.atlanmod.emfviews.ui.EmfViewsUIPlugin.java

License:Open Source License

/**
 * Returns the image descriptor with the given relative path.
 * /* w  ww . j av a  2 s .  com*/
 * @param name
 *            the image name
 * @return the image descriptor
 */
public static ImageDescriptor getImageDescriptor(String name) {
    if (Platform.isRunning()) {
        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();
        }
    }
    return null;
}