Example usage for org.eclipse.jface.resource ImageDescriptor createFromURL

List of usage examples for org.eclipse.jface.resource ImageDescriptor createFromURL

Introduction

In this page you can find the example usage for org.eclipse.jface.resource ImageDescriptor createFromURL.

Prototype

public static ImageDescriptor createFromURL(URL url) 

Source Link

Document

Creates and returns a new image descriptor from a URL.

Usage

From source file:edu.clarkson.serl.critic.CriticPlugin.java

License:Open Source License

@Override
protected void initializeImageRegistry(ImageRegistry registry) {
    super.initializeImageRegistry(registry);
    Bundle bundle = Platform.getBundle(CriticPlugin.PLUGIN_ID);

    // Add the main image to registry
    ImageDescriptor myImage = ImageDescriptor
            .createFromURL(FileLocator.find(bundle, new Path("icons/CriticAL.gif"), null));
    registry.put(CriticPlugin.IMG_CRITICAL_MAIN, myImage);

    // Add the small image to registry
    myImage = ImageDescriptor//ww  w. java2  s .c  om
            .createFromURL(FileLocator.find(bundle, new Path("icons/CriticALSmall.gif"), null));
    registry.put(CriticPlugin.IMG_CRITICAL_SMALL, myImage);

    // Add the Criticism image to registry
    myImage = ImageDescriptor.createFromURL(FileLocator.find(bundle, new Path("icons/Criticism.gif"), null));
    registry.put(CriticPlugin.IMG_CRITICISM, myImage);

    // Add the Explanation image to registry
    myImage = ImageDescriptor.createFromURL(FileLocator.find(bundle, new Path("icons/Explanation.gif"), null));
    registry.put(CriticPlugin.IMG_EXPLANATION, myImage);

    // Add the Recommendation image to registry
    myImage = ImageDescriptor
            .createFromURL(FileLocator.find(bundle, new Path("icons/Recommendation.gif"), null));
    registry.put(CriticPlugin.IMG_RECOMMENDATION, myImage);
}

From source file:edu.harvard.i2b2.eclipse.plugins.querytool.Activator.java

License:Open Source License

@Override
protected void initializeImageRegistry(ImageRegistry registry) {
    super.initializeImageRegistry(registry);
    Bundle bundle = Platform.getBundle(PLUGIN_ID);

    registry.put(Images.LEAF,/*from w  ww  .  java  2 s . c  o  m*/
            ImageDescriptor.createFromURL(FileLocator.find(bundle, new Path(Images.LEAF_PATH), null)));
    registry.put(Images.OPEN_FOLDER,
            ImageDescriptor.createFromURL(FileLocator.find(bundle, new Path(Images.OPEN_FOLDER_PATH), null)));
    registry.put(Images.OPEN_CASE,
            ImageDescriptor.createFromURL(FileLocator.find(bundle, new Path(Images.OPEN_CASE_PATH), null)));
    registry.put(Images.CLOSED_FOLDER,
            ImageDescriptor.createFromURL(FileLocator.find(bundle, new Path(Images.CLOSED_FOLDER_PATH), null)));
    registry.put(Images.CLOSED_CASE,
            ImageDescriptor.createFromURL(FileLocator.find(bundle, new Path(Images.CLOSED_CASE_PATH), null)));
    registry.put(Images.PREVIOUS_QUERY, ImageDescriptor
            .createFromURL(FileLocator.find(bundle, new Path(Images.PREVIOUS_QUERY_PATH), null)));
    registry.put(Images.PREVIOUS_TEMPORAL_QUERY, ImageDescriptor
            .createFromURL(FileLocator.find(bundle, new Path(Images.PREVIOUS_TEMPORAL_QUERY_PATH), null)));
    registry.put(Images.PLAIN_PEOPLE,
            ImageDescriptor.createFromURL(FileLocator.find(bundle, new Path(Images.PLAIN_PEOPLE_PATH), null)));
    registry.put(Images.PATIENT_SET,
            ImageDescriptor.createFromURL(FileLocator.find(bundle, new Path(Images.PATIENT_SET_PATH), null)));
    registry.put(Images.PATIENT_COUNT,
            ImageDescriptor.createFromURL(FileLocator.find(bundle, new Path(Images.PATIENT_COUNT_PATH), null)));
    registry.put(Images.ENCOUNTER_SET,
            ImageDescriptor.createFromURL(FileLocator.find(bundle, new Path(Images.ENCOUNTER_SET_PATH), null)));
    registry.put(Images.WORKING,
            ImageDescriptor.createFromURL(FileLocator.find(bundle, new Path(Images.WORKING_PATH), null)));

    registry.put(Images.HELP_INACTIVE,
            ImageDescriptor.createFromURL(FileLocator.find(bundle, new Path(Images.HELP_INACTIVE_PATH), null)));
    registry.put(Images.HELP_ACTIVE,
            ImageDescriptor.createFromURL(FileLocator.find(bundle, new Path(Images.HELP_ACTIVE_PATH), null)));

    registry.put(Images.BOUND_BY_PATIENT, ImageDescriptor
            .createFromURL(FileLocator.find(bundle, new Path(Images.BOUND_BY_PATIENT_PATH), null)));
    registry.put(Images.BOUND_BY_ENCOUNTER, ImageDescriptor
            .createFromURL(FileLocator.find(bundle, new Path(Images.BOUND_BY_ENCOUNTER_PATH), null)));
    registry.put(Images.BOUND_BY_OBSERVATION, ImageDescriptor
            .createFromURL(FileLocator.find(bundle, new Path(Images.BOUND_BY_OBSERVATION_PATH), null)));
    registry.put(Images.TEMPORAL_ANCHOR, ImageDescriptor
            .createFromURL(FileLocator.find(bundle, new Path(Images.TEMPORAL_ANCHOR_PATH), null)));

    registry.put(Images.EXPANDER_CLOSED, ImageDescriptor
            .createFromURL(FileLocator.find(bundle, new Path(Images.EXPANDER_CLOSED_PATH), null)));
    registry.put(Images.EXPANDER_CLOSED_ACTIVE, ImageDescriptor
            .createFromURL(FileLocator.find(bundle, new Path(Images.EXPANDER_CLOSED_ACTIVE_PATH), null)));
    registry.put(Images.EXPANDER_OPEN,
            ImageDescriptor.createFromURL(FileLocator.find(bundle, new Path(Images.EXPANDER_OPEN_PATH), null)));
    registry.put(Images.EXPANDER_OPEN_ACTIVE, ImageDescriptor
            .createFromURL(FileLocator.find(bundle, new Path(Images.EXPANDER_OPEN_ACTIVE_PATH), null)));

    registry.put(Images.EXPANDER_DOWN,
            ImageDescriptor.createFromURL(FileLocator.find(bundle, new Path(Images.EXPANDER_DOWN_PATH), null)));
    registry.put(Images.EXPANDER_DOWN_ACTIVE, ImageDescriptor
            .createFromURL(FileLocator.find(bundle, new Path(Images.EXPANDER_DOWN_ACTIVE_PATH), null)));
    registry.put(Images.EXPANDER_UP,
            ImageDescriptor.createFromURL(FileLocator.find(bundle, new Path(Images.EXPANDER_UP_PATH), null)));
    registry.put(Images.EXPANDER_UP_ACTIVE, ImageDescriptor
            .createFromURL(FileLocator.find(bundle, new Path(Images.EXPANDER_UP_ACTIVE_PATH), null)));

    registry.put(Images.RIGHT_ARROW,
            ImageDescriptor.createFromURL(FileLocator.find(bundle, new Path(Images.RIGHT_ARROW_PATH), null)));
    registry.put(Images.RIGHT_ARROW_ACTIVATED, ImageDescriptor
            .createFromURL(FileLocator.find(bundle, new Path(Images.RIGHT_ARROW_ACTIVATED_PATH), null)));
    registry.put(Images.RIGHT_ARROW_SMALL_WHITE, ImageDescriptor
            .createFromURL(FileLocator.find(bundle, new Path(Images.RIGHT_ARROW_SMALL_WHITE_PATH), null)));
    registry.put(Images.RIGHT_ARROW_SMALL_GRAY, ImageDescriptor
            .createFromURL(FileLocator.find(bundle, new Path(Images.RIGHT_ARROW_SMALL_GRAY_PATH), null)));
    registry.put(Images.RIGHT_ARROW_TRIMMED_BLACK, ImageDescriptor
            .createFromURL(FileLocator.find(bundle, new Path(Images.RIGHT_ARROW_TRIMMED_BLACK_PATH), null)));
    registry.put(Images.LEFT_ARROW_TRIMMED_BLACK, ImageDescriptor
            .createFromURL(FileLocator.find(bundle, new Path(Images.LEFT_ARROW_TRIMMED_BLACK_PATH), null)));
    registry.put(Images.RETURN,
            ImageDescriptor.createFromURL(FileLocator.find(bundle, new Path(Images.RETURN_PATH), null)));

    // load known animated gifs frame-by-frame
    initializeAnimatedGifs(registry);
}

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  w  w.ja  v  a 2 s. com
    return ImageDescriptor.getMissingImageDescriptor();
}

From source file:edu.shef.damson.ui.DebugUIPlugin.java

License:Open Source License

/**
 * Declares a workbench image given the path of the image file (relative to
 * the workbench plug-in). This is a helper method that creates the image
 * descriptor and passes it to the main <code>declareImage</code> method.
 * /* ww  w.ja  v  a 2 s  .c  o  m*/
 * @param symbolicName the symbolic name of the image
 * @param path the path of the image file relative to the base of the workbench
 * plug-ins install directory
 * <code>false</code> if this is not a shared image
 */
private void declareImage(String key, String path) {
    Bundle bundle = Platform.getBundle("edu.shef.damson.ui");
    URL url = FileLocator.find(bundle, new Path(path), null);
    ImageDescriptor desc = ImageDescriptor.createFromURL(url);
    getImageRegistry().put(key, desc);
}

From source file:edu.tum.in.bruegge.epd.emfstore.handler.merge.util.ChangePackageVisualizationHelper.java

License:Open Source License

private Image getCustomOperationProviderLabel(AbstractOperation operation) {
    Image image;/* w w w  .ja va  2  s  .  c  o  m*/
    AbstractOperationCustomLabelProvider customLabelProvider = customLabelProviderManager
            .getCustomLabelProvider(operation);
    if (customLabelProvider != null) {
        try {
            URL imageUrl = (URL) customLabelProvider.getImage(operation);
            if (imageUrl != null) {
                ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(imageUrl);
                image = imageDescriptor.createImage();
                if (image != null) {
                    return image;
                }
            }
            // BEGIN SUPRESS CATCH EXCEPTION
        } catch (RuntimeException e) {
            // END SUPRESS CATCH EXCEPTION
            ModelUtil.logWarning("Image load from custom operation item provider failed!", e);
        }
    }
    return null;
}

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  ww .ja  v  a  2s .  c om
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.utexas.cs.orc.orceclipse.OrcResources.java

License:Open Source License

/**
 * Create an image descriptor for the given path in a bundle. The path can
 * contain variables like $NL$. If no image could be found,
 * <code>null</code> is returned.
 *
 * @param bundle Plug-in to serh fo the image
 * @param path Path to the image file in the give plug-in
 * @return ImageDescriptor of image or null
 *///w ww.  j  ava2s.  c  o  m
public static ImageDescriptor createImageDescriptor(final Bundle bundle, final IPath path) {
    final URL url = FileLocator.find(bundle, path, null);
    if (url != null) {
        return ImageDescriptor.createFromURL(url);
    }
    return null;
}

From source file:edu.washington.cs.cupid.views.BulletinBoardView.java

License:Open Source License

/**
 * Helper method to load images//from  www  .  j  a  va 2 s .c o m
 */
private static Image getImage(String file) {
    Bundle bundle = FrameworkUtil.getBundle(BulletinBoardView.class);
    URL url = FileLocator.find(bundle, new Path("icons/" + file), null);
    ImageDescriptor image = ImageDescriptor.createFromURL(url);
    return image.createImage();
}

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./*  www. j a  v  a  2  s. 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:egovframework.hdev.imp.ide.EgovDeviceAPIIdePlugin.java

License:Apache License

/**
 * ? ? ?/*from   www.  j  a va  2 s  . co m*/
 * @param registry
 * @param key
 * @param fileName
 */
@SuppressWarnings("deprecation")
private void registerImage(ImageRegistry registry, String key, String fileName) {
    try {
        IPath path = new Path(ICONS_PATH + fileName);
        URL url = find(path);
        if (url != null) {
            ImageDescriptor desc = ImageDescriptor.createFromURL(url);
            registry.put(key, desc);
        }
    } catch (Exception e) {
        DeviceAPIIdeLog.logError(e);
    }
    return;
}