Example usage for org.eclipse.jface.resource JFaceResources getImageRegistry

List of usage examples for org.eclipse.jface.resource JFaceResources getImageRegistry

Introduction

In this page you can find the example usage for org.eclipse.jface.resource JFaceResources getImageRegistry.

Prototype

public static ImageRegistry getImageRegistry() 

Source Link

Document

Returns the image registry for JFace itself.

Usage

From source file:org.marketcetera.photon.commons.ui.FilterBox.java

protected Control createClearControl(Composite composite) {
    final Image inactiveImage = JFaceResources.getImageRegistry().getDescriptor(DCLEAR_ICON).createImage();
    final Image activeImage = JFaceResources.getImageRegistry().getDescriptor(CLEAR_ICON).createImage();

    final Label clearButton = new Label(composite, SWT.NONE);
    clearButton.setImage(inactiveImage);
    clearButton.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    clearButton.setToolTipText(Messages.FilterBox_clearButton_tooltip);
    clearButton.addMouseListener(new MouseAdapter() {
        @Override//from  ww w . j av  a2  s  .com
        public void mouseDown(MouseEvent e) {
            clearText();
        }
    });
    clearButton.addMouseTrackListener(new MouseTrackAdapter() {
        @Override
        public void mouseEnter(MouseEvent e) {
            clearButton.setImage(activeImage);
        }

        @Override
        public void mouseExit(MouseEvent e) {
            clearButton.setImage(inactiveImage);
        }
    });
    clearButton.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            inactiveImage.dispose();
            activeImage.dispose();
        }
    });
    return clearButton;
}

From source file:org.marketcetera.photon.commons.ui.workbench.FilterBox.java

protected Control createClearControl(Composite composite) {
    final Image inactiveImage = JFaceResources.getImageRegistry().getDescriptor(DCLEAR_ICON).createImage();
    final Image activeImage = JFaceResources.getImageRegistry().getDescriptor(CLEAR_ICON).createImage();

    final Label clearButton = new Label(composite, SWT.NONE);
    clearButton.setImage(inactiveImage);
    clearButton.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    clearButton.setToolTipText(Messages.FILTER_BOX_CLEAR_BUTTON_TOOLTIP.getText());
    clearButton.addMouseListener(new MouseAdapter() {
        @Override/*from   www  . j  a va 2  s. c  om*/
        public void mouseDown(MouseEvent e) {
            clearText();
        }
    });
    clearButton.addMouseTrackListener(new MouseTrackAdapter() {
        @Override
        public void mouseEnter(MouseEvent e) {
            clearButton.setImage(activeImage);
        }

        @Override
        public void mouseExit(MouseEvent e) {
            clearButton.setImage(inactiveImage);
        }
    });
    clearButton.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            inactiveImage.dispose();
            activeImage.dispose();
        }
    });
    return clearButton;
}

From source file:org.ow2.aspirerfid.ide.bpwme.navigator.BpwmeLabelProvider.java

License:Open Source License

/**
 * Returns the image for each element//  w  w w  .  j  a v  a 2  s.c o  m
 */
private Image getImageImage(String path, String pluginPath) {
    Image image = JFaceResources.getImageRegistry().get(path);
    if (image == null) {
        ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(pluginPath, path);
        if (descriptor == null) {
            descriptor = ImageDescriptor.getMissingImageDescriptor();
        }
        JFaceResources.getImageRegistry().put(path, image = descriptor.createImage());
    }
    return image;
}

From source file:org.ow2.aspirerfid.ide.MasterDataEditorGMF.images.ImageNodeShape.java

License:Open Source License

protected Image getImageImage(String path) {
    Image image = JFaceResources.getImageRegistry().get(path);
    if (image == null) {
        ImageDescriptor descriptor = AbstractUIPlugin
                .imageDescriptorFromPlugin("org.ow2.aspirerfid.ide.MasterDataEditorGMF", path);
        if (descriptor == null) {
            descriptor = ImageDescriptor.getMissingImageDescriptor();
        }//from   w ww .  j a  v  a 2  s .com
        JFaceResources.getImageRegistry().put(path, image = descriptor.createImage());
    }
    return image;
}

From source file:org.ow2.petals.client.swt.ImageIds.java

License:Open Source License

/**
 * Loads all the images referenced by the class constants, into the JFace Resource manager.
 *//*from w  w  w  .  ja va  2 s. c o  m*/
public static void loadImageInJFaceResources(ClientApplication clientapp) {

    for (Field f : ImageIds.class.getDeclaredFields()) {
        try {
            String path = (String) f.get(String.class);
            if (path != null) {
                Image img = loadImage(path, clientapp);
                if (img != null)
                    JFaceResources.getImageRegistry().put(path, img);
            }

        } catch (IllegalArgumentException e) {
            clientapp.log(null, e, Level.INFO);

        } catch (IllegalAccessException e) {
            clientapp.log(null, e, Level.INFO);
        }
    }
}

From source file:org.pentaho.ui.xul.swt.tags.treeutil.XulTableColumnLabelProvider.java

License:Open Source License

public XulTableColumnLabelProvider(XulTree tree, XulDomContainer aDomContainer) {
    this.tree = tree;
    this.domContainer = aDomContainer;
    if (JFaceResources.getImageRegistry().getDescriptor(CHECKED) == null) {
        JFaceResources.getImageRegistry().put(UNCHECKED,
                makeImage(((TableViewer) tree.getManagedObject()).getControl().getShell(), false));
        JFaceResources.getImageRegistry().put(CHECKED,
                makeImage(((TableViewer) tree.getManagedObject()).getControl().getShell(), true));
    }//from   w w w .  j av  a2  s  . c o  m
}

From source file:org.pentaho.ui.xul.swt.tags.treeutil.XulTableColumnLabelProvider.java

License:Open Source License

public Image getColumnImage(Object row, int col) {
    if (tree.getColumns().getColumn(col).getColumnType() == ColumnType.CHECKBOX) {
        if (isSelected(row, col)) {
            return JFaceResources.getImageRegistry().get(CHECKED);
        } else {/*from w  w w .j  av a  2 s.c  om*/
            return JFaceResources.getImageRegistry().get(UNCHECKED);
        }
    }

    if (tree.getColumns().getColumn(col).getImagebinding() != null) {
        String src = ((SwtTreeItem) row).getImage();
        Display display = ((TableViewer) tree.getManagedObject()).getTable().getDisplay();
        return SwtXulUtil.getCachedImage(src, domContainer, display);
    }
    return null;
}

From source file:org.pentaho.ui.xul.util.SwtXulUtil.java

License:Open Source License

public static Image getCachedImage(String src, XulDomContainer container, Display display) {

    Image img = null;/*from w ww  .  j a va  2  s .c  o m*/

    if (src == null) {
        return null;
    }

    if (JFaceResources.getImageRegistry().getDescriptor(src) != null) {
        img = JFaceResources.getImageRegistry().get(src);
    }

    if (img == null) {
        InputStream in = null;
        try {
            in = XulUtil.loadResourceAsStream(src, container);
            if (in != null) {
                img = new Image(display, in);
                JFaceResources.getImageRegistry().put(src, img);
            }
        } catch (Exception e) {
            logger.error(e);
        } finally {
            try {
                in.close();
            } catch (Exception ignored) {
            }
        }
    }

    return img;
}

From source file:org.polarsys.reqcycle.jdt.model.JDTLabelProvider.java

License:Open Source License

@Override
public Image getImage(Object element) {
    Image image = JFaceResources.getImage(Activator.PLUGIN_ID + ICONS_JMETH_OBJ_GIF);
    if (image == null) {
        JFaceResources.getImageRegistry().put(Activator.PLUGIN_ID + ICONS_JMETH_OBJ_GIF, desc);
        image = JFaceResources.getImage(Activator.PLUGIN_ID + ICONS_JMETH_OBJ_GIF);
    }/*  w ww.  j  a va  2  s  .  c  o m*/
    return image;
}

From source file:org.polarsys.reqcycle.styling.ui.dialogs.IconRegistry.java

License:Open Source License

public static Image getImage(String id) {
    Image image = JFaceResources.getImageRegistry().get(id);
    return image;
}