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:cc.warlock.rcp.ui.WarlockSharedImages.java

License:Open Source License

private void addImage(String path) {
    Bundle pluginBundle = Warlock2Plugin.getDefault().getBundle();
    ImageDescriptor descriptor = ImageDescriptor.createFromURL(pluginBundle.getEntry(path));

    descriptors.put(path, descriptor);/*from  ww w .  java2 s  .co  m*/
    images.put(path, descriptor.createImage());
}

From source file:cc.warlock.scribe.ui.ScribeSharedImages.java

License:Open Source License

private void addImage(String path) {
    Bundle pluginBundle = Activator.getDefault().getBundle();
    ImageDescriptor descriptor = ImageDescriptor.createFromURL(pluginBundle.getEntry(path));

    descriptors.put(path, descriptor);//from   w ww .j ava 2s .  c  o  m
    images.put(path, descriptor.createImage());
}

From source file:ccw.CCWPlugin.java

License:Open Source License

@Override
protected void initializeImageRegistry(ImageRegistry reg) {
    reg.put(NS, ImageDescriptor.createFromURL(getBundle().getEntry("/icons/jdt/package_obj.gif")));
    reg.put(PUBLIC_FUNCTION, ImageDescriptor.createFromURL(getBundle().getEntry("/icons/jdt/methpub_obj.gif")));
    reg.put(PRIVATE_FUNCTION,/*from  w ww.  j  a  v a  2s.  co m*/
            ImageDescriptor.createFromURL(getBundle().getEntry("/icons/jdt/methpri_obj.gif")));
    reg.put(CLASS, ImageDescriptor.createFromURL(getBundle().getEntry("/icons/jdt/class_obj.gif")));
    reg.put(SORT, ImageDescriptor.createFromURL(getBundle().getEntry("/icons/jdt/alphab_sort_co.gif")));
}

From source file:ccw.leiningen.NewLeiningenProjectWizard.java

License:Open Source License

@Override
public void setDefaultPageImageDescriptor(ImageDescriptor imageDescriptor) {
    ImageDescriptor d = ImageDescriptor.createFromURL(
            FileLocator.find(CCWPlugin.getDefault().getBundle(), new Path("icons/clojure64x64.png"), null));
    super.setDefaultPageImageDescriptor(d);
}

From source file:ch.elexis.core.ui.icons.Images.java

License:Open Source License

/**
 * //from  www .  j  a  v  a  2  s.co  m
 * @return an {@link ImageDescriptor} of type URLImageDescriptor
 * @since 3.3
 */
public ImageDescriptor getURLImageDescriptor() {
    try {
        URL imageDesciptorUrl = new URL(getIconURI());
        return ImageDescriptor.createFromURL(imageDesciptorUrl);
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:ch.elexis.core.ui.icons.Images.java

License:Open Source License

/**
 * Add an image descriptor for a specific key and {@link IconSize} to the global
 * {@link ImageRegistry}/*from   w w w. j a  v  a 2s .c  o  m*/
 * 
 * @param name
 * @param is
 * @return <code>true</code> if successfully added, else <code>false</code>
 */
private static boolean addIconImageDescriptor(String name, ImageSize is) {
    String fileName;
    try {
        ResourceBundle iconsetProperties = ResourceBundle.getBundle("iconset");
        fileName = iconsetProperties.getString(name);
    } catch (MissingResourceException | IllegalArgumentException e) {
        fileName = name;
    }

    Path path = new Path("icons/" + is.name + "/" + fileName);
    URL fileLocation = FileLocator.find(Activator.getContext().getBundle(), path, null);
    if (fileLocation == null)
        return false;
    ImageDescriptor id = ImageDescriptor.createFromURL(fileLocation);
    JFaceResources.getImageRegistry().put(name + is.name, id);

    return true;
}

From source file:ch.hsr.ifs.cutelauncher.CuteLauncherPlugin.java

License:Open Source License

private static ImageDescriptor createImageDescriptor(Bundle bundle, IPath path) {
    URL url = FileLocator.find(bundle, path, null);
    return ImageDescriptor.createFromURL(url);
}

From source file:ch.ntb.inf.deep.eclipse.DeepPlugin.java

License:Apache License

public static Image createImage(String imagePath) {
    final Bundle pluginBundle = Platform.getBundle(DeepPlugin.PLUGIN_ID);

    final Path imageFilePath = new Path(DeepPlugin.IMAGES_PATH + imagePath);

    final URL imageFileUrl = FileLocator.find(pluginBundle, imageFilePath, null);

    return ImageDescriptor.createFromURL(imageFileUrl).createImage();
}

From source file:ch.ntb.inf.deep.eclipse.ui.wizard.DeepProjectWizard.java

License:Apache License

private ImageDescriptor getImageDescriptor(String relativePath) {
    String iconPath = "icons/full/obj16/";
    try {//from   ww w. j av  a2  s.c o m
        DeepPlugin plugin = DeepPlugin.getDefault();
        URL installURL = plugin.getBundle().getEntry("/");
        URL url;
        url = new URL(installURL, iconPath + relativePath);
        return ImageDescriptor.createFromURL(url);
    } catch (MalformedURLException e) {
        e.printStackTrace();
        return null;
    }
}

From source file:cideplus.ui.astview.ASTViewImages.java

License:Open Source License

public static ImageDescriptor createImageDescriptor(Bundle bundle, IPath path) {
    URL url = FileLocator.find(bundle, path, null);
    if (url != null) {
        return ImageDescriptor.createFromURL(url);
    }/*w ww.  j  a va2 s.co  m*/
    return null;
}