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

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

Introduction

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

Prototype

public static ImageDescriptor createFromImage(Image img) 

Source Link

Document

Creates and returns a new image descriptor for the given image.

Usage

From source file:spritey.ui.actions.AddFolderAction.java

License:Open Source License

/**
 * Creates a new instance of AddFolderAction.
 * //from w ww  .  ja  va  2 s  . co  m
 * @param viewer
 *        the viewer on which action will be performed.
 * @param page
 *        the wizard page that this action affects.
 */
public AddFolderAction(Viewer viewer, WizardPageEx page) {
    super(viewer, page);
    Image image = Application.getImageRegistry().get(FOLDER_IMG_ID);
    setImageDescriptor(ImageDescriptor.createFromImage(image));
    setToolTipText(Messages.ADD_SPRITES_ADD_FOLDER);
    setText(Messages.ADD_SPRITES_ADD_FOLDER);
    setAccelerator(SWT.MOD1 | 'F');
    setEnabled(false);
}

From source file:spritey.ui.actions.AddSpritesAction.java

License:Open Source License

/**
 * Creates a new instance of AddFolderAction.
 * /*from w w w . ja  va  2  s  .com*/
 * @param viewer
 *        the viewer on which action will be performed.
 * @param page
 *        the wizard page that this action affects.
 */
public AddSpritesAction(Viewer viewer, WizardPageEx page) {
    super(viewer, page);
    Image image = Application.getImageRegistry().get(ADD_IMG_ID);
    setImageDescriptor(ImageDescriptor.createFromImage(image));
    setToolTipText(Messages.ADD_SPRITES_ADD_SPRITES);
    setText(Messages.ADD_SPRITES_ADD_SPRITES);
    setAccelerator(SWT.MOD1 | 'S');
    setEnabled(false);
}

From source file:spritey.ui.actions.CollapseAllAction.java

License:Open Source License

public CollapseAllAction(TreeViewer viewer) {
    super(viewer);
    Image image = Application.getImageRegistry().get(COLLAPSE_ALL_IMG_ID);
    setImageDescriptor(ImageDescriptor.createFromImage(image));
    setToolTipText(Messages.ADD_SPRITES_COLLAPSE_ALL);
    setText(Messages.ADD_SPRITES_COLLAPSE_ALL);
}

From source file:spritey.ui.actions.CreateGroupAction.java

License:Open Source License

/**
 * Creates an new instance of CreateGroupAction.
 * /*from ww  w .  j  a  v  a  2  s. c o m*/
 * @param viewer
 *        the viewer on which action will be performed.
 */
public CreateGroupAction(Viewer viewer) {
    super(viewer);
    Image image = Application.getImageRegistry().get(CREATE_GROUP_IMG_ID);
    setImageDescriptor(ImageDescriptor.createFromImage(image));
    setToolTipText(Messages.ADD_SPRITES_CREATE_GROUP);
    setText(Messages.ADD_SPRITES_CREATE_GROUP);
    setAccelerator(SWT.MOD1 | 'G');
    setEnabled(false);
}

From source file:spritey.ui.actions.DeleteAction.java

License:Open Source License

/**
 * Creates an new instance of DeleteAction.
 * /*w w  w  .  j av a2  s  .c om*/
 * @param viewer
 *        the viewer on which action will be performed.
 * @param page
 *        the wizard page that this action affects.
 */
public DeleteAction(Viewer viewer, WizardPageEx page) {
    super(viewer);
    Image image = Application.getImageRegistry().get(DELETE_IMG_ID);
    setImageDescriptor(ImageDescriptor.createFromImage(image));
    setToolTipText(Messages.ADD_SPRITES_DELETE);
    setText(Messages.ADD_SPRITES_DELETE);
    setAccelerator(SWT.DEL);
    setEnabled(false);

    this.page = page;
}

From source file:spritey.ui.actions.ExpandAllAction.java

License:Open Source License

public ExpandAllAction(TreeViewer viewer) {
    super(viewer);
    Image image = Application.getImageRegistry().get(EXPAND_ALL_IMG_ID);
    setImageDescriptor(ImageDescriptor.createFromImage(image));
    setToolTipText(Messages.ADD_SPRITES_EXPAND_ALL);
    setText(Messages.ADD_SPRITES_EXPAND_ALL);
}

From source file:uk.ac.diamond.scisoft.analysis.rcp.plotting.sideplot.BoxProfile.java

License:Apache License

private void createPushPlotActions() {
    final IWorkbenchPartSite site = EclipseUtils.getPage().getActivePart().getSite();
    final String fullPlotID = "uk.ac.diamond.scisoft.analysis.rcp.plotView";
    pushMajorPlottingDataPlot1 = new Action() {
        @Override//from ww w .jav  a 2s  .  c o  m
        public void run() {
            pushPlottingData(site, fullPlotID + "1", 0);
        }
    };
    pushMajorPlottingDataPlot1.setText("Push major profiles to plot 1");
    final org.eclipse.swt.graphics.Image icon = SWTResourceManager.getImage(StaticScanPlotView.class,
            "/icons/chart_curve_add.png");
    final ImageDescriptor d = ImageDescriptor.createFromImage(icon);
    pushMajorPlottingDataPlot1.setImageDescriptor(d);
    pushMajorPlottingDataPlot1.setToolTipText("Push major profiles to plot 1");

    pushMajorPlottingDataPlot2 = new Action() {
        @Override
        public void run() {
            pushPlottingData(site, fullPlotID + "2", 0);
        }
    };
    pushMajorPlottingDataPlot2.setText("Push major profiles to plot 2");
    pushMajorPlottingDataPlot2.setImageDescriptor(d);
    pushMajorPlottingDataPlot2.setToolTipText("Push major profiles to plot 2");

    pushMinorPlottingDataPlot1 = new Action() {
        @Override
        public void run() {
            pushPlottingData(site, fullPlotID + "1", 1);
        }
    };
    pushMinorPlottingDataPlot1.setText("Push minor profiles to plot 1");
    pushMinorPlottingDataPlot1.setImageDescriptor(d);
    pushMinorPlottingDataPlot1.setToolTipText("Push minor profiles to plot 1");

    pushMinorPlottingDataPlot2 = new Action() {
        @Override
        public void run() {
            pushPlottingData(site, fullPlotID + "2", 1);
        }
    };
    pushMinorPlottingDataPlot2.setText("Push minor profiles to plot 2");
    pushMinorPlottingDataPlot2.setImageDescriptor(d);
    pushMinorPlottingDataPlot2.setToolTipText("Push minor profiles to plot 2");

    pushPlottingData = new DropDownAction();
    pushPlottingData.setToolTipText("Push plotting to plot 1 or 2");
    pushPlottingData.setImageDescriptor(d);
    pushPlottingData.add(pushMajorPlottingDataPlot1);
    pushPlottingData.add(pushMajorPlottingDataPlot2);
    pushPlottingData.add(pushMinorPlottingDataPlot1);
    pushPlottingData.add(pushMinorPlottingDataPlot2);
}

From source file:uk.ac.diamond.scisoft.analysis.rcp.plotting.sideplot.DerivativeViewer.java

License:Apache License

private void createExtraActions() {
    showLeg = Plot1DUIAdapter.createShowLegend(plotter);
    showLeg.setChecked(true);//www  .  j av a 2  s.  c o m

    final DerivativeViewer viewer = this;

    sendToPlotView = new Action() {
        @Override
        public void run() {
            try {
                EclipseUtils.getActivePage().showView("uk.ac.diamond.scisoft.analysis.rcp.plotView2");
                SDAPlotter.plot("Plot 2", viewer.getXValues(), viewer.getYValues().toArray(new Dataset[0]));
            } catch (Exception e) {
                logger.error("Error plotting to DerivitiveViewer", e);
            }
        }

    };
    sendToPlotView.setToolTipText("Send the results of the derivative to a separate plot view");
    final org.eclipse.swt.graphics.Image icon = SWTResourceManager.getImage(StaticScanPlotView.class,
            "/icons/chart_curve_add.png");
    final ImageDescriptor d = ImageDescriptor.createFromImage(icon);
    sendToPlotView.setImageDescriptor(d);
    sendToPlotView.setText("Send derivative to Plot 2");
}

From source file:uk.ac.diamond.scisoft.analysis.rcp.plotting.sideplot.LineProfile.java

License:Apache License

private void createPushPlotActions() {
    final IWorkbenchPartSite site = EclipseUtils.getPage().getActivePart().getSite();
    final String fullPlotID = "uk.ac.diamond.scisoft.analysis.rcp.plotView";
    pushPlottingDataPlot1 = new Action() {
        @Override/*from w  w  w  . ja  v  a  2 s .c o  m*/
        public void run() {
            pushPlottingData(site, fullPlotID + "1", 0);
        }
    };
    pushPlottingDataPlot1.setText("Push line profiles to plot 1");
    final org.eclipse.swt.graphics.Image icon = SWTResourceManager.getImage(StaticScanPlotView.class,
            "/icons/chart_curve_add.png");
    final ImageDescriptor d = ImageDescriptor.createFromImage(icon);
    pushPlottingDataPlot1.setImageDescriptor(d);
    pushPlottingDataPlot1.setToolTipText("Push line profiles to plot 1");

    pushPlottingDataPlot2 = new Action() {
        @Override
        public void run() {
            pushPlottingData(site, fullPlotID + "2", 0);
        }
    };
    pushPlottingDataPlot2.setText("Push line profiles to plot 2");
    pushPlottingDataPlot2.setImageDescriptor(d);
    pushPlottingDataPlot2.setToolTipText("Push line profiles to plot 2");

    pushPlottingData = new DropDownAction();
    pushPlottingData.setToolTipText("Push plotting to plot 1 or 2");
    pushPlottingData.setImageDescriptor(d);
    pushPlottingData.add(pushPlottingDataPlot1);
    pushPlottingData.add(pushPlottingDataPlot2);

}

From source file:uk.ac.diamond.scisoft.analysis.rcp.plotting.sideplot.SectorProfile.java

License:Apache License

private void createPushPlotActions() {
    final String fullPlotID = "uk.ac.diamond.scisoft.analysis.rcp.plotView";
    final IWorkbenchPartSite site = EclipseUtils.getPage().getActivePart().getSite();
    final org.eclipse.swt.graphics.Image icon = SWTResourceManager.getImage(StaticScanPlotView.class,
            "/icons/chart_curve_add.png");
    final ImageDescriptor d = ImageDescriptor.createFromImage(icon);
    pushRadialPlottingDataPlot1 = new Action() {
        @Override//from ww  w.  java  2  s.c  o m
        public void run() {
            pushPlottingData(site, fullPlotID + "1", 0);

        }
    };
    pushRadialPlottingDataPlot1.setText("Push radial datasets to plot 1");
    pushRadialPlottingDataPlot1.setImageDescriptor(d);
    pushRadialPlottingDataPlot1.setToolTipText("Push radial datasets to plot 1");
    pushAzimuthPlottingDataPlot1 = new Action() {
        @Override
        public void run() {
            pushPlottingData(site, fullPlotID + "1", 1);

        }
    };
    pushAzimuthPlottingDataPlot1.setText("Push azimuth datasets to plot 1");
    pushAzimuthPlottingDataPlot1.setImageDescriptor(d);
    pushAzimuthPlottingDataPlot1.setToolTipText("Push azimuth datasets to plot 1");
    pushRadialPlottingDataPlot2 = new Action() {
        @Override
        public void run() {
            pushPlottingData(site, fullPlotID + "2", 0);

        }
    };
    pushRadialPlottingDataPlot2.setText("Push radial datasets to plot 2");
    pushRadialPlottingDataPlot2.setImageDescriptor(d);
    pushRadialPlottingDataPlot2.setToolTipText("Push radial datasets to plot 2");
    pushAzimuthPlottingDataPlot2 = new Action() {
        @Override
        public void run() {
            pushPlottingData(site, fullPlotID + "2", 1);

        }
    };
    pushAzimuthPlottingDataPlot2.setText("Push azimuth datasets to plot 2");
    pushAzimuthPlottingDataPlot2.setImageDescriptor(d);
    pushAzimuthPlottingDataPlot2.setToolTipText("Push azimuth datasets to plot 2");

    pushPlottingData = new DropDownAction();
    pushPlottingData.setToolTipText("Push plotting to plot 1 or 2");
    pushPlottingData.setImageDescriptor(d);
    pushPlottingData.add(pushRadialPlottingDataPlot1);
    pushPlottingData.add(pushAzimuthPlottingDataPlot1);
    pushPlottingData.add(pushRadialPlottingDataPlot2);
    pushPlottingData.add(pushAzimuthPlottingDataPlot2);
}