org.eclipse.jface.resource.ImageRegistry Java Examples

The following examples show how to use org.eclipse.jface.resource.ImageRegistry. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImageResource.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private static void initializeImageRegistry() {
	imageRegistry = new ImageRegistry();

	// load Web browser images
	registerImage(IMG_OBJ_BROWSER, URL_OBJ + "browser.png"); //$NON-NLS-1$

	registerImage(IMG_ELCL_NAV_BACKWARD, URL_ELCL + "nav_backward.gif"); //$NON-NLS-1$
	registerImage(IMG_ELCL_NAV_CONSOLE, URL_ELCL + "console.png"); //$NON-NLS-1$
	registerImage(IMG_ELCL_NAV_FORWARD, URL_ELCL + "nav_forward.gif"); //$NON-NLS-1$
	registerImage(IMG_ELCL_NAV_STOP, URL_ELCL + "nav_stop.gif"); //$NON-NLS-1$
	registerImage(IMG_ELCL_NAV_REFRESH, URL_ELCL + "nav_refresh.gif"); //$NON-NLS-1$
	registerImage(IMG_ELCL_NAV_GO, URL_ELCL + "nav_go.gif"); //$NON-NLS-1$
	registerImage(IMG_ELCL_NAV_HOME, URL_ELCL + "nav_home.gif"); //$NON-NLS-1$
	registerImage(IMG_ELCL_COMMAND, URL_ELCL + "command.png"); //$NON-NLS-1$
	
	registerImage(IMG_DLCL_NAV_BACKWARD, URL_DLCL + "nav_backward.gif"); //$NON-NLS-1$
	registerImage(IMG_DLCL_NAV_FORWARD, URL_DLCL + "nav_forward.gif"); //$NON-NLS-1$
	registerImage(IMG_DLCL_NAV_STOP, URL_DLCL + "nav_stop.gif"); //$NON-NLS-1$
	registerImage(IMG_DLCL_NAV_REFRESH, URL_DLCL + "nav_refresh.gif"); //$NON-NLS-1$
	registerImage(IMG_DLCL_NAV_GO, URL_DLCL + "nav_go.gif"); //$NON-NLS-1$
	registerImage(IMG_DLCL_NAV_HOME, URL_DLCL + "nav_home.gif"); //$NON-NLS-1$	
}
 
Example #2
Source File: BusinessObjectPlugin.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public static Image getImage(final String imageName) {
    final ImageRegistry reg = getDefault().getImageRegistry();

    Image result = reg.get(imageName);

    if (result != null && !result.isDisposed()) {//prevent from bad dispose
        return result;
    }

    final ImageDescriptor descriptor = ImageDescriptor.createFromURL(getDefault().getBundle().getResource(imageName));
    if (descriptor != null) {
        result = descriptor.createImage();
    }

    reg.remove(imageName);
    if (result != null) {
        reg.put(imageName, result);
    }

    return result;
}
 
Example #3
Source File: JSPlugin.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * getImage
 * 
 * @param path
 * @return
 */
public static Image getImage(String path)
{
	ImageRegistry registry = PLUGIN.getImageRegistry();
	Image image = registry.get(path);
	if (image == null)
	{
		ImageDescriptor id = getImageDescriptor(path);
		if (id == null)
		{
			return null;
		}
		registry.put(path, id);
		image = registry.get(path);
	}
	return image;
}
 
Example #4
Source File: CamelDesignerPlugin.java    From tesb-studio-se with Apache License 2.0 6 votes vote down vote up
@Override
protected void initializeImageRegistry(ImageRegistry reg) {
    super.initializeImageRegistry(reg);
    reg.put(BEAN_WIZ_ICON, createImageDescriptor(BEAN_WIZ_ICON).createImage());

    reg.put(DEPEN_ICON, createImageDescriptor(DEPEN_ICON).createImage());
    reg.put(BUNDLE_CP_ICON, createImageDescriptor(BUNDLE_CP_ICON).createImage());
    reg.put(REQUIRE_BD_ICON, createImageDescriptor(REQUIRE_BD_ICON).createImage());
    reg.put(IMPORT_PKG_ICON, createImageDescriptor(IMPORT_PKG_ICON).createImage());
    reg.put(REFRESH_ICON, createImageDescriptor(REFRESH_ICON).createImage());
    reg.put(GRAY_REM_ICON, createImageDescriptor(GRAY_REM_ICON).createImage());
    reg.put(HIGHLIGHT_REM_ICON, createImageDescriptor(HIGHLIGHT_REM_ICON).createImage());
    reg.put(OPTIONAL_OVERLAY_ICON, createImageDescriptor(OPTIONAL_OVERLAY_ICON).createImage());
    reg.put(IMPORT_PACKAGE_OVERLAY_ICON, getOptionalOverlayIcon(getImage(IMPORT_PKG_ICON)));
    reg.put(REQUIRE_BUNDLE_OVERLAY_ICON, getOptionalOverlayIcon(getImage(REQUIRE_BD_ICON)));
}
 
Example #5
Source File: XYGraphMediaFactory.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Private constructor to avoid instantiation.
 */
private XYGraphMediaFactory() {
	_colorRegistry = new ColorRegistry();
	_imageRegistry = new ImageRegistry();
	_fontRegistry = new FontRegistry();
	cursorRegistry = new HashMap<String, Cursor>();
	_imageCache = new HashMap<ImageDescriptor, Image>();

	// dispose all images from the image cache, when the display is disposed
	Display.getDefault().addListener(SWT.Dispose, new Listener() {
		public void handleEvent(final Event event) {
			for (Image img : _imageCache.values()) {
				img.dispose();
			}
			disposeResources();
		}
	});

}
 
Example #6
Source File: BasicSymbolProviderPreferencePage.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Image getImage(Object element) {
    if (element instanceof IMappingFile) {
        // Add binary/mapping icons to the image registry if needed
        ImageRegistry registry = Activator.getDefault().getImageRegistry();
        Image binImage = registry.get(BIN_ICON.toString());
        if (binImage == null) {
            registry.put(BIN_ICON.toString(), BIN_ICON);
            binImage = registry.get(BIN_ICON.toString());
        }
        Image txtImage = registry.get(TXT_ICON.toString());
        if (txtImage == null) {
            registry.put(TXT_ICON.toString(), TXT_ICON);
            txtImage = registry.get(TXT_ICON.toString());
        }

        return ((IMappingFile) element).isBinaryFile() ? binImage : txtImage;
    }

    return null;
}
 
Example #7
Source File: StaticHTMLPrviewPlugin.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private void registerImage( ImageRegistry registry, String key,
		String fileName )
{
	try
	{
		IPath path = new Path( "icons/" + fileName ); //$NON-NLS-1$
		URL url = find( path );
		if ( url != null )
		{
			ImageDescriptor desc = ImageDescriptor.createFromURL( url );
			registry.put( key, desc );
		}
	}
	catch ( Exception e )
	{
	}
}
 
Example #8
Source File: SVGPlugin.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * getImage
 * 
 * @param path
 * @return
 */
public static Image getImage(String path)
{
	ImageRegistry registry = plugin.getImageRegistry();
	Image image = registry.get(path);

	if (image == null)
	{
		ImageDescriptor id = getImageDescriptor(path);

		if (id != null)
		{
			registry.put(path, id);
			image = registry.get(path);
		}
	}

	return image;
}
 
Example #9
Source File: DotActivatorEx.java    From gef with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected void initializeImageRegistry(ImageRegistry reg) {
	for (String colorScheme : DotColors.getColorSchemes()) {
		for (String colorName : DotColors.getColorNames(colorScheme)) {
			String hex = DotColors.get(colorScheme, colorName);
			/*
			 * The same hex color code can belong to more than one color
			 * names (synonyms) within one color scheme
			 */
			if (reg.get(hex) == null) {
				Image image = createImage(hex);
				reg.put(hex, image);
			}
		}
	}
}
 
Example #10
Source File: BasicSymbolProviderPreferencePage.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Image getImage(Object element) {
    if (element instanceof IMappingFile) {
        // Add binary/mapping icons to the image registry if needed
        ImageRegistry registry = Objects.requireNonNull(Activator.getDefault()).getImageRegistry();
        Image binImage = registry.get(BIN_ICON.toString());
        if (binImage == null) {
            registry.put(BIN_ICON.toString(), BIN_ICON);
            binImage = registry.get(BIN_ICON.toString());
        }
        Image txtImage = registry.get(TXT_ICON.toString());
        if (txtImage == null) {
            registry.put(TXT_ICON.toString(), TXT_ICON);
            txtImage = registry.get(TXT_ICON.toString());
        }

        return ((IMappingFile) element).isBinaryFile() ? binImage : txtImage;
    }

    return null;
}
 
Example #11
Source File: LivingApplicationPlugin.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public static Image getImage(final String imageName) {
    final ImageRegistry reg = getDefault().getImageRegistry();

    Image result = reg.get(imageName);

    if (result != null && !result.isDisposed()) {//prevent from bad dispose
        return result;
    }

    final ImageDescriptor descriptor = ImageDescriptor.createFromURL(getDefault().getBundle().getResource(imageName));
    if (descriptor != null) {
        result = descriptor.createImage();
    }

    reg.remove(imageName);
    if (result != null) {
        reg.put(imageName, result);
    }

    return result;
}
 
Example #12
Source File: ScriptingUIPlugin.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the image on the specified path.
 * 
 * @param path
 *            the path to the image
 * @return Image the image object
 */
public static Image getImage(String path)
{
	ImageRegistry registry = getDefault().getImageRegistry();

	if (registry.get(path) == null)
	{
		ImageDescriptor id = getImageDescriptor(path);

		if (id != null)
		{
			registry.put(path, id);
		}
	}

	return registry.get(path);
}
 
Example #13
Source File: CPVariableElementLabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public CPVariableElementLabelProvider(boolean highlightReadOnly) {
	ImageRegistry reg= JavaPlugin.getDefault().getImageRegistry();
	fJARImage= reg.get(JavaPluginImages.IMG_OBJS_EXTJAR);
	fFolderImage= PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);

	fDeprecatedJARImage= new DecorationOverlayIcon(fJARImage, JavaPluginImages.DESC_OVR_DEPRECATED, IDecoration.TOP_LEFT).createImage();
	fDeprecatedFolderImage= new DecorationOverlayIcon(fFolderImage, JavaPluginImages.DESC_OVR_DEPRECATED, IDecoration.TOP_LEFT).createImage();

	fHighlightReadOnly= highlightReadOnly;
}
 
Example #14
Source File: UIHelper.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public static Image getImage( String imgKey, ImageDescriptor descriptor )
{
	ImageRegistry registry = JFaceResources.getImageRegistry( );
	Image image = registry.get( imgKey );
	if ( image == null )
	{
		image = descriptor.createImage( );
		if ( image != null )
		{
			registry.put( imgKey, image );
		}
	}
	return image;
}
 
Example #15
Source File: Activator.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void initializeImageRegistry(ImageRegistry reg) {
    reg.put(ITmfImageConstants.IMG_UI_ZOOM, getImageFromPath(ITmfImageConstants.IMG_UI_ZOOM));
    reg.put(ITmfImageConstants.IMG_UI_ZOOM_IN, getImageFromPath(ITmfImageConstants.IMG_UI_ZOOM_IN));
    reg.put(ITmfImageConstants.IMG_UI_ZOOM_OUT, getImageFromPath(ITmfImageConstants.IMG_UI_ZOOM_OUT));
    reg.put(ITmfImageConstants.IMG_UI_SEQ_DIAGRAM_OBJ, getImageFromPath(ITmfImageConstants.IMG_UI_SEQ_DIAGRAM_OBJ));
    reg.put(ITmfImageConstants.IMG_UI_ARROW_COLLAPSE_OBJ, getImageFromPath(ITmfImageConstants.IMG_UI_ARROW_COLLAPSE_OBJ));
    reg.put(ITmfImageConstants.IMG_UI_ARROW_UP_OBJ, getImageFromPath(ITmfImageConstants.IMG_UI_ARROW_UP_OBJ));
    reg.put(ITmfImageConstants.IMG_UI_CONFLICT, getImageFromPath(ITmfImageConstants.IMG_UI_CONFLICT));
}
 
Example #16
Source File: JSModelFormatter.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private Image addOverlay(Image base, ImageDescriptor overlay, int location, String key)
{
	ImageRegistry reg = getImageRegistry();
	Image cached = reg.get(key);
	if (cached != null)
	{
		return cached;
	}

	DecorationOverlayIcon decorator = new DecorationOverlayIcon(base, overlay, location);
	Image result = decorator.createImage();
	reg.put(key, result);
	return result;
}
 
Example #17
Source File: Activator.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void initializeImageRegistry ( final ImageRegistry reg )
{
    super.initializeImageRegistry ( reg );
    reg.put ( ImageConstants.IMG_EVENTS, imageDescriptorFromPlugin ( PLUGIN_ID, "icons/events.png" ) );
    reg.put ( ImageConstants.IMG_MONITORS, imageDescriptorFromPlugin ( PLUGIN_ID, "icons/monitors.png" ) );
}
 
Example #18
Source File: ProcessNavigatorLabelProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
private Image getImage(String key, IElementType elementType) {
	ImageRegistry imageRegistry = ProcessDiagramEditorPlugin.getInstance().getImageRegistry();
	Image image = imageRegistry.get(key);
	if (image == null && elementType != null && ProcessElementTypes.isKnownElementType(elementType)) {
		image = ProcessElementTypes.getImage(elementType);
		imageRegistry.put(key, image);
	}

	if (image == null) {
		image = imageRegistry.get("Navigator?ImageNotFound"); //$NON-NLS-1$
		imageRegistry.put(key, image);
	}
	return image;
}
 
Example #19
Source File: UIEplPlugin.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates the specified image descriptor and registers it
 */
private void createImageDescriptor(String id, ImageRegistry reg)
{
	URL url = FileLocator.find(getBundle(), new Path(ICON_PATH).append(id), null);
	ImageDescriptor desc = ImageDescriptor.createFromURL(url);
	reg.put(id, desc);
}
 
Example #20
Source File: GWTPlugin.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void initializeImageRegistry(ImageRegistry reg) {
  super.initializeImageRegistry(reg);

  reg.put(GWTImages.GWT_ICON, imageDescriptorFromPath("icons/gwt_16x16.png"));
  reg.put(GWTImages.GWT_ICON_CODESERVER, imageDescriptorFromPath("icons/gwt_codeserver_16x16.png"));
  reg.put(GWTImages.GWT_ICON_COMPILER, imageDescriptorFromPath("icons/gwt_compiler_16x16.png"));

  reg.put(GWTImages.GWT_LOGO, imageDescriptorFromPath("icons/gwt_75x46.png"));
  reg.put(GWTImages.JAVA_ICON, imageDescriptorFromPath("icons/jcu_obj.gif"));

  reg.put(GWTImages.JSNI_DEFAULT_METHOD_SMALL, imageDescriptorFromPath("icons/methdef_obj.gif"));
  reg.put(GWTImages.JSNI_PRIVATE_METHOD_SMALL, imageDescriptorFromPath("icons/methpri_obj.gif"));
  reg.put(GWTImages.JSNI_PROTECTED_METHOD_SMALL, imageDescriptorFromPath("icons/methpro_obj.gif"));
  reg.put(GWTImages.JSNI_PUBLIC_METHOD_SMALL, imageDescriptorFromPath("icons/methpub_obj.gif"));

  reg.put(GWTImages.NEW_ASYNC_INTERFACE_LARGE, imageDescriptorFromPath("icons/gwt-new-asyncinterface_large.png"));
  reg.put(GWTImages.NEW_ASYNC_INTERFACE_SMALL, imageDescriptorFromPath("icons/gwt-new-asyncinterface_small.png"));

  reg.put(GWTImages.EDITOR_SELECTION_INFO, imageDescriptorFromPath("icons/wordassist_co.gif"));
  reg.put(GWTImages.NEW_ENTRY_POINT_LARGE, imageDescriptorFromPath("icons/gwt-new-entrypoint_large.png"));
  reg.put(GWTImages.NEW_ENTRY_POINT_SMALL, imageDescriptorFromPath("icons/gwt-new-entrypoint_small.png"));

  reg.put(GWTImages.NEW_HOST_PAGE_LARGE, imageDescriptorFromPath("icons/gwt-new-hostpage_large.png"));
  reg.put(GWTImages.NEW_HOST_PAGE_SMALL, imageDescriptorFromPath("icons/gwt-new-hostpage_small.png"));
  reg.put(GWTImages.NEW_MODULE_LARGE, imageDescriptorFromPath("icons/gwt-new-module_large.png"));
  reg.put(GWTImages.NEW_MODULE_SMALL, imageDescriptorFromPath("icons/gwt-new-module_small.png"));
  reg.put(GWTImages.MODULE_ICON, imageDescriptorFromPath("icons/gwt-module-file_small.gif"));
  reg.put(GWTImages.GWT_COMPILE_LARGE, imageDescriptorFromPath("icons/gwt_75x46.png"));
  reg.put(GWTImages.NEW_CLIENT_BUNDLE_LARGE, imageDescriptorFromPath("icons/gwt-new-clientbundle_large.png"));
  reg.put(GWTImages.NEW_CLIENT_BUNDLE_SMALL, imageDescriptorFromPath("icons/gwt-new-clientbundle_small.png"));
  reg.put(GWTImages.NEW_UI_BINDER_LARGE, imageDescriptorFromPath("icons/gwt-new-uibinder_large.png"));
  reg.put(GWTImages.NEW_UI_BINDER_SMALL, imageDescriptorFromPath("icons/gwt-new-uibinder_small.png"));
}
 
Example #21
Source File: CrosstabUIHelper.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This is a convenience method to get an imgIcon from a URL.
 * 
 * @param sPluginRelativePath
 *            The URL for the imgIcon.
 * @return The imgIcon represented by the given URL.
 * @see #setImageCached( boolean )
 */
public static Image getImage( String sPluginRelativePath )
{
	ImageRegistry registry = JFaceResources.getImageRegistry( );
	Image image = registry.get( sPluginRelativePath );
	if ( image == null )
	{
		image = createImage( sPluginRelativePath );
		registry.put( sPluginRelativePath, image );
	}
	return image;
}
 
Example #22
Source File: Images.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
static void registerImages( ImageRegistry registry ) {
  Field[] declaredFields = Images.class.getDeclaredFields();
  for( Field field : declaredFields ) {
    if( isStringConstant( field ) ) {
      registerImage( registry, getStringValue( field ) );
    }
  }
}
 
Example #23
Source File: UIHelper.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This is a convenience method to get an imgIcon from a URL.
 * 
 * @param sPluginRelativePath
 *            The URL for the imgIcon.
 * @return The imgIcon represented by the given URL.
 * @see #setImageCached( boolean )
 */
public static Image getImage( String sPluginRelativePath )
{
	ImageRegistry registry = JFaceResources.getImageRegistry( );
	String resourcePath = ChartUIPlugin.ID + "/" + sPluginRelativePath; //$NON-NLS-1$
	Image image = registry.get( resourcePath );
	if ( image == null )
	{
		image = createImage( sPluginRelativePath );
		registry.put( resourcePath, image );
	}
	return image;
}
 
Example #24
Source File: Images.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
private static ImageRegistry getImageRegistry() {
  ImageRegistry result = null;
  LaunchExtrasPlugin pluginInstance = LaunchExtrasPlugin.getInstance();
  if( pluginInstance != null && pluginInstance.getBundle().getState() == Bundle.ACTIVE ) {
    result = pluginInstance.getImageRegistry();
  }
  return result;
}
 
Example #25
Source File: Activator.java    From EasyShell with Eclipse Public License 2.0 5 votes vote down vote up
protected void initializeImageRegistry(ImageRegistry registry) {
   imageNames = new ArrayList<String>();
   Bundle bundle = Platform.getBundle(Constants.PLUGIN_ID);
   OS os = Utils.getOS();
   for (String imageId : Category.getImageIdsAsList()) {
       String imagePath = Constants.IMAGE_PATH + os.getId() + "/" + imageId + Constants.IMAGE_EXT;
       URL url = bundle.getEntry(imagePath);
       if (url == null) {
           imagePath = Constants.IMAGE_PATH + imageId + Constants.IMAGE_EXT;
       }
       addImageToRegistry(registry, bundle, imagePath, imageId);
   }
   addImageToRegistry(registry, bundle, Constants.IMAGE_PATH + Constants.IMAGE_EASYSHELL + Constants.IMAGE_EXT, Constants.IMAGE_EASYSHELL);
   addImageToRegistry(registry, bundle, Constants.IMAGE_PATH + Constants.IMAGE_ECLIPSE + Constants.IMAGE_EXT, Constants.IMAGE_ECLIPSE);
}
 
Example #26
Source File: Images.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
public static ImageDescriptor getImageDescriptor( String name ) {
  ImageDescriptor result = null;
  ImageRegistry imageRegistry = getImageRegistry();
  if( imageRegistry != null ) {
    result = imageRegistry.getDescriptor( name );
  }
  return result;
}
 
Example #27
Source File: UIHelper.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This is a convenience method to get an imgIcon from a URL.
 * 
 * @param sPluginRelativePath
 *            The URL for the imgIcon.
 * @return The imgIcon represented by the given URL.
 * @throws IOException
 * @see #setImageCached(boolean )
 */
public static Image getImage( String sPluginRelativePath )
		throws IOException
{
	ImageRegistry registry = JFaceResources.getImageRegistry( );
	Image image = registry.get( sPluginRelativePath );
	if ( image == null )
	{
		image = createImage( sPluginRelativePath );
		registry.put( sPluginRelativePath, image );
	}
	return image;
}
 
Example #28
Source File: Images.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
private static ImageRegistry getImageRegistry() {
  ImageRegistry result = null;
  WorkingSetExtrasPlugin pluginInstance = WorkingSetExtrasPlugin.getInstance();
  if( pluginInstance != null && pluginInstance.getBundle().getState() == Bundle.ACTIVE ) {
    result = pluginInstance.getImageRegistry();
  }
  return result;
}
 
Example #29
Source File: JsniMethodBodyCompletionProposalComputerTest.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Test that the icons that we depend on are included in the registry.
 */
public void testIcons() {
  // TODO: This should really be a test of GWTImages.
  GWTPlugin plugin = GWTPlugin.getDefault();
  ImageRegistry imageRegistry = plugin.getImageRegistry();
  for (String imageId : IMAGE_IDS) {
    Image image = imageRegistry.get(imageId);
    assertNotNull("ImageId: " + imageId + " was not in the ImageRegistry",
        image);
  }
}
 
Example #30
Source File: UIHelper.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This is a convenience method to get an imgIcon from a URL.
 * 
 * @param sPluginRelativePath
 *            The URL for the imgIcon.
 * @return The imgIcon represented by the given URL.
 * @see #setImageCached( boolean )
 */
public static ImageDescriptor getImageDescriptor( String sPluginRelativePath )
{
	ImageRegistry registry = JFaceResources.getImageRegistry( );
	ImageDescriptor image = registry.getDescriptor( sPluginRelativePath );
	if ( image == null )
	{
		registry.put( sPluginRelativePath,
				createImage( sPluginRelativePath ) );
		image = registry.getDescriptor( sPluginRelativePath );
	}
	return image;
}