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:org.csstudio.auth.ui.dialogs.LoginDialog.java

License:Open Source License

/**
 * Creates the contents of this dialog.//  w w w. j  a  v a 2 s. co m
 */
@Override
protected Control createDialogArea(final Composite parent) {
    Composite parentComposite = (Composite) super.createDialogArea(parent);

    setTitle(_title);
    setMessage(_message);

    // Create the layout
    Composite contents = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, 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);
    contents.setLayout(layout);
    contents.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, true));
    contents.setFont(parent.getFont());

    // user name
    Label label = new Label(contents, SWT.NONE);
    label.setText(Messages.LoginDialog_UserName);
    _username = new Text(contents, SWT.BORDER | SWT.FLAT);

    _username.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    _username.setText(_lastUser != null ? _lastUser : "");

    // password
    label = new Label(contents, SWT.NONE);
    label.setText(Messages.LoginDialog_Password);
    _password = new Text(contents, SWT.BORDER | SWT.FLAT | SWT.PASSWORD);
    _password.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

    // Anonymous login checkbox
    _loginAnonymous = new Button(contents, SWT.CHECK);
    _loginAnonymous.setText(Messages.LoginDialog_LoginAnonymous);
    _loginAnonymous.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1));
    _loginAnonymous.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            if (_loginAnonymous.getSelection()) {
                // Disable name/password when anonymous
                _username.setEnabled(false);
                _password.setEnabled(false);
            } else {
                // (Re-)enable name/password entry
                _username.setEnabled(true);
                _password.setEnabled(true);
                // ... and jump to name field
                _username.setFocus();
            }
        }
    });

    // remember password checkbox (invisible by default)
    _rememberLogin = new Button(contents, SWT.CHECK);
    _rememberLogin.setText("Remember my user name and password");
    _rememberLogin.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1));
    _rememberLogin.setVisible(false);

    if (_lastUser != null && _lastUser.trim().length() > 0) {
        _password.setFocus();
    } else {
        _username.setFocus();
    }
    return parentComposite;
}

From source file:org.csstudio.auth.ui.internal.preferences.AddSubnetDialog.java

License:Open Source License

/**
 * {@inheritDoc}//from   ww w  . j a v a  2s  .c om
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite parentComposite = (Composite) super.createDialogArea(parent);

    setTitle("Add Subnet");
    setMessage("Please enter the subnet address and netmask.");

    Composite contents = new Composite(parentComposite, SWT.NULL);
    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;
    contents.setLayout(layout);
    contents.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, true));
    contents.setFont(parentComposite.getFont());

    Label addressLabel = new Label(contents, SWT.NULL);
    addressLabel.setText("Subnet address:");
    _networkAddress = new Text(contents, SWT.SINGLE | SWT.BORDER);
    _networkAddress.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    _networkAddress.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (e.widget == _networkAddress) {
                autocompleteNetmask();
                checkValid();
            }
        }
    });

    Label netmaskLabel = new Label(contents, SWT.NULL);
    netmaskLabel.setText("Subnet address:");
    _netmask = new Text(contents, SWT.SINGLE | SWT.BORDER);
    _netmask.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    _netmask.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (e.widget == _netmask) {
                checkValid();
            }
        }
    });

    return contents;
}

From source file:org.csstudio.auth.ui.internal.preferences.SystemPropertyDialog.java

License:Open Source License

/**
 * {@inheritDoc}/*www .  j a  v a2s  .c  o  m*/
 */
@Override
protected Control createDialogArea(final Composite parent) {
    Composite parentComposite = (Composite) super.createDialogArea(parent);

    Composite contents = new Composite(parentComposite, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.numColumns = 2;
    contents.setLayout(layout);
    contents.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, true));
    contents.setFont(parentComposite.getFont());

    Label keyLabel = new Label(contents, SWT.NULL);
    keyLabel.setText(Messages.SystemPropertyDialog_KEY_LABEL);
    final Text keyText = new Text(contents, SWT.SINGLE | SWT.BORDER);
    GridData layoutData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
    layoutData.widthHint = 250;
    keyText.setLayoutData(layoutData);
    keyText.setText(_key);
    keyText.addModifyListener(new ModifyListener() {
        public void modifyText(final ModifyEvent e) {
            if (e.widget == keyText) {
                _key = keyText.getText();
                // enable the OK button if the "key" field contains not
                // just whitespace
                getButton(IDialogConstants.OK_ID).setEnabled(!_key.trim().equals("")); //$NON-NLS-1$
            }
        }
    });

    Label valueLabel = new Label(contents, SWT.NULL);
    valueLabel.setText(Messages.SystemPropertyDialog_VALUE_LABEL);
    final Text valueText = new Text(contents, SWT.SINGLE | SWT.BORDER);
    valueText.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    valueText.setText(_value);
    valueText.addModifyListener(new ModifyListener() {
        public void modifyText(final ModifyEvent e) {
            if (e.widget == valueText) {
                _value = valueText.getText();
            }
        }
    });

    return contents;
}

From source file:org.csstudio.nsls2.startuphelper.StartupDialog.java

License:Open Source License

/**
 * Creates the contents of this dialog.//from   ww w.  j  a  v  a2s .co  m
 */
@Override
protected Control createDialogArea(final Composite parent) {
    Composite parentComposite = (Composite) super.createDialogArea(parent);

    setTitle(_title);
    setMessage(_message);

    // Create the layout
    Composite contents = 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);
    contents.setLayout(layout);
    contents.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, true));
    contents.setFont(parent.getFont());

    if (showLogin) {
        Group loginGroup = new Group(contents, SWT.SHADOW_ETCHED_IN);
        loginGroup.setText(Messages.LoginDialog_Login);
        createLoginSection(loginGroup);
    }

    if (showWorkspace) {
        Group workspaceGroup = new Group(contents, SWT.SHADOW_ETCHED_IN);
        workspaceGroup.setText(Messages.StartupDialog_SelectWorkspace);
        createWorkspaceSection(workspaceGroup);
    }

    return parentComposite;
}

From source file:org.csstudio.sds.util.SaveAsDialog.java

License:Open Source License

/**
 * {@inheritDoc}//from   w ww . j a  v a  2s  .  c o  m
 */
protected Control createDialogArea(final Composite parent) {
    // top level composite
    Composite parentComposite = (Composite) super.createDialogArea(parent);

    // create a composite with standard margins and spacing
    Composite composite = new Composite(parentComposite, 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);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    //        composite.setFont(parentComposite.getFont());

    Listener listener = new Listener() {
        public void handleEvent(final Event event) {
            setDialogComplete(validatePage());
        }
    };

    _resourceGroup = new ResourceAndContainerGroup(composite, listener, Messages.SaveAsDialog_FILE_LABEL,
            Messages.SaveAsDialog_FILE);
    _resourceGroup.setAllowExistingResources(true);

    return parentComposite;
}

From source file:org.dawb.workbench.ui.data.PlotDataChooseDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    // create a composite with standard margins and spacing
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, 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);//from ww w.j  a v  a2  s .c o m
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    applyDialogFont(composite);

    // Add a choice list to choose the existing data. 
    Label label = new Label(composite, SWT.WRAP);
    label.setText(
            "Please choose the plotted data to which the error '" + error.getName() + "' should be assigned.");
    label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 2, 1));

    label = new Label(composite, SWT.WRAP);
    label.setText("Plotted data ");
    label.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));

    final Combo combo = new Combo(composite, SWT.READ_ONLY | SWT.BORDER);
    combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    combo.setItems(getSelectionNames());
    combo.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            final String name = combo.getItem(combo.getSelectionIndex());
            selection = getSelectionByName(name);
        }
    });
    combo.select(0);

    return composite;
}

From source file:org.drools.eclipse.flow.common.editor.action.ExportImageDialog.java

License:Apache License

protected Control createDialogArea(Composite parent) {
    // top level composite
    Composite parentComposite = (Composite) super.createDialogArea(parent);

    // create a composite with standard margins and spacing
    Composite composite = new Composite(parentComposite, 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  a2s .  c o  m*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parentComposite.getFont());

    Listener listener = new Listener() {
        public void handleEvent(Event event) {
            setDialogComplete(validatePage());
        }
    };

    resourceGroup = new ResourceAndContainerGroup(composite, listener,
            IDEWorkbenchMessages.SaveAsDialog_fileLabel, IDEWorkbenchMessages.SaveAsDialog_file);
    resourceGroup.setAllowExistingResources(true);

    return parentComposite;
}

From source file:org.ebayopensource.turmeric.eclipse.services.ui.dialogs.ChangeServiceVersionDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {

    Composite control = (Composite) super.createDialogArea(parent);
    setTitle(SOAMessages.CHANGE_SERVICE_VERSION_DIALOG_TITLE);
    setMessage(SOAMessages.CHANGE_SERVICE_VERSION_DIALOG_TITLE);
    Composite parentComposite = new Composite(control, SWT.NONE);
    GridLayout layout = new GridLayout(2, 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);
    parentComposite.setLayout(layout);// w ww  .ja  v  a 2s.com
    parentComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    parentComposite.setFont(parentComposite.getFont());

    Group group = new Group(parentComposite, SWT.SHADOW_ETCHED_IN);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    group.setLayoutData(data);
    layout = new GridLayout(1, true);
    group.setLayout(layout);
    layout.marginLeft = 3;
    maintenanceBtn = new Button(group, SWT.RADIO);
    maintenanceBtn.setText(SOAMessages.CHANGE_MAINTENANCE_VERSION_LABEL);
    ControlDecoration controlDecoration = new ControlDecoration(maintenanceBtn, SWT.LEFT | SWT.TOP);
    controlDecoration.setShowOnlyOnFocus(false);
    controlDecoration.setDescriptionText(SOAMessages.CHANGE_MAINTENANCE_VERSION_DECORATION);
    FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION);
    controlDecoration.setImage(fieldDecoration.getImage());
    maintenanceBtn.addSelectionListener(new SelectionListener() {

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

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

    minorBtn = new Button(group, SWT.RADIO);
    minorBtn.setText(SOAMessages.CHANGE_MINOR_VERSION_LABEL);
    controlDecoration = new ControlDecoration(minorBtn, SWT.LEFT | SWT.TOP);
    controlDecoration.setShowOnlyOnFocus(false);
    controlDecoration.setDescriptionText(SOAMessages.CHANGE_MINOR_VERSION_DECORATION);
    controlDecoration.setImage(fieldDecoration.getImage());
    minorBtn.addSelectionListener(new SelectionListener() {

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

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

    majorBtn = new Button(group, SWT.RADIO);
    majorBtn.setText(SOAMessages.CHANGE_MAJOR_VERSION_LABEL);
    controlDecoration = new ControlDecoration(majorBtn, SWT.LEFT | SWT.TOP);
    controlDecoration.setShowOnlyOnFocus(false);
    controlDecoration.setDescriptionText(SOAMessages.CHANGE_MAJOR_VERSION_DECORATION);
    controlDecoration.setImage(fieldDecoration.getImage());
    majorBtn.addSelectionListener(new SelectionListener() {

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

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

    Label label = new Label(parentComposite, SWT.LEFT);
    label.setText(SOAMessages.EXISTING_SERVICE_VERSION);
    oldVersionText = new Text(parentComposite, SWT.BORDER | SWT.READ_ONLY);
    oldVersionText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    oldVersionText.setText(oldVersionStr);

    label = new Label(parentComposite, SWT.LEFT);
    label.setText(SOAMessages.NEW_SERVICE_VERSION);
    newVersionText = new Text(parentComposite, SWT.BORDER);
    newVersionText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    newVersionText.setText("1.2.0");
    newVersionText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            validateNewVersionText();
        }

    });
    newVersionText.addKeyListener(new KeyListener() {

        @Override
        public void keyPressed(KeyEvent e) {
        }

        @Override
        public void keyReleased(KeyEvent e) {
            // only when newVersionText is editable, remember this string.
            // it means this is a manual input.
            if (newVersionText.getEditable() == true) {
                String newVersionStr = newVersionText.getText();
                newVersionText.setData(newVersionStr);
            }
        }
    });
    newVersionText.setData(oldVersionStr);
    Dialog.applyDialogFont(control);
    return control;
}

From source file:org.ebayopensource.turmeric.eclipse.services.ui.properties.SOAServiceDependenciesPage.java

License:Open Source License

private GridLayout initGridLayout(GridLayout layout, boolean margins) {
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    if (margins) {
        layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
        layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    } else {/* www . j a va  2s.c om*/
        layout.marginWidth = 0;
        layout.marginHeight = 0;
    }

    return layout;
}

From source file:org.ebayopensource.turmeric.eclipse.utils.ui.SOAErrorDialog.java

License:Open Source License

/**
 * create the main part of the dialog./*from  www .  ja va 2s.c  om*/
 *
 * @param parent the parent
 * @return the control
 */
@Override
protected Control createDialogArea(Composite parent) {
    createMessageArea(parent);
    // create content area
    Composite composite = new Composite(parent, SWT.NONE);
    GridData childData = new GridData(GridData.FILL_BOTH);
    childData.horizontalSpan = 2;
    composite.setLayoutData(childData);
    composite.setFont(parent.getFont());

    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);

    return composite;
}