Example usage for org.eclipse.jface.resource JFaceResources getDialogFont

List of usage examples for org.eclipse.jface.resource JFaceResources getDialogFont

Introduction

In this page you can find the example usage for org.eclipse.jface.resource JFaceResources getDialogFont.

Prototype

public static Font getDialogFont() 

Source Link

Document

Returns the JFace's dialog font.

Usage

From source file:org.eclipse.jst.jsf.common.ui.internal.dialogfield.LayoutUtil.java

License:Open Source License

/**
 * Returns a width hint for a button control.
 * @param button //from  ww  w  . jav  a2s  . c o m
 * @return the hint value
 */
static int getButtonWidthHint(Button button) {
    if (button.getFont().equals(JFaceResources.getDefaultFont()))
        button.setFont(JFaceResources.getDialogFont());

    GC gc = new GC(button);
    gc.setFont(button.getFont());
    FontMetrics fontMetrics = gc.getFontMetrics();
    gc.dispose();

    int length = button.getText().length();
    int widthHint = Dialog.convertWidthInCharsToPixels(fontMetrics, length < 2 ? 2 : length);
    return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
}

From source file:org.eclipse.jst.jsf.common.ui.internal.preferences.StrategyOrderingPanel.java

License:Open Source License

private int computeWidth(final Control control, final String name) {
    if (name == null) {
        return 0;
    }/*from ww  w.  ja  v a 2 s. c  o m*/
    final GC gc = new GC(control);
    try {
        gc.setFont(JFaceResources.getDialogFont());
        return gc.stringExtent(name).x + 10;
    } finally {
        gc.dispose();
    }
}

From source file:org.eclipse.jst.jsf.common.ui.internal.preferences.StrategyOrderingPanel.java

License:Open Source License

/**
 * Returns a width hint for a button control.
 *///from   ww w .  j  a  v a 2  s .  c om
private static int getButtonWidthHint(final Button button) {
    button.setFont(JFaceResources.getDialogFont());
    PixelConverter converter = new PixelConverter(button);
    final int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
}

From source file:org.eclipse.jst.jsf.ui.internal.validation.OptionsConfigurationBlock.java

License:Open Source License

/**
 * @param parent// w  ww . java 2s.  co  m
 * @param label
 * @param key
 * @param values
 * @param indent
 * @param widthHint
 * @param listener
 * @return a check box styled button with a related link
 */
protected Button addCheckBoxWithLink(Composite parent, String label, Key key, String[] values, int indent,
        int widthHint, SelectionListener listener) {
    ControlData data = new ControlData(key, values);

    GridData gd = new GridData(GridData.FILL, GridData.FILL, true, false);
    gd.horizontalSpan = 3;
    gd.horizontalIndent = indent;

    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    composite.setLayout(layout);
    composite.setLayoutData(gd);

    Button checkBox = new Button(composite, SWT.CHECK);
    checkBox.setFont(JFaceResources.getDialogFont());
    checkBox.setData(data);
    checkBox.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false));
    checkBox.addSelectionListener(getSelectionListener());

    gd = new GridData(GridData.FILL, GridData.CENTER, true, false);
    gd.widthHint = widthHint;

    Link link = new Link(composite, SWT.NONE);
    link.setText(label);
    link.setLayoutData(gd);
    if (listener != null) {
        link.addSelectionListener(listener);
    }

    makeScrollableCompositeAware(link);
    makeScrollableCompositeAware(checkBox);

    String currValue = getValue(key);
    checkBox.setSelection(data.getSelection(currValue) == 0);

    fCheckBoxes.add(checkBox);

    return checkBox;
}

From source file:org.eclipse.jst.jsf.ui.internal.validation.OptionsConfigurationBlock.java

License:Open Source License

/**
 * @param parent//  w ww.  j  ava 2s .  com
 * @param label
 * @param key
 * @param values
 * @param valueLabels
 * @param indent
 * @return a Combo box added to parent with the label and key
 */
protected Combo addComboBox(Composite parent, String label, Key key, String[] values, String[] valueLabels,
        int indent) {
    GridData gd = new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1);
    gd.horizontalIndent = indent;

    Label labelControl = new Label(parent, SWT.LEFT);
    labelControl.setFont(JFaceResources.getDialogFont());

    labelControl.setText(label);
    labelControl.setLayoutData(gd);

    Combo comboBox = newComboControl(parent, key, values, valueLabels);
    comboBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

    fLabels.put(comboBox, labelControl);

    return comboBox;
}

From source file:org.eclipse.jst.jsf.ui.internal.validation.OptionsConfigurationBlock.java

License:Open Source License

Combo addInversedComboBox(Composite parent, String label, Key key, String[] values, String[] valueLabels,
        int indent) {
    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    gd.horizontalIndent = indent;/*from   w  w  w  .  ja  va  2s  . co  m*/
    gd.horizontalSpan = 3;

    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    composite.setLayout(layout);
    composite.setLayoutData(gd);

    Combo comboBox = newComboControl(composite, key, values, valueLabels);
    comboBox.setFont(JFaceResources.getDialogFont());
    comboBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

    Label labelControl = new Label(composite, SWT.LEFT | SWT.WRAP);
    labelControl.setText(label);
    labelControl.setLayoutData(new GridData());

    fLabels.put(comboBox, labelControl);
    return comboBox;
}

From source file:org.eclipse.jst.jsf.ui.internal.validation.OptionsConfigurationBlock.java

License:Open Source License

Combo newComboControl(Composite composite, Key key, String[] values, String[] valueLabels) {
    ControlData data = new ControlData(key, values);

    Combo comboBox = new Combo(composite, SWT.READ_ONLY);
    comboBox.setItems(valueLabels);//from  ww  w  . j a  va2s  .  c  om
    comboBox.setData(data);
    comboBox.addSelectionListener(getSelectionListener());
    comboBox.setFont(JFaceResources.getDialogFont());

    makeScrollableCompositeAware(comboBox);

    String currValue = getValue(key);
    comboBox.select(data.getSelection(currValue));

    fComboBoxes.add(comboBox);
    return comboBox;
}

From source file:org.eclipse.jst.jsf.ui.internal.validation.OptionsConfigurationBlock.java

License:Open Source License

Text addTextField(Composite parent, String label, Key key, int indent, int widthHint) {
    Label labelControl = new Label(parent, SWT.WRAP);
    labelControl.setText(label);//ww  w. j  a v a  2  s.c  o m
    labelControl.setFont(JFaceResources.getDialogFont());
    labelControl.setLayoutData(new GridData());

    Text textBox = new Text(parent, SWT.BORDER | SWT.SINGLE);
    textBox.setData(key);
    textBox.setLayoutData(new GridData());

    makeScrollableCompositeAware(textBox);

    fLabels.put(textBox, labelControl);

    String currValue = getValue(key);
    if (currValue != null) {
        textBox.setText(currValue);
    }
    textBox.addModifyListener(getTextModifyListener());

    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    if (widthHint != 0) {
        data.widthHint = widthHint;
    }
    data.horizontalIndent = indent;
    data.horizontalSpan = 2;
    textBox.setLayoutData(data);

    fTextBoxes.add(textBox);
    return textBox;
}

From source file:org.eclipse.linuxtools.internal.valgrind.massif.birt.HeapChart.java

License:Open Source License

public HeapChart(MassifSnapshot[] snapshots) {
    TimeUnit timeUnit = snapshots[0].getUnit();
    long xScaling = getXScaling(snapshots, timeUnit);
    long yScaling = getYScaling(snapshots);

    double[] time = new double[snapshots.length];
    double[] dataUseful = new double[snapshots.length];
    double[] dataExtra = new double[snapshots.length];
    double[] dataStacks = null;

    boolean isStack = isStackProfiled(snapshots);
    if (isStack) {
        dataStacks = new double[snapshots.length];
    }/*w w  w .jav  a2 s.  co  m*/
    double[] dataTotal = new double[snapshots.length];
    for (int i = 0; i < snapshots.length; i++) {
        time[i] = snapshots[i].getTime() / xScaling;
        dataUseful[i] = snapshots[i].getHeapBytes() / yScaling;
        dataExtra[i] = snapshots[i].getHeapExtra() / yScaling;
        dataTotal[i] = dataUseful[i] + dataExtra[i];
        if (isStack) {
            dataStacks[i] = snapshots[i].getStacks() / yScaling;
        }
    }

    initialize();
    setDimension(ChartDimension.TWO_DIMENSIONAL_LITERAL);
    setType("Line Chart"); //$NON-NLS-1$
    setSubType("Overlay"); //$NON-NLS-1$

    Font font = JFaceResources.getDialogFont();
    FontData fd = font.getFontData()[0];

    // Title
    FontDefinition titleFont = getTitle().getLabel().getCaption().getFont();
    titleFont.setName(fd.getName());
    titleFont.setSize(fd.getHeight() + 2);

    // Plot
    getBlock().setBackground(ColorDefinitionImpl.WHITE());
    Plot p = getPlot();
    p.getClientArea().setBackground(ColorDefinitionImpl.create(255, 255, 225));

    // X-Axis
    Axis xAxisPrimary = getPrimaryBaseAxes()[0];
    xAxisPrimary.setType(AxisType.LINEAR_LITERAL);
    xAxisPrimary.getMajorGrid().setTickStyle(TickStyle.BELOW_LITERAL);
    xAxisPrimary.getOrigin().setType(IntersectionType.VALUE_LITERAL);
    xAxisPrimary.getTitle().getCaption().setValue(xUnits);
    xAxisPrimary.getTitle().setVisible(true);

    FontDefinition xAxisFont = xAxisPrimary.getTitle().getCaption().getFont();
    xAxisFont.setName(fd.getName());
    xAxisFont.setSize(fd.getHeight());

    xAxisFont = xAxisPrimary.getLabel().getCaption().getFont();
    xAxisFont.setName(fd.getName());
    xAxisFont.setSize(fd.getHeight());

    // Y-Axis
    Axis yAxisPrimary = getPrimaryOrthogonalAxis(xAxisPrimary);
    yAxisPrimary.getMajorGrid().setTickStyle(TickStyle.LEFT_LITERAL);
    yAxisPrimary.getMajorGrid().getLineAttributes().setVisible(true);
    yAxisPrimary.getTitle().getCaption().setValue(yUnits);
    yAxisPrimary.getTitle().setVisible(true);

    FontDefinition yAxisFont = yAxisPrimary.getTitle().getCaption().getFont();
    yAxisFont.setName(fd.getName());
    yAxisFont.setSize(fd.getHeight());

    yAxisFont = yAxisPrimary.getLabel().getCaption().getFont();
    yAxisFont.setName(fd.getName());
    yAxisFont.setSize(fd.getHeight());

    // // Z-Axis
    // Axis zAxis = AxisImpl.create(Axis.ANCILLARY_BASE);
    // zAxis.setType(AxisType.LINEAR_LITERAL);
    // zAxis.setLabelPosition(Position.BELOW_LITERAL);
    // zAxis.setTitlePosition(Position.BELOW_LITERAL);
    // zAxis.getMajorGrid().setTickStyle(TickStyle.BELOW_LITERAL);
    // zAxis.setOrientation(Orientation.HORIZONTAL_LITERAL);
    // xAxisPrimary.getAncillaryAxes().add(zAxis);

    // Legend
    Legend legend = getLegend();
    legend.setPosition(Position.BELOW_LITERAL);
    legend.setOrientation(Orientation.HORIZONTAL_LITERAL);

    FontDefinition legendFont = legend.getText().getFont();
    legendFont.setName(fd.getName());
    legendFont.setSize(fd.getHeight());

    // Data Set
    NumberDataSet mainValues = NumberDataSetImpl.create(time);
    NumberDataSet orthoValues1 = NumberDataSetImpl.create(dataUseful);
    NumberDataSet orthoValues2 = NumberDataSetImpl.create(dataExtra);
    NumberDataSet orthoValuesS = null;
    if (isStack) {
        orthoValuesS = NumberDataSetImpl.create(dataStacks);
    }
    NumberDataSet orthoValues3 = NumberDataSetImpl.create(dataTotal);

    SampleData sd = DataFactory.eINSTANCE.createSampleData();
    BaseSampleData sdBase = DataFactory.eINSTANCE.createBaseSampleData();
    sdBase.setDataSetRepresentation("");//$NON-NLS-1$
    sd.getBaseSampleData().add(sdBase);

    OrthogonalSampleData sdOrthogonal1 = DataFactory.eINSTANCE.createOrthogonalSampleData();
    sdOrthogonal1.setDataSetRepresentation("");//$NON-NLS-1$
    sdOrthogonal1.setSeriesDefinitionIndex(0);
    sd.getOrthogonalSampleData().add(sdOrthogonal1);

    OrthogonalSampleData sdOrthogonal2 = DataFactory.eINSTANCE.createOrthogonalSampleData();
    sdOrthogonal2.setDataSetRepresentation("");//$NON-NLS-1$
    sdOrthogonal2.setSeriesDefinitionIndex(1);
    sd.getOrthogonalSampleData().add(sdOrthogonal2);

    if (isStack) {
        OrthogonalSampleData sdOrthogonalS = DataFactory.eINSTANCE.createOrthogonalSampleData();
        sdOrthogonalS.setDataSetRepresentation("");//$NON-NLS-1$
        sdOrthogonalS.setSeriesDefinitionIndex(2);
        sd.getOrthogonalSampleData().add(sdOrthogonalS);
    }

    OrthogonalSampleData sdOrthogonal3 = DataFactory.eINSTANCE.createOrthogonalSampleData();
    sdOrthogonal3.setDataSetRepresentation("");//$NON-NLS-1$
    sdOrthogonal3.setSeriesDefinitionIndex(isStack ? 3 : 2);
    sd.getOrthogonalSampleData().add(sdOrthogonal3);

    setSampleData(sd);

    // X-Series
    Series seCategory = SeriesImpl.create();
    seCategory.setDataSet(mainValues);
    SeriesDefinition sdX = SeriesDefinitionImpl.create();
    xAxisPrimary.getSeriesDefinitions().add(sdX);
    sdX.getSeries().add(seCategory);

    // Y-Series
    LineSeries ls1 = (LineSeries) LineSeriesImpl.create();
    ls1.setDataSet(orthoValues1);
    ls1.getLineAttributes().setColor(ColorDefinitionImpl.CREAM());
    for (int i = 0; i < ls1.getMarkers().size(); i++) {
        Marker marker = (Marker) ls1.getMarkers().get(i);
        marker.setType(MarkerType.DIAMOND_LITERAL);
    }

    ls1.setPaletteLineColor(true);
    ls1.setSeriesIdentifier(Messages.getString("HeapChart.Useful_Heap")); //$NON-NLS-1$   
    ls1.getTriggers().add(getClickTrigger(ls1));
    ls1.getTriggers().add(getDblClickTrigger(ls1));

    // Y-Series
    LineSeries ls2 = (LineSeries) LineSeriesImpl.create();
    ls2.setDataSet(orthoValues2);
    ls2.getLineAttributes().setColor(ColorDefinitionImpl.CREAM());
    for (int i = 0; i < ls2.getMarkers().size(); i++) {
        Marker marker = (Marker) ls2.getMarkers().get(i);
        marker.setType(MarkerType.DIAMOND_LITERAL);
    }
    ls2.setPaletteLineColor(true);
    ls2.setSeriesIdentifier(Messages.getString("HeapChart.Extra_Heap")); //$NON-NLS-1$
    ls2.getTriggers().add(getClickTrigger(ls2));
    ls2.getTriggers().add(getDblClickTrigger(ls2));

    // Y-Series
    LineSeries lsS = null;
    if (isStack) {
        lsS = (LineSeries) LineSeriesImpl.create();
        lsS.setDataSet(orthoValuesS);
        lsS.getLineAttributes().setColor(ColorDefinitionImpl.CREAM());
        for (int i = 0; i < lsS.getMarkers().size(); i++) {
            Marker marker = (Marker) lsS.getMarkers().get(i);
            marker.setType(MarkerType.DIAMOND_LITERAL);
        }
        lsS.setPaletteLineColor(true);
        lsS.setSeriesIdentifier(Messages.getString("HeapChart.Stacks")); //$NON-NLS-1$
        lsS.getTriggers().add(getClickTrigger(lsS));
        lsS.getTriggers().add(getDblClickTrigger(lsS));
    }

    // Y-Series
    LineSeries ls3 = (LineSeries) LineSeriesImpl.create();
    ls3.setDataSet(orthoValues3);
    ls3.getLineAttributes().setColor(ColorDefinitionImpl.CREAM());
    for (int i = 0; i < ls3.getMarkers().size(); i++) {
        Marker marker = (Marker) ls3.getMarkers().get(i);
        marker.setType(MarkerType.DIAMOND_LITERAL);
    }
    ls3.setPaletteLineColor(true);
    ls3.setSeriesIdentifier(Messages.getString("HeapChart.Total_Heap")); //$NON-NLS-1$
    ls3.getTriggers().add(getClickTrigger(ls3));
    ls3.getTriggers().add(getDblClickTrigger(ls3));

    SeriesDefinition sdY = SeriesDefinitionImpl.create();
    sdY.getSeriesPalette().shift(-1);
    yAxisPrimary.getSeriesDefinitions().add(sdY);
    sdY.getSeries().add(ls1);
    sdY.getSeries().add(ls2);
    if (isStack) {
        sdY.getSeries().add(lsS);
    }
    sdY.getSeries().add(ls3);

    // // Z-Series
    // SeriesDefinition sdZ = SeriesDefinitionImpl.create();
    // zAxis.getSeriesDefinitions().add(sdZ);
}

From source file:org.eclipse.linuxtools.internal.valgrind.massif.charting.ChartEditor.java

License:Open Source License

@Override
public void createPartControl(Composite parent) {
    final ChartEditorInput input = (ChartEditorInput) getEditorInput();
    final HeapChart heapChart = input.getChart();
    control = new Chart(parent, SWT.FILL);
    heapChart.setChartControl(control);/*from   www.  ja  va 2  s  .c  o m*/

    final Color LIGHTYELLOW = new Color(Display.getDefault(), 255, 255, 225);
    final Color WHITE = Display.getDefault().getSystemColor(SWT.COLOR_WHITE);
    final Color BLACK = Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
    final Color RED = Display.getDefault().getSystemColor(SWT.COLOR_RED);
    final Color ORANGE = new Color(Display.getDefault(), 255, 165, 0);
    final Color GREEN = Display.getDefault().getSystemColor(SWT.COLOR_GREEN);
    final Color DARK_BLUE = new Color(Display.getDefault(), 64, 128, 128);
    final int TICK_GAP = 40;

    control.setBackground(WHITE);
    control.setBackgroundInPlotArea(LIGHTYELLOW);

    FontData fd = JFaceResources.getDialogFont().getFontData()[0];
    fd.setStyle(SWT.BOLD);

    Font font = new Font(Display.getDefault(), fd);
    fd.setHeight(fd.getHeight() + 2);
    Font titleFont = new Font(Display.getDefault(), fd);

    ITitle title = control.getTitle();
    title.setFont(titleFont);
    title.setForeground(BLACK);
    title.setText(heapChart.title);

    IAxis xAxis = control.getAxisSet().getXAxis(0);
    xAxis.getGrid().setStyle(LineStyle.NONE);
    xAxis.getTick().setForeground(BLACK);
    ITitle xTitle = xAxis.getTitle();
    xTitle.setFont(font);
    xTitle.setForeground(BLACK);
    xTitle.setText(heapChart.xUnits);

    IAxis yAxis = control.getAxisSet().getYAxis(0);
    yAxis.getGrid().setStyle(LineStyle.SOLID);
    yAxis.getTick().setForeground(BLACK);
    yAxis.getTick().setTickMarkStepHint(TICK_GAP);
    ITitle yTitle = yAxis.getTitle();
    yTitle.setFont(font);
    yTitle.setText(heapChart.yUnits);
    yTitle.setForeground(BLACK);

    control.getLegend().setPosition(SWT.BOTTOM);

    // data
    final ILineSeries lsUseful = (ILineSeries) control.getSeriesSet().createSeries(SeriesType.LINE,
            Messages.getString("HeapChart.Useful_Heap")); //$NON-NLS-1$;
    lsUseful.setXSeries(heapChart.time);
    lsUseful.setYSeries(heapChart.dataUseful);
    lsUseful.setSymbolType(PlotSymbolType.DIAMOND);
    lsUseful.setSymbolColor(RED);
    lsUseful.setLineColor(RED);

    final ILineSeries lsExtra = (ILineSeries) control.getSeriesSet().createSeries(SeriesType.LINE,
            Messages.getString("HeapChart.Extra_Heap")); //$NON-NLS-1$;
    lsExtra.setXSeries(heapChart.time);
    lsExtra.setYSeries(heapChart.dataExtra);
    lsExtra.setSymbolType(PlotSymbolType.DIAMOND);
    lsExtra.setSymbolColor(ORANGE);
    lsExtra.setLineColor(ORANGE);

    if (heapChart.dataStacks != null) {
        final ILineSeries lsStack = (ILineSeries) control.getSeriesSet().createSeries(SeriesType.LINE,
                Messages.getString("HeapChart.Stacks")); //$NON-NLS-1$;
        lsStack.setXSeries(heapChart.time);
        lsStack.setYSeries(heapChart.dataStacks);
        lsStack.setSymbolType(PlotSymbolType.DIAMOND);
        lsStack.setSymbolColor(DARK_BLUE);
        lsStack.setLineColor(DARK_BLUE);
    }

    final ILineSeries lsTotal = (ILineSeries) control.getSeriesSet().createSeries(SeriesType.LINE,
            Messages.getString("HeapChart.Total_Heap")); //$NON-NLS-1$;
    lsTotal.setXSeries(heapChart.time);
    lsTotal.setYSeries(heapChart.dataTotal);
    lsTotal.setSymbolType(PlotSymbolType.DIAMOND);
    lsTotal.setSymbolColor(GREEN);
    lsTotal.setLineColor(GREEN);

    // adjust axes
    control.getAxisSet().adjustRange();

    IAxisSet axisSet = control.getAxisSet();
    Range xRange = axisSet.getXAxis(0).getRange();
    Range yRange = axisSet.getYAxis(0).getRange();

    double xExtra = 0.05 * (xRange.upper - xRange.lower);
    double yExtra = 0.05 * (yRange.upper - yRange.lower);

    axisSet.getXAxis(0).setRange(new Range(xRange.lower, xRange.upper + xExtra));
    axisSet.getYAxis(0).setRange(new Range(yRange.lower, yRange.upper + yExtra));

    // listeners
    control.getPlotArea().addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDown(MouseEvent e) {
            showView();
            TableViewer viewer = input.getView().getTableViewer();
            input.getView().setTopControl(viewer.getControl());

            Point p = new Point(e.x, e.y);

            int closest = 0;
            double d1, d2, d3, currMin;
            double globalMin = Double.MAX_VALUE;
            for (int i = 0; i < heapChart.time.length; i++) {
                // get distance from click event to data points for the given index
                d1 = distance(lsUseful.getPixelCoordinates(i), p);
                d2 = distance(lsExtra.getPixelCoordinates(i), p);
                d3 = distance(lsTotal.getPixelCoordinates(i), p);
                // find the closest data point to the click event
                currMin = Math.min(Math.min(d1, d2), d3);
                if (currMin < globalMin) {
                    closest = i;
                    globalMin = currMin;
                }
            }

            MassifSnapshot snapshot = (MassifSnapshot) viewer.getElementAt(closest);
            viewer.setSelection(new StructuredSelection(snapshot), true);

            if (e.count == 2 && snapshot.isDetailed()) {
                ChartLocationsDialog dialog = new ChartLocationsDialog(Display.getCurrent().getActiveShell());
                dialog.setInput(snapshot);

                if (dialog.open() == Window.OK) {
                    dialog.openEditorForResult();
                }
            }

        }
    });

}