Example usage for org.eclipse.jface.dialogs IDialogConstants VERTICAL_SPACING

List of usage examples for org.eclipse.jface.dialogs IDialogConstants VERTICAL_SPACING

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants VERTICAL_SPACING.

Prototype

int VERTICAL_SPACING

To view the source code for org.eclipse.jface.dialogs IDialogConstants VERTICAL_SPACING.

Click Source Link

Document

Vertical spacing in dialog units (value 4).

Usage

From source file:com.ibm.xsp.extlib.designer.bluemix.preference.PreferencePage.java

License:Open Source License

@Override
protected void createPageContents() {
    loadProfileList();//from  w  ww . jav a 2s .  com

    Group group = createGroup(BluemixUtil.productizeString("%BM_PRODUCT% Server"), 2); // $NLX-PreferencePage.IBMBluemixServer-1$

    WizardUtils.createLabel(group, "&URL:", 1); // $NLX-PreferencePage.URL-1$
    _serverCombo = WizardUtils.createEditCombo(group, 1, BLUEMIX_SERVERS, -1, null);

    WizardUtils.createLabel(group, "Use&rname:", 1); // $NLX-PreferencePage.Username-1$
    _usernameText = WizardUtils.createText(group, 1);

    WizardUtils.createLabel(group, "&Password:", 1); // $NLX-PreferencePage.Password-1$
    _passwordText = WizardUtils.createPasswordText(group, 1);

    _testButton = WizardUtils.createButton(group, "Test &connection...", this,
            GridData.HORIZONTAL_ALIGN_BEGINNING, 2); // $NLX-PreferencePage.Testconnection-1$
    GridData gd = (GridData) _testButton.getLayoutData();
    gd.verticalIndent = 7;

    // Deployment Group
    group = createGroup("Deployment"); // $NLX-PreferencePage.Deployment-1$

    PreferenceWidget pw = addField(KEY_BLUEMIX_DEPLOY_WAIT, "&Wait for all instances to start", // $NLX-PreferencePage.Waitforallinstancestostart-1$
            BOOLEAN_PREF, group);
    _waitButton = (Button) pw.getWidget();
    _waitButton.addSelectionListener(this);
    gd = (GridData) _waitButton.getLayoutData();
    gd.verticalIndent = 7;

    _deployComposite = createChildComposite(group);

    pw = addField(KEY_BLUEMIX_DEPLOY_WAIT_TIMEOUT, "&Timeout (seconds):", // $NLX-PreferencePage.Timeoutseconds-1$
            INTEGER_PREF, _deployComposite, 60, 600);
    GridData width = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
    ;
    width.widthHint = 70;
    ((Control) pw.getWidget()).setLayoutData(GridDataFactory.copyData(width));

    addField(KEY_BLUEMIX_DEPLOY_WAIT_SHOW_SUCCESS, "Display &success dialog when complete", // $NLX-PreferencePage.Displaysuccessdialogwhencomplete-1$
            BOOLEAN_PREF, _deployComposite, 2);

    // Hybrid connection
    group = createGroup("Hybrid Integration Profiles", 2); // $NLX-PreferencePage.HybridIntegrationProfiles-1$
    _hybridTableEditor = new ManifestTableEditor(group, 1, new String[] { "name" }, new String[] { "Name" },
            true, false, 8, 60, "hybrid.profile.table.id", _profileList, false, null, this, this); // $NON-NLS-1$ $NON-NLS-3$ $NLX-PreferencePage.Name-2$ 
    gd = (GridData) _hybridTableEditor.getLayoutData();
    gd.verticalIndent = 7;

    Composite buttonComposite = new Composite(group, SWT.NONE);
    GridLayout buttonLayout = new GridLayout();
    buttonLayout.numColumns = 1;
    buttonLayout.marginWidth = 0;
    buttonLayout.marginHeight = 0;
    buttonLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    buttonLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    buttonComposite.setLayout(buttonLayout);

    GridData buttonLayoutData = new GridData(
            GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
    buttonLayoutData.verticalIndent = 7;
    buttonComposite.setLayoutData(buttonLayoutData);
    buttonComposite.setFont(group.getFont());

    _newProfileButton = new CustomButton(buttonComposite, SWT.PUSH, ""); // $NON-NLS-1$
    _newProfileButton.setText("&New..."); // $NLX-PreferencePage.New-1$
    _newProfileButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    _newProfileButton.addSelectionListener(this);

    _editProfileButton = new CustomButton(buttonComposite, SWT.PUSH, ""); // $NON-NLS-1$
    _editProfileButton.setText("&Edit..."); // $NLX-PreferencePage.Edit-1$
    _editProfileButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    _editProfileButton.addSelectionListener(this);

    _dupProfileButton = new CustomButton(buttonComposite, SWT.PUSH, ""); // $NON-NLS-1$
    _dupProfileButton.setText("Dupl&icate"); // $NLX-PreferencePage.Duplicate-1$
    _dupProfileButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    _dupProfileButton.addSelectionListener(this);

    _deleteProfileButton = new CustomButton(buttonComposite, SWT.PUSH, ""); // $NON-NLS-1$
    _deleteProfileButton.setText("De&lete"); // $NLX-PreferencePage.Delete-1$
    _deleteProfileButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    _deleteProfileButton.addSelectionListener(this);

    // Set the initial value for the non-widget controls
    _serverCombo.setText(getSecurePreference(KEY_BLUEMIX_SERVER_URL, ""));
    _usernameText.setText(getSecurePreference(KEY_BLUEMIX_SERVER_USERNAME, ""));
    _passwordText.setText(getSecurePreference(KEY_BLUEMIX_SERVER_PASSWORD, ""));
}

From source file:com.iw.plugins.spindle.ui.preferences.AbstractPreferencePage.java

License:Open Source License

protected Group createGroup(int numColumns, Composite parent, String text) {
    final Group group = new Group(parent, SWT.NONE);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;//from   ww w. j a va 2 s.co m
    gd.widthHint = 0;
    group.setLayoutData(gd);
    group.setFont(parent.getFont());

    final GridLayout layout = new GridLayout(numColumns, false);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);

    group.setLayout(layout);
    group.setText(text);
    return group;
}

From source file:com.iw.plugins.spindle.ui.preferences.SpindleEditorPreferencePage.java

License:Mozilla Public License

protected Group createGroup(int numColumns, Composite parent, String text) {
    final Group group = new Group(parent, SWT.NONE);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;//from   w  w w  . j  a  v  a  2 s. c  om
    // gd.widthHint = 0;
    group.setLayoutData(gd);
    group.setFont(parent.getFont());

    final GridLayout layout = new GridLayout(numColumns, false);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);

    group.setLayout(layout);
    group.setText(text);
    return group;
}

From source file:com.iw.plugins.spindle.ui.preferences.SpindleGeneralPreferencePage.java

License:Mozilla Public License

protected Group createGroup(int numColumns, Composite parent, String text) {
    final Group group = new Group(parent, SWT.NONE);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;/*  w  w w. ja  v a2  s.c  om*/
    //    gd.widthHint = 0;
    group.setLayoutData(gd);
    group.setFont(parent.getFont());

    final GridLayout layout = new GridLayout(numColumns, false);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);

    group.setLayout(layout);
    group.setText(text);
    return group;
}

From source file:com.jaspersoft.studio.jface.dialogs.DataAdapterErrorDialog.java

License:Open Source License

/**
 * This implementation of the <code>Dialog</code> framework method creates
 * and lays out a composite. Subclasses that require a different dialog area
 * may either override this method, or call the <code>super</code>
 * implementation and add controls to the created composite.
 * /*from w  w  w  .ja v a 2  s .c o  m*/
 * Note:  Since 3.4, the created composite no longer grabs excess vertical space.
 * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=72489.
 * If the old behavior is desired by subclasses, get the returned composite's
 * layout data and set grabExcessVerticalSpace to true.
 */
@Override
protected Control createDialogArea(Composite parent) {
    // Create a composite with standard margins and spacing
    // Add the messageArea to this composite so that as subclasses add widgets to the messageArea
    // and dialogArea, the number of children of parent remains fixed and with consistent layout.
    // Fixes bug #240135
    Composite composite = new Composite(parent, SWT.NONE);
    createMessageArea(composite);
    createSupportArea(parent);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.numColumns = 2;
    composite.setLayout(layout);
    GridData childData = new GridData(GridData.FILL_BOTH);
    childData.horizontalSpan = 2;
    childData.grabExcessVerticalSpace = false;
    composite.setLayoutData(childData);
    composite.setFont(parent.getFont());

    return composite;
}

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

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite content = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    content.setLayout(layout);/*w ww . j  av a2 s  .  c  om*/
    content.setLayoutData(new GridData(GridData.FILL_BOTH));
    content.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    content.setBackgroundMode(SWT.INHERIT_FORCE);

    applyDialogFont(content);

    Label label = new Label(content, SWT.NONE);
    label.setLayoutData(new GridData(SWT.TOP, SWT.RIGHT, false, false));

    InputStream is = getClass().getResourceAsStream("about.png");
    try {
        ImageLoader loader = new ImageLoader();
        ImageData[] data = loader.load(is);

        final Image image = new Image(Display.getDefault(), data[0]);
        label.setImage(image);
        label.addDisposeListener(new DisposeListener() {

            @Override
            public void widgetDisposed(DisposeEvent arg0) {
                image.dispose();
            }
        });
        is.close();
    } catch (IOException e) {
        e.printStackTrace();
    }

    String title = Main.APP_TITLE + " " + Main.APP_VERSION;
    final String epl = "http://www.eclipse.org/legal/epl-v10.html";
    final String famfamfam = "http://www.famfamfam.com/lab/icons/silk";
    final String fugue = "http://p.yusukekamiyamane.com";
    final String message = title + "\r\n\r\n"
            + "Copyright (c) 2016 Marco Maccaferri and others. All rights reserved.\r\n\r\n"
            + "This program and the accompanying materials are made available under the\r\n"
            + "terms of the Eclipse Public License v1.0 which accompanies this distribution\r\n"
            + "and is available at " + epl + "\r\n\r\nIcons from " + famfamfam + "\r\nand " + fugue;

    final StyledText text = new StyledText(content, SWT.READ_ONLY);
    text.setLayoutData(new GridData(SWT.TOP, SWT.RIGHT, true, false));
    text.setCaret(null);
    text.setMargins(0, layout.verticalSpacing,
            convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING), layout.verticalSpacing);
    text.setText(message);

    final List<StyleRange> linkRanges = new ArrayList<StyleRange>();

    StyleRange style = new StyleRange();
    style.start = 0;
    style.length = title.length();
    style.fontStyle = SWT.BOLD;
    text.setStyleRange(style);

    style = new StyleRange();
    style.start = message.indexOf(epl);
    style.length = epl.length();
    style.underline = true;
    style.underlineStyle = SWT.UNDERLINE_LINK;
    text.setStyleRange(style);
    linkRanges.add(style);

    style = new StyleRange();
    style.start = message.indexOf(famfamfam);
    style.length = famfamfam.length();
    style.underline = true;
    style.underlineStyle = SWT.UNDERLINE_LINK;
    text.setStyleRange(style);
    linkRanges.add(style);

    style = new StyleRange();
    style.start = message.indexOf(fugue);
    style.length = fugue.length();
    style.underline = true;
    style.underlineStyle = SWT.UNDERLINE_LINK;
    text.setStyleRange(style);
    linkRanges.add(style);

    text.addListener(SWT.MouseDown, new Listener() {

        @Override
        public void handleEvent(Event event) {
            try {
                int offset = text.getOffsetAtLocation(new Point(event.x, event.y));
                for (StyleRange style : linkRanges) {
                    if (offset >= style.start && offset < (style.start + style.length)) {
                        String link = text.getText(style.start, style.start + style.length - 1);
                        System.out.println("[" + link + "]");
                        Program.launch(link);
                        break;
                    }
                }
            } catch (IllegalArgumentException e) {
                // no character under event.x, event.y
            }
        }
    });

    return content;
}

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;//from www  .  ja  va 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.maccasoft.composer.ListSelectionDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);/*from w  ww  .  ja  v a 2s  .c  o m*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    applyDialogFont(composite);

    Label label = new Label(composite, SWT.NONE);
    label.setText(message);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    viewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
    GridData layoutData = new GridData(GridData.FILL_BOTH);
    layoutData.widthHint = convertWidthInCharsToPixels(50);
    layoutData.heightHint = viewer.getTable().getItemHeight() * 20;
    viewer.getControl().setLayoutData(layoutData);
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setLabelProvider(new LabelProvider());
    viewer.setInput(elements);

    return composite;
}

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

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(1, false);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);//www  . j  a  v  a 2  s.com
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    applyDialogFont(composite);

    if ("win32".equals(SWT.getPlatform())) { //$NON-NLS-1$
        font = new Font(Display.getDefault(), "Courier New", 10, SWT.NONE); //$NON-NLS-1$
    } else {
        font = new Font(Display.getDefault(), "mono", 10, SWT.NONE); //$NON-NLS-1$
    }

    text = new Text(composite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    text.setFont(font);
    text.setLayoutData(new GridData(convertWidthInCharsToPixels(80), convertHeightInCharsToPixels(25)));
    if (data != null) {
        text.setText(data);
    }

    text.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            font.dispose();
        }
    });

    return composite;
}

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

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(1, false);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);/*ww  w  .jav  a  2  s  .  co  m*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    applyDialogFont(composite);

    if ("win32".equals(SWT.getPlatform())) { //$NON-NLS-1$
        font = new Font(Display.getDefault(), "Courier New", 10, SWT.NONE); //$NON-NLS-1$
    } else {
        font = new Font(Display.getDefault(), "mono", 10, SWT.NONE); //$NON-NLS-1$
    }

    Composite container = new Composite(composite, SWT.NONE);
    GridLayout gridLayout = new GridLayout(2, false);
    gridLayout.marginWidth = gridLayout.marginHeight = 0;
    container.setLayout(gridLayout);
    spin = new Button(container, SWT.RADIO);
    spin.setText("Spin");
    spin.setSelection(true);
    spin.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            updateTextDump();
            text.setFocus();
        }
    });
    clang = new Button(container, SWT.RADIO);
    clang.setText("C Array");
    clang.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            updateTextDump();
            text.setFocus();
        }
    });

    text = new Text(composite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    text.setFont(font);
    text.setLayoutData(new GridData(convertWidthInCharsToPixels(80), convertHeightInCharsToPixels(25)));

    text.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            font.dispose();
        }
    });
    text.setFocus();

    size = new Label(composite, SWT.NONE);
    size.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));

    updateTextDump();

    return composite;
}