List of usage examples for org.eclipse.jface.resource ImageDescriptor createImage
public Image createImage()
From source file:com.iw.plugins.spindle.Images.java
License:Mozilla Public License
public static Image getSharedImage(String name) { ImageRegistry registry = getImageRegistry(); URL imageURL = getImageURL(name); String urlString = null;//from www . ja v a 2 s .com if (imageURL != null) { urlString = imageURL.toString(); } else { return getSharedImage("missing.gif"); } Image result = registry.get(urlString); if (result == null) { ImageDescriptor descriptor = ImageDescriptor.createFromURL(imageURL); Registry.put(urlString, descriptor.createImage()); result = registry.get(urlString); } return result; }
From source file:com.iw.plugins.spindle.TapestryImages.java
License:Mozilla Public License
public static Image getSharedImage(String name) { ImageRegistry registry = getImageRegistry(); URL imageURL = getImageURL(name); String urlString = null;// w ww .ja v a 2 s.co m if (imageURL != null) { urlString = imageURL.toString(); } else { return registry.get("missing"); } Image result = registry.get(urlString); if (result == null) { ImageDescriptor descriptor = ImageDescriptor.createFromURL(imageURL); Registry.put(urlString, descriptor.createImage()); result = registry.get(urlString); } return result; }
From source file:com.javadude.antxr.eclipse.ui.editor.outline.AntxrOutlineLabelProvider.java
License:Open Source License
/** {@inheritDoc} */ public Image getImage(Object anElement) { ImageDescriptor descriptor; if (anElement instanceof Grammar) { descriptor = AntxrUIPluginImages.DESC_OBJS_CLASS; } else if (anElement instanceof Rule) { switch (((Rule) anElement).getVisibility()) { case Rule.PRIVATE: descriptor = AntxrUIPluginImages.DESC_MISC_PRIVATE; break; case Rule.PROTECTED: descriptor = AntxrUIPluginImages.DESC_MISC_PROTECTED; break; default:/* w w w. j a v a2s . c o m*/ descriptor = AntxrUIPluginImages.DESC_MISC_PUBLIC; break; } } else { descriptor = AntxrUIPluginImages.DESC_MISC_DEFAULT; } // obtain the cached image corresponding to the descriptor Image image = fImageCache.get(descriptor); if (image == null) { image = descriptor.createImage(); fImageCache.put(descriptor, image); } return image; }
From source file:com.kevlindev.pinconverter.ui.BoardLabelProvider.java
static Image getImage(String resource) { ImageDescriptor descriptor = ImageDescriptor.createFromFile(BoardLabelProvider.class, resource); return descriptor.createImage(); }
From source file:com.laex.cg2d.core.splashHandlers.ExtensibleSplashHandler.java
License:Open Source License
/** * Process splash element icon./* ww w. j a v a2 s . c om*/ * * @param configurationElement * the configuration element */ private void processSplashElementIcon(IConfigurationElement configurationElement) { // Get attribute icon String iconImageFilePath = configurationElement.getAttribute(F_ELEMENT_ICON); // Abort if an icon attribute was not specified if ((iconImageFilePath == null) || (iconImageFilePath.length() == 0)) { return; } // Create a corresponding image descriptor ImageDescriptor descriptor = AbstractUIPlugin .imageDescriptorFromPlugin(configurationElement.getNamespaceIdentifier(), iconImageFilePath); // Abort if no corresponding image was found if (descriptor == null) { return; } // Create the image Image image = descriptor.createImage(); // Abort if image creation failed if (image == null) { return; } // Abort if the image does not have dimensions of 50x50 if ((image.getBounds().width != F_IMAGE_WIDTH) || (image.getBounds().height != F_IMAGE_HEIGHT)) { // Dipose of the image image.dispose(); return; } // Store the image and tooltip fImageList.add(image); }
From source file:com.legstar.eclipse.plugin.cixsmap.dialogs.LegacyOperationDialog.java
License:Open Source License
/** {@inheritDoc} */ protected final void configureShell(final Shell newShell) { super.configureShell(newShell); newShell.setText(Messages.operation_mapping_dialog_title); ImageDescriptor image = AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, Messages.operations_mapping_icon); newShell.setImage(image.createImage()); }
From source file:com.legstar.eclipse.plugin.cixsmap.dialogs.LegacyStructureDialog.java
License:Open Source License
/** {@inheritDoc} */ protected final void configureShell(final Shell newShell) { super.configureShell(newShell); newShell.setText(Messages.structure_mapping_dialog_title); ImageDescriptor image = AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, Messages.operations_mapping_icon); newShell.setImage(image.createImage()); }
From source file:com.liferay.ide.portlet.ui.editor.DependenciesFormPage.java
License:Open Source License
protected void createFormContent(IManagedForm managedForm) { super.createFormContent(managedForm); ScrolledForm form = managedForm.getForm(); ImageDescriptor descriptor = PortletUIPlugin.imageDescriptorFromPlugin(PortletUIPlugin.PLUGIN_ID, "/icons/e16/plugin.png"); form.setImage(descriptor.createImage()); form.setText(Msgs.dependencies);/* w w w.j a v a 2 s.co m*/ Composite body = form.getBody(); body.setLayout(FormLayoutFactory.createFormGridLayout(true, 2)); Composite left; Composite right; FormToolkit toolkit = managedForm.getToolkit(); left = toolkit.createComposite(body, SWT.NONE); left.setLayout(FormLayoutFactory.createFormPaneGridLayout(false, 1)); left.setLayoutData(new GridData(GridData.FILL_BOTH)); right = toolkit.createComposite(body, SWT.NONE); right.setLayout(FormLayoutFactory.createFormPaneGridLayout(false, 1)); right.setLayoutData(new GridData(GridData.FILL_BOTH)); PortalJarsSection jarsSection = new PortalJarsSection(this, left, _getRequiredSectionLabels()); managedForm.addPart(jarsSection); GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING); gd.widthHint = 150; PortalTldsSection tldsSection = new PortalTldsSection(this, right, _getRequiredSectionLabels()); managedForm.addPart(tldsSection); // managedForm.addPart(new PortalJarsSection(this, left, // getRequiredSectionLabels())); }
From source file:com.liferay.ide.portlet.ui.editor.PluginPackageFormPage.java
License:Open Source License
@Override protected void createFormContent(IManagedForm managedForm) { super.createFormContent(managedForm); form = managedForm.getForm();/*from ww w . j av a 2 s . c om*/ FormToolkit toolkit = managedForm.getToolkit(); toolkit.decorateFormHeading(form.getForm()); form.setText(Msgs.liferayPluginPackageProperties); ImageDescriptor descriptor = PortletUIPlugin.imageDescriptorFromPlugin(PortletUIPlugin.PLUGIN_ID, "/icons/e16/plugin.png"); form.setImage(descriptor.createImage()); toolkit = managedForm.getToolkit(); Composite body = form.getBody(); body.setLayout(FormLayoutFactory.createFormGridLayout(true, 2)); Composite left; Composite right; toolkit = managedForm.getToolkit(); left = toolkit.createComposite(body, SWT.NONE); left.setLayout(FormLayoutFactory.createFormPaneGridLayout(false, 1)); left.setLayoutData(new GridData(GridData.FILL_BOTH)); right = toolkit.createComposite(body, SWT.NONE); right.setLayout(FormLayoutFactory.createFormPaneGridLayout(false, 1)); right.setLayoutData(new GridData(GridData.FILL_BOTH)); PluginPackageGeneralSection generalSection = new PluginPackageGeneralSection(this, left); managedForm.addPart(generalSection); IProject project = getFormEditor().getCommonProject(); if (SDKUtil.isSDKProject(project)) { PortalJarsSection jarsSection = new PortalJarsSection(this, right, _getPortalSectionLabels()); managedForm.addPart(jarsSection); PortalDeployExcludesSection excludesSection = new PortalDeployExcludesSection(this, right, _getPortalSectionLabels()); managedForm.addPart(excludesSection); PortalTldsSection tldsSection = new PortalTldsSection(this, right, _getPortalSectionLabels()); managedForm.addPart(tldsSection); RequiredDeploymentContextsSection contextsSection = new RequiredDeploymentContextsSection(this, right, _getContextsSectionLabels()); managedForm.addPart(contextsSection); } }
From source file:com.liferay.ide.project.ui.upgrade.animated.AbstractCanvas.java
License:Open Source License
protected final Image loadImage(String name) { URL url = null;//from w ww . ja va 2s . co m try { url = ProjectUI.getDefault().getBundle().getEntry("images/" + name); } catch (Exception e) { } ImageDescriptor imagedesc = ImageDescriptor.createFromURL(url); Image image = imagedesc.createImage(); resources.add(image); return image; }