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

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

Introduction

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

Prototype

public ImageData getImageData(int zoom) 

Source Link

Document

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

Usage

From source file:de.fhg.igd.swingrcp.SwingAction.java

License:Open Source License

/**
 * Creates a Swing action from a JFace action
 * //from  ww w . java  2  s  .  c om
 * @param action the JFace action
 */
public SwingAction(IAction action) {
    super();
    this.action = action;

    putValue(Action.NAME, action.getText());
    putValue(Action.SHORT_DESCRIPTION, action.getToolTipText());
    putValue(Action.LONG_DESCRIPTION, action.getDescription());

    ImageDescriptor imageDesc = action.getImageDescriptor();
    if (imageDesc != null) {
        ImageData imageData = imageDesc.getImageData(100);

        if (imageData != null) {
            BufferedImage img = SwingRCPUtilities.convertToAWT(imageData, true);
            ImageIcon icon = new ImageIcon(img);
            putValue(Action.SMALL_ICON, icon);
        }
    }
}