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

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

Introduction

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

Prototype

int HORIZONTAL_MARGIN

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

Click Source Link

Document

Horizontal margin in dialog units (value 7).

Usage

From source file:org.apache.directory.studio.valueeditors.password.PasswordDialog.java

License:Apache License

/**
 * Creates the new password tab./*w  w w  . ja  v  a2 s  .  c o m*/
 */
private void createNewPasswordTab() {
    // New password composite
    newPasswordComposite = new Composite(tabFolder, SWT.NONE);
    GridLayout newLayout = new GridLayout(2, false);
    newLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    newLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    newLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    newLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    newPasswordComposite.setLayout(newLayout);

    // New password text
    BaseWidgetUtils.createLabel(newPasswordComposite, Messages.getString("PasswordDialog.EnterNewPassword"), 1); //$NON-NLS-1$
    newPasswordText = BaseWidgetUtils.createText(newPasswordComposite, "", 1); //$NON-NLS-1$

    // Confirm new password text
    BaseWidgetUtils.createLabel(newPasswordComposite, Messages.getString("PasswordDialog.ConfirmNewPassword"), //$NON-NLS-1$
            1);
    confirmNewPasswordText = BaseWidgetUtils.createText(newPasswordComposite, "", 1); //$NON-NLS-1$

    // New password hashing method combo
    BaseWidgetUtils.createLabel(newPasswordComposite, Messages.getString("PasswordDialog.SelectHashMethod"), 1); //$NON-NLS-1$
    newPasswordHashMethodComboViewer = new ComboViewer(newPasswordComposite);
    newPasswordHashMethodComboViewer.setContentProvider(new ArrayContentProvider());
    newPasswordHashMethodComboViewer.setLabelProvider(new LabelProvider() {
        public String getText(Object element) {
            String hashMethod = getHashMethodName(element);

            if (!"".equals(hashMethod)) {
                return hashMethod;
            }

            return super.getText(element);
        }
    });
    newPasswordHashMethodComboViewer.setInput(HASH_METHODS);
    newPasswordHashMethodComboViewer.getControl()
            .setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    // New password preview text
    BaseWidgetUtils.createLabel(newPasswordComposite, Messages.getString("PasswordDialog.PasswordPreview"), 1); //$NON-NLS-1$
    newPasswordPreviewText = BaseWidgetUtils.createReadonlyText(newPasswordComposite, "", 1); //$NON-NLS-1$

    // New salt button
    newSaltButton = BaseWidgetUtils.createButton(newPasswordComposite,
            Messages.getString("PasswordDialog.NewSalt"), 1); //$NON-NLS-1$
    newSaltButton.setLayoutData(new GridData());
    newSaltButton.setEnabled(false);

    // New password preview details composite
    Composite newPasswordPreviewDetailsComposite = BaseWidgetUtils.createColumnContainer(newPasswordComposite,
            2, 1);

    // New password preview hex label
    BaseWidgetUtils.createLabel(newPasswordPreviewDetailsComposite,
            Messages.getString("PasswordDialog.PasswordHex"), 1); //$NON-NLS-1$
    newPasswordPreviewValueHexText = BaseWidgetUtils.createLabeledText(newPasswordPreviewDetailsComposite, ":", //$NON-NLS-1$
            1);

    // New password preview salt hex label
    BaseWidgetUtils.createLabel(newPasswordPreviewDetailsComposite,
            Messages.getString("PasswordDialog.SaltHex"), 1); //$NON-NLS-1$
    newPasswordPreviewSaltHexText = BaseWidgetUtils.createLabeledText(newPasswordPreviewDetailsComposite, "", //$NON-NLS-1$
            1);

    // Show new password details button
    showNewPasswordDetailsButton = BaseWidgetUtils.createCheckbox(newPasswordPreviewDetailsComposite,
            Messages.getString("PasswordDialog.ShowNewPasswordDetails"), 2); //$NON-NLS-1$

    // New password tab
    newPasswordTab = new TabItem(tabFolder, SWT.NONE);
    newPasswordTab.setText(Messages.getString("PasswordDialog.NewPassword")); //$NON-NLS-1$
    newPasswordTab.setControl(newPasswordComposite);
}

From source file:org.codehaus.groovy.eclipse.dsl.inferencing.suggestions.ui.AbstractDialogue.java

License:Apache License

protected int getDefaultCompositeHMargin() {
    return convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
}

From source file:org.cs3.pdt.connector.internal.preferences.EditConfigurationDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    final Composite composite = (Composite) super.createDialogArea(parent);
    GridLayout parentLayout = ((GridLayout) composite.getLayout());
    parentLayout.numColumns = 4;//ww  w . j  a va2 s. co m
    parentLayout.marginHeight = 0;
    parentLayout.marginWidth = 0;
    parentLayout.verticalSpacing = 0;
    parentLayout.horizontalSpacing = 0;

    composite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));

    Composite pageAreaComposite = new Composite(composite, SWT.NONE);
    pageAreaComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout layout = new GridLayout(1, true);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = 0;
    pageAreaComposite.setLayout(layout);

    formTitleComposite = new Composite(pageAreaComposite, SWT.NONE);
    FormLayout titleLayout = new FormLayout();
    titleLayout.marginWidth = 0;
    titleLayout.marginHeight = 0;
    formTitleComposite.setLayout(titleLayout);

    GridData titleGridData = new GridData(GridData.FILL_HORIZONTAL);
    titleGridData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN;
    formTitleComposite.setLayoutData(titleGridData);

    // Build the title area and separator line
    Composite titleComposite = new Composite(formTitleComposite, SWT.NONE);
    layout = new GridLayout();
    layout.marginBottom = 5;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.horizontalSpacing = 0;
    titleComposite.setLayout(layout);

    FormData titleFormData = new FormData();
    titleFormData.top = new FormAttachment(0, 0);
    titleFormData.left = new FormAttachment(0, 0);
    titleFormData.right = new FormAttachment(100, 0);
    titleFormData.bottom = new FormAttachment(100, 0);

    titleComposite.setLayoutData(titleFormData);
    createTitleArea(titleComposite);

    Label separator = new Label(pageAreaComposite, SWT.HORIZONTAL | SWT.SEPARATOR);

    separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));

    // Build the Page container
    pageContainer = createPageContainer(pageAreaComposite);
    GridData pageContainerData = new GridData(GridData.FILL_BOTH);
    pageContainerData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN;
    pageContainer.setLayoutData(pageContainerData);
    // Build the separator line
    Label bottomSeparator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
    bottomSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    return composite;
}

From source file:org.cs3.pdt.connector.internal.preferences.EditConfigurationDialog.java

License:Open Source License

/**
 * Creates the inner page container./* w ww.j  a v a2  s.  c  o m*/
 * 
 * @param parent
 * @return Composite
 */
protected Composite createPageContainer(Composite parent) {

    Composite outer = new Composite(parent, SWT.NONE);

    GridData outerData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
    outerData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN;

    outer.setLayout(new GridLayout());
    outer.setLayoutData(outerData);

    //Create an outer composite for spacing
    scrolled = new ScrolledComposite(outer, SWT.V_SCROLL | SWT.H_SCROLL);

    // always show the focus control
    scrolled.setShowFocusedControl(true);
    scrolled.setExpandHorizontal(true);
    scrolled.setExpandVertical(true);

    GridData scrolledData = new GridData(
            GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);

    scrolled.setLayoutData(scrolledData);

    Composite result = new Composite(scrolled, SWT.NONE);

    GridData resultData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);

    result.setLayout(new FillLayout());
    result.setLayoutData(resultData);

    scrolled.setContent(result);

    return result;
}

From source file:org.csstudio.auth.ui.dialogs.LoginDialog.java

License:Open Source License

/**
 * Creates the contents of this dialog.//w w  w . ja  va  2 s  . c  om
 */
@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   w w  w. j  a  va  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.nsls2.startuphelper.StartupDialog.java

License:Open Source License

/**
 * Creates the contents of this dialog./*  ww w  . j av  a2s. c  o  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  w w  .  j  a  v a2  s  .  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);//w  w  w.  j  a v a  2s  .c om
    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  w w.  j a v a 2 s.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;
}