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.eclipse.gef.BrowserCursorSupportDefaultImpl.java

License:Open Source License

@Override
public Cursor createPlug() {
    String sourceName = "icons/plugmask.gif";
    ImageDescriptor id = ImageDescriptor.createFromFile(Internal.class, sourceName);
    return new Cursor(id.createImage());
}

From source file:org.eclipse.gef.examples.ediagram.EDiagramImages.java

License:Open Source License

public static ImageDescriptor getImageDescriptor(String key) {
    return ImageDescriptor.createFromFile(EDiagramImages.class, key);
}

From source file:org.eclipse.gef.examples.flow.FlowEditorPaletteFactory.java

License:Open Source License

private static PaletteContainer createComponentsDrawer() {

    PaletteDrawer drawer = new PaletteDrawer("Components", null);

    List entries = new ArrayList();

    CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry("Activity",
            "Create a new Activity Node", Activity.class, new SimpleFactory(Activity.class),
            ImageDescriptor.createFromFile(FlowPlugin.class, "images/gear16.gif"),
            ImageDescriptor.createFromFile(Activity.class, "images/gear16.gif"));
    entries.add(combined);/*  w  w w .j  a  v  a  2  s . co  m*/

    combined = new CombinedTemplateCreationEntry("Sequential Activity", "Create a Sequential Activity",
            SequentialActivity.class, new SimpleFactory(SequentialActivity.class),
            ImageDescriptor.createFromFile(FlowPlugin.class, "images/sequence16.gif"),
            ImageDescriptor.createFromFile(FlowPlugin.class, "images/sequence16.gif"));
    entries.add(combined);

    combined = new CombinedTemplateCreationEntry("Parallel Activity", "Create a  Parallel Activity",
            ParallelActivity.class, new SimpleFactory(ParallelActivity.class),
            ImageDescriptor.createFromFile(FlowPlugin.class, "images/parallel16.gif"),
            ImageDescriptor.createFromFile(FlowPlugin.class, "images/parallel16.gif"));
    entries.add(combined);

    drawer.addAll(entries);
    return drawer;
}

From source file:org.eclipse.gef.examples.flow.FlowEditorPaletteFactory.java

License:Open Source License

private static PaletteContainer createControlGroup(PaletteRoot root) {
    PaletteGroup controlGroup = new PaletteGroup("Control Group");

    List entries = new ArrayList();

    ToolEntry tool = new SelectionToolEntry();
    entries.add(tool);/*  ww w.j  a  va2  s . com*/
    root.setDefaultEntry(tool);

    tool = new MarqueeToolEntry();
    entries.add(tool);

    PaletteSeparator sep = new PaletteSeparator("org.eclipse.gef.examples.flow.flowplugin.sep2");
    sep.setUserModificationPermission(PaletteEntry.PERMISSION_NO_MODIFICATION);
    entries.add(sep);

    tool = new ConnectionCreationToolEntry("Connection Creation", "Creating connections", null,
            ImageDescriptor.createFromFile(FlowPlugin.class, "images/connection16.gif"),
            ImageDescriptor.createFromFile(Activity.class, "images/connection16.gif"));
    entries.add(tool);
    controlGroup.addAll(entries);
    return controlGroup;
}

From source file:org.eclipse.gef.examples.flow.ui.FlowWizardPage1.java

License:Open Source License

public FlowWizardPage1(IWorkbench aWorkbench, IStructuredSelection selection) {
    super("sampleFlowPage1", selection);
    this.setTitle("Create Flow Example File");
    this.setDescription("Create a new flow file resource");
    this.setImageDescriptor(ImageDescriptor.createFromFile(FlowPlugin.class, "images/flowbanner.gif"));
    this.workbench = aWorkbench;
}

From source file:org.eclipse.gef.examples.logicdesigner.actions.DecrementRetargetAction.java

License:Open Source License

/**
 * Constructor for IncrementRetargetAction.
 *//* w  w w  . ja va2s  .  c  o  m*/
public DecrementRetargetAction() {
    super(IncrementDecrementAction.DECREMENT, LogicMessages.IncrementDecrementAction_Decrement_ActionLabelText);
    setToolTipText(LogicMessages.IncrementDecrementAction_Decrement_ActionToolTipText);
    setImageDescriptor(ImageDescriptor.createFromFile(LogicPlugin.class, "icons/minus.gif")); //$NON-NLS-1$
}

From source file:org.eclipse.gef.examples.logicdesigner.actions.IncrementDecrementAction.java

License:Open Source License

public IncrementDecrementAction(IWorkbenchPart part, boolean increment) {
    super(part);//from www.j a  v a  2  s.  c  o  m
    if (increment) {
        request = new Request(INCREMENT_REQUEST);
        setText(LogicMessages.IncrementDecrementAction_Increment_ActionLabelText);
        setId(INCREMENT);
        setToolTipText(LogicMessages.IncrementDecrementAction_Increment_ActionToolTipText);
        setImageDescriptor(ImageDescriptor.createFromFile(LogicPlugin.class, "icons/plus.gif")); //$NON-NLS-1$
    } else {
        request = new Request(DECREMENT_REQUEST);
        setText(LogicMessages.IncrementDecrementAction_Decrement_ActionLabelText);
        setId(DECREMENT);
        setToolTipText(LogicMessages.IncrementDecrementAction_Decrement_ActionToolTipText);
        setImageDescriptor(ImageDescriptor.createFromFile(LogicPlugin.class, "icons/minus.gif")); //$NON-NLS-1$
    }
    setHoverImageDescriptor(getImageDescriptor());
}

From source file:org.eclipse.gef.examples.logicdesigner.actions.IncrementRetargetAction.java

License:Open Source License

/**
 * Constructor for IncrementRetargetAction.
 *//*  ww w. j  a va 2  s .c  o m*/
public IncrementRetargetAction() {
    super(IncrementDecrementAction.INCREMENT, LogicMessages.IncrementDecrementAction_Increment_ActionLabelText);
    setToolTipText(LogicMessages.IncrementDecrementAction_Increment_ActionToolTipText);
    setImageDescriptor(ImageDescriptor.createFromFile(LogicPlugin.class, "icons/plus.gif")); //$NON-NLS-1$
}

From source file:org.eclipse.gef.examples.logicdesigner.LogicPlugin.java

License:Open Source License

static private PaletteContainer createComponentsDrawer() {

    PaletteDrawer drawer = new PaletteDrawer(LogicMessages.LogicPlugin_Category_Components_Label,
            ImageDescriptor.createFromFile(Circuit.class, "icons/comp.gif"));//$NON-NLS-1$

    List entries = new ArrayList();

    CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry(
            LogicMessages.LogicPlugin_Tool_CreationTool_FlowContainer_Label,
            LogicMessages.LogicPlugin_Tool_CreationTool_FlowContainer_Description,
            new SimpleFactory(LogicFlowContainer.class),
            ImageDescriptor.createFromFile(Circuit.class, "icons/logicflow16.gif"), //$NON-NLS-1$
            ImageDescriptor.createFromFile(Circuit.class, "icons/logicflow24.gif")//$NON-NLS-1$
    );//from  www .ja  va  2s .c  o m
    combined.setToolClass(LogicCreationTool.class);
    entries.add(combined);

    combined = new CombinedTemplateCreationEntry(LogicMessages.LogicPlugin_Tool_CreationTool_Circuit_Label,
            LogicMessages.LogicPlugin_Tool_CreationTool_Circuit_Description, new SimpleFactory(Circuit.class),
            ImageDescriptor.createFromFile(Circuit.class, "icons/circuit16.gif"), //$NON-NLS-1$
            ImageDescriptor.createFromFile(Circuit.class, "icons/circuit24.gif")//$NON-NLS-1$
    );
    combined.setToolClass(LogicCreationTool.class);
    entries.add(combined);

    entries.add(new PaletteSeparator());

    combined = new CombinedTemplateCreationEntry(LogicMessages.LogicPlugin_Tool_CreationTool_Label_Label,
            LogicMessages.LogicPlugin_Tool_CreationTool_Label_Description, new SimpleFactory(LogicLabel.class),
            ImageDescriptor.createFromFile(Circuit.class, "icons/label16.gif"), //$NON-NLS-1$
            ImageDescriptor.createFromFile(Circuit.class, "icons/label24.gif")//$NON-NLS-1$
    );
    combined.setToolClass(LogicCreationTool.class);
    entries.add(combined);

    combined = new CombinedTemplateCreationEntry(LogicMessages.LogicPlugin_Tool_CreationTool_LED_Label,
            LogicMessages.LogicPlugin_Tool_CreationTool_LED_Description, new SimpleFactory(LED.class),
            ImageDescriptor.createFromFile(Circuit.class, "icons/ledicon16.gif"), //$NON-NLS-1$
            ImageDescriptor.createFromFile(Circuit.class, "icons/ledicon24.gif")//$NON-NLS-1$
    );
    combined.setToolClass(LogicCreationTool.class);
    entries.add(combined);

    combined = new CombinedTemplateCreationEntry(LogicMessages.LogicPlugin_Tool_CreationTool_ORGate_Label,
            LogicMessages.LogicPlugin_Tool_CreationTool_ORGate_Description, new SimpleFactory(OrGate.class),
            ImageDescriptor.createFromFile(Circuit.class, "icons/or16.gif"), //$NON-NLS-1$
            ImageDescriptor.createFromFile(Circuit.class, "icons/or24.gif")//$NON-NLS-1$
    );
    combined.setToolClass(LogicCreationTool.class);
    entries.add(combined);

    combined = new CombinedTemplateCreationEntry(LogicMessages.LogicPlugin_Tool_CreationTool_XORGate_Label,
            LogicMessages.LogicPlugin_Tool_CreationTool_XORGate_Description, new SimpleFactory(XORGate.class),
            ImageDescriptor.createFromFile(Circuit.class, "icons/xor16.gif"), //$NON-NLS-1$
            ImageDescriptor.createFromFile(Circuit.class, "icons/xor24.gif")//$NON-NLS-1$
    );
    combined.setToolClass(LogicCreationTool.class);
    entries.add(combined);

    combined = new CombinedTemplateCreationEntry(LogicMessages.LogicPlugin_Tool_CreationTool_ANDGate_Label,
            LogicMessages.LogicPlugin_Tool_CreationTool_ANDGate_Description, new SimpleFactory(AndGate.class),
            ImageDescriptor.createFromFile(Circuit.class, "icons/and16.gif"), //$NON-NLS-1$
            ImageDescriptor.createFromFile(Circuit.class, "icons/and24.gif")//$NON-NLS-1$
    );
    combined.setToolClass(LogicCreationTool.class);
    entries.add(combined);

    PaletteStack liveGroundStack = new PaletteStack(
            LogicMessages.LogicPlugin_Tool_CreationTool_LiveGroundStack_Label,
            LogicMessages.LogicPlugin_Tool_CreationTool_LiveGroundStack_Description, null);

    combined = new CombinedTemplateCreationEntry(LogicMessages.LogicPlugin_Tool_CreationTool_LiveOutput_Label,
            LogicMessages.LogicPlugin_Tool_CreationTool_LiveOutput_Description,
            new SimpleFactory(LiveOutput.class),
            ImageDescriptor.createFromFile(Circuit.class, "icons/live16.gif"), //$NON-NLS-1$
            ImageDescriptor.createFromFile(Circuit.class, "icons/live24.gif")//$NON-NLS-1$
    );
    combined.setToolClass(LogicCreationTool.class);
    liveGroundStack.add(combined);

    combined = new CombinedTemplateCreationEntry(LogicMessages.LogicPlugin_Tool_CreationTool_Ground_Label,
            LogicMessages.LogicPlugin_Tool_CreationTool_Ground_Description,
            new SimpleFactory(GroundOutput.class),
            ImageDescriptor.createFromFile(Circuit.class, "icons/ground16.gif"), //$NON-NLS-1$
            ImageDescriptor.createFromFile(Circuit.class, "icons/ground24.gif")//$NON-NLS-1$
    );
    combined.setToolClass(LogicCreationTool.class);
    liveGroundStack.add(combined);

    entries.add(liveGroundStack);

    drawer.addAll(entries);
    return drawer;
}

From source file:org.eclipse.gef.examples.logicdesigner.LogicPlugin.java

License:Open Source License

static private PaletteContainer createControlGroup(PaletteRoot root) {
    PaletteGroup controlGroup = new PaletteGroup(LogicMessages.LogicPlugin_Category_ControlGroup_Label);

    List entries = new ArrayList();

    ToolEntry tool = new PanningSelectionToolEntry();
    entries.add(tool);//from  w  w  w .j  a  v a 2 s.  com
    root.setDefaultEntry(tool);

    PaletteStack marqueeStack = new PaletteStack(LogicMessages.Marquee_Stack, "", null); //$NON-NLS-1$

    // NODES CONTAINED (default)
    marqueeStack.add(new MarqueeToolEntry());

    // NODES TOUCHED
    MarqueeToolEntry marquee = new MarqueeToolEntry();
    marquee.setToolProperty(MarqueeSelectionTool.PROPERTY_MARQUEE_BEHAVIOR,
            new Integer(MarqueeSelectionTool.BEHAVIOR_NODES_TOUCHED));
    marqueeStack.add(marquee);

    // NODES CONTAINED AND RELATED CONNECTIONS

    marquee = new MarqueeToolEntry();
    marquee.setToolProperty(MarqueeSelectionTool.PROPERTY_MARQUEE_BEHAVIOR,
            new Integer(MarqueeSelectionTool.BEHAVIOR_NODES_CONTAINED_AND_RELATED_CONNECTIONS));
    marqueeStack.add(marquee);

    // NODES TOUCHED AND RELATED CONNECTIONS
    marquee = new MarqueeToolEntry();
    marquee.setToolProperty(MarqueeSelectionTool.PROPERTY_MARQUEE_BEHAVIOR,
            new Integer(MarqueeSelectionTool.BEHAVIOR_NODES_TOUCHED_AND_RELATED_CONNECTIONS));
    marqueeStack.add(marquee);

    // CONNECTIONS CONTAINED
    marquee = new MarqueeToolEntry();
    marquee.setToolProperty(MarqueeSelectionTool.PROPERTY_MARQUEE_BEHAVIOR,
            new Integer(MarqueeSelectionTool.BEHAVIOR_CONNECTIONS_CONTAINED));
    marqueeStack.add(marquee);

    // CONNECTIONS TOUCHED
    marquee = new MarqueeToolEntry();
    marquee.setToolProperty(MarqueeSelectionTool.PROPERTY_MARQUEE_BEHAVIOR,
            new Integer(MarqueeSelectionTool.BEHAVIOR_CONNECTIONS_TOUCHED));
    marqueeStack.add(marquee);

    marqueeStack.setUserModificationPermission(PaletteEntry.PERMISSION_NO_MODIFICATION);
    entries.add(marqueeStack);

    tool = new ConnectionCreationToolEntry(
            LogicMessages.LogicPlugin_Tool_ConnectionCreationTool_ConnectionCreationTool_Label,
            LogicMessages.LogicPlugin_Tool_ConnectionCreationTool_ConnectionCreationTool_Description, null,
            ImageDescriptor.createFromFile(Circuit.class, "icons/connection16.gif"), //$NON-NLS-1$
            ImageDescriptor.createFromFile(Circuit.class, "icons/connection24.gif")//$NON-NLS-1$
    );
    entries.add(tool);
    controlGroup.addAll(entries);
    return controlGroup;
}