Example usage for org.eclipse.jface.dialogs Dialog convertVerticalDLUsToPixels

List of usage examples for org.eclipse.jface.dialogs Dialog convertVerticalDLUsToPixels

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs Dialog convertVerticalDLUsToPixels.

Prototype

public static int convertVerticalDLUsToPixels(FontMetrics fontMetrics, int dlus) 

Source Link

Document

Returns the number of pixels corresponding to the given number of vertical dialog units.

Usage

From source file:ar.com.tadp.xml.rinzo.jdt.eclipse.copies.PixelConverter.java

License:Open Source License

public int convertVerticalDLUsToPixels(int dlus) {
    return Dialog.convertVerticalDLUsToPixels(fFontMetrics, dlus);
}

From source file:au.com.cybersearch2.controls.DialogPixels.java

License:Open Source License

public DialogPixels(FontMetrics fontMetrics) {
    marginWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN);
    marginHeight = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN);
    horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_SPACING);
    verticalSpacing = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING);
    buttonWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH);
}

From source file:com.aptana.ide.core.ui.PixelConverter.java

License:Open Source License

/**
 * @see DialogPage#convertVerticalDLUsToPixels
 *///from   w w  w  .  java2s  .  c  o m
public int convertVerticalDLUsToPixels(int dlus) {
    return Dialog.convertVerticalDLUsToPixels(fFontMetrics, dlus);
}

From source file:com.aptana.internal.ui.text.spelling.PixelConverter.java

License:Open Source License

public int convertVerticalDLUsToPixels(int dlus) {
    return Dialog.convertVerticalDLUsToPixels(this.fFontMetrics, dlus);
}

From source file:com.google.dart.tools.ui.omni.OmniBoxPopup.java

License:Open Source License

@Override
protected Point getDefaultSize() {
    GC gc = new GC(table);
    FontMetrics fontMetrics = gc.getFontMetrics();
    gc.dispose();/*from   w w w .j  av a 2s  .c  om*/
    int x = Dialog.convertHorizontalDLUsToPixels(fontMetrics, 300);
    x = Math.max(x, 350);
    int y = Dialog.convertVerticalDLUsToPixels(fontMetrics, 270);
    y = Math.max(y, 420);
    return new Point(x, y);
}

From source file:com.iw.plugins.spindle.ui.PixelConverter.java

License:Mozilla Public License

/**
 * @see org.eclipse.jface.dialogs.DialogPage#convertVerticalDLUsToPixels(int)
 *//* ww w.  ja va 2  s.  c om*/
public int convertVerticalDLUsToPixels(int dlus) {
    return Dialog.convertVerticalDLUsToPixels(fontMetrics, dlus);
}

From source file:com.maccasoft.composer.InstrumentChart.java

License:Open Source License

void createChart(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(1, false));
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    gridData.widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, 300);
    gridData.heightHint = Dialog.convertVerticalDLUsToPixels(fontMetrics, 180);

    chart = new Chart(composite, SWT.NONE);
    chart.setLayoutData(gridData);//from  w ww .jav a 2s. com
    chart.getTitle().setVisible(false);
    chart.getLegend().setPosition(SWT.TOP);

    createBottomControls(composite);

    IAxisSet axisSet = chart.getAxisSet();

    xAxis = axisSet.getXAxis(0);
    xAxis.getTitle().setVisible(false);

    yAxis1 = axisSet.getYAxis(0);
    yAxis1.getTitle().setVisible(false);
    yAxis1.setRange(new Range(0.0, 100.0));

    yAxis2 = axisSet.getYAxis(axisSet.createYAxis());
    yAxis2.getTitle().setVisible(false);
    yAxis2.setPosition(Position.Secondary);
    yAxis2.setRange(new Range(0.0, 5000.0));

    lineSeries1 = (ILineSeries) chart.getSeriesSet().createSeries(SeriesType.LINE, "Volume");
    lineSeries1.setAntialias(SWT.ON);
    lineSeries1.setLineWidth(1);
    lineSeries1.setSymbolType(PlotSymbolType.NONE);
    lineSeries1.setLineColor(Display.getDefault().getSystemColor(SWT.COLOR_RED));
    lineSeries1.setYAxisId(0);

    lineSeries2 = (ILineSeries) chart.getSeriesSet().createSeries(SeriesType.LINE, "Frequency");
    lineSeries2.setAntialias(SWT.ON);
    lineSeries2.setLineWidth(1);
    lineSeries2.setSymbolType(PlotSymbolType.NONE);
    lineSeries2.setLineColor(Display.getDefault().getSystemColor(SWT.COLOR_GREEN));
    lineSeries2.setYAxisId(1);

    lineSeries3 = (ILineSeries) chart.getSeriesSet().createSeries(SeriesType.LINE, "Duty (%)");
    lineSeries3.setAntialias(SWT.ON);
    lineSeries3.setLineWidth(1);
    lineSeries3.setSymbolType(PlotSymbolType.NONE);
    lineSeries3.setLineColor(Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY));
    lineSeries3.setYAxisId(0);
}

From source file:com.maccasoft.composer.InstrumentEditor.java

License:Open Source License

@Override
protected void configureShell(Shell newShell) {
    super.configureShell(newShell);

    GC gc = new GC(newShell);
    fontMetrics = gc.getFontMetrics();/*from  w ww .j  av  a2s  .c o  m*/
    gc.dispose();

    Rectangle screen = newShell.getDisplay().getClientArea();

    Rectangle rect = new Rectangle(0, 0, Dialog.convertHorizontalDLUsToPixels(fontMetrics, 760),
            Dialog.convertVerticalDLUsToPixels(fontMetrics, 320));
    rect.x = (screen.width - rect.width) / 2;
    rect.y = (screen.height - rect.height) / 2;
    if (rect.y < 0) {
        rect.height += rect.y * 2;
        rect.y = 0;
    }

    newShell.setLocation(rect.x, rect.y);
    newShell.setSize(rect.width, rect.height);

    FillLayout layout = new FillLayout();
    layout.marginWidth = layout.marginHeight = 5;
    newShell.setLayout(layout);
    newShell.setText("Instrument Editor");
}

From source file:com.maccasoft.composer.InstrumentEditor.java

License:Open Source License

protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);

    GridLayout layout = new GridLayout();
    layout.numColumns = 0;/*ww w . j a  v a  2 s  . c  om*/
    layout.makeColumnsEqualWidth = false;
    layout.marginWidth = 0;
    layout.marginTop = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics,
            IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));

    Button button = createButton(composite, -1, "Get Spin Data");
    button.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            StringBuilder sb = new StringBuilder();
            sb.append("DAT\n\n");

            sb.append(name.getText().replace(' ', '_'));
            sb.append("\n");

            for (Command cmd : list) {
                if (!cmd.isDisabled()) {
                    sb.append("    " + cmd.toSpinString() + "\n");
                }
            }

            TextDialog dlg = new TextDialog(getShell());
            dlg.setString(sb.toString());
            dlg.open();
        }
    });

    button = createButton(composite, -1, "Get C Data");
    button.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            StringBuilder sb = new StringBuilder();
            sb.append(String.format("uint32_t %s[] = {\n", name.getText().replace(' ', '_')));

            for (Command cmd : list) {
                if (!cmd.isDisabled()) {
                    sb.append("    " + cmd.toCString() + ",\n");
                }
            }

            sb.append("};\n");

            TextDialog dlg = new TextDialog(getShell());
            dlg.setString(sb.toString());
            dlg.open();
        }
    });

    Label label = new Label(composite, SWT.NONE);
    label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    layout.numColumns++;

    button = createButton(composite, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL);
    button.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            okPressed();
            setReturnCode(OK);
            close();
        }
    });
    getShell().setDefaultButton(button);

    button = createButton(composite, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL);
    button.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            close();
        }
    });

    return composite;
}

From source file:com.microsoft.tfs.client.common.ui.controls.generic.BaseControl.java

License:Open Source License

public BaseControl(final Composite parent, final int style) {
    super(parent, style);

    /* Compute metrics in pixels */
    final GC gc = new GC(this);
    final FontMetrics fontMetrics = gc.getFontMetrics();
    gc.dispose();//from  www  . j  ava  2s  . c  o  m

    horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_SPACING);
    verticalSpacing = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING);

    spacing = Math.max(horizontalSpacing, verticalSpacing);

    horizontalMargin = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN);
    verticalMargin = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN);

    minimumMessageAreaWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics,
            IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
}