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

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

Introduction

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

Prototype

public Image createImage() 

Source Link

Document

Creates and returns a new SWT image for this image descriptor.

Usage

From source file:eu.artist.migration.modernization.uml2java.repackaged.gen.java.ui.UML2JavaUIActivator.java

License:Open Source License

/**
 * Returns an image at the given plug-in relative path.
 * /* w  w w .j  a  va2 s  .  c  o  m*/
 * @param path
 *            is a plug-in relative path
 * @return the image
 */
public Image getImage(String path) {
    Image result = imageMap.get(path);
    if (result == null) {
        ImageDescriptor descriptor = getImageDescriptor(path);
        if (descriptor != null) {
            result = descriptor.createImage();
            imageMap.put(path, result);
        }
    }
    return result;
}

From source file:eu.artist.postmigration.nfrvt.lang.common.ui.labeling.ARTISTCommonLabelProvider.java

License:Open Source License

/**
 * Retrieves the image specified by the imageName from the given plugin.
 * If no such image can be found, null is returned.
 * @param plugin plugin to be searched/*from   ww  w  .  j  a  va2 s  . c  o m*/
 * @param imageName name of the image
 * @return image if found or null
 */
private Image getImageByName(AbstractUIPlugin plugin, String imageName) {
    if (plugin == null || imageName == null || imageName.isEmpty())
        return null;

    URL imgUrl = plugin.getBundle().getEntry(IMAGE_DIRECTORY + imageName);
    if (imgUrl != null) {
        ImageDescriptor id = null;
        Image result = plugin.getImageRegistry().get(imgUrl.toExternalForm());
        if (result == null) {
            id = ImageDescriptor.createFromURL(imgUrl);
            if (id != null) {
                result = id.createImage();
                plugin.getImageRegistry().put(imgUrl.toExternalForm(), result);
            }
        }
        return result;
    }
    return null;
}

From source file:eu.artist.postmigration.nfrvt.lang.util.run.ui.ModelSelectionTab.java

License:Open Source License

@Override
public Image getImage() {
    ImageDescriptor id = ImageDescriptor.createFromURL(getIcon());
    if (id != null)
        return id.createImage();
    return null;/*from w ww . j  a  v a  2  s.c  om*/
}

From source file:eu.artist.postmigration.nfrvt.search.run.ui.AnalysisSettingsTab.java

License:Open Source License

@Override
public Image getImage() {
    URL imgUrl = MigrationExplorerActivator.getDefault().getBundle().getEntry("icons/AnalysisSettingsTab.gif");
    if (imgUrl != null) {
        ImageDescriptor id = null;
        Image result = MigrationExplorerActivator.getDefault().getImageRegistry().get(imgUrl.toExternalForm());
        if (result == null) {
            id = ImageDescriptor.createFromURL(imgUrl);
            if (id != null) {
                result = id.createImage();
                MigrationExplorerActivator.getDefault().getImageRegistry().put(imgUrl.toExternalForm(), result);
            }//from   ww w  .  j a v a 2s  . c om
        }
        return result;
    }
    return null;
}

From source file:eu.artist.postmigration.nfrvt.search.run.ui.EvaluationSettingsTab.java

License:Open Source License

@Override
public Image getImage() {
    URL imgUrl = MigrationExplorerActivator.getDefault().getBundle().getEntry("icons/EvaluationSettings.gif");
    if (imgUrl != null) {
        ImageDescriptor id = null;
        Image result = MigrationExplorerActivator.getDefault().getImageRegistry().get(imgUrl.toExternalForm());
        if (result == null) {
            id = ImageDescriptor.createFromURL(imgUrl);
            if (id != null) {
                result = id.createImage();
                MigrationExplorerActivator.getDefault().getImageRegistry().put(imgUrl.toExternalForm(), result);
            }//from  w ww .ja  v  a2 s .  c o  m
        }
        return result;
    }
    return null;
}

From source file:eu.artist.postmigration.nfrvt.search.run.ui.PatternSettingsTab.java

License:Open Source License

@Override
public Image getImage() {
    URL imgUrl = MigrationExplorerActivator.getDefault().getBundle().getEntry("icons/PatternSettings.gif");
    if (imgUrl != null) {
        ImageDescriptor id = null;
        Image result = MigrationExplorerActivator.getDefault().getImageRegistry().get(imgUrl.toExternalForm());
        if (result == null) {
            id = ImageDescriptor.createFromURL(imgUrl);
            if (id != null) {
                result = id.createImage();
                MigrationExplorerActivator.getDefault().getImageRegistry().put(imgUrl.toExternalForm(), result);
            }/*from   w w  w .ja va2  s  .  c  o  m*/
        }
        return result;
    }
    return null;
}

From source file:eu.artist.postmigration.nfrvt.strategy.fumlsimulation.run.ui.AnalysisSettingsTab.java

License:Open Source License

@Override
public Image getImage() {
    URL imgUrl = FUMLSimulationActivator.getDefault().getBundle().getEntry("icons/AnalysisSettingsTab.gif");
    if (imgUrl != null) {
        ImageDescriptor id = null;
        Image result = FUMLSimulationActivator.getDefault().getImageRegistry().get(imgUrl.toExternalForm());
        if (result == null) {
            id = ImageDescriptor.createFromURL(imgUrl);
            if (id != null) {
                result = id.createImage();
                FUMLSimulationActivator.getDefault().getImageRegistry().put(imgUrl.toExternalForm(), result);
            }//from  ww w .j a v a2  s  .c  o m
        }
        return result;
    }
    return null;
}

From source file:eu.celar.ui.wizards.wizardselection.ExtPointWizardSelectionListPage.java

License:Open Source License

private static void addElement(final Vector<IWizardSelectionNode> nodes, final IConfigurationElement element) {
    String id = element.getAttribute(EXT_ID);
    String name = element.getAttribute(EXT_NAME);
    String iconName = element.getAttribute(EXT_ICON);
    Image icon = null;/*ww w .  j  av  a  2 s. c  o  m*/
    ImageDescriptor iconDesc = null;
    if (iconName != null) {
        String pluginId = element.getContributor().getName();
        iconDesc = AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, iconName);
    }
    if (iconDesc != null) {
        icon = iconDesc.createImage();
    }
    IWizardSelectionNode wizardNode = new ExtPointWizardSelectionNode(element, id, name, icon);
    nodes.add(wizardNode);
}

From source file:eu.esdihumboldt.hale.ui.views.report.ReportListLabelProvider.java

License:Open Source License

/**
 * Get an Image from cache or resource./*  w w  w  .  ja  v a2 s  . c om*/
 * 
 * @param img name of file
 * 
 * @return the Image
 */
protected Image getImage(String img) {
    ImageDescriptor descriptor = null;

    descriptor = AbstractUIPlugin.imageDescriptorFromPlugin("eu.esdihumboldt.hale.ui.views.report", img);
    if (descriptor == null) {
        return null;
    }

    Image image = imageCache.get(descriptor);
    if (image == null) {
        image = descriptor.createImage();
        imageCache.put(descriptor, image);
    }
    return image;
}

From source file:eu.geclipse.jsdl.ui.providers.DataStageInLabelProvider.java

License:Open Source License

void loadImages() {

    URL stageInURL = Activator.getDefault().getBundle().getEntry("icons/stage-in.gif"); //$NON-NLS-1$    
    URL stageInOutURL = Activator.getDefault().getBundle().getEntry("icons/stage-in-out.gif"); //$NON-NLS-1$
    ImageDescriptor stageInDesc = ImageDescriptor.createFromURL(stageInURL);
    ImageDescriptor stageInOutDesc = ImageDescriptor.createFromURL(stageInOutURL);
    this.stageInImage = stageInDesc.createImage();
    this.stageInOutImage = stageInOutDesc.createImage();

}