List of usage examples for org.eclipse.jface.resource ImageDescriptor createFromFile
public static ImageDescriptor createFromFile(Class<?> location, String filename)
From source file:es.axios.udig.spatialoperations.ui.view.SOView.java
License:Open Source License
/** * Create actions, linking view to current map. *//*from w ww. jav a 2s . c om*/ private void createActions() { this.runButton = new runButtonAction(); this.showHideDemoMenu = new menuAction(Messages.SOComposite_show_hide_demo_tooltip); this.runAction = new Action() { @Override public void run() { soComposite.executeOperation(); } }; this.runAction.setText(Messages.SOComposite_perform); this.runAction.setToolTipText(Messages.SOComposite_perform); String imgFile = "images/run.gif"; //$NON-NLS-1$ this.runAction.setImageDescriptor(ImageDescriptor.createFromFile(SOComposite.class, imgFile)); this.runAction.setEnabled(false); }
From source file:es.axios.udig.ui.editingtools.merge.view.MergeComposite.java
License:LGPL
private void createImageRegistry() { registry = new ImageRegistry(); String imgFile = "images/" + "trash" + ".gif"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ registry.put("trash", ImageDescriptor.createFromFile(MergeComposite.class, imgFile)); }
From source file:eu.modelwriter.marker.MarkerActivator.java
License:Open Source License
@Override protected ImageRegistry createImageRegistry() { String[] images = new String[] { Images.IMAGE_BLACK_ID, "/icons/Black.gif", Images.IMAGE_RED_ID, "/icons/Red.gif", Images.IMAGE_MENU_ID, "/icons/Menu.gif", Images.IMAGE_LINK_ID, "/icons/Link.gif", Images.IMAGE_DELETE_ID, "/icons/Delete.gif", Images.IMAGE_ANNOTATION_ID, "/icons/Annotation.gif", Images.IMAGE_SIG_ID, "/icons/sig.png", Images.IMAGE_RELATION_ID, "/icons/relation.png", Images.IMAGE_MODELWRITER_ID, "/icons/modelwriter.gif" }; ImageRegistry imageRegistry = super.createImageRegistry(); Iterator<String> i = Arrays.asList(images).iterator(); while (i.hasNext()) { String id = i.next();//from w w w. j a v a 2 s. co m String imagePath = i.next(); imageRegistry.put(id, ImageDescriptor.createFromFile(getClass(), imagePath)); } return imageRegistry; }
From source file:eu.modelwriter.marker.model.decorators.FileDecorator.java
License:Open Source License
@Override public void decorate(Object resource, IDecoration decoration) { int markers = MarkerFactory.findMarkers((IResource) resource).size(); if (markers > 0) { decoration.addOverlay(ImageDescriptor.createFromFile(FileDecorator.class, ICON), IDecoration.TOP_RIGHT); decoration.setForegroundColor(color); } else {//w w w .ja v a 2 s. co m decoration.addOverlay(null); decoration.setForegroundColor(new Color(null, 0, 0, 0, 0)); } }
From source file:eu.udig.image.georeferencing.ui.GeoreferencingView.java
License:Open Source License
/** * Create actions, linking view to current map. *///from ww w. j a v a 2s. c om private void createActions() { this.runButton = new runButtonAction(); this.runAction = new Action() { @Override public void run() { executeGeoReferencingCommand(); } }; this.runAction.setText(Messages.GeoreferencingView_runActionText); this.runAction.setToolTipText(Messages.GeoreferencingView_runActionTooltip); String imgFile = RUN_IMAGE_BUTTON; this.runAction.setImageDescriptor(ImageDescriptor.createFromFile(GeoreferencingView.class, imgFile)); this.runAction.setEnabled(false); this.loadButton = new loadButtonAction(); this.loadAction = new Action() { @Override public void run() { loadMarks(); }; }; this.loadAction.setText(Messages.GeoreferencingView_loadActionText); this.loadAction.setToolTipText(Messages.GeoreferencingView_loadActionTooltip); imgFile = LOAD_IMAGE_BUTTON; this.loadAction.setImageDescriptor(ImageDescriptor.createFromFile(GeoreferencingView.class, imgFile)); this.loadAction.setEnabled(false); this.saveButton = new saveButtonAction(); this.saveAction = new Action() { @Override public void run() { saveMarks(); }; }; this.saveAction.setText(Messages.GeoreferencingView_saveActionText); this.saveAction.setToolTipText(Messages.GeoreferencingView_saveActionTooltip); imgFile = SAVE_IMAGE_BUTTON; this.saveAction.setImageDescriptor(ImageDescriptor.createFromFile(GeoreferencingView.class, imgFile)); this.saveAction.setEnabled(false); }
From source file:eu.udig.tools.merge.internal.view.MergeComposite.java
License:LGPL
private void createImageRegistry() { registry = new ImageRegistry(); String imgFile = "images/" + "trash" + ".gif"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ registry.put("trash", ImageDescriptor.createFromFile(MergeComposite.class, imgFile)); //$NON-NLS-1$ }
From source file:fr.isima.ponge.wsprotocol.gefeditor.uiparts.ProtocolEditorPaletteFactory.java
License:Open Source License
/** * Creates the states drawer group.//w w w . j av a2s . c om * * @param palette * The palette to add the tools to. * @return The tools. */ protected static PaletteContainer createStatesDrawer(PaletteRoot palette) { PaletteDrawer drawer = new PaletteDrawer(Messages.statesPaletteGroup); CombinedTemplateCreationEntry component; component = new CombinedTemplateCreationEntry(Messages.initialState, Messages.createInitialState, State.class, new StateCreationFactory(true, false), ImageDescriptor.createFromFile(EditorPlugin.class, "icons/state_ini_16.png"), ImageDescriptor //$NON-NLS-1$ .createFromFile(EditorPlugin.class, "icons/state_ini_24.png")); //$NON-NLS-1$ drawer.add(component); component = new CombinedTemplateCreationEntry(Messages.normalState, Messages.createNormalState, State.class, new StateCreationFactory(false, false), ImageDescriptor.createFromFile(EditorPlugin.class, "icons/state_nor_16.png"), //$NON-NLS-1$ ImageDescriptor.createFromFile(EditorPlugin.class, "icons/state_nor_24.png")); //$NON-NLS-1$ drawer.add(component); component = new CombinedTemplateCreationEntry(Messages.finalState, Messages.createFinalState, State.class, new StateCreationFactory(false, true), ImageDescriptor.createFromFile(EditorPlugin.class, "icons/state_fin_16.png"), ImageDescriptor //$NON-NLS-1$ .createFromFile(EditorPlugin.class, "icons/state_fin_24.png")); //$NON-NLS-1$ drawer.add(component); return drawer; }
From source file:fr.isima.ponge.wsprotocol.gefeditor.uiparts.ProtocolEditorPaletteFactory.java
License:Open Source License
/** * Creates the operations drawer group.//w w w . ja v a 2 s. c o m * * @param palette * The palette to add the tools to. * @return The tools. */ protected static PaletteContainer createOperationsDrawer(PaletteRoot palette) { PaletteDrawer drawer = new PaletteDrawer(Messages.operationsPaletteGroup); ConnectionCreationToolEntry tool; tool = new ConnectionCreationToolEntry(Messages.inputOperation, Messages.createInputOperation, new CreationFactory() { public Object getNewObject() { return null; } public Object getObjectType() { return Polarity.POSITIVE; } }, ImageDescriptor.createFromFile(EditorPlugin.class, "icons/operation_plus_16.png"), //$NON-NLS-1$ ImageDescriptor.createFromFile(EditorPlugin.class, "icons/operation_plus_24.png")); //$NON-NLS-1$ drawer.add(tool); tool = new ConnectionCreationToolEntry(Messages.outputOperation, Messages.createOutputOperation, new CreationFactory() { public Object getNewObject() { return null; } public Object getObjectType() { return Polarity.NEGATIVE; } }, ImageDescriptor.createFromFile(EditorPlugin.class, "icons/operation_minus_16.png"), //$NON-NLS-1$ ImageDescriptor.createFromFile(EditorPlugin.class, "icons/operation_minus_24.png")); //$NON-NLS-1$ drawer.add(tool); tool = new ConnectionCreationToolEntry(Messages.implicitOperation, Messages.createImplicitOperation, new CreationFactory() { public Object getNewObject() { return null; } public Object getObjectType() { return Polarity.NULL; } }, ImageDescriptor.createFromFile(EditorPlugin.class, "icons/operation_none_16.png"), //$NON-NLS-1$ ImageDescriptor.createFromFile(EditorPlugin.class, "icons/operation_none_24.png")); //$NON-NLS-1$ drawer.add(tool); return drawer; }
From source file:fr.lip6.move.coloane.core.extensions.ApiDescription.java
License:Open Source License
/** * Constructor// w w w. ja v a 2s. c o m * @param apiClass The main class of the API * @param name The API name * @param description The API description (will be used as tip) * @param iconPath The icon associated with the API * @throws ColoaneException if the API name is <code>null</code> */ public ApiDescription(IApi apiClass, String name, String description, String iconPath) throws ColoaneException { this.apiClass = apiClass; this.name = name; if (name == null) { throw new ColoaneException("The API name cannot be null"); //$NON-NLS-1$ } this.description = description; if (this.description == null) { this.description = ""; //$NON-NLS-1$ } if (iconPath != null) { this.icon = ImageDescriptor.createFromFile(this.apiClass.getClass(), "/" + iconPath); //$NON-NLS-1$ } }
From source file:fr.lip6.move.coloane.core.extensions.ToolsContribution.java
License:Open Source License
/** * {@inheritDoc}// www.ja v a 2 s. c o m */ @Override protected final IContributionItem[] getContributionItems() { List<IContributionItem> allContribs = new ArrayList<IContributionItem>(); // Browse all local tools IConfigurationElement[] tools = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID); for (int i = 0; i < tools.length; i++) { String name = tools[i].getAttribute(NAME); String description = tools[i].getAttribute(DESCRIPTION); String icon = "/" + tools[i].getAttribute(ICON); //$NON-NLS-1$ // Create the associated action try { IService action = (IService) tools[i].createExecutableExtension(ACTION); IAction localAction = new LocalAction(name, description, ImageDescriptor.createFromFile(action.getClass(), icon), action); allContribs.add(new ActionContributionItem(localAction)); } catch (CoreException e) { LOGGER.warning("Extension [" + name + "] was unable to be instanciated"); //$NON-NLS-1$ //$NON-NLS-2$ IStatus warningStatus = new Status(IStatus.ERROR, "fr.lip6.move.coloane.extensions.tools", //$NON-NLS-1$ "Extension " + name + " was unable to be instanciated", e); //$NON-NLS-1$ //$NON-NLS-2$ StatusManager.getManager().handle(warningStatus); } catch (ClassCastException ce) { LOGGER.warning("Extension [" + name + "] was unable to be instanciated (invalid tool)"); //$NON-NLS-1$ //$NON-NLS-2$ IStatus warningStatus = new Status(IStatus.ERROR, "fr.lip6.move.coloane.extensions.tools", //$NON-NLS-1$ "Extension " + name + " was unable to be instanciated", ce); //$NON-NLS-1$ //$NON-NLS-2$ StatusManager.getManager().handle(warningStatus); } } // Thanks to strange getContributionsItems prototype, the array list must be translated into an array IContributionItem[] toReturn = new IContributionItem[allContribs.size()]; for (int i = 0; i < allContribs.size(); i++) { toReturn[i] = allContribs.get(i); } if (toReturn.length == 0) { toReturn = new IContributionItem[1]; IAction localAction = new LocalAction("No tool currently available", "", null, null); //$NON-NLS-1$//$NON-NLS-2$ localAction.setEnabled(false); toReturn[0] = new ActionContributionItem(localAction); } return toReturn; }