List of usage examples for org.eclipse.jface.resource ImageDescriptor getMissingImageDescriptor
public static ImageDescriptor getMissingImageDescriptor()
From source file:org.eclipse.debug.tests.launching.LaunchConfigurationTests.java
License:Open Source License
/** * Test support for a declared launch configuration type image * @throws Exception//from www. j a v a 2 s .co m */ public void testGetTyeImage() throws Exception { ImageDescriptor descriptor = DebugUITools.getImageDescriptor("org.eclipse.debug.tests.launch.type"); //$NON-NLS-1$ assertNotNull("The image descriptior type.image.2 must exist", descriptor); //$NON-NLS-1$ assertNotSame("The image descriptor is not type.image.2", ImageDescriptor.getMissingImageDescriptor(), //$NON-NLS-1$ descriptor); }
From source file:org.eclipse.dltk.debug.ui.ScriptDebugImages.java
License:Open Source License
/** * Declare an Image in the registry table. * /*from w w w. ja va2 s . c o m*/ * @param key * The key to use when registering the image * @param path * The path where the image can be found. This path is relative * to where this plugin class is found (i.e. typically the * packages directory) */ private final static void declareRegistryImage(String key, String path) { ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor(); Bundle bundle = Platform.getBundle(DLTKDebugUIPlugin.getUniqueIdentifier()); URL url = null; if (bundle != null) { url = FileLocator.find(bundle, new Path(path), null); desc = ImageDescriptor.createFromURL(url); } fgImageRegistry.put(key, desc); }
From source file:org.eclipse.dltk.internal.ui.dialogs.ImageManager.java
License:Open Source License
@Override public Image get(ImageDescriptor descriptor) { if (descriptor == null) descriptor = ImageDescriptor.getMissingImageDescriptor(); return super.get(descriptor); }
From source file:org.eclipse.dltk.javascript.ui.typeinfo.ElementLabelProvider.java
License:Open Source License
@Override public Image getImage(Object element) { if (element instanceof Element) { final Element el = (Element) element; final ImageDescriptor descriptor = ElementLabelProviderRegistry.getImageDescriptor(el); if (descriptor != null) { return registry.get(descriptor); }//from w w w . ja v a2 s. c o m final ImageDescriptor desc; if (element instanceof Type) { desc = ScriptElementImageProvider.getTypeImageDescriptor(Modifiers.AccDefault, false); } else if (element instanceof Member) { final int flags = ((Member) element).getVisibility().getFlags(); if (element instanceof Property) { desc = ScriptElementImageProvider.getFieldImageDescriptor(flags); } else { assert element instanceof Method; desc = ScriptElementImageProvider.getMethodImageDescriptor(flags); } } else { desc = ImageDescriptor.getMissingImageDescriptor(); } return registry.get(decorateImageDescriptor(desc, el)); } return super.getImage(element); }
From source file:org.eclipse.dltk.mod.debug.ui.ImageDescriptorRegistry.java
License:Open Source License
/** * Returns the image associated with the given image descriptor. * /*from w w w .ja v a2 s . c o m*/ * @param descriptor the image descriptor for which the registry manages an image * @return the image associated with the image descriptor or <code>null</code> * if the image descriptor can't create the requested image. */ public Image get(ImageDescriptor descriptor) { if (descriptor == null) descriptor = ImageDescriptor.getMissingImageDescriptor(); Image result = (Image) fRegistry.get(descriptor); if (result != null) return result; Assert.isTrue(fDisplay == DLTKDebugUIPlugin.getStandardDisplay(), "DebugUIMessages.ImageDescriptorRegistry_Allocating_image_for_wrong_display_1"); //$NON-NLS-1$ result = descriptor.createImage(); if (result != null) fRegistry.put(descriptor, result); return result; }
From source file:org.eclipse.e4.demo.simpleide.jdt.internal.editor.viewer.ImageDescriptorRegistry.java
License:Open Source License
/** * Returns the image associated with the given image descriptor. * * @param descriptor the image descriptor for which the registry manages an image, * or <code>null</code> for a missing image descriptor * @return the image associated with the image descriptor or <code>null</code> * if the image descriptor can't create the requested image. *//*from ww w . java2s . c o m*/ public Image get(ImageDescriptor descriptor) { if (descriptor == null) descriptor = ImageDescriptor.getMissingImageDescriptor(); Image result = (Image) fRegistry.get(descriptor); if (result != null) return result; Assert.isTrue(fDisplay == Display.getCurrent(), "Allocating image for wrong display."); //$NON-NLS-1$ result = descriptor.createImage(); if (result != null) fRegistry.put(descriptor, result); return result; }
From source file:org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.java
License:Open Source License
private void handleNullRefPlaceHolders(MUIElement element, MWindow refWin, boolean resolveAlways) { // use appContext as MApplication.getContext() is null during the processing of // the model processor classes EPlaceholderResolver resolver = appContext.get(EPlaceholderResolver.class); // Re-resolve any placeholder references List<MPlaceholder> phList = findElements(element, null, MPlaceholder.class, null); List<MPlaceholder> nullRefList = new ArrayList<>(); for (MPlaceholder ph : phList) { if (resolveAlways) { resolver.resolvePlaceholderRef(ph, refWin); } else if ((!resolveAlways) && (ph.getRef() == null)) { resolver.resolvePlaceholderRef(ph, refWin); MUIElement partElement = ph.getRef(); if (partElement instanceof MPart) { MPart part = (MPart) partElement; if (part.getIconURI() == null) { MPartDescriptor desc = getPartDescriptor(part.getElementId()); if (desc != null) { part.setIconURI(desc.getIconURI()); }/*from ww w.j a v a 2 s.com*/ } } } if (ph.getRef() == null) { nullRefList.add(ph); } } if (!resolveAlways) { List<MPart> partList = findElements(element, null, MPart.class, null); for (MPart part : partList) { if (COMPATIBILITY_VIEW_URI.equals(part.getContributionURI()) && part.getIconURI() == null) { part.getTransientData().put(IPresentationEngine.OVERRIDE_ICON_IMAGE_KEY, ImageDescriptor.getMissingImageDescriptor().createImage()); } } } for (MPlaceholder ph : nullRefList) { replacePlaceholder(ph); } return; }
From source file:org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.java
License:Open Source License
private void replacePlaceholder(MPlaceholder ph) { MPart part = createModelElement(MPart.class); part.setElementId(ph.getElementId()); part.getTransientData().put(IPresentationEngine.OVERRIDE_ICON_IMAGE_KEY, ImageDescriptor.getMissingImageDescriptor().createImage()); String label = (String) ph.getTransientData().get(TAG_LABEL); if (label != null) { part.setLabel(label);// w ww .j a v a 2 s .c o m } else { part.setLabel(getLabel(ph.getElementId())); } part.setContributionURI(COMPATIBILITY_VIEW_URI); part.setCloseable(true); MElementContainer<MUIElement> curParent = ph.getParent(); int curIndex = curParent.getChildren().indexOf(ph); curParent.getChildren().remove(curIndex); curParent.getChildren().add(curIndex, part); if (curParent.getSelectedElement() == ph) { curParent.setSelectedElement(part); } }
From source file:org.eclipse.e4.ui.workbench.renderers.swt.DirectContributionItem.java
License:Open Source License
private Image getImage(String iconURI, LocalResourceManager resourceManager) { Image image = null;/*from www. j a v a 2 s. c om*/ if (iconURI != null && iconURI.length() > 0) { ImageDescriptor iconDescriptor = resUtils.imageDescriptorFromURI(URI.createURI(iconURI)); if (iconDescriptor != null) { try { image = resourceManager.createImage(iconDescriptor); } catch (DeviceResourceException e) { iconDescriptor = ImageDescriptor.getMissingImageDescriptor(); image = resourceManager.createImage(iconDescriptor); // as we replaced the failed icon, log the message once. Activator.trace(Policy.DEBUG_MENUS, "failed to create image " + iconURI, e); //$NON-NLS-1$ } } } return image; }
From source file:org.eclipse.e4.xwt.vex.ResourceManager.java
License:Open Source License
/** * Declare an Image in the registry table. * // w w w . j a va 2s .c o m * @param key * The key to use when registering the image * @param path * The path where the image can be found. This path is relative to where this plugin class is found (i.e. typically the packages directory) */ private final void declareRegistryImage(String key, String path) { ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor(); URL url = getImageURL(path); if (url != null) { desc = ImageDescriptor.createFromURL(url); } getImageRegistry().put(key, desc); }