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

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

Introduction

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

Prototype

int HORIZONTAL_SPACING

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

Click Source Link

Document

Horizontal spacing in dialog units (value 4).

Usage

From source file:net.sourceforge.sqlexplorer.dialogs.SaveOutsideProjectDlg.java

License:Open Source 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);// www .j av  a 2s  . co  m
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parentComposite.getFont());

    Label label = new Label(composite, SWT.WRAP);
    String msg = Messages.getString("Confirm.SaveOutsideProject.Intro") + "\n\n";
    IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
    if (projects == null || projects.length == 0)
        msg = msg + Messages.getString("Confirm.SaveOutsideProject.NoProjectsConfigured");
    msg = msg + Messages.getString("Confirm.SaveOutsideProject.SaveInProject");
    label.setText(msg);

    return parentComposite;
}

From source file:net.tourbook.ui.MessageRegion.java

License:Open Source License

/**
 * Create the contents for the receiver.
 * // w w  w  .  ja  v a 2  s.  c om
 * @param parent
 *            the Composite that the children will be created in
 */
public void createContents(final Composite parent) {
    messageComposite = new Composite(parent, SWT.NONE);
    final GridLayout messageLayout = new GridLayout();
    messageLayout.numColumns = 2;
    messageLayout.marginWidth = 0;
    messageLayout.marginHeight = 0;
    messageLayout.makeColumnsEqualWidth = false;
    messageComposite.setLayout(messageLayout);
    messageImageLabel = new Label(messageComposite, SWT.NONE);

    final GridData imageData = new GridData(GridData.VERTICAL_ALIGN_CENTER);
    final Image sizingImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
    Rectangle imageBounds;
    if (sizingImage == null) {
        imageBounds = new Rectangle(0, 0, IDialogConstants.VERTICAL_MARGIN * 2,
                IDialogConstants.VERTICAL_MARGIN * 2);
    } else {
        imageBounds = sizingImage.getBounds();
    }
    imageData.heightHint = imageBounds.height + IDialogConstants.VERTICAL_SPACING;
    imageData.widthHint = imageBounds.width + IDialogConstants.HORIZONTAL_SPACING;
    messageImageLabel.setLayoutData(imageData);

    messageText = new Text(messageComposite, SWT.NONE);
    messageText.setEditable(false);
    messageText.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));

    final GridData textData = new GridData(
            GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
    messageText.setLayoutData(textData);
    hideRegion();

}

From source file:nexcore.tool.uml.ui.project.explorer.dialog.FragmentSaveDialog.java

License:Open Source License

/**
 * @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 */// www  . ja  va 2  s  .c o m
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);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parentComposite.getFont());

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

    resourceGroup = new ContainerGroup(composite, dialogType);
    resourceGroup.setAllowExistingResources(true);

    return parentComposite;
}

From source file:nl.utwente.ce.imageexport.ExceptionErrorDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    createMessageArea(composite);/*ww  w  .  jav  a  2s  . c o m*/
    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:org.apache.directory.studio.connection.ui.dialogs.PasswordDialog.java

License:Apache License

/**
 * {@inheritDoc}//from   www  . ja  va2s .c  o  m
 */
@Override
protected Control createDialogArea(Composite parent) {
    // Composite
    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);
    GridData compositeGridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    compositeGridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    composite.setLayoutData(compositeGridData);

    // Message
    if (message != null) {
        Label messageLabel = BaseWidgetUtils.createWrappedLabel(composite, message, 1);
        GridData messageLabelGridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
        messageLabelGridData.widthHint = convertHorizontalDLUsToPixels(
                IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        messageLabel.setLayoutData(messageLabelGridData);
    }

    // Password Text
    passwordText = BaseWidgetUtils.createText(composite, value, 1);
    passwordText.setEchoChar('\u2022');

    // Show Password Checkbox
    showPasswordCheckbox = BaseWidgetUtils.createCheckbox(composite,
            Messages.getString("PasswordDialog.ShowPassword"), 1); //$NON-NLS-1$
    showPasswordCheckbox.addSelectionListener(showPasswordCheckboxListener);

    // Setting focus
    passwordText.setFocus();
    applyDialogFont(composite);

    return composite;
}

From source file:org.apache.directory.studio.connection.ui.dialogs.ResetPasswordDialog.java

License:Apache License

/**
 * {@inheritDoc}//from   www. j  ava 2 s  .c  o m
 */
@Override
protected Control createDialogArea(Composite parent) {
    // Composite
    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);
    GridData compositeGridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    compositeGridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    composite.setLayoutData(compositeGridData);

    // Message
    if (message != null) {
        Label messageLabel = BaseWidgetUtils.createWrappedLabel(composite, message, 1);
        GridData messageLabelGridData = new GridData(SWT.FILL, SWT.CENTER, true, true, 2, 1);
        messageLabelGridData.widthHint = convertHorizontalDLUsToPixels(
                IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        messageLabel.setLayoutData(messageLabelGridData);
    }

    // Current Password Group
    Group currentPasswordGroup = BaseWidgetUtils.createGroup(composite,
            Messages.getString("ResetPasswordDialog.CurrentPassword"), 1); //$NON-NLS-1$
    currentPasswordGroup.setLayout(new GridLayout(2, false));

    // Current Password Text
    BaseWidgetUtils.createLabel(currentPasswordGroup,
            Messages.getString("ResetPasswordDialog.CurrentPasswordColon"), 1); //$NON-NLS-1$
    currentPasswordText = BaseWidgetUtils.createText(currentPasswordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$
    currentPasswordText.setEchoChar('\u2022');
    currentPasswordText.addModifyListener(event -> validate());

    // Show Current Password Checkbox
    BaseWidgetUtils.createLabel(currentPasswordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$
    showCurrentPasswordCheckbox = BaseWidgetUtils.createCheckbox(currentPasswordGroup,
            Messages.getString("ResetPasswordDialog.ShowPassword"), 1); //$NON-NLS-1$
    showCurrentPasswordCheckbox.addSelectionListener(new SelectionAdapter() {
        /**
         * {@inheritDoc}
         */
        @Override
        public void widgetSelected(SelectionEvent event) {
            if (showCurrentPasswordCheckbox.getSelection()) {
                currentPasswordText.setEchoChar('\0');
            } else {
                currentPasswordText.setEchoChar('\u2022');
            }
        }
    });

    // New Password Group
    Group newPasswordGroup = BaseWidgetUtils.createGroup(composite,
            Messages.getString("ResetPasswordDialog.NewPassword"), 1); //$NON-NLS-1$
    newPasswordGroup.setLayout(new GridLayout(2, false));

    // New Password Text
    BaseWidgetUtils.createLabel(newPasswordGroup, Messages.getString("ResetPasswordDialog.NewPasswordColon"), //$NON-NLS-1$
            1);
    newPasswordText = BaseWidgetUtils.createText(newPasswordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$
    newPasswordText.setEchoChar('\u2022');
    newPasswordText.addModifyListener(event -> validate());

    // Show New Password Checkbox
    BaseWidgetUtils.createLabel(newPasswordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$
    showNewPasswordCheckbox = BaseWidgetUtils.createCheckbox(newPasswordGroup,
            Messages.getString("ResetPasswordDialog.ShowPassword"), 1); //$NON-NLS-1$
    showNewPasswordCheckbox.addSelectionListener(new SelectionAdapter() {
        /**
         * {@inheritDoc}
         */
        @Override
        public void widgetSelected(SelectionEvent event) {
            if (showNewPasswordCheckbox.getSelection()) {
                newPasswordText.setEchoChar('\0');
            } else {
                newPasswordText.setEchoChar('\u2022');
            }
        }
    });

    // Verify Text
    BaseWidgetUtils.createLabel(newPasswordGroup,
            Messages.getString("ResetPasswordDialog.VerifyNewPasswordColon"), 1); //$NON-NLS-1$
    verifyNewPasswordText = BaseWidgetUtils.createText(newPasswordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$
    verifyNewPasswordText.setEchoChar('\u2022');
    verifyNewPasswordText.addModifyListener(event -> validate());

    // Show Verify New Password Checkbox
    BaseWidgetUtils.createLabel(newPasswordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$
    showVerifyNewPasswordCheckbox = BaseWidgetUtils.createCheckbox(newPasswordGroup,
            Messages.getString("ResetPasswordDialog.ShowPassword"), 1); //$NON-NLS-1$
    showVerifyNewPasswordCheckbox.addSelectionListener(new SelectionAdapter() {
        /**
         * {@inheritDoc}
         */
        @Override
        public void widgetSelected(SelectionEvent event) {
            if (showVerifyNewPasswordCheckbox.getSelection()) {
                verifyNewPasswordText.setEchoChar('\0');
            } else {
                verifyNewPasswordText.setEchoChar('\u2022');
            }
        }
    });

    // Setting focus
    currentPasswordGroup.setFocus();

    applyDialogFont(composite);
    return composite;
}

From source file:org.apache.directory.studio.connection.ui.dialogs.SetupPasswordDialog.java

License:Apache License

/**
 * {@inheritDoc}//from w  w w . j a  v  a  2  s . c o  m
 */
@Override
protected Control createDialogArea(Composite parent) {
    // Composite
    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);
    GridData compositeGridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    compositeGridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    composite.setLayoutData(compositeGridData);

    // Message
    if (message != null) {
        Label messageLabel = BaseWidgetUtils.createWrappedLabel(composite, message, 1);
        GridData messageLabelGridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
        messageLabelGridData.widthHint = convertHorizontalDLUsToPixels(
                IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        messageLabel.setLayoutData(messageLabelGridData);
    }

    // Password Group
    Group passwordGroup = BaseWidgetUtils.createGroup(composite,
            Messages.getString("SetupPasswordDialog.Password"), 1); //$NON-NLS-1$
    passwordGroup.setLayout(new GridLayout(2, false));

    // Password Text
    BaseWidgetUtils.createLabel(passwordGroup, Messages.getString("SetupPasswordDialog.PasswordColon"), 1); //$NON-NLS-1$
    passwordText = BaseWidgetUtils.createText(passwordGroup, value, 1);
    passwordText.setEchoChar('\u2022');
    passwordText.addModifyListener(event -> validate());

    // Show Password Checkbox
    BaseWidgetUtils.createLabel(passwordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$
    showPasswordCheckbox = BaseWidgetUtils.createCheckbox(passwordGroup,
            Messages.getString("SetupPasswordDialog.ShowPassword"), 1); //$NON-NLS-1$
    showPasswordCheckbox.addSelectionListener(new SelectionAdapter() {
        /**
         * {@inheritDoc}
         */
        @Override
        public void widgetSelected(SelectionEvent event) {
            if (showPasswordCheckbox.getSelection()) {
                passwordText.setEchoChar('\0');
            } else {
                passwordText.setEchoChar('\u2022');
            }
        }
    });

    // Verify Text
    BaseWidgetUtils.createLabel(passwordGroup, Messages.getString("SetupPasswordDialog.VerifyPasswordColon"), //$NON-NLS-1$
            1);
    verifyPasswordText = BaseWidgetUtils.createText(passwordGroup, value, 1);
    verifyPasswordText.setEchoChar('\u2022');
    verifyPasswordText.addModifyListener(event -> validate());

    // Show Verify Password Checkbox
    BaseWidgetUtils.createLabel(passwordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$
    showVerifyPasswordCheckbox = BaseWidgetUtils.createCheckbox(passwordGroup,
            Messages.getString("SetupPasswordDialog.ShowPassword"), 1); //$NON-NLS-1$
    showVerifyPasswordCheckbox.addSelectionListener(new SelectionAdapter() {
        /**
         * {@inheritDoc}
         */
        @Override
        public void widgetSelected(SelectionEvent event) {
            if (showVerifyPasswordCheckbox.getSelection()) {
                verifyPasswordText.setEchoChar('\0');
            } else {
                verifyPasswordText.setEchoChar('\u2022');
            }
        }
    });

    // Setting focus
    passwordText.setFocus();

    applyDialogFont(composite);
    return composite;
}

From source file:org.apache.directory.studio.valueeditors.image.ImageDialog.java

License:Apache License

/**
 * Creates a tab item composite./*from www  . j  av a  2  s  .c o  m*/
 *
 * @return a tab item composite
 */
private Composite createTabItemComposite() {
    Composite composite = new Composite(tabFolder, SWT.NONE);

    GridLayout compositeLayout = new GridLayout(1, false);
    compositeLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    compositeLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    compositeLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    compositeLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(compositeLayout);

    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    return composite;
}

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

License:Apache License

/**
 * Creates the current password tab./*w w w . j  av  a 2  s. c o  m*/
 */
private void createCurrentPasswordTab() {
    // Current password composite
    currentPasswordComposite = new Composite(tabFolder, SWT.NONE);
    GridLayout currentLayout = new GridLayout(2, false);
    currentLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    currentLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    currentLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    currentLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    currentPasswordComposite.setLayout(currentLayout);
    currentPasswordComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    // Current password text
    BaseWidgetUtils.createLabel(currentPasswordComposite,
            Messages.getString("PasswordDialog.CurrentPassword") + ":", 1); //$NON-NLS-1$//$NON-NLS-2$
    currentPasswordText = BaseWidgetUtils.createReadonlyText(currentPasswordComposite, "", 1); //$NON-NLS-1$

    // Current password details composite
    new Label(currentPasswordComposite, SWT.NONE);
    Composite currentPasswordDetailsComposite = BaseWidgetUtils.createColumnContainer(currentPasswordComposite,
            2, 1);

    // Current password hash method label
    BaseWidgetUtils.createLabel(currentPasswordDetailsComposite,
            Messages.getString("PasswordDialog.HashMethod"), 1); //$NON-NLS-1$
    currentPasswordHashMethodText = BaseWidgetUtils.createLabeledText(currentPasswordDetailsComposite, "", 1); //$NON-NLS-1$

    // Current password hex label
    BaseWidgetUtils.createLabel(currentPasswordDetailsComposite,
            Messages.getString("PasswordDialog.PasswordHex"), 1); //$NON-NLS-1$
    currentPasswordValueHexText = BaseWidgetUtils.createLabeledText(currentPasswordDetailsComposite, "", 1); //$NON-NLS-1$

    // Current password salt hex label
    BaseWidgetUtils.createLabel(currentPasswordDetailsComposite, Messages.getString("PasswordDialog.SaltHex"), //$NON-NLS-1$
            1);
    currentPasswordSaltHexText = BaseWidgetUtils.createLabeledText(currentPasswordDetailsComposite, "", 1); //$NON-NLS-1$

    // Show current password details button
    showCurrentPasswordDetailsButton = BaseWidgetUtils.createCheckbox(currentPasswordDetailsComposite,
            Messages.getString("PasswordDialog.ShowCurrentPasswordDetails"), 2); //$NON-NLS-1$

    // Verify password text
    BaseWidgetUtils.createLabel(currentPasswordComposite, Messages.getString("PasswordDialog.VerifyPassword"), //$NON-NLS-1$
            1);
    testPasswordText = BaseWidgetUtils.createText(currentPasswordComposite, "", 1); //$NON-NLS-1$

    // Verify password details composite
    new Label(currentPasswordComposite, SWT.NONE);
    Composite testPasswordDetailsComposite = BaseWidgetUtils.createColumnContainer(currentPasswordComposite, 2,
            1);

    // Bind DN label
    BaseWidgetUtils.createLabel(testPasswordDetailsComposite, Messages.getString("PasswordDialog.BindDn"), 1); //$NON-NLS-1$
    testBindDnText = BaseWidgetUtils.createLabeledText(testPasswordDetailsComposite, "", 1); //$NON-NLS-1$

    // Show verify password details button
    showTestPasswordDetailsButton = BaseWidgetUtils.createCheckbox(testPasswordDetailsComposite,
            Messages.getString("PasswordDialog.ShowTestPasswordDetails"), 2); //$NON-NLS-1$

    // Verify password buttons composite
    new Label(currentPasswordComposite, SWT.NONE);
    Composite verifyPasswordButtonsComposite = BaseWidgetUtils.createColumnContainer(currentPasswordComposite,
            2, 1);

    // Verify button
    verifyPasswordButton = BaseWidgetUtils.createButton(verifyPasswordButtonsComposite,
            Messages.getString("PasswordDialog.Verify"), 1); //$NON-NLS-1$
    verifyPasswordButton.setEnabled(false);

    // Bind button
    bindPasswordButton = BaseWidgetUtils.createButton(verifyPasswordButtonsComposite,
            Messages.getString("PasswordDialog.Bind"), 1); //$NON-NLS-1$
    bindPasswordButton.setEnabled(false);

    // Current password tab
    currentPasswordTab = new TabItem(tabFolder, SWT.NONE);
    currentPasswordTab.setText(Messages.getString("PasswordDialog.CurrentPassword")); //$NON-NLS-1$
    currentPasswordTab.setControl(currentPasswordComposite);
}

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

License:Apache License

/**
 * Creates the new password tab.//from  w  w  w .j  av  a2s .c  om
 */
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);
}