Example usage for org.eclipse.jface.resource ImageDescriptor createFromFile

List of usage examples for org.eclipse.jface.resource ImageDescriptor createFromFile

Introduction

In this page you can find the example usage for org.eclipse.jface.resource ImageDescriptor createFromFile.

Prototype

public static ImageDescriptor createFromFile(Class<?> location, String filename) 

Source Link

Document

Creates and returns a new image descriptor from a file.

Usage

From source file:edu.tsinghua.lumaqq.resource.Resources.java

License:Open Source License

/**
 * ???/*from   w w  w.  j a  va  2s. c o m*/
 * 
 * @param resId
 *       ?ID
 * @return
 *       ImageDescriptor
 */
public ImageDescriptor getImageDescriptor(int resId) {
    ImageDescriptor ret = registry.getDescriptor(resourceLocations[resId]);
    if (ret == null) {
        ret = ImageDescriptor.createFromFile(LumaQQ.class, resourceLocations[resId]);
        if (ret != null)
            registry.put(resourceLocations[resId], ret);
        return ret;
    } else
        return ret;
}

From source file:eldaEditor.editor.DSCDiagramEditor.java

License:Open Source License

protected PaletteRoot getPaletteRoot() {
    PaletteRoot root = new PaletteRoot();
    PaletteGroup group = new PaletteGroup("Tools");

    // Add a selection tool to the group
    ToolEntry tool = new SelectionToolEntry();
    group.add(0, tool);//w  w  w. j  a v a2 s  . c  o m
    root.setDefaultEntry(tool);

    // Add a marquee tool to the group
    ToolEntry marqueeToolEntry = new MarqueeToolEntry();
    marqueeToolEntry.setToolProperty(AbstractTool.PROPERTY_UNLOAD_WHEN_FINISHED, Boolean.TRUE);
    group.add(1, marqueeToolEntry);

    // Add a (unnamed) separator to the group
    group.add(2, new PaletteSeparator());
    root.add(group);

    CreationToolEntry createCompositeStateEntry = new CreationToolEntry("Composite State",
            "State tool to insert  a new composite state element",
            new DSCDiagramModelCreationFactory(DSCState.class, false),
            ImageDescriptor.createFromFile(OutlineIcons.class, "state1.gif"),
            ImageDescriptor.createFromFile(OutlineIcons.class, "state1_on.gif"));

    CreationToolEntry createSimpleStateEntry = new CreationToolEntry("Simple State",
            "State tool to insert  a new state element",
            new DSCDiagramModelCreationFactory(DSCState.class, true),
            ImageDescriptor.createFromFile(OutlineIcons.class, "state1.gif"),
            ImageDescriptor.createFromFile(OutlineIcons.class, "state1_on.gif"));

    ConnectionCreationToolEntry transitionToolEntry = new ConnectionCreationToolEntry("Transition",
            "Transition tool to insert  a new transition", new DSCDiagramModelCreationFactory(Transition.class),
            ImageDescriptor.createFromFile(OutlineIcons.class, "transition.gif"),
            ImageDescriptor.createFromFile(OutlineIcons.class, "transition_on.gif"));

    //      transitionToolEntry.setToolProperty("defaultCursor", curs);
    transitionToolEntry.setToolProperty("defaultCursor", new Cursor(null, SWT.CURSOR_UPARROW));
    transitionToolEntry.setToolProperty("disabledCursor", new Cursor(null, SWT.CURSOR_NO));

    CreationToolEntry createNoteEntry = new CreationToolEntry("Note", "Note tool to insert a new note element",
            new GenericDiagramModelCreationFactory(Note.class),
            ImageDescriptor.createFromFile(OutlineIcons.class, "note.gif"),
            ImageDescriptor.createFromFile(OutlineIcons.class, "note_on.gif"));
    createNoteEntry.setToolProperty(AbstractTool.PROPERTY_UNLOAD_WHEN_FINISHED, Boolean.TRUE);

    CreationToolEntry createTextEntry = new CreationToolEntry("Text", "Text tool to insert a new text label",
            new GenericDiagramModelCreationFactory(TextLabel.class),
            ImageDescriptor.createFromFile(OutlineIcons.class, "label_off.gif"),
            ImageDescriptor.createFromFile(OutlineIcons.class, "label_on.gif"));

    ConnectionCreationToolEntry anchorNoteToItemToolEntry = new ConnectionCreationToolEntry(
            "Anchor note to item", "AnchorNoteToItem tool to insert a new note relationship",
            new DSCDiagramModelCreationFactory(AnchorNoteToItem.class),
            ImageDescriptor.createFromFile(OutlineIcons.class, "indication.gif"),
            ImageDescriptor.createFromFile(OutlineIcons.class, "indication_on.gif"));
    anchorNoteToItemToolEntry.setToolProperty(AbstractTool.PROPERTY_UNLOAD_WHEN_FINISHED, Boolean.TRUE);

    Image img = Icons.IMAGE_MIRINO;
    ImageData imgData = img.getImageData();
    Cursor curs = new Cursor(null, imgData, 0, 0);

    anchorNoteToItemToolEntry.setToolProperty("defaultCursor", curs);
    anchorNoteToItemToolEntry.setToolProperty("disabledCursor", new Cursor(null, SWT.CURSOR_NO));

    group.add(3, createSimpleStateEntry);
    group.add(4, createCompositeStateEntry);
    group.add(5, transitionToolEntry);
    group.add(6, new PaletteSeparator());
    //      group.add(5, createStartPointEntry);
    //      group.add(6, createEndPointEntry);
    //      group.add(7, createHorizontalJoinEntry);
    //      group.add(8, createVerticalJoinEntry);
    //      group.add(9, createHorizontalForkEntry);
    //      group.add(10, createVerticalForkEntry);
    group.add(7, new PaletteSeparator());
    group.add(8, createTextEntry);
    group.add(9, createNoteEntry);
    group.add(10, anchorNoteToItemToolEntry);
    //      group.add(9, createHorizontalLineEntry);
    //      group.add(15, createVerticalLineEntry);
    //      group.add(9,new PaletteSeparator());

    return root;
}

From source file:es.axios.udig.georeferencing.internal.ui.coordinatepanel.CoordinateTableComposite.java

License:LGPL

/**
 * Creates the {@link ImageRegistry} that stores the image shown by the
 * tools./*from   w  ww .j av a2  s. c o  m*/
 * 
 * @return The imageRegistry.
 */
private ImageRegistry createImageRegistry() {

    ImageRegistry registry = new ImageRegistry(this.getDisplay());

    String opId = "Delete"; //$NON-NLS-1$
    String imgFile = "image/delete.gif"; //$NON-NLS-1$ 
    registry.put(opId, ImageDescriptor.createFromFile(CoordinateTableComposite.class, imgFile));

    opId = "Add"; //$NON-NLS-1$
    imgFile = "image/add.png"; //$NON-NLS-1$ 
    registry.put(opId, ImageDescriptor.createFromFile(CoordinateTableComposite.class, imgFile));

    opId = "Move"; //$NON-NLS-1$
    imgFile = "image/movemarker.png"; //$NON-NLS-1$ 
    registry.put(opId, ImageDescriptor.createFromFile(CoordinateTableComposite.class, imgFile));

    opId = "DeleteAll"; //$NON-NLS-1$
    imgFile = "image/deleteAll.gif"; //$NON-NLS-1$ 
    registry.put(opId, ImageDescriptor.createFromFile(CoordinateTableComposite.class, imgFile));

    return registry;
}

From source file:es.axios.udig.georeferencing.internal.ui.imagepanel.ImageComposite.java

License:LGPL

/**
 * Create the images that are shown in the tools.
 * //w w  w  .jav  a  2s.c o  m
 * @return The imageRegistry
 */
private ImageRegistry createImageRegistry() {

    ImageRegistry registry = new ImageRegistry(this.getDisplay());

    String opId = "DeleteAll"; //$NON-NLS-1$
    String imgFile = "image/cancel_all_co2.gif"; //$NON-NLS-1$ 
    registry.put(opId, ImageDescriptor.createFromFile(ImageComposite.class, imgFile));

    opId = "Delete"; //$NON-NLS-1$
    imgFile = "image/clear_co2.gif"; //$NON-NLS-1$ 
    registry.put(opId, ImageDescriptor.createFromFile(ImageComposite.class, imgFile));

    opId = "Load"; //$NON-NLS-1$
    imgFile = "image/folder.png"; //$NON-NLS-1$ 
    registry.put(opId, ImageDescriptor.createFromFile(ImageComposite.class, imgFile));

    opId = "Add"; //$NON-NLS-1$
    imgFile = "image/placemark_pointer2.gif"; //$NON-NLS-1$ 
    registry.put(opId, ImageDescriptor.createFromFile(ImageComposite.class, imgFile));

    opId = "Move"; //$NON-NLS-1$
    imgFile = "image/movemarker.png"; //$NON-NLS-1$ 
    registry.put(opId, ImageDescriptor.createFromFile(ImageComposite.class, imgFile));

    opId = "ZoomIn"; //$NON-NLS-1$
    imgFile = "image/zoom-in-5.png"; //$NON-NLS-1$ 
    registry.put(opId, ImageDescriptor.createFromFile(ImageComposite.class, imgFile));

    opId = "ZoomOut"; //$NON-NLS-1$
    imgFile = "image/zoom-out-5.png"; //$NON-NLS-1$ 
    registry.put(opId, ImageDescriptor.createFromFile(ImageComposite.class, imgFile));

    opId = "ZoomFit"; //$NON-NLS-1$
    imgFile = "image/zoom_extent.gif"; //$NON-NLS-1$ 
    registry.put(opId, ImageDescriptor.createFromFile(ImageComposite.class, imgFile));

    opId = "Pan"; //$NON-NLS-1$
    imgFile = "image/pan.png"; //$NON-NLS-1$ 
    registry.put(opId, ImageDescriptor.createFromFile(ImageComposite.class, imgFile));

    return registry;
}

From source file:es.axios.udig.georeferencing.ui.GeoreferencingView.java

License:LGPL

/**
 * Create actions, linking view to current map.
 *//*  w ww  . j a  v  a2 s . c o  m*/
private void createActions() {
    this.runButton = new runButtonAction();
    this.runAction = new Action() {

        @Override
        public void run() {
            showEnabled(false);
            cmd.execute();
            showEnabled(true);
        }
    };
    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:es.axios.udig.sextante.linetopolygon.LineToPolygonUIFactory.java

License:Open Source License

public Image createIcon() {

    final String file = "images/LineToPolygon.gif"; //$NON-NLS-1$
    ImageDescriptor descriptor = ImageDescriptor.createFromFile(SOLineToPolygonComposite.class, file);
    Image image = descriptor.createImage();
    return image;
}

From source file:es.axios.udig.spatialoperations.internal.ui.parameters.buffer.BufferLayersComposite.java

License:LGPL

private ImageRegistry CreateImageRegistry() {

    ImageRegistry registry = new ImageRegistry();

    String imgFile = "images/" + SOURCE_LEGEND + ".gif"; //$NON-NLS-1$ //$NON-NLS-2$
    registry.put(SOURCE_LEGEND, ImageDescriptor.createFromFile(BufferLayersComposite.class, imgFile));

    return registry;
}

From source file:es.axios.udig.spatialoperations.internal.ui.parameters.buffer.BufferParametersPresenterFactory.java

License:LGPL

public Image createIcon() {

    final String file = "images/Buffer.gif"; //$NON-NLS-1$

    ImageDescriptor descriptor = ImageDescriptor.createFromFile(BufferComposite.class, file);

    Image image = descriptor.createImage();

    return image;
}

From source file:es.axios.udig.spatialoperations.internal.ui.parameters.clip.ClipComposite.java

License:Open Source License

private ImageRegistry CreateImageRegistry() {

    ImageRegistry registry = new ImageRegistry();

    String imgFile = "images/" + SOURCE_LEGEND + ".gif"; //$NON-NLS-1$ //$NON-NLS-2$
    registry.put(SOURCE_LEGEND, ImageDescriptor.createFromFile(ClipComposite.class, imgFile));

    imgFile = "images/" + REFERENCE_LEGEND + ".gif"; //$NON-NLS-1$ //$NON-NLS-2$
    registry.put(REFERENCE_LEGEND, ImageDescriptor.createFromFile(ClipComposite.class, imgFile));

    return registry;
}

From source file:es.axios.udig.spatialoperations.internal.ui.parameters.clip.ClipParametersPresenterFactory.java

License:Open Source License

public Image createIcon() {

    final String file = "images/Clip.gif"; //$NON-NLS-1$

    ImageDescriptor descriptor = ImageDescriptor.createFromFile(ClipComposite.class, file);

    Image image = descriptor.createImage();

    return image;
}