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.eclipse.ui.internal.EditorManager.java

License:Open Source License

/**
 * Method to create the editor's pin ImageDescriptor
 * //from w w w .  ja v a  2  s . co m
 * @return the single image descriptor for the editor's pin icon
 */
ImageDescriptor getEditorPinImageDesc() {
    ImageRegistry registry = JFaceResources.getImageRegistry();
    ImageDescriptor pinDesc = registry.getDescriptor(PIN_EDITOR_KEY);
    // Avoid registering twice
    if (pinDesc == null) {
        pinDesc = WorkbenchImages.getWorkbenchImageDescriptor(PIN_EDITOR);
        registry.put(PIN_EDITOR_KEY, pinDesc);

    }
    return pinDesc;
}

From source file:org.eclipse.wst.css.ui.internal.image.CSSImageHelper.java

License:Open Source License

private ImageRegistry getImageRegistry() {
    return JFaceResources.getImageRegistry();
}

From source file:org.eclipse.wst.sse.ui.internal.StructuredMarkerAnnotation.java

License:Open Source License

private Image getGrayImage(Display display, Image image) {
    if (image != null) {
        String key = Integer.toString(image.hashCode());
        // make sure we cache the gray image
        Image grayImage = JFaceResources.getImageRegistry().get(key);
        if (grayImage == null) {
            grayImage = new Image(display, image, SWT.IMAGE_GRAY);
            JFaceResources.getImageRegistry().put(key, grayImage);
        }/*w w  w . j  av  a2  s.c om*/
        image = grayImage;
    }
    return image;
}

From source file:org.eclipse.wst.xml.ui.internal.contentassist.SourceEditorImageHelper.java

License:Open Source License

public Image createImage(String resource) {
    ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(XMLUIPlugin.ID, resource);
    Image image = desc.createImage();
    JFaceResources.getImageRegistry().put(resource, image);
    return image;
}

From source file:org.eclipse.wst.xml.ui.internal.contentassist.SourceEditorImageHelper.java

License:Open Source License

public Image getImage(String resource) {
    Image image = JFaceResources.getImageRegistry().get(resource);
    if (image == null) {
        image = createImage(resource);// w w  w.j  ava 2  s .  c o  m
    }
    return image;
}

From source file:org.eclipse.wst.xml.ui.internal.tabletree.XMLEditorPluginImageHelper.java

License:Open Source License

/**
 * Returns the image registry for this plugin.
 * /*from   w ww.  j  a va  2 s  .c  o m*/
 * @return ImageRegistry - image registry for this plugin
 */
private static ImageRegistry getImageRegistry() {
    return JFaceResources.getImageRegistry();
}

From source file:org.elbe.relations.RelationsImages.java

License:Open Source License

/**
 * @return {@link Image} this item's image
 *///from  ww w  . j ava2  s. co m
public Image getImage() {
    try {
        final ImageRegistry lRegistry = JFaceResources.getImageRegistry();
        Image outImage = lRegistry.get(name);
        if (outImage == null) {
            outImage = createImage(name, getDescriptor());
            lRegistry.put(name, outImage);
        }
        return outImage;
    } catch (final NullPointerException exc) {
        // provide an empty image for testing purposes
        return new Image(null, 1, 1);
    }
}

From source file:org.jboss.tools.central.editors.xpl.TextSearchControl.java

License:Open Source License

@SuppressWarnings("restriction")
public TextSearchControl(Composite parent, boolean automaticFind) {
    super(parent, getCompositeStyle(automaticFind, parent));

    int textStyle = SWT.SINGLE;
    int numColumns = 1;
    if (useNativeSearchField(automaticFind, parent)) {
        if (automaticFind) {
            textStyle |= SWT.SEARCH | ICON_CANCEL;
        } else {//from  ww w .  ja va2 s  . co  m
            textStyle |= SWT.SEARCH | ICON_SEARCH | ICON_CANCEL;
        }
    } else {
        super.setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
        super.setFont(parent.getFont());
        numColumns = 2;
        if (!automaticFind) {
            numColumns += 1;
        }
    }
    GridLayoutFactory.swtDefaults().margins(0, 0).extendedMargins(0, 0, 0, 0).spacing(0, 1)
            .numColumns(numColumns).applyTo(this);

    textControl = new Text(this, textStyle);
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);

    textControl.setLayoutData(gridData);

    KeyStroke stroke;
    String proposalKey = null;
    try {
        stroke = KeyStroke.getInstance("M1+SPACE"); //$NON-NLS-1$
        proposalKey = stroke.format();
    } catch (ParseException e1) {
        JBossCentralActivator.log(e1);
    }
    stroke = null;
    final ControlDecoration dec = new ControlDecoration(textControl, SWT.TOP | SWT.LEFT);
    FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault();
    FieldDecoration fd = registry.getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
    dec.setImage(fd.getImage());
    String description;
    if (proposalKey == null) {
        description = fd.getDescription();
    } else {
        description = fd.getDescription() + "(" + proposalKey + ")";
    }
    dec.setDescriptionText(description);

    dec.setImage(FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL).getImage());

    dec.setShowOnlyOnFocus(true);
    dec.setShowHover(true);

    ContentProposalAdapter adapter = new ContentProposalAdapter(textControl, new TextContentAdapter(),
            new SearchContentProposalProvider(), null, null);
    adapter.setPropagateKeys(true);
    adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);

    if (useNativeSearchField == null || !useNativeSearchField) {
        findControl = createLabelButtonControl(this, JFaceResources.getImageRegistry().getDescriptor(FIND_ICON),
                Messages.TextControl_AccessibleListenerFindButton, Messages.TextControl_FindToolTip,
                ICON_SEARCH);
        Point size = findControl.computeSize(SWT.DEFAULT, SWT.DEFAULT);
        GridData data = (GridData) textControl.getLayoutData();
        data.heightHint = size.y;
        clearControl = createLabelButtonControl(this,
                JFaceResources.getImageRegistry().getDescriptor(CLEAR_ICON),
                WorkbenchMessages.FilteredTree_ClearToolTip, //FilteredTree_AccessibleListenerClearButton,
                WorkbenchMessages.FilteredTree_ClearToolTip, ICON_CANCEL);
        addModifyListener(new ModifyListener() {

            public void modifyText(ModifyEvent e) {
                updateButtonVisibilityAndEnablement();

            }
        });
        updateButtonVisibilityAndEnablement();
    }

    IDialogSettings section = getSearchSettings();
    proposals = section.getArray(SEARCH_KEY);
    if (proposals == null) {
        proposals = new String[0];
        section.put(SEARCH_KEY, proposals);
    }
    String message = section.get(INITIAL_MESSAGE);
    if (message == null || message.isEmpty()) {
        message = JBossCentralActivator.SEARCH_THE_COMMUNITY;
    }
    setInitialMessage(message);

    registerListeners();
}

From source file:org.jlibrary.client.JLibraryPlugin.java

License:Open Source License

public ImageRegistry getImageRegistry() {

    return JFaceResources.getImageRegistry();
}

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

private static void testNativeSearchField(Composite composite) {
    if (useNativeSearchField == null) {
        useNativeSearchField = false;/*from   w w  w.  ja  v a  2 s. c  o  m*/
        Text testText = null;
        try {
            testText = new Text(composite, SWT.SEARCH | SWT.CANCEL);
            if ((testText.getStyle() & SWT.CANCEL) != 0) {
                useNativeSearchField = Boolean.TRUE;
            } else {
                ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(
                        "org.marketcetera.photon.commons.ui", //$NON-NLS-1$
                        "$nl$/icons/full/etool16/clear_co.gif"); //$NON-NLS-1$
                if (descriptor != null) {
                    JFaceResources.getImageRegistry().put(CLEAR_ICON, descriptor);
                }
                descriptor = AbstractUIPlugin.imageDescriptorFromPlugin("org.marketcetera.photon.commons.ui", //$NON-NLS-1$ 
                        "$nl$/icons/full/dtool16/clear_co.gif"); //$NON-NLS-1$
                if (descriptor != null) {
                    JFaceResources.getImageRegistry().put(DCLEAR_ICON, descriptor);
                }
            }
        } finally {
            if (testText != null) {
                testText.dispose();
            }
        }
    }
}