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:com.google.gdt.eclipse.managedapis.BaseResources.java

License:Open Source License

public ImageDescriptor getManagedApiImportIcon() throws MalformedURLException {
    URL updateAvailableImageUrl = getURLForLocalPath(ManagedApiConstants.ICON_WIZARD_MANAGED_API_IMPORT);
    return ImageDescriptor.createFromURL(updateAvailableImageUrl);
}

From source file:com.google.gdt.eclipse.managedapis.BaseResources.java

License:Open Source License

/**
 * Provides method to access the 16x16 icon used to overlay the classpath
 * container and JARs to denote the availability of an update.
 *//*from  w w  w .j ava 2  s  .co  m*/
public ImageDescriptor getUpdateAvailableOverlay16ImageDescriptor() throws MalformedURLException {
    URL updateAvailableImageUrl = getURLForLocalPath(ManagedApiConstants.OVERLAY_16_UPDATE_AVAILABLE);
    return ImageDescriptor.createFromURL(updateAvailableImageUrl);
}

From source file:com.google.gdt.eclipse.managedapis.BaseResources.java

License:Open Source License

private Image getImageForUrl(URL url) {
    Image image = null;//from  w ww .  j av  a 2s  .  co m
    try {
        ensureInitialized("Unable to load image from non-UI thread.");
        ImageDescriptor descriptor = ImageDescriptor.createFromURL(url);
        image = resourceManager.createImage(descriptor);
    } catch (SWTException e) {
        ManagedApiLogger.warn(e, "Load Image exception:");
    }
    return image;
}

From source file:com.google.gdt.eclipse.managedapis.impl.ManagedApiImpl.java

License:Open Source License

private static ImageDescriptor createClasspathContainerIconImageDescriptor(ApiInfo apiInfo) {
    ImageDescriptor imageDescriptor = null;
    URL iconLink = apiInfo.getIconLink(ManagedApiPlugin.ICON_KEY_CLASSPATH_CONTAINER);
    if (iconLink != null) {
        if (URL_PROTOCOL_FILE.equals(iconLink.getProtocol())) {
            File iconFile = null;
            try {
                iconFile = new File(iconLink.toURI());
            } catch (URISyntaxException e) {
                // Ignore
            }/*from   w  w w  .j a  v a  2s . c om*/

            if (iconFile != null && iconFile.exists()) {
                imageDescriptor = ImageDescriptor.createFromURL(iconLink);
            } else {
                ManagedApiLogger.warn("Bad image reference for icon: " + iconLink.toExternalForm());
            }
        } else {
            imageDescriptor = ImageDescriptor.createFromURL(iconLink);
        }
    }
    return imageDescriptor;
}

From source file:com.google.inject.tools.ideplugin.eclipse.EclipseMenuAction.java

License:Apache License

private static ImageDescriptor makeImage(String imagefile) {
    return ImageDescriptor.createFromURL(getIconURL(imagefile));
}

From source file:com.google.test.metric.eclipse.ui.plugin.Activator.java

License:Apache License

public Image getImage(String path) throws ImageNotFoundException {
    Image image = images.get(path);
    if (image == null) {
        String pluginLocation = Activator.getDefault().getBundle().getLocation();
        if (pluginLocation.startsWith("reference:")) {
            pluginLocation = pluginLocation.substring(10);
        }// w  ww . ja va  2  s .  c  o  m
        URL url;
        try {
            url = new URL(pluginLocation + path);
        } catch (MalformedURLException e) {
            throw new ImageNotFoundException("Image : " + path + " not found");
        }

        ImageDescriptor projectImageDescriptor = ImageDescriptor.createFromURL(url);
        image = projectImageDescriptor.createImage();
        images.put(path, image);
    }
    return image;
}

From source file:com.googlecode.osde.internal.Activator.java

License:Apache License

public ImageDescriptor createImageDescriptor(String url) {
    ImageRegistry registry = getImageRegistry();
    ImageDescriptor imageDescriptor = registry.getDescriptor(url);
    if (imageDescriptor == null) {
        try {/*from  w  ww. j  av a2  s .com*/
            imageDescriptor = ImageDescriptor.createFromURL(new URL(url));
        } catch (MalformedURLException e) {
            imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
        }
        registry.put(url, imageDescriptor);
    }
    return imageDescriptor;
}

From source file:com.googlecode.osde.internal.Activator.java

License:Apache License

private ImageDescriptor createSystemImageDescriptor(String path) {
    ImageDescriptor descriptor;//from w w  w . j  a  v a2 s .  c  o m
    try {
        URL installUrl = getInstallUrl();
        descriptor = ImageDescriptor.createFromURL(new URL(installUrl, path));
    } catch (MalformedURLException e) {
        descriptor = ImageDescriptor.getMissingImageDescriptor();
    }
    return descriptor;
}

From source file:com.gwtplatform.plugin.wizard.NewProjectWizard.java

License:Apache License

public NewProjectWizard() {
    super();/*from w  w w  . java 2  s.c  o  m*/
    setNeedsProgressMonitor(true);
    setWindowTitle("New GWTP Project");
    sourceWriterFactory = new SourceWriterFactory();

    try {
        URL url = new URL(Activator.getDefault().getBundle().getEntry("/"), "icons/gwtp-logo.png");
        setDefaultPageImageDescriptor(ImageDescriptor.createFromURL(url));
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
}

From source file:com.hudson.hibernatesynchronizer.wizard.NewConfigurationWizard.java

License:GNU General Public License

/**
 * Constructor for NewConfigurationWizard.
 */// w  ww.  ja  v  a 2s  .co  m
public NewConfigurationWizard() {
    super();
    setNeedsProgressMonitor(true);

    try {
        URL prefix = new URL(Plugin.getDefault().getDescriptor().getInstallURL(), "icons/");
        ImageDescriptor id = ImageDescriptor.createFromURL(new URL(prefix, "new_wizard.gif"));
        setDefaultPageImageDescriptor(id);
    } catch (MalformedURLException e) {
    }
}