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:eu.geclipse.ui.wizards.NewGridProjectWizard.java

License:Open Source License

/**
 * Initialize the Grid project in the Grid project in the workspace
 *//*from   w w w.j a  v  a 2  s  .  c  o  m*/
public void init(final IWorkbench workbench, final IStructuredSelection selection) {
    setWindowTitle(Messages.getString("NewGridProjectWizard.windowTitle")); //$NON-NLS-1$
    URL imgUrl = Activator.getDefault().getBundle().getEntry("icons/wizban/newgridprj_wiz.gif"); //$NON-NLS-1$
    setDefaultPageImageDescriptor(ImageDescriptor.createFromURL(imgUrl));
}

From source file:eu.geclipse.ui.wizards.VoSelectionWizardPage.java

License:Open Source License

public VoSelectionWizardPage(final boolean allowMultiSelection, final Class<?> voType) {
    super("eu.geclipse.ui.voSelectionWizardPage", //$NON-NLS-1$
            "VO Selection Page", null);
    setDescription("Specify the VO that should be used");
    URL imgUrl = Activator.getDefault().getBundle().getEntry("icons/wizban/vo_wiz.gif"); //$NON-NLS-1$
    setImageDescriptor(ImageDescriptor.createFromURL(imgUrl));
    this.allowMultiSelection = allowMultiSelection;
    this.voType = voType;
    this.voList = new ArrayList<IVirtualOrganization>();
}

From source file:eu.geclipse.ui.wizards.VoServiceSelectionPage.java

License:Open Source License

public VoServiceSelectionPage() {
    super("voServiceSelectionPage", //$NON-NLS-1$
            "Service Selection", null);
    setDescription("Add services to your VO");
    URL imgUrl = Activator.getDefault().getBundle().getEntry("icons/wizban/vo_wiz.gif"); //$NON-NLS-1$
    setImageDescriptor(ImageDescriptor.createFromURL(imgUrl));
}

From source file:eu.geclipse.ui.wizards.VoServiceSelectionPage.java

License:Open Source License

protected static Image getImage(final String name) {

    Image result = images.get(name);

    if (result == null) {
        URL url = Activator.getDefault().getBundle().getResource(name);
        ImageDescriptor desc = ImageDescriptor.createFromURL(url);
        result = desc.createImage();//from ww w  .  j a  va 2 s  .  c  o  m
        images.put(name, result);
    }

    return result;

}

From source file:eu.geclipse.workflow.ui.wizards.NewWorkflowCreationWizardPage.java

License:Open Source License

/**
 * Constructor which takes the pagename and current selection as arguments.
 * // w w  w  .j a va  2s. c  o m
 * @param pageName
 * @param selection
 */
protected NewWorkflowCreationWizardPage(String pageName, IStructuredSelection selection) {
    super(pageName);
    URL imgUrl = WorkflowDiagramEditorPlugin.getDefault().getBundle()
            .getEntry("icons/wizban/NewWorkflowWizard.gif"); //$NON-NLS-1$
    setImageDescriptor(ImageDescriptor.createFromURL(imgUrl));
    this.currentSelection = selection;
    setPageComplete(false);
}

From source file:eu.modelwriter.marker.ui.internal.views.contextualview.ContextualViewTreeLabelProvider.java

License:Open Source License

public static ImageDescriptor getImageDescriptor(final String bundleID, final String path) {
    assert (bundleID != null) : "No bundle defined";
    assert (path != null) : "No path defined";

    // if the bundle is not ready then there is no image
    final Bundle bundle = Platform.getBundle(bundleID);
    final int bundleState = bundle.getState();
    if ((bundleState != Bundle.ACTIVE) && (bundleState != Bundle.STARTING)
            && (bundleState != Bundle.RESOLVED)) {
        return null;
    }//from w w  w  .  j ava  2 s. c om

    // look for the image (this will check both the plugin and fragment
    // folders
    final URL imagePath = FileLocator.find(bundle, new Path(path), null);

    if (imagePath != null) {
        return ImageDescriptor.createFromURL(imagePath);
    }

    return null;
}

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

private static ImageDescriptor getImageDescriptor(String relativePath) {

    try {//from  w  w  w  . j  a  va  2s  .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:eu.xsdi.mdlui.MdlUiPlugin.java

License:LGPL

private void registerImage(ImageRegistry registry, String key, String fileName) {
    try {//ww w  .ja va2 s .c om
        URL url = MdlUiPlugin.class.getResource(fileName);
        if (url != null) {
            ImageDescriptor desc = ImageDescriptor.createFromURL(url);
            registry.put(key, desc);
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

From source file:example.debug.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.
 * //from   ww  w . j  ava2 s  . co  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) {
    URL url = BundleUtility.find("example.debug.ui", path);
    ImageDescriptor desc = ImageDescriptor.createFromURL(url);
    getImageRegistry().put(key, desc);
}

From source file:ext.org.eclipse.jdt.internal.ui.text.java.CompletionProposalCategory.java

License:Open Source License

CompletionProposalCategory(IConfigurationElement element, CompletionProposalComputerRegistry registry)
        throws CoreException {
    fElement = element;//  w ww . j av a2s. c  o m
    fRegistry = registry;
    IExtension parent = (IExtension) element.getParent();
    fId = parent.getUniqueIdentifier();
    checkNotNull(fId, "id"); //$NON-NLS-1$
    String name = parent.getLabel();
    if (name == null)
        fName = fId;
    else
        fName = name;

    String icon = element.getAttribute(ICON);
    ImageDescriptor img = null;
    if (icon != null) {
        Bundle bundle = getBundle();
        if (bundle != null) {
            Path path = new Path(icon);
            URL url = FileLocator.find(bundle, path, null);
            img = ImageDescriptor.createFromURL(url);
        }
    }
    fImage = img;

}