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

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

Introduction

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

Prototype

int MINIMUM_MESSAGE_AREA_WIDTH

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

Click Source Link

Document

Minimum width of message area in dialog units (value 300).

Usage

From source file:org.openmaji.implementation.tool.eclipse.ui.dialog.CreateWorksheetDialog.java

License:Open Source License

/**
 * @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 *///w  w  w.j  a v  a  2s.  c  o m
protected Control createDialogArea(Composite parent) {
    setTitle("Create Worksheet");
    setMessage(
            "Enter the name of the new worksheet and select the subsystem it should use to create new Meems");

    Composite parentComposite = (Composite) super.createDialogArea(parent);

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

    layout.numColumns = 2;
    int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    //String defaultUserName = MajiPlugin.getDefault().getPreferenceStore().getString(MajiSystemPreferencePage.MAJI_USERNAME_PROPERTIES);

    Label label = new Label(composite, SWT.WRAP);
    label.setText("&Worksheet Name");

    GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);
    //data.widthHint = widthHint;

    label.setLayoutData(data);
    label.setFont(parent.getFont());

    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    data.widthHint = widthHint;
    txtWorksheetName = new Text(composite, SWT.SINGLE | SWT.BORDER);
    txtWorksheetName.setFocus();
    txtWorksheetName.setLayoutData(data);
    txtWorksheetName.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });

    label = new Label(composite, SWT.WRAP);
    label.setText("Subsystem");

    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_END
            | GridData.VERTICAL_ALIGN_CENTER);

    label.setLayoutData(data);
    label.setFont(parent.getFont());

    comboSubsystem = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);

    populateCombo();

    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    data.widthHint = widthHint;

    // horizontal bar
    Label bar = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
    data = new GridData();
    data.horizontalSpan = 2;
    data.horizontalAlignment = GridData.FILL;
    bar.setLayoutData(data);
    return composite;
}

From source file:org.openmaji.implementation.tool.eclipse.ui.dialog.LoginDialog.java

License:Open Source License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 *///from  ww w.java2 s  .c om
protected Control createDialogArea(Composite parent) {
    Composite parentComposite = (Composite) super.createDialogArea(parent);

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

    layout.numColumns = 2;
    int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    String defaultUserName = MajiPlugin.getDefault().getPreferenceStore()
            .getString(MajiSystemPreferencePage.MAJI_USERNAME_PROPERTIES);

    // User name
    Label label = new Label(composite, SWT.WRAP);
    label.setText("&User Name");

    GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);
    //data.widthHint = widthHint;

    label.setLayoutData(data);
    label.setFont(parent.getFont());

    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    data.widthHint = widthHint;
    txtUserName = new Text(composite, SWT.SINGLE | SWT.BORDER);
    txtUserName.setLayoutData(data);
    txtUserName.setText(defaultUserName);

    // Password
    // User name
    label = new Label(composite, SWT.WRAP);
    label.setText("&Password");

    // Enable Quick-Password Feature for develper
    String quickPassword = System.getProperty(QUICK_PASSWORD);
    if ((quickPassword != null) && (quickPassword.equalsIgnoreCase("true"))) {
        label.addMouseListener(new MouseListener() {
            public void mouseDoubleClick(MouseEvent e) {
                txtPassword.setText(txtUserName.getText() + "99");
            }

            public void mouseDown(MouseEvent e) {
            }

            public void mouseUp(MouseEvent e) {
            }
        });
    }

    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_END
            | GridData.VERTICAL_ALIGN_CENTER);

    label.setLayoutData(data);
    label.setFont(parent.getFont());

    txtPassword = new Text(composite, SWT.SINGLE | SWT.BORDER);
    txtPassword.setEchoChar('*');
    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    data.widthHint = widthHint;
    txtPassword.setLayoutData(data);
    if (defaultUserName.length() > 0)
        txtPassword.setFocus();

    // horizontal bar
    Label bar = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
    data = new GridData();
    data.horizontalSpan = 2;
    data.horizontalAlignment = GridData.FILL;
    bar.setLayoutData(data);
    return composite;
}

From source file:org.ops4j.pax.cursor.ui.AddEditUrlDialog.java

License:Apache License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);

    validator = new IInputValidator() {
        public String isValid(String newText) {
            try {
                Integer.parseInt(newText);
                return null;
            } catch (NumberFormatException e) {
                return "Level must be an integer";
            }/*from w  w  w  .  ja  v  a  2  s. c o  m*/
        }
    };

    Label urlLabel = new Label(composite, SWT.WRAP);
    urlLabel.setText(urlMessage);
    GridData urlData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
    urlData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    urlLabel.setLayoutData(urlData);
    urlLabel.setFont(parent.getFont());

    urlInput = new Text(composite, SWT.SINGLE | SWT.BORDER);
    urlInput.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    urlInput.setText(url);
    urlInput.addFocusListener(new FocusListener() {
        public void focusLost(FocusEvent e) {
        }

        public void focusGained(FocusEvent e) {
            urlInput.selectAll();
        }
    });
    urlInput.setFocus();

    Label lvlLabel = new Label(composite, SWT.WRAP);
    lvlLabel.setText(levelMessage);
    GridData lvlData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
    lvlData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    lvlLabel.setLayoutData(lvlData);
    lvlLabel.setFont(parent.getFont());

    levelInput = new Text(composite, SWT.SINGLE | SWT.BORDER);
    levelInput.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    levelInput.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateLevel();
        }
    });
    levelInput.setText(String.valueOf(level));
    levelInput.addFocusListener(new FocusListener() {
        public void focusLost(FocusEvent e) {
        }

        public void focusGained(FocusEvent e) {
            levelInput.selectAll();
        }
    });

    errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
    errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    setErrorMessage(errorMessage);
    errorMessageText.setForeground(new Color(errorMessageText.getDisplay(), 255, 0, 0));

    applyDialogFont(composite);

    return composite;
}

From source file:org.python.pydev.shared_ui.dialogs.InputDialogWithLongMessage.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);
    // create message
    if (message != null) {
        Text messageText = new Text(composite,
                SWT.BORDER | SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL);
        messageText.setText(message);/*  w ww.  ja v a2 s  . c  o m*/
        GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
                | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        messageText.setLayoutData(data);
        messageText.setFont(parent.getFont());
    }
    text = new Text(composite, getInputTextStyle());
    text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    text.addModifyListener(e -> validateInput());
    errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
    errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    // Set the error message text
    // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
    setErrorMessage(errorMessage);

    applyDialogFont(composite);
    return composite;
}

From source file:org.rubypeople.rdt.internal.launching.PasswordDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);
    // create message
    if (message != null) {
        Label label = new Label(composite, SWT.WRAP);
        label.setText(message);/*from w  ww  . ja  v a 2  s  .  c  o  m*/
        GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
                | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        label.setLayoutData(data);
        label.setFont(parent.getFont());
    }
    text = new Text(composite, SWT.SINGLE | SWT.BORDER);
    text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    text.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    char cbit = '*';
    if (Platform.OS_MACOSX.equals(Platform.getOS())) {
        cbit = (char) (('*' << 8) + '*');
    }
    text.setEchoChar(cbit);

    errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
    errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    // Set the error message text
    // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
    setErrorMessage(errorMessage);

    applyDialogFont(composite);
    return composite;
}

From source file:org.springframework.ide.eclipse.internal.uaa.preferences.UaaDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite parent2 = (Composite) super.createDialogArea(parent);

    Composite composite = new Composite(parent2, SWT.NONE);
    composite.setLayout(new GridLayout(1, false));
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).applyTo(composite);

    Link link = new Link(composite, SWT.NONE | SWT.WRAP);
    link.setText(MESSAGE.replace("%name%", PLATFORM_NAME));
    link.addSelectionListener(new SelectionAdapter() {
        @Override/*from   w  ww  . j a va2 s . co  m*/
        public void widgetSelected(SelectionEvent e) {
            if ("tou".equals(e.text)) {
                UaaUtils.openUrl("http://www.springsource.org/uaa/terms_of_use");
            } else if ("faq".equals(e.text)) {
                UaaUtils.openUrl("http://www.springsource.org/uaa/faq");
            } else if ("prefs".equals(e.text)) {
                Display.getDefault().asyncExec(new Runnable() {

                    public void run() {
                        close();
                        PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null,
                                "org.springframework.ide.eclipse.uaa.preferencePage", null, null);
                        dialog.open();
                        setReturnCode(CANCEL);
                    }
                });
            }
        }
    });
    link.setFont(parent.getFont());

    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER)
            .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT)
            .grab(true, false).applyTo(link);

    composite.pack();
    return parent;
}

From source file:org.summer.sdt.internal.ui.dialogs.SortMembersMessageDialog.java

License:Open Source License

@Override
protected Control createMessageArea(Composite parent) {
    initializeDialogUnits(parent);/*from   w w  w  . j a  v a  2 s.c om*/

    Composite messageComposite = new Composite(parent, SWT.NONE);
    messageComposite.setFont(parent.getFont());
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    messageComposite.setLayout(layout);
    messageComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    createLinkControl(messageComposite);

    fNotSortAllRadio.doFillIntoGrid(messageComposite, 1);
    LayoutUtil.setHorizontalIndent(fNotSortAllRadio.getSelectionButton(null));

    fSortAllRadio.doFillIntoGrid(messageComposite, 1);
    LayoutUtil.setHorizontalIndent(fSortAllRadio.getSelectionButton(null));

    final Composite warningComposite = new Composite(messageComposite, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    warningComposite.setLayout(layout);
    warningComposite.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
    warningComposite.setFont(messageComposite.getFont());

    Image image = Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
    final Label imageLabel1 = new Label(warningComposite, SWT.LEFT | SWT.WRAP);
    imageLabel1.setImage(image);
    imageLabel1.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 1, 1));

    final Label label = new Label(warningComposite, SWT.WRAP);
    label.setText(DialogsMessages.SortMembersMessageDialog_sort_warning_label);
    GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1);
    gridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    label.setLayoutData(gridData);
    label.setFont(warningComposite.getFont());

    fNotSortAllRadio.setDialogFieldListener(new IDialogFieldListener() {
        public void dialogFieldChanged(DialogField field) {
            imageLabel1.setEnabled(!fNotSortAllRadio.isSelected());
            label.setEnabled(!fNotSortAllRadio.isSelected());
        }
    });
    imageLabel1.setEnabled(!fNotSortAllRadio.isSelected());
    label.setEnabled(!fNotSortAllRadio.isSelected());

    return messageComposite;
}

From source file:org.summer.sdt.internal.ui.refactoring.reorg.RenameTypeWizardSimilarElementsOptionsDialog.java

License:Open Source License

@Override
protected Control createMessageArea(Composite parent) {
    initializeDialogUnits(parent);/*ww w . j  a v a 2s. co m*/

    Composite messageComposite = new Composite(parent, SWT.NONE);
    messageComposite.setFont(parent.getFont());
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    messageComposite.setLayout(layout);
    messageComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    Label infoLabel = new Label(messageComposite, SWT.WRAP);
    infoLabel.setText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_select_strategy);
    GridData gd = new GridData(GridData.FILL, GridData.CENTER, true, false);
    gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    infoLabel.setLayoutData(gd);
    infoLabel.setFont(parent.getFont());

    fExactStrategyRadio = new SelectionButtonDialogField(SWT.RADIO);
    fExactStrategyRadio
            .setLabelText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_strategy_1);
    fExactStrategyRadio.doFillIntoGrid(messageComposite, 1);
    fExactStrategyRadio.setSelection(fSelectedStrategy == RenamingNameSuggestor.STRATEGY_EXACT);
    LayoutUtil.setHorizontalIndent(fExactStrategyRadio.getSelectionButton(null));

    fEmbeddedStrategyRadio = new SelectionButtonDialogField(SWT.RADIO);
    fEmbeddedStrategyRadio
            .setLabelText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_strategy_2);
    fEmbeddedStrategyRadio.doFillIntoGrid(messageComposite, 1);
    fEmbeddedStrategyRadio.setSelection(fSelectedStrategy == RenamingNameSuggestor.STRATEGY_EMBEDDED);
    LayoutUtil.setHorizontalIndent(fEmbeddedStrategyRadio.getSelectionButton(null));

    fSuffixStrategyRadio = new SelectionButtonDialogField(SWT.RADIO);
    fSuffixStrategyRadio
            .setLabelText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_strategy_3);
    fSuffixStrategyRadio.doFillIntoGrid(messageComposite, 1);
    fSuffixStrategyRadio.setSelection(fSelectedStrategy == RenamingNameSuggestor.STRATEGY_SUFFIX);
    LayoutUtil.setHorizontalIndent(fSuffixStrategyRadio.getSelectionButton(null));

    final Composite warningComposite = new Composite(messageComposite, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    warningComposite.setLayout(layout);
    warningComposite.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
    warningComposite.setFont(messageComposite.getFont());

    Image image = Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
    fWarningImageLabel = new Label(warningComposite, SWT.LEFT | SWT.WRAP);
    fWarningImageLabel.setImage(image);
    fWarningImageLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 1, 1));

    fWarningLabel = new Label(warningComposite, SWT.WRAP);
    fWarningLabel.setText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_warning_short_names);
    GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1);
    gridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    fWarningLabel.setLayoutData(gridData);
    fWarningLabel.setFont(warningComposite.getFont());

    fExactStrategyRadio.setDialogFieldListener(new IDialogFieldListener() {

        public void dialogFieldChanged(DialogField field) {
            updateLabel();
            fSelectedStrategy = RenamingNameSuggestor.STRATEGY_EXACT;
        }
    });

    fEmbeddedStrategyRadio.setDialogFieldListener(new IDialogFieldListener() {

        public void dialogFieldChanged(DialogField field) {
            updateLabel();
            fSelectedStrategy = RenamingNameSuggestor.STRATEGY_EMBEDDED;
        }
    });

    fSuffixStrategyRadio.setDialogFieldListener(new IDialogFieldListener() {

        public void dialogFieldChanged(DialogField field) {
            updateLabel();
            fSelectedStrategy = RenamingNameSuggestor.STRATEGY_SUFFIX;
        }
    });

    updateLabel();

    return messageComposite;
}

From source file:org.talend.mdm.repository.ui.dialogs.FileInputDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = (GridLayout) composite.getLayout();
    gridLayout.numColumns = 2;//from w w w  .jav  a 2  s . c o m
    // create message
    if (message != null) {
        Label label = new Label(composite, SWT.WRAP);
        label.setText(message);
        GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
                | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
        data.horizontalSpan = 2;
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        label.setLayoutData(data);
        label.setFont(parent.getFont());
    }
    text = new Text(composite, SWT.BORDER | SWT.READ_ONLY);
    text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    text.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });

    selFileBun = new Button(composite, SWT.NONE);
    selFileBun.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            FileDialog fileDialog = new FileDialog(getShell());
            fileDialog.setFilterExtensions(fileExtensions);
            String filePath = fileDialog.open();
            if (filePath != null) {
                text.setText(filePath);
            }
        }
    });
    selFileBun.setText("..."); //$NON-NLS-1$
    errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
    GridData gd_errorMessageText = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    gd_errorMessageText.horizontalSpan = 2;
    errorMessageText.setLayoutData(gd_errorMessageText);
    errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    // Set the error message text

    applyDialogFont(composite);
    return composite;
}

From source file:org.tigris.subversion.subclipse.core.util.InputDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);
    // create message
    if (message != null) {
        Label label = new Label(composite, SWT.WRAP);
        label.setText(message);//w ww. j a va 2  s  .c  o m
        GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
                | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        label.setLayoutData(data);
        label.setFont(parent.getFont());
    }
    text = new Text(composite, SWT.PASSWORD);
    text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    text.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
    errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    // Set the error message text
    // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
    setErrorMessage(errorMessage);

    applyDialogFont(composite);
    return composite;
}