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

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

Introduction

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

Prototype

public static ImageDescriptor createFromURL(URL url) 

Source Link

Document

Creates and returns a new image descriptor from a URL.

Usage

From source file:distributed.plugin.ui.actions.LoadAdversaryRetargetAction.java

License:Open Source License

/**
 * @param actionID//from  ww w  .  j a  v a2  s  .  com
 * @param text
 */
public LoadAdversaryRetargetAction(String actionID, String text) {
    super(actionID, text);
    //           setImageDescriptor(
    //           ImageDescriptor.createFromFile(GraphEditor.class,"icons/load_en.gif"));

    try {
        final URL installUrl = Activator.getDefault().getBundle().getEntry("/");
        final URL imageUrl = new URL(installUrl, "icons/adver.png");
        setImageDescriptor(ImageDescriptor.createFromURL(imageUrl));

    } catch (MalformedURLException e) {
    }
    setToolTipText(text);
    setText(text);
    setDescription(text);
}

From source file:distributed.plugin.ui.actions.LoadRetargetAction.java

License:Open Source License

/**
 * @param actionID//from w  w  w  . j  ava  2s  .co  m
 * @param text
 */
public LoadRetargetAction(String actionID, String text) {
    super(actionID, text);
    //           setImageDescriptor(
    //           ImageDescriptor.createFromFile(GraphEditor.class,"icons/load_en.gif"));

    try {
        final URL installUrl = Activator.getDefault().getBundle().getEntry("/");
        final URL imageUrl = new URL(installUrl, "icons/load.png");
        setImageDescriptor(ImageDescriptor.createFromURL(imageUrl));

    } catch (MalformedURLException e) {
    }
    setToolTipText(text);
    setText(text);
    setDescription(text);
}

From source file:distributed.plugin.ui.actions.RemoveStateRetargetAction.java

License:Open Source License

/**
 * @param actionID/*www  .ja  va  2s .c  o m*/
 * @param text
 */
public RemoveStateRetargetAction(String actionID, String text) {
    super(actionID, text);
    try {
        final URL installUrl = Activator.getDefault().getBundle().getEntry("/");
        final URL imageUrl = new URL(installUrl, "icons/view_state.png");
        setImageDescriptor(ImageDescriptor.createFromURL(imageUrl));

    } catch (MalformedURLException e) {
    }
    setToolTipText(text);

}

From source file:distributed.plugin.ui.actions.ResumeRetargetAction.java

License:Open Source License

/**
 * @param actionID//from   w  w w  . j a v a 2s. com
 * @param text
 */
public ResumeRetargetAction(String actionID, String text) {
    super(actionID, text);
    try {
        final URL installUrl = Activator.getDefault().getBundle().getEntry("/");
        final URL imageUrl = new URL(installUrl, "icons/resume_en.gif");
        setImageDescriptor(ImageDescriptor.createFromURL(imageUrl));

    } catch (MalformedURLException e) {
    }
    setToolTipText(text);
}

From source file:distributed.plugin.ui.actions.SpeedRetargetAction.java

License:Open Source License

/**
 * @param actionID/*from www  . ja  v a2 s .  c  o m*/
 * @param text
 */
public SpeedRetargetAction(String actionID, String text) {
    super(actionID, text);
    try {
        final URL installUrl = Activator.getDefault().getBundle().getEntry("/");
        final URL imageUrl = new URL(installUrl, "icons/speed.png");
        setImageDescriptor(ImageDescriptor.createFromURL(imageUrl));

    } catch (MalformedURLException e) {
    }
    setToolTipText(text);
}

From source file:distributed.plugin.ui.actions.StepNextRetargetAction.java

License:Open Source License

/**
 * @param actionID//  www . j  a  va2s.  c o m
 * @param text
 */
public StepNextRetargetAction(String actionID, String text) {
    super(actionID, text);
    try {
        final URL installUrl = Activator.getDefault().getBundle().getEntry("/");
        final URL imageUrl = new URL(installUrl, "icons/step_next_en.gif");
        setImageDescriptor(ImageDescriptor.createFromURL(imageUrl));

    } catch (MalformedURLException e) {
    }
    setToolTipText(text);
}

From source file:distributed.plugin.ui.actions.StopRetargetAction.java

License:Open Source License

/**
 * @param actionID/* w  ww. java 2s  .  c o  m*/
 * @param text
 */
public StopRetargetAction(String actionID, String text) {
    super(actionID, text);
    try {
        final URL installUrl = Activator.getDefault().getBundle().getEntry("/");
        final URL imageUrl = new URL(installUrl, "icons/stop.png");
        setImageDescriptor(ImageDescriptor.createFromURL(imageUrl));

    } catch (MalformedURLException e) {
    }
    setToolTipText(text);
}

From source file:distributed.plugin.ui.actions.SuspendRetargetAction.java

License:Open Source License

/**
 * @param actionID//from w  ww  .ja  va2  s. c om
 * @param text
 */
public SuspendRetargetAction(String actionID, String text) {
    super(actionID, text);
    try {
        final URL installUrl = Activator.getDefault().getBundle().getEntry("/");
        final URL imageUrl = new URL(installUrl, "icons/suspend_en.gif");
        setImageDescriptor(ImageDescriptor.createFromURL(imageUrl));

    } catch (MalformedURLException e) {
    }
    setToolTipText(text);
}

From source file:distributed.plugin.ui.editor.GraphEditor.java

License:Open Source License

private PaletteContainer createDrawerComponents() {

    URL installUrl = Activator.getDefault().getBundle().getEntry("/");
    URL imageUrl = null;/*from w ww  . j  a v  a 2 s. c  o m*/

    try {
        imageUrl = new URL(installUrl, "icons/draw.png");
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    PaletteDrawer drawer = new PaletteDrawer(IGraphEditorConstants.DRAW_COMPONENTS,
            ImageDescriptor.createFromURL(imageUrl));

    List entries = new ArrayList();

    try {
        imageUrl = new URL(installUrl, "icons/node.gif");
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry(IGraphEditorConstants.DRAW_NODE,
            IGraphEditorConstants.DRAW_NODE_DESC, IGraphEditorConstants.TEMPLATE_NODE,
            this.getFactory(IGraphEditorConstants.TEMPLATE_NODE), ImageDescriptor.createFromURL(imageUrl),
            ImageDescriptor.createFromURL(imageUrl));
    entries.add(combined);

    try {
        imageUrl = new URL(installUrl, "icons/uni_link.png");
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    ToolEntry tool = new ConnectionCreationToolEntry(IGraphEditorConstants.DRAW_UNI_LINK,
            IGraphEditorConstants.DRAW_UNI_LINK_DESC, this.getFactory(IGraphEditorConstants.TEMPLATE_UNI_LINK),
            ImageDescriptor.createFromURL(imageUrl), ImageDescriptor.createFromURL(imageUrl));
    entries.add(tool);

    try {
        imageUrl = new URL(installUrl, "icons/bi_link.png");
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    tool = new ConnectionCreationToolEntry(IGraphEditorConstants.DRAW_BI_LINK,
            IGraphEditorConstants.DRAW_BI_LINK_DESC, this.getFactory(IGraphEditorConstants.TEMPLATE_BI_LINK),
            ImageDescriptor.createFromURL(imageUrl), ImageDescriptor.createFromURL(imageUrl));
    entries.add(tool);

    drawer.addAll(entries);
    return drawer;
}

From source file:distributed.plugin.ui.editor.GraphEditor.java

License:Open Source License

private PaletteContainer createGraphComponents() {

    URL installUrl = Activator.getDefault().getBundle().getEntry("/");
    URL imageUrl = null;/*from   w ww  . j a  v a2  s . c  o m*/

    try {
        imageUrl = new URL(installUrl, "icons/graph.png");
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    PaletteDrawer drawer = new PaletteDrawer(IGraphEditorConstants.TOPOLOGY_TYPES,
            ImageDescriptor.createFromURL(imageUrl));

    List entries = new ArrayList();

    try {
        imageUrl = new URL(installUrl, "icons/ring.png");
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry(IGraphEditorConstants.RING,
            IGraphEditorConstants.RING_DESC, IGraphEditorConstants.TEMPLATE_RING,
            this.getFactory(IGraphEditorConstants.TEMPLATE_RING), ImageDescriptor.createFromURL(imageUrl),
            ImageDescriptor.createFromURL(imageUrl));
    entries.add(combined);

    try {
        imageUrl = new URL(installUrl, "icons/tree.png");
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    combined = new CombinedTemplateCreationEntry(IGraphEditorConstants.TREE, IGraphEditorConstants.TREE_DESC,
            IGraphEditorConstants.TEMPLATE_TREE, this.getFactory(IGraphEditorConstants.TEMPLATE_TREE),
            ImageDescriptor.createFromURL(imageUrl), //$NON-NLS-1$
            ImageDescriptor.createFromURL(imageUrl)//$NON-NLS-1$
    );
    entries.add(combined);

    try {
        imageUrl = new URL(installUrl, "icons/complete.png");
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    combined = new CombinedTemplateCreationEntry(IGraphEditorConstants.COMPLETE,
            IGraphEditorConstants.COMPLETE_DESC, IGraphEditorConstants.TEMPLATE_COMPLETE,
            this.getFactory(IGraphEditorConstants.TEMPLATE_COMPLETE), ImageDescriptor.createFromURL(imageUrl), //$NON-NLS-1$
            ImageDescriptor.createFromURL(imageUrl)//$NON-NLS-1$
    );
    entries.add(combined);

    try {
        imageUrl = new URL(installUrl, "icons/spatial.png");
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    combined = new CombinedTemplateCreationEntry(IGraphEditorConstants.SPATIAL,
            IGraphEditorConstants.SPATIAL_DESC, IGraphEditorConstants.TEMPLATE_SPATIAL,
            this.getFactory(IGraphEditorConstants.TEMPLATE_SPATIAL), ImageDescriptor.createFromURL(imageUrl), //$NON-NLS-1$
            ImageDescriptor.createFromURL(imageUrl)//$NON-NLS-1$
    );
    entries.add(combined);

    try {
        imageUrl = new URL(installUrl, "icons/mesh.png");
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    combined = new CombinedTemplateCreationEntry(IGraphEditorConstants.MESH, IGraphEditorConstants.MESH_DESC,
            IGraphEditorConstants.TEMPLATE_MESH, this.getFactory(IGraphEditorConstants.TEMPLATE_MESH),
            ImageDescriptor.createFromURL(imageUrl), //$NON-NLS-1$
            ImageDescriptor.createFromURL(imageUrl)//$NON-NLS-1$
    );
    entries.add(combined);

    try {
        imageUrl = new URL(installUrl, "icons/hypercube.png");
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    combined = new CombinedTemplateCreationEntry(IGraphEditorConstants.HYPER_CUBE,
            IGraphEditorConstants.HYPER_CUBE_DESC, IGraphEditorConstants.TEMPLATE_HYPER_CUBE,
            this.getFactory(IGraphEditorConstants.TEMPLATE_HYPER_CUBE), ImageDescriptor.createFromURL(imageUrl), //$NON-NLS-1$
            ImageDescriptor.createFromURL(imageUrl)//$NON-NLS-1$
    );
    entries.add(combined);

    try {
        imageUrl = new URL(installUrl, "icons/torus.png");
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    PaletteStack toruses = new PaletteStack(IGraphEditorConstants.TORUS_STACK,
            IGraphEditorConstants.TORUS_STACK_DESC, null);

    combined = new CombinedTemplateCreationEntry(IGraphEditorConstants.TORUS_1,
            IGraphEditorConstants.TORUS_1_DESC, IGraphEditorConstants.TEMPLATE_TORUS_1,
            this.getFactory(IGraphEditorConstants.TEMPLATE_TORUS_1), ImageDescriptor.createFromURL(imageUrl), //$NON-NLS-1$
            ImageDescriptor.createFromURL(imageUrl)//$NON-NLS-1$
    );
    toruses.add(combined);

    try {
        imageUrl = new URL(installUrl, "icons/torus2.png");
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    combined = new CombinedTemplateCreationEntry(IGraphEditorConstants.TORUS_2,
            IGraphEditorConstants.TORUS_2_DESC, IGraphEditorConstants.TEMPLATE_TORUS_2,
            this.getFactory(IGraphEditorConstants.TEMPLATE_TORUS_2), ImageDescriptor.createFromURL(imageUrl), //$NON-NLS-1$
            ImageDescriptor.createFromURL(imageUrl)//$NON-NLS-1$
    );
    toruses.add(combined);
    entries.add(toruses);

    try {
        imageUrl = new URL(installUrl, "icons/conn.png");
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    PaletteStack random = new PaletteStack(IGraphEditorConstants.RANDOM_STACK,
            IGraphEditorConstants.RANDOM_STACK_DESC, null);

    combined = new CombinedTemplateCreationEntry(IGraphEditorConstants.CONNECTED,
            IGraphEditorConstants.CONNECTED_DESC, IGraphEditorConstants.TEMPLATE_CONNECTED,
            this.getFactory(IGraphEditorConstants.TEMPLATE_CONNECTED), ImageDescriptor.createFromURL(imageUrl), //$NON-NLS-1$
            ImageDescriptor.createFromURL(imageUrl)//$NON-NLS-1$
    );
    random.add(combined);

    try {
        imageUrl = new URL(installUrl, "icons/genn.png");
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    combined = new CombinedTemplateCreationEntry(IGraphEditorConstants.FOREST,
            IGraphEditorConstants.FORREST_DESC, IGraphEditorConstants.TEMPLATE_GENERIC,
            this.getFactory(IGraphEditorConstants.TEMPLATE_GENERIC), ImageDescriptor.createFromURL(imageUrl), //$NON-NLS-1$
            ImageDescriptor.createFromURL(imageUrl)//$NON-NLS-1$
    );
    random.add(combined);
    entries.add(random);

    try {
        imageUrl = new URL(installUrl, "icons/torus2.png");
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    combined = new CombinedTemplateCreationEntry(IGraphEditorConstants.MATRIX,
            IGraphEditorConstants.MATRIX_DESC, IGraphEditorConstants.TEMPLATE_MATRIX,
            this.getFactory(IGraphEditorConstants.TEMPLATE_MATRIX), ImageDescriptor.createFromURL(imageUrl), //$NON-NLS-1$
            ImageDescriptor.createFromURL(imageUrl)//$NON-NLS-1$
    );
    entries.add(combined);

    drawer.addAll(entries);
    return drawer;
}