List of usage examples for org.eclipse.jface.resource ImageDescriptor createImage
public Image createImage()
From source file:com.aptana.ide.core.ui.CoreUIPlugin.java
License:Open Source License
/** * getImage//ww w . j av a 2 s .com * * @param path * @return Image */ public static Image getImage(String path) { if (images.get(path) == null) { ImageDescriptor id = getImageDescriptor(path); if (id == null) { return null; } Image i = id.createImage(); images.put(path, i); return i; } return images.get(path); }
From source file:com.aptana.ide.core.ui.InitialStartup.java
License:Open Source License
public static void start() { ImageDescriptor imageDescriptor = CoreUIPlugin.getImageDescriptor("icons/editorarea.gif"); //$NON-NLS-1$ if (imageDescriptor != null) { editorAreaImage_studio = imageDescriptor.createImage(); editorAreaImage = editorAreaImage_studio; }//from ww w. j a v a 2 s . com ImageDescriptor imageDescriptor_radrails = CoreUIPlugin.getImageDescriptor("icons/editorarea_radrails.gif"); //$NON-NLS-1$ if (imageDescriptor_radrails != null) { editorAreaImage_radrails = imageDescriptor_radrails.createImage(); } IPreferenceStore prefs = CoreUIPlugin.getDefault().getPreferenceStore(); boolean hasRunFirstStartup = prefs.getBoolean(IPreferenceConstants.PREF_KEY_FIRST_STARTUP); if (!hasRunFirstStartup) { initForFirstTimeStartup(); prefs.setValue(IPreferenceConstants.PREF_KEY_FIRST_STARTUP, true); } final IWorkbench workbench = PlatformUI.getWorkbench(); perpListener = new IPerspectiveListener() { public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) { recordPerspectiveActivation(perspective); checkPerspective(page, perspective); setEditorAreaPaintListener(page); } public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) { } }; PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { public void run() { IWorkbenchWindow w = workbench.getActiveWorkbenchWindow(); addListenerToWindow(w); } }); addWindowListener(workbench); final IPartListener _partListener = createPartActivationListener(); PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { public void run() { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window != null) { window.getPartService().addPartListener(_partListener); } } }); }
From source file:com.aptana.ide.core.ui.update.PluginsImageRegistry.java
License:Open Source License
public Image getImage(Plugin plugin) { Image image = null;//from w ww. j av a2 s. co m String path = plugin.getImagePath(); if (path != null) { image = fImages.get(path); if (image == null) { // generates the image from the path ImageDescriptor descriptor = Activator.getImageDescriptor(path); if (descriptor == null) { // could be a local file path try { image = ImageDescriptor.createFromURL(getURL(path)).createImage(); } catch (MalformedURLException e) { // ignore } } else { image = descriptor.createImage(); } if (image != null) { fImages.put(path, image); } } } return image == null ? DEFAULT_IMAGE : image; }
From source file:com.aptana.ide.documentation.DocumentationPlugin.java
License:Open Source License
/** * getImage/*w ww. j av a 2s. c om*/ * * @param path * @return Image */ public static Image getImage(String path) { if (images.get(path) == null) { ImageDescriptor id = getImageDescriptor(path); if (id == null) { return null; } Image i = id.createImage(); images.put(path, i); return i; } else { return (Image) images.get(path); } }
From source file:com.aptana.ide.editor.js.JSPlugin.java
License:Open Source License
/** * getImage/*from w ww . java 2 s . c om*/ * * @param path * @return Image */ public static Image getImage(String path) { if (images.get(path) == null) { ImageDescriptor id = getImageDescriptor(path); if (id == null) { return null; } Image i = id.createImage(); images.put(path, i); return i; } else { return images.get(path); } }
From source file:com.aptana.ide.editors.preferences.PreferenceMastHead.java
License:Open Source License
/** * Creates a new preference mast head//w ww .ja va2 s. c o m * * @param parent - * parent composite * @param description - * text description of pref page * @param parentLevel - * parent level to paint to (use -1 to turn off) * @param imageDescriptor - * image to display for pref page */ public PreferenceMastHead(Composite parent, String description, int parentLevel, ImageDescriptor imageDescriptor) { top = new Composite(parent, SWT.NONE); GridLayout topLayout = new GridLayout(2, false); topLayout.marginHeight = 0; topLayout.marginWidth = 0; top.setLayout(topLayout); GridData topData = new GridData(SWT.FILL, SWT.FILL, true, true); top.setBackground(HEADER_BG_COLOR); if (imageDescriptor != null) { image = imageDescriptor.createImage(); topData.heightHint = image.getImageData().height + 10; } Composite currParent = top.getParent(); int parents = 0; while (currParent != null && parents <= parentLevel) { currParent = currParent.getParent(); parents++; } if (currParent != null && parentLevel > 0) { parentVisible = currParent; } top.setLayoutData(topData); top.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { if (top.isVisible()) { if (parentVisible != null) { GC gc = new GC(parentVisible); gc.setBackground(parentVisible.getBackground()); gc.fillRectangle(0, 0, parentVisible.getSize().x, parentVisible.getSize().y); gc.setBackground(HEADER_BG_COLOR); gc.fillRectangle(0, 0, parentVisible.getSize().x, top.getSize().y + 10); gc.setBackground(FOOTER_BG_COLOR); gc.fillRectangle(0, top.getSize().y + 10, parentVisible.getSize().x, 5); gc.dispose(); } if (image != null) { GC gc = new GC(top); gc.drawImage(image, 5, 10); gc.dispose(); } } } }); Composite descComp = new Composite(top, SWT.NONE); GridLayout descCompLayout = new GridLayout(1, true); descCompLayout.marginHeight = 13; descCompLayout.marginWidth = 0; descComp.setLayout(descCompLayout); descComp.setBackground(HEADER_BG_COLOR); editorDescription = new Label(descComp, SWT.LEFT | SWT.WRAP); Font font = editorDescription.getFont(); FontData[] fd = SWTUtils.resizeFont(font, 2); Font newFont = new Font(top.getDisplay(), fd); top.setFont(newFont); editorDescription.setFont(newFont); editorDescription.setBackground(HEADER_BG_COLOR); GridData descData = new GridData(SWT.FILL, SWT.BOTTOM, true, true); editorDescription.setLayoutData(descData); GridData descCompData = new GridData(SWT.FILL, SWT.FILL, true, true); if (image != null) { descCompData.horizontalIndent = image.getImageData().width + 15; } descComp.setLayoutData(descCompData); if (description != null) { editorDescription.setForeground(HEADER_FG_COLOR); editorDescription.setText(description); } }
From source file:com.aptana.ide.ui.io.epl.OpenWithMenu.java
License:Open Source License
/** * Returns an image to show for the corresponding editor descriptor. * * @param editorDesc the editor descriptor, or null for the system editor * @return the image or null// w w w. j a v a2 s . c o m */ private Image getImage(IEditorDescriptor editorDesc) { ImageDescriptor imageDesc = getImageDescriptor(editorDesc); if (imageDesc == null) { return null; } Image image = (Image) imageCache.get(imageDesc); if (image == null) { image = imageDesc.createImage(); imageCache.put(imageDesc, image); } return image; }
From source file:com.aptana.ide.xul.XULPlugin.java
License:Open Source License
/** * Gets an image from an ID//from w w w.j av a2 s . co m * * @param imageID - * image id * @return - Image */ public Image getImage(String imageID) { Image image = getImageRegistry().get(imageID); // need to create and add to registry if (image == null) { ImageDescriptor imgDescriptor = (ImageDescriptor) imageDescMap.get(imageID); if (imgDescriptor != null) { // create the image and add to registry image = imgDescriptor.createImage(); getImageRegistry().put(imageID, image); } } return image; }
From source file:com.aptana.php.debug.ui.pathmapper.PathMapperDialog.java
License:Open Source License
public void setImageDescriptor(ImageDescriptor image) { if (image != null) { this.image = image.createImage(); super.setTitleImage(this.image); }//www . j av a 2 s .c o m }
From source file:com.aptana.portal.ui.browser.AbstractPortalBrowserEditor.java
License:Open Source License
@Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { setSite(site);/*from ww w . j a v a2s . c o m*/ setInput(input); if (input instanceof WebBrowserEditorInput) { WebBrowserEditorInput wbei = (WebBrowserEditorInput) input; initialURL = null; if (wbei.getURL() != null) initialURL = wbei.getURL().toExternalForm(); if (browser != null) { browser.setUrl(initialURL); site.getWorkbenchWindow().getActivePage().activate(this); } setPartName(wbei.getName()); setTitleToolTip(wbei.getToolTipText()); Image oldImage = image; ImageDescriptor id = wbei.getImageDescriptor(); image = id.createImage(); setTitleImage(image); if (oldImage != null && !oldImage.isDisposed()) oldImage.dispose(); } }