List of usage examples for org.eclipse.jface.resource JFaceResources getImageRegistry
public static ImageRegistry getImageRegistry()
From source file:org.eclipse.nebula.widgets.nattable.util.GUIHelper.java
License:Open Source License
public static Image getImage(String key) { Image image = JFaceResources.getImage(key); if (image == null) { URL imageUrl = getImageUrl(key); if (imageUrl != null) { ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(imageUrl); JFaceResources.getImageRegistry().put(key, imageDescriptor.createImage()); image = JFaceResources.getImage(key); }/*from w w w. jav a2s. com*/ } return image; }
From source file:org.eclipse.nebula.widgets.nattable.util.GUIHelper.java
License:Open Source License
public static Image getImage(ImageData data) { if (JFaceResources.getImage(data.toString()) == null) { JFaceResources.getImageRegistry().put(data.toString(), ImageDescriptor.createFromImageData(data)); }/* w w w .j a v a2 s .co m*/ return JFaceResources.getImage(data.toString()); }
From source file:org.eclipse.osee.framework.ui.skynet.widgets.dialog.FilteredTree.java
License:Open Source License
@Override protected Composite createFilterControls(Composite parent) { ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PlatformUI.PLUGIN_ID, "$nl$/icons/full/etool16/clear_co.gif"); //$NON-NLS-1$ if (descriptor != null) { JFaceResources.getImageRegistry().put(CLEAR_ICON, descriptor); }//w w w .j a v a 2 s . co m descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PlatformUI.PLUGIN_ID, "$nl$/icons/full/dtool16/clear_co.gif"); //$NON-NLS-1$ if (descriptor != null) { JFaceResources.getImageRegistry().put(DISABLED_CLEAR_ICON, descriptor); } return super.createFilterControls(parent); }
From source file:org.eclipse.papyrus.core.utils.PapyrusImageUtils.java
License:Open Source License
private static Image getIcon(String path) { String key = Activator.PLUGIN_ID + path; Image result = JFaceResources.getImageRegistry().get(key); if (result == null) { URL url = Activator.getDefault().getBundle().getEntry(path); try {//from w ww.java2s . com result = new Image(Display.getDefault(), url.openStream()); JFaceResources.getImageRegistry().put(key, result); } catch (IOException e) { } } return result; }
From source file:org.eclipse.papyrus.infra.onefile.model.impl.SubResourceFile.java
License:Open Source License
public Image getImage() { Image image = JFaceResources.getImage(getFile().getFileExtension()); if (image == null) { ImageDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry() .getImageDescriptor(getFile().getName()); JFaceResources.getImageRegistry().put(getFile().getFileExtension(), desc); }//from ww w. j a v a 2 s . c om return JFaceResources.getImage(getFile().getFileExtension()); }
From source file:org.eclipse.papyrus.infra.widgets.toolbox.utils.ToolbooxImageUtils.java
License:Open Source License
/** * Returns an image according to {@link ISharedImages} * /*ww w . j a va 2 s. c o m*/ * @param id * , the constant * @return */ public static Image getImage(int id) { StringBuffer path = new StringBuffer("/icons/"); switch (id) { case ISharedImages.IMG_RUN: path = path.append("run.gif"); break; default: break; } String key = Activator.PLUGIN_ID + path; Image result = JFaceResources.getImageRegistry().get(key); if (result == null) { URL url = Activator.getDefault().getBundle().getEntry(path.toString()); try { result = new Image(Display.getDefault(), url.openStream()); JFaceResources.getImageRegistry().put(key, result); } catch (IOException e) { } } return result; }
From source file:org.eclipse.rcptt.ui.jface.providers.BooleanLabelProvider.java
License:Open Source License
private static Image loadImageCached(String cacheKey, String path) { ImageRegistry registry = JFaceResources.getImageRegistry(); synchronized (registry) { Image rv = registry.get(cacheKey); if (rv == null) { registry.put(cacheKey,//from ww w . j a v a2s.c o m ImageDescriptor.createFromFile(BooleanLabelProvider.class, "/icons/providers/" + path)); rv = registry.get(cacheKey); } assert rv != null; return rv; } }
From source file:org.eclipse.sapphire.ui.forms.swt.SapphireWizard.java
License:Open Source License
private final void refreshImage() { if (this.defaultPageImage != null) { JFaceResources.getResources().destroyImage(this.defaultPageImageDescriptor); this.defaultPageImage = null; }//from www . ja va 2s .c o m this.defaultPageImageDescriptor = toImageDescriptor(this.part.getImage()); if (this.defaultPageImageDescriptor == null) { this.defaultPageImageDescriptor = JFaceResources.getImageRegistry().getDescriptor(Wizard.DEFAULT_IMAGE); } }
From source file:org.eclipse.sapphire.ui.swt.SapphireWizard.java
License:Open Source License
private final void refreshImage() { ImageDescriptor img = toImageDescriptor(this.part.getImage()); if (img == null) { img = JFaceResources.getImageRegistry().getDescriptor(DEFAULT_IMAGE); }/* www . j a va 2s. c o m*/ setDefaultPageImageDescriptor(img); }
From source file:org.eclipse.sirius.ext.e3.ui.dialogs.FilteredTree.java
License:Open Source License
/** * Create the button that clears the text. * * @param parent//from w ww .j a va2 s . com * parent <code>Composite</code> of toolbar button */ private void createClearTextOld(Composite parent) { // only create the button if the text widget doesn't support one // natively if ((filterText.getStyle() & SWT.ICON_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(JFaceResources.getImageRegistry().getDescriptor(CLEAR_ICON)); clearTextAction.setDisabledImageDescriptor( JFaceResources.getImageRegistry().getDescriptor(DISABLED_CLEAR_ICON)); filterToolBar.add(clearTextAction); } }