List of usage examples for org.eclipse.jface.resource ImageDescriptor createFromFile
public static ImageDescriptor createFromFile(Class<?> location, String filename)
From source file:bilab.notebook.NotebookPageEditorPaletteFactory.java
License:Open Source License
/** Create the "Shapes" drawer. */ private static PaletteContainer createShapesDrawer() { final PaletteDrawer componentsDrawer = new PaletteDrawer("Graphics"); CombinedTemplateCreationEntry component = new CombinedTemplateCreationEntry("Ellipse", "Create an elliptical shape", EllipticalGraphic.class, new SimpleFactory(EllipticalGraphic.class), ImageDescriptor.createFromFile(BilabPlugin.class, "notebook/icons/ellipse16.gif"), ImageDescriptor.createFromFile(BilabPlugin.class, "notebook/icons/ellipse24.gif")); componentsDrawer.add(component);//from w w w .j a v a 2s. com component = new CombinedTemplateCreationEntry("Rectangle", "Create a rectangular shape", RectangularGraphic.class, new SimpleFactory(RectangularGraphic.class), ImageDescriptor.createFromFile(BilabPlugin.class, "notebook/icons/rectangle16.gif"), ImageDescriptor.createFromFile(BilabPlugin.class, "notebook/icons/rectangle24.gif")); componentsDrawer.add(component); return componentsDrawer; }
From source file:bilab.notebook.NotebookPageEditorPaletteFactory.java
License:Open Source License
/** Create the "Tools" group. */ private static PaletteContainer createToolsGroup(final PaletteRoot palette) { final PaletteGroup toolGroup = new PaletteGroup("Tools"); // Add a selection tool to the group ToolEntry tool = new SelectionToolEntry(); toolGroup.add(tool);//w w w .j a v a2 s . com palette.setDefaultEntry(tool); // Add a marquee tool to the group toolGroup.add(new MarqueeToolEntry()); // Add a (unnamed) separator to the group toolGroup.add(new PaletteSeparator()); // Add (solid-line) connection tool tool = new ConnectionCreationToolEntry("Solid connection", "Create a solid-line connection", new CreationFactory() { @Override public Object getNewObject() { return null; } // see ShapeEditPart#createEditPolicies() // this is abused to transmit the desired line style @Override public Object getObjectType() { return Connection.SOLID_CONNECTION; } }, ImageDescriptor.createFromFile(BilabPlugin.class, "notebook/icons/connection_s16.gif"), ImageDescriptor.createFromFile(BilabPlugin.class, "notebook/icons/connection_s24.gif")); toolGroup.add(tool); // Add (dashed-line) connection tool tool = new ConnectionCreationToolEntry("Dashed connection", "Create a dashed-line connection", new CreationFactory() { @Override public Object getNewObject() { return null; } // see ShapeEditPart#createEditPolicies() // this is abused to transmit the desired line style @Override public Object getObjectType() { return Connection.DASHED_CONNECTION; } }, ImageDescriptor.createFromFile(BilabPlugin.class, "notebook/icons/connection_d16.gif"), ImageDescriptor.createFromFile(BilabPlugin.class, "notebook/icons/connection_d24.gif")); toolGroup.add(tool); return toolGroup; }
From source file:br.com.santos.celeste.outros.ResourceManager.java
License:Open Source License
/** * Returns an {@link ImageDescriptor} stored in the file at the specified path relative to the specified * class.//from www. j a v a2 s. com * * @param clazz * the {@link Class} relative to which to find the image descriptor. * @param path * the path to the image file. * @return the {@link ImageDescriptor} stored in the file at the specified path. */ public static ImageDescriptor getImageDescriptor(Class<?> clazz, String path) { return ImageDescriptor.createFromFile(clazz, path); }
From source file:ch.qos.logback.beagle.util.ResourceUtil.java
License:Open Source License
public static Image loadImage(Display display, String resourcePath) { // URL url = ResourceUtil.class.getClassLoader().getResource(resourcePath); // ImageDescriptor iDescriptor = ImageDescriptor.createFromURL(url); ImageDescriptor iDescriptor = ImageDescriptor.createFromFile(Constants.class, resourcePath); return iDescriptor.createImage(); }
From source file:cn.edu.pku.ogeditor.dialogs.ConceptFilterDialog.java
License:Open Source License
/** * Constructs a FileTreeLabelProvider//from ww w .j av a 2 s . c o m */ public ConceptFilterTreeLabelProvider() { // Create the list to hold the listeners listeners = new ArrayList<ILabelProviderListener>(); image = ImageDescriptor.createFromFile(ShapesPlugin.class, "icons/ellipse16.gif").createImage(); //new Image(null, new FileInputStream("../icons/ellipse16.gif")); }
From source file:cn.edu.pku.ogeditor.dialogs.RelationFilterDialog.java
License:Open Source License
public RelationFilterTreeLabelProvider() { listeners = new ArrayList<ILabelProviderListener>(); image = ImageDescriptor.createFromFile(ShapesPlugin.class, "icons/connection_common.gif").createImage(); }
From source file:cn.edu.pku.ogeditor.ShapesEditorPaletteRoot.java
License:Open Source License
public void addShapeTool(final Shape shape) { allUpperLevelShapes.add(shape);//ww w . j a va 2s.c om if (shape.isSeparator()) { conceptDrawer.add(new PaletteSeparator()); return; } if (conceptDrawer != null) { CombinedTemplateCreationEntry component = new CombinedTemplateCreationEntry(shape.getName(), "Create a " + shape.getName(), Shape.class, new ShapesCreationFactory(shape.getName()), ImageDescriptor.createFromFile(ShapesPlugin.class, "icons/ellipse16.gif"), ImageDescriptor.createFromFile(ShapesPlugin.class, "icons/ellipse24.gif")); conceptDrawer.add(component); } }
From source file:cn.edu.pku.ogeditor.ShapesEditorPaletteRoot.java
License:Open Source License
public void addConnectionTool(final Connection connection) { allUpperLevelConnections.add(connection); if (connection.isSeparator()) { connectionDrawer.add(new PaletteSeparator()); return;/*from www . ja v a 2s.c o m*/ } if (connectionDrawer != null) { ImageDescriptor newConnectionDescriptor = ImageDescriptor.createFromFile(ShapesPlugin.class, "icons/connection_common.gif"); ConnectionCreationToolEntry tool = new ConnectionCreationToolEntry(connection.getName(), "Create a " + connection.getName() + " relation", new CreationFactory() { public Object getNewObject() { return null; } public Object getObjectType() { return connection.getName(); } }, newConnectionDescriptor, newConnectionDescriptor); connectionDrawer.add(tool); } else System.err.println("Drawer is null!"); }
From source file:com.alibaba.antx.config.gui.resource.Resources.java
License:Open Source License
public static ImageDescriptor getImageDescriptor(String key) { while (!key.startsWith("icon.") && !key.startsWith("image.")) { key = getText(key);/*from ww w. j a va 2s. com*/ } return ImageDescriptor.createFromFile(Resources.class, getText(key)); }
From source file:com.amalto.workbench.image.ImageProvider.java
License:Open Source License
public static ImageDescriptor getImageDesc(IImage image) { ImageDescriptor toReturn = (ImageDescriptor) cacheDescriptors.get(image.getLocation(), image.getPath()); if (toReturn == null) { toReturn = ImageDescriptor.createFromFile(image.getLocation(), image.getPath()); cacheDescriptors.put(image.getLocation(), image.getPath(), toReturn); }//w w w .j a v a 2 s . c o m return toReturn; }