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:org.jpericia.editor.actions.ShapesEditorPaletteFactory.java

License:Open Source License

/** Create the "Shapes" drawer. */
private static PaletteContainer createShapesDrawer() {
    PaletteDrawer componentsDrawer = new PaletteDrawer("Shapes");

    CombinedTemplateCreationEntry component = new CombinedTemplateCreationEntry("Ellipse",
            "Create an elliptical shape", EllipticalShape.class, new SimpleFactory(EllipticalShape.class),
            ImageDescriptor.createFromFile(EditorPlugin.class, "icons/ellipse16.gif"),
            ImageDescriptor.createFromFile(EditorPlugin.class, "icons/ellipse24.gif"));
    componentsDrawer.add(component);//from w w w  . j a v  a 2 s . c  o m

    component = new CombinedTemplateCreationEntry("Rectangle", "Create a rectangular shape",
            RectangularShape.class, new SimpleFactory(RectangularShape.class),
            ImageDescriptor.createFromFile(EditorPlugin.class, "icons/rectangle16.gif"),
            ImageDescriptor.createFromFile(EditorPlugin.class, "icons/rectangle24.gif"));
    componentsDrawer.add(component);

    return componentsDrawer;
}

From source file:org.jpericia.editor.actions.ShapesEditorPaletteFactory.java

License:Open Source License

/** Create the "Tools" group. */
private static PaletteContainer createToolsGroup(PaletteRoot palette) {
    PaletteGroup toolGroup = new PaletteGroup("Tools");

    // Add a selection tool to the group
    ToolEntry tool = new PanningSelectionToolEntry();
    toolGroup.add(tool);/*from   w  w  w  .j  a  v  a 2 s . c  o  m*/
    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() {
                public Object getNewObject() {
                    return null;
                }

                // see ShapeEditPart#createEditPolicies()
                // this is abused to transmit the desired line style
                public Object getObjectType() {
                    return Connection.SOLID_CONNECTION;
                }
            }, ImageDescriptor.createFromFile(EditorPlugin.class, "icons/connection_s16.gif"),
            ImageDescriptor.createFromFile(EditorPlugin.class, "icons/connection_s24.gif"));
    toolGroup.add(tool);

    // Add (dashed-line) connection tool
    tool = new ConnectionCreationToolEntry("Dashed connection", "Create a dashed-line connection",
            new CreationFactory() {
                public Object getNewObject() {
                    return null;
                }

                // see ShapeEditPart#createEditPolicies()
                // this is abused to transmit the desired line style
                public Object getObjectType() {
                    return Connection.DASHED_CONNECTION;
                }
            }, ImageDescriptor.createFromFile(EditorPlugin.class, "icons/connection_d16.gif"),
            ImageDescriptor.createFromFile(EditorPlugin.class, "icons/connection_d24.gif"));
    toolGroup.add(tool);

    return toolGroup;
}

From source file:org.l2x6.eircc.ui.misc.IrcImages.java

License:Open Source License

/**
 *
 *///from   w w  w .ja v  a 2s .c  o m
public IrcImages() {

    for (ImageKey imageKey : ImageKey.values()) {
        ImageDescriptor imageDescriptor = ImageDescriptor.createFromFile(this.getClass(),
                imageKey.getAbsolutePath());
        if (imageKey.getFlags() != SWT.NONE) {
            imageDescriptor = ImageDescriptor.createWithFlags(imageDescriptor, imageKey.getFlags());
        }
        imageRegistry.put(imageKey.getKey16x16(), imageDescriptor);
    }

}

From source file:org.mapsforge.mapmaker.gui.MapFileWizardPage.java

License:Open Source License

protected MapFileWizardPage(String pageName, IDialogSettings settings) {
    super(pageName);
    setPageComplete(false);/*from   w ww .  jav  a 2s.c  om*/
    setTitle(pageName);
    setImageDescriptor(ImageDescriptor.createFromFile(null, "logo.png"));

    this.settings = settings;
    this.DEFAULT_SETTINGS = createDefaultSettings();
    if (this.settings.getSection(SETTINGS_SECTION_NAME) == null) {
        System.out.println("[WizardPage] (MapFile) Using default settings.");
        this.settings.addSection(createDefaultSettings());
    }

    // Event listener for all checkboxes
    this.checkBoxSelectionListener = new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            MapFileWizardPage.this.onInputChanged();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);

        }
    };

    this.textFieldModificationListener = new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            MapFileWizardPage.this.onInputChanged();
        }
    };

    this.errorBgColor = Display.getCurrent().getSystemColor(SWT.COLOR_RED);
    this.okBgColor = Display.getCurrent().getSystemColor(SWT.COLOR_WHITE);
}

From source file:org.objectstyle.wolips.jdt.decorator.ActionMethodDecorator.java

License:Open Source License

public void decorate(Object element, IDecoration decoration) {
    if (this.isAction(element)) {
        decoration// w w w.  j  ava 2  s.co m
                .addOverlay(ImageDescriptor.createFromFile(ActionMethodDecorator.class, "action_overlay.gif"));
    }
}

From source file:org.oobium.eclipse.designer.DesignerPlugin.java

License:Open Source License

public static Image getImage(String key) {
    Image image = instance.getImageRegistry().get(key);
    if (image == null) {
        image = ImageDescriptor.createFromFile(DesignerPlugin.class, key).createImage(true);
        instance.getImageRegistry().put(key, image);
    }/*from w ww. j a  va 2s  .  c  o  m*/
    return image;
}

From source file:org.oobium.eclipse.designer.DesignerPlugin.java

License:Open Source License

public static ImageDescriptor getImageDescriptor(String key) {
    ImageDescriptor descriptor = instance.getImageRegistry().getDescriptor(key);
    if (descriptor == null) {
        descriptor = ImageDescriptor.createFromFile(DesignerPlugin.class, key);
        instance.getImageRegistry().put(key, descriptor);
    }//from  w w w.  j a  v  a2s .  c  o  m
    return descriptor;
}

From source file:org.oobium.eclipse.esp.EspPlugin.java

License:Open Source License

public static Image getImage(String key) {
    Image image = instance.getImageRegistry().get(key);
    if (image == null) {
        image = ImageDescriptor.createFromFile(EspPlugin.class, key).createImage(true);
        instance.getImageRegistry().put(key, image);
    }//from  ww w  . jav a 2  s  .  co  m
    return image;
}

From source file:org.oobium.eclipse.esp.EspPlugin.java

License:Open Source License

public static ImageDescriptor getImageDescriptor(String key) {
    ImageDescriptor descriptor = instance.getImageRegistry().getDescriptor(key);
    if (descriptor == null) {
        descriptor = ImageDescriptor.createFromFile(EspPlugin.class, key);
        instance.getImageRegistry().put(key, descriptor);
    }//ww  w. ja va  2s. c o m
    return descriptor;
}

From source file:org.oobium.eclipse.OobiumPlugin.java

License:Open Source License

public static ImageDescriptor getImageDescriptor(String key) {
    ImageDescriptor descriptor = instance.getImageRegistry().getDescriptor(key);
    if (descriptor == null) {
        descriptor = ImageDescriptor.createFromFile(OobiumPlugin.class, key);
        instance.getImageRegistry().put(key, descriptor);
    }/*from w w  w. ja  v  a2 s  .  co m*/
    return descriptor;
}