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:com.google.gdt.eclipse.managedapis.ui.ManageApiInfoDecorator.java

License:Open Source License

/**
 * Checks if classpath entry will cause error. If it does, it will add error
 * icon to Managed Api container and return true. Else will return false.
 *///from w ww . j a  va 2  s.co  m
private boolean checkAndApplyErrorDecoration(IDecoration decoration, ManagedApiProject managedApiProject,
        IClasspathEntry entry) {
    if (!JavaConventions.validateClasspathEntry(managedApiProject.getJavaProject(), entry, false).isOK()) {
        ImageDescriptor overlay = JFaceResources.getImageRegistry()
                .getDescriptor("org.eclipse.jface.fieldassist.IMG_DEC_FIELD_ERROR");
        decoration.addOverlay(overlay, IDecoration.BOTTOM_LEFT);
        return true;
    }
    return false;
}

From source file:com.hangum.tadpole.rdb.core.viewers.connections.DBIconsUtils.java

License:Open Source License

/**
 * //from  www.j  av  a2 s. c  o m
 * @param pluginId
 * @param imgURL
 * @return
 */
public static ImageDescriptor getPluginImageDescriptor(String pluginId, String imgURL) {
    String imgKey = pluginId + imgURL;

    ImageDescriptor descriptor = JFaceResources.getImageRegistry().getDescriptor(imgKey);
    if (descriptor == null) {
        //         if(logger.isDebugEnabled()) logger.debug(String.format("==[image][new][key] %s]", imgKey));
        try {
            descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, imgURL);
            JFaceResources.getImageRegistry().put(pluginId, descriptor);
        } catch (Exception e) {
            logger.error("create image exception", e);
        }
        return descriptor;
    } else {
        if (logger.isDebugEnabled())
            logger.debug(String.format("==[image][registery] %s]", imgKey));

        return descriptor;
    }
}

From source file:com.hundsun.ares.studio.ui.control.deprecated.FilteredTable.java

License:Open Source License

/**
 * Create the button that clears the text.
 * //from www  .  ja  va  2s.c o m
 * @param parent parent <code>Composite</code> of toolbar button 
 */
private void createClearText(Composite parent) {
    // only create the button if the text widget doesn't support one natively
    if ((filterText.getStyle() & SWT.CANCEL) == 0) {
        filterToolBar = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
        filterToolBar.createControl(parent);

        IAction clearTextAction = new Action("", IAction.AS_PUSH_BUTTON) {//$NON-NLS-1$
            /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.jface.action.Action#run()
             */
            public void run() {
                clearText();
            }
        };

        clearTextAction.setToolTipText(WorkbenchMessages.FilteredTree_ClearToolTip);
        clearTextAction.setImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(CLEAR_ICON));
        clearTextAction
                .setDisabledImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(DCLEAR_ICON));

        filterToolBar.add(clearTextAction);
    }
}

From source file:com.hydra.project.myplugin_nebula.xviewer.util.internal.FilteredTreeComposite.java

License:Open Source License

/**
 * Create the button that clears the text.
 * // w  ww .j a va2  s  .c  o  m
 * @param parent parent <code>Composite</code> of toolbar button
 */
private void createClearText(Composite parent) {
    // only create the button if the text widget doesn't support one
    // natively
    if ((filterText.getStyle() & SWT.CANCEL) == 0) {
        filterToolBar = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
        filterToolBar.createControl(parent);

        IAction clearTextAction = new Action("", IAction.AS_PUSH_BUTTON) {//$NON-NLS-1$
            @Override
            public void run() {
                clearText();
            }
        };

        clearTextAction.setToolTipText(WorkbenchMessages.FilteredTree_ClearToolTip);
        clearTextAction.setImageDescriptor(XViewerImageCache.getImageDescriptor("clear.gif")); //$NON-NLS-1$
        clearTextAction
                .setDisabledImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(DCLEAR_ICON));

        filterToolBar.add(clearTextAction);
    }
}

From source file:com.ibm.research.tagging.core.ui.controls.FilteredTable.java

License:Open Source License

/**
 * Create the button that clears the text.
 * //from   w  ww  .j ava 2s.co m
 * @param parent parent <code>Composite</code> of toolbar button 
 */
private void createClearText(Composite parent) {
    ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.HORIZONTAL);
    filterToolBar = new ToolBarManager(toolBar);

    IAction clearTextAction = new Action("", IAction.AS_PUSH_BUTTON) {//$NON-NLS-1$
        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.jface.action.Action#run()
         */
        public void run() {
            clearText();
        }
    };

    clearTextAction.setToolTipText(WorkbenchMessages.FilteredTree_ClearToolTip);
    clearTextAction.setImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(CLEAR_ICON));
    clearTextAction.setDisabledImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(DCLEAR_ICON));

    filterToolBar.add(clearTextAction);
}

From source file:com.mindquarry.desktop.client.MindClient.java

License:Open Source License

private void initRegistries() {
    ImageRegistry reg = JFaceResources.getImageRegistry();

    Image img;/*  w  w  w.ja  v  a2  s  .c om*/
    if (SVNFileUtil.isOSX) {
        img = new Image(Display.getCurrent(),
                MindClient.class.getResourceAsStream("/com/mindquarry/icons/128x128/logo/mindquarry-icon.png")); //$NON-NLS-1$
    } else {
        img = new Image(Display.getCurrent(),
                MindClient.class.getResourceAsStream("/com/mindquarry/icons/32x32/logo/mindquarry-icon.png")); //$NON-NLS-1$
    }
    reg.put(CLIENT_IMG_KEY, img);

    img = new Image(Display.getCurrent(), MindClient.class
            .getResourceAsStream("/org/tango-project/tango-icon-theme/16x16/apps/help-browser.png")); //$NON-NLS-1$
    reg.put(Dialog.DLG_IMG_HELP, img);

    Image trayImg = new Image(Display.getCurrent(),
            MindClient.class.getResourceAsStream("/com/mindquarry/icons/16x16/logo/mindquarry-icon.png")); //$NON-NLS-1$
    reg.put(CLIENT_TRAY_IMG_KEY, trayImg);

    FontRegistry fReg = JFaceResources.getFontRegistry();
    fReg.put(TASK_TITLE_FONT_KEY, getTaskFont());
    fReg.put(TASK_DESC_FONT_KEY, getTaskDescriptionFont());
    fReg.put(TEAM_NAME_FONT_KEY, getTeamFont());
}

From source file:com.mindquarry.desktop.client.widget.task.TaskLabelProvider.java

License:Open Source License

private Image createOverlayIcon(Task task) {
    ImageRegistry reg = JFaceResources.getImageRegistry();

    String id = TASK_PREFIX + task.getStatus();
    if (task.getPriority() != null) {
        id += "-" + task.getPriority();
    }/*  w ww  . jav  a2 s  .  c o m*/

    Image result = reg.get(id);
    if (result == null) {
        String rID = "/com/mindquarry/icons/" + ICON_SIZE + "x" + ICON_SIZE + "/status/task-" + task.getStatus()
                + ".png";
        InputStream is = TaskLabelProvider.class.getResourceAsStream(rID);

        if (task.getPriority() == null) {
            result = new Image(Display.getDefault(), is);
            reg.put(id, result);
        } else {
            try {
                BufferedImage statusImg = ImageIO.read(is);

                rID = "/com/mindquarry/icons/" + OVERLAY_ICON_SIZE + "x" + OVERLAY_ICON_SIZE + "/emblems/task-"
                        + task.getPriority() + ".png";
                is = TaskLabelProvider.class.getResourceAsStream(rID);
                BufferedImage priorityImg = ImageIO.read(is);

                int offset = ICON_SIZE - OVERLAY_ICON_SIZE;
                ImageAdaptor combImg = ImageHelper.combine(statusImg, priorityImg, offset, offset);

                result = combImg.toSwtImage();
                reg.put(id, result);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    return result;
}

From source file:com.mindquarry.desktop.minutes.editor.MinutesEditor.java

License:Open Source License

/**
 * Initialzes the image registry for the minutes editor.
 *//*from ww  w  .  j  a v a 2 s . c om*/
private void initRegistries() {
    ImageRegistry reg = JFaceResources.getImageRegistry();

    Image img = new Image(Display.getCurrent(),
            MinutesEditor.class.getResourceAsStream("/com/mindquarry/icons/16x16/logo/mindquarry-icon.png")); //$NON-NLS-1$
    reg.put(EDITOR_IMG_KEY, img);
    img = new Image(Display.getCurrent(), MinutesEditor.class
            .getResourceAsStream("/org/tango-project/tango-icon-theme/22x22/emotes/face-smile.png")); //$NON-NLS-1$
    reg.put(SMILE_IMG_KEY, img);

    FontRegistry fReg = JFaceResources.getFontRegistry();
    fReg.put(CONV_TOPIC_TITLE_FONT_KEY, new FontData[] { new FontData("Arial", //$NON-NLS-1$
            10, SWT.ITALIC) });
    fReg.put(CONV_TITLE_FONT_KEY, new FontData[] { new FontData("Arial", //$NON-NLS-1$
            10, SWT.BOLD) });
}

From source file:com.mmkarton.mx7.reportgenerator.util.ProcedureColumnNode.java

License:Open Source License

public Image getImage() {
    // TODO Auto-generated method stub
    return JFaceResources.getImageRegistry().get(PROCEDURE_COLUMN_ICON);
}

From source file:com.mmkarton.mx7.reportgenerator.util.ProcedureNode.java

License:Open Source License

public Image getImage() {
    return JFaceResources.getImageRegistry().get(PROCEDURE_ICON);
}