List of usage examples for org.eclipse.jface.resource ImageDescriptor getImageData
@Deprecated
public ImageData getImageData()
ImageData
object for this image descriptor. From source file:org.eclipse.babel.tapiji.tools.rbmanager.ImageUtils.java
License:Open Source License
/** * @return a Image from the folder 'icons' * @throws URISyntaxException//ww w . j a va 2 s .c o m */ public static Image getBaseImage(String imageName) { Image image = imageRegistry.get(imageName); if (image == null) { ImageDescriptor descriptor = RBManagerActivator.getImageDescriptor(imageName); if (descriptor.getImageData() != null) { image = descriptor.createImage(false); imageRegistry.put(imageName, image); } } return image; }
From source file:org.eclipse.birt.report.designer.internal.ui.views.LibraryImageDescriptor.java
License:Open Source License
private ImageData getImageData(ImageDescriptor descriptor) { ImageData data = descriptor.getImageData(); // null if (data == null) { data = DEFAULT_IMAGE_DATA;//w w w .j ava2 s . c om } return data; }
From source file:org.eclipse.bpel.common.ui.CommonUIPlugin.java
License:Open Source License
/** * Initializes the table of images used in this plugin. *//*from w w w . ja v a 2 s .co m*/ private void initializeImages(Display display) { URL baseURL = getBundle().getEntry("/"); //$NON-NLS-1$ // A little reflection magic ... so that we don't // have to add the createImageDescriptor every time // we add it to the IBPELUIConstants .. Field fields[] = ICommonUIConstants.class.getFields(); for (int i = 0; i < fields.length; i++) { Field f = fields[i]; if (f.getType() != String.class) { continue; } String name = f.getName(); if (name.startsWith("ICON_") || name.startsWith("CURSOR_")) { //$NON-NLS-1$ //$NON-NLS-2$ try { String value = (String) f.get(null); createImageDescriptor(value, baseURL); } catch (Exception e) { log(e); } } } // tray buttons ImageRegistry registry = getImageRegistry(); ImageDescriptor desc = registry.getDescriptor(ICommonUIConstants.ICON_TRAY_EXPAND_ARROW); registry.remove(ICommonUIConstants.ICON_KEY_TRAY_COLLAPSE_BUTTON); registry.remove(ICommonUIConstants.ICON_KEY_TRAY_EXPAND_BUTTON); registry.put(ICommonUIConstants.ICON_KEY_TRAY_COLLAPSE_BUTTON, desc.createImage()); ImageData data = ImageUtils.flip(desc.getImageData()); registry.put(ICommonUIConstants.ICON_KEY_TRAY_EXPAND_BUTTON, new Image(display, data)); }
From source file:org.eclipse.bpel.ui.editparts.LinkEditPart.java
License:Open Source License
private ImageData getImageData(String uri) { if (uri.length() == 0) return null; URL url = null;/* w w w .j a v a 2 s . c o m*/ try { url = new URL(uri); } catch (MalformedURLException e) { return null; } ImageDescriptor desc = ImageDescriptor.createFromURL(url); return desc.getImageData(); }
From source file:org.eclipse.bpel.ui.util.BPELUtil.java
License:Open Source License
private static ImageData getImageData(String uri) { if (uri.length() == 0) return null; URL url = null;//from w w w.j av a2 s. c o m try { url = new URL(uri); } catch (MalformedURLException e) { return null; } ImageDescriptor desc = ImageDescriptor.createFromURL(url); return desc.getImageData(); }
From source file:org.eclipse.cdt.debug.internal.ui.OverlayImageDescriptor.java
License:Open Source License
/** * Draw the fOverlays for the reciever.// w ww . java 2 s . co m */ protected void drawOverlays(ImageDescriptor[] overlays) { Point size = getSize(); for (int i = 0; i < overlays.length; i++) { ImageDescriptor overlay = overlays[i]; if (overlay == null) continue; ImageData overlayData = overlay.getImageData(); //Use the missing descriptor if it is not there. if (overlayData == null) overlayData = ImageDescriptor.getMissingImageDescriptor().getImageData(); switch (i) { case TOP_LEFT: drawImage(overlayData, 0, 0); break; case TOP_RIGHT: drawImage(overlayData, size.x - overlayData.width, 0); break; case BOTTOM_LEFT: drawImage(overlayData, 0, size.y - overlayData.height); break; case BOTTOM_RIGHT: drawImage(overlayData, size.x - overlayData.width, size.y - overlayData.height); break; } } }
From source file:org.eclipse.cdt.dsf.debug.internal.ui.disassembly.AbstractImageRegistry.java
License:Open Source License
private ImageDescriptor createFileImageDescriptor(String key) { URL url = fBaseUrl;//from w ww .jav a 2 s . c om String pluginId = fPlugins.get(key); if (pluginId != null) { Bundle bundle = Platform.getBundle(pluginId); if (bundle != null) { url = bundle.getEntry("/"); //$NON-NLS-1$ } } String[] locations = fLocations.get(key); if (locations != null) { for (int i = 0; i < locations.length; i++) { String loc = locations[i]; URL full; try { full = new URL(url, loc); ImageDescriptor candidate = ImageDescriptor.createFromURL(full); if (candidate != null && candidate.getImageData() != null) { return candidate; } } catch (MalformedURLException e) { DsfUIPlugin.getDefault().getLog() .log(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, "Malformed Icon URL", e)); //$NON-NLS-1$ } catch (SWTException e) { // try the next one. } } } return null; }
From source file:org.eclipse.cdt.dsf.gdb.internal.ui.osview.OSResourcesView.java
License:Open Source License
@Override public void createPartControl(Composite xparent) { Composite parent = new Composite(xparent, SWT.NONE); GridLayout topLayout = new GridLayout(1, false); topLayout.marginWidth = 0;//from ww w .ja v a 2s . c om topLayout.marginHeight = 0; parent.setLayout(topLayout); fViewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); GridData viewerData = new GridData(GridData.FILL_BOTH); viewerData.exclude = true; fViewer.getControl().setLayoutData(viewerData); fViewer.setComparator(fComparator = new Comparator()); Table table = fViewer.getTable(); table.setHeaderVisible(true); table.setVisible(false); fNothingLabelContainer = new Composite(parent, SWT.NONE); GridData nothingLayout = new GridData(SWT.FILL, SWT.FILL, true, true); fNothingLabelContainer.setLayoutData(nothingLayout); GridLayout containerLayout = new GridLayout(1, false); fNothingLabelContainer.setLayout(containerLayout); fNothingLabel = new Link(fNothingLabelContainer, SWT.BORDER); fNothingLabel.setText(Messages.OSView_4); fNothingLabel.setBackground(fNothingLabel.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); fNothingLabel.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { if (event.text.equals("fetch")) //$NON-NLS-1$ if (fSessionData != null && fResourceClass != null) fSessionData.fetchData(fResourceClass); } }); fNothingLabelContainer.setBackground(fNothingLabel.getBackground()); GridData nothingLabelLayout = new GridData(SWT.CENTER, SWT.TOP, true, false); fNothingLabel.setLayoutData(nothingLabelLayout); fResourceClassEditor = new ResourceClassContributionItem(); fResourceClassEditor.setListener(new ResourceClassContributionItem.Listener() { @Override public void resourceClassChanged(String newClass) { fResourceClass = newClass; // Since user explicitly changed the class, initiate fetch immediately. fSessionData.fetchData(fResourceClass); // Do not call 'update()' here. fetchData call above will notify // us at necessary moments. } }); IActionBars bars = getViewSite().getActionBars(); bars.getToolBarManager().add(fResourceClassEditor); fRefreshAction = new Action() { @Override public void run() { if (fSessionData != null && fResourceClass != null) fSessionData.fetchData(fResourceClass); } }; fRefreshAction.setText(Messages.OSView_3); fRefreshAction.setToolTipText(Messages.OSView_3); try { Bundle bundle = Platform.getBundle("org.eclipse.ui"); //$NON-NLS-1$ URL url = bundle.getEntry("/"); //$NON-NLS-1$ url = new URL(url, "icons/full/elcl16/refresh_nav.gif"); //$NON-NLS-1$ ImageDescriptor candidate = ImageDescriptor.createFromURL(url); if (candidate != null && candidate.getImageData() != null) { fRefreshAction.setImageDescriptor(candidate); } } catch (Exception e) { } bars.getToolBarManager().add(fRefreshAction); bars.updateActionBars(); fResourceClass = fResourceClassEditor.getResourceClassId(); setupContextListener(); DsfSession.addSessionEndedListener(this); }
From source file:org.eclipse.cdt.dsf.gdb.internal.ui.tracepoints.AbstractImageRegistry.java
License:Open Source License
private ImageDescriptor createFileImageDescriptor(String key) { URL url = fBaseUrl;/*from ww w . ja v a 2 s. co m*/ String pluginId = fPlugins.get(key); if (pluginId != null) { Bundle bundle = Platform.getBundle(pluginId); if (bundle != null) { url = bundle.getEntry("/"); //$NON-NLS-1$ } } String[] locations = fLocations.get(key); if (locations != null) { for (int i = 0; i < locations.length; i++) { String loc = locations[i]; URL full; try { full = new URL(url, loc); ImageDescriptor candidate = ImageDescriptor.createFromURL(full); if (candidate != null && candidate.getImageData() != null) { return candidate; } } catch (MalformedURLException e) { GdbUIPlugin.getDefault().getLog() .log(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, "Malformed Icon URL", e)); //$NON-NLS-1$ } catch (SWTException e) { // try the next one. } } } return null; }
From source file:org.eclipse.compare.internal.patch.DecoratorOverlayIcon.java
License:Open Source License
/** * Draw the overlays for the receiver.// w w w . ja v a 2s .co m * @param overlaysArray the overlay images */ protected void drawOverlays(ImageDescriptor[] overlaysArray) { for (int i = 0; i < overlays.length; i++) { ImageDescriptor overlay = overlaysArray[i]; if (overlay == null) { continue; } ImageData overlayData = overlay.getImageData(); //Use the missing descriptor if it is not there. if (overlayData == null) { overlayData = ImageDescriptor.getMissingImageDescriptor().getImageData(); } switch (i) { case IDecoration.TOP_LEFT: drawImage(overlayData, 0, 0); break; case IDecoration.TOP_RIGHT: drawImage(overlayData, size.x - overlayData.width, 0); break; case IDecoration.BOTTOM_LEFT: drawImage(overlayData, 0, size.y - overlayData.height); break; case IDecoration.BOTTOM_RIGHT: drawImage(overlayData, size.x - overlayData.width, size.y - overlayData.height); break; } } }