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

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

Introduction

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

Prototype

int VERTICAL_SPACING

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

Click Source Link

Document

Vertical spacing in dialog units (value 4).

Usage

From source file:com.safi.workshop.sqlexplorer.dialogs.CreateDriverDlg.java

License:Open Source License

@Override
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 .j  a va 2 s.c o m
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parentComposite.getFont());

    Composite nameGroup = new Composite(composite, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 3;
    layout.marginWidth = 10;
    nameGroup.setLayout(layout);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
    nameGroup.setLayoutData(data);

    Composite topComposite = new Composite(nameGroup, SWT.NONE);
    data = new GridData(GridData.FILL_VERTICAL | GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 3;
    topComposite.setLayoutData(data);
    topComposite.setLayout(new GridLayout());

    Group topGroup = new Group(topComposite, SWT.NULL);
    topGroup.setText(Messages.getString("Driver_14"));

    data = new GridData(GridData.FILL_VERTICAL | GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 3;
    data.widthHint = SIZING_TEXT_FIELD_WIDTH;
    topGroup.setLayoutData(data);
    layout = new GridLayout();
    layout.numColumns = 4;
    layout.marginWidth = 5;
    topGroup.setLayout(layout);

    Label label = new Label(topGroup, SWT.WRAP);
    label.setText(Messages.getString("Name_15"));
    nameField = new Text(topGroup, SWT.BORDER);
    data = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1);
    data.widthHint = 250;
    nameField.setLayoutData(data);

    nameField.addKeyListener(new KeyListener() {

        public void keyPressed(org.eclipse.swt.events.KeyEvent e) {
            CreateDriverDlg.this.validate();
        };

        public void keyReleased(org.eclipse.swt.events.KeyEvent e) {
            CreateDriverDlg.this.validate();
        };
    });

    Label label5 = new Label(topGroup, SWT.WRAP);
    label5.setText(Messages.getString("Example_URL_16"));
    exampleUrlField = new Text(topGroup, SWT.BORDER);
    data = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1);
    data.widthHint = 250;
    exampleUrlField.setLayoutData(data);
    exampleUrlField.addKeyListener(new KeyListener() {

        public void keyPressed(org.eclipse.swt.events.KeyEvent e) {
            CreateDriverDlg.this.validate();
        };

        public void keyReleased(org.eclipse.swt.events.KeyEvent e) {
            CreateDriverDlg.this.validate();
        };
    });

    Composite centralComposite = new Composite(nameGroup, SWT.NONE);
    data = new GridData(GridData.FILL_VERTICAL | GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 3;
    data.verticalSpan = 4;
    data.heightHint = 200;
    centralComposite.setLayoutData(data);
    centralComposite.setLayout(new FillLayout());

    TabFolder tabFolder = new TabFolder(centralComposite, SWT.NULL);
    TabItem item1 = new TabItem(tabFolder, SWT.NULL);
    item1.setText(Messages.getString("Java_Class_Path_17"));
    TabItem item2 = new TabItem(tabFolder, SWT.NULL);
    item2.setText(Messages.getString("Extra_Class_Path_18"));
    createJavaClassPathPanel(tabFolder, item1);
    createExtraClassPathPanel(tabFolder, item2);

    Label label4 = new Label(nameGroup, SWT.WRAP);
    label4.setText(Messages.getString("Driver_Class_Name_19"));
    combo = new Combo(nameGroup, SWT.BORDER | SWT.DROP_DOWN);
    data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
    data.widthHint = SIZING_TEXT_FIELD_WIDTH;
    data.horizontalSpan = 2;
    combo.setLayoutData(data);

    combo.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {

        public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
        }

        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            CreateDriverDlg.this.validate();
        };
    });

    combo.addKeyListener(new KeyListener() {

        public void keyPressed(org.eclipse.swt.events.KeyEvent e) {
            CreateDriverDlg.this.validate();
        };

        public void keyReleased(org.eclipse.swt.events.KeyEvent e) {
            CreateDriverDlg.this.validate();
        };
    });

    nameGroup.layout();

    guideUrlLabel = new Label(topGroup, SWT.NONE);
    guideUrlLabel.setText("Guide URL:");

    guideUrlField = new Text(topGroup, SWT.BORDER);
    final GridData gd_guideUrlField = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1);
    guideUrlField.setLayoutData(gd_guideUrlField);

    urlRegexPatternLabel = new Label(topGroup, SWT.NONE);
    urlRegexPatternLabel.setText("URL Regex Pattern:");

    regexField = new Text(topGroup, SWT.BORDER);
    final GridData gd_regexField = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);
    regexField.setLayoutData(gd_regexField);

    testButton = new Button(topGroup, SWT.NONE);
    testButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            try {
                if (Pattern.matches(regexField.getText(), exampleUrlField.getText())) {
                    MessageDialog.openInformation(getShell(), "Success",
                            "The pattern matches the example URL: " + exampleUrlField.getText());
                } else {
                    MessageDialog.openError(getShell(), "Failed",
                            "The pattern does not match the example URL: " + exampleUrlField.getText());
                }
            } catch (Exception e2) {
                MessageDialog.openError(getShell(), "Invalid",
                        "The pattern does not seem to be a valid regex pattern");
            }

        }
    });
    testButton.setToolTipText("Test example URL against regex pattern");
    testButton.setText("test");

    defaultPortLabel = new Label(topGroup, SWT.NONE);
    defaultPortLabel.setToolTipText("Used to establish SSH tunnel");
    defaultPortLabel.setText("Default Port:");

    portSpinner = new Spinner(topGroup, SWT.BORDER);
    portSpinner.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    portSpinner.setTextLimit(6);
    portSpinner.setMaximum(66000);
    new Label(topGroup, SWT.NONE);
    loadData();
    return parentComposite;
}

From source file:com.safi.workshop.sqlexplorer.dialogs.PasswordConnDlg.java

License:Open Source License

@Override
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  va2s .com*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parentComposite.getFont());

    Composite nameGroup = new Composite(composite, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 10;
    nameGroup.setLayout(layout);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
    nameGroup.setLayoutData(data);

    Label label = new Label(nameGroup, SWT.WRAP);
    label.setText(Messages.getString("Alias_1")); //$NON-NLS-1$
    Label aliasTxt = new Label(nameGroup, SWT.WRAP);
    aliasTxt.setText(alias.getName());
    Label label2 = new Label(nameGroup, SWT.WRAP);
    label2.setText(Messages.getString("Driver_2")); //$NON-NLS-1$
    Label driverTxt = new Label(nameGroup, SWT.WRAP);
    driverTxt.setText(alias.getDriver().getId());
    Label label3 = new Label(nameGroup, SWT.WRAP);
    label3.setText(Messages.getString("Url_3")); //$NON-NLS-1$
    Label urlTxt = new Label(nameGroup, SWT.WRAP);
    urlTxt.setText(alias.getUrl());
    Label label4 = new Label(nameGroup, SWT.WRAP);
    label4.setText(Messages.getString("User_4")); //$NON-NLS-1$
    userTxt = new Text(nameGroup, SWT.BORDER);
    if (user != null)
        userTxt.setText(user.getUserName());
    data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
    data.widthHint = SIZING_TEXT_FIELD_WIDTH;
    data.horizontalSpan = 1;
    userTxt.setLayoutData(data);

    Label label5 = new Label(nameGroup, SWT.WRAP);
    label5.setText(Messages.getString("Password_5")); //$NON-NLS-1$
    pswdTxt = new Text(nameGroup, SWT.BORDER);
    if (user != null)
        pswdTxt.setText(user.getPassword());
    pswdTxt.setEchoChar('*');

    data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
    data.widthHint = SIZING_TEXT_FIELD_WIDTH;
    data.horizontalSpan = 1;
    pswdTxt.setLayoutData(data);
    pswdTxt.setFocus();

    fAutoCommitBox = new Button(nameGroup, SWT.CHECK);
    fAutoCommitBox.setText(Messages.getString("PasswordConnDlg.AutoCommit_1")); //$NON-NLS-1$
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalAlignment = GridData.BEGINNING;
    gd.horizontalSpan = 1;
    fAutoCommitBox.setLayoutData(gd);

    fCommitOnCloseBox = new Button(nameGroup, SWT.CHECK);
    fCommitOnCloseBox.setText(Messages.getString("PasswordConnDlg.Commit_On_Close_2")); //$NON-NLS-1$
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalAlignment = GridData.BEGINNING;
    gd.horizontalSpan = 2;
    fCommitOnCloseBox.setLayoutData(gd);

    fAutoCommitBox.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            if (fAutoCommitBox.getSelection()) {
                fCommitOnCloseBox.setEnabled(false);
            } else
                fCommitOnCloseBox.setEnabled(true);
        }
    });

    fAutoCommitBox.getDisplay().asyncExec(new Runnable() {

        public void run() {
            IPreferenceStore store = SQLExplorerPlugin.getDefault().getPreferenceStore();
            fCommitOnCloseBox.setSelection(store.getBoolean(IConstants.COMMIT_ON_CLOSE));
            fAutoCommitBox.setSelection(store.getBoolean(IConstants.AUTO_COMMIT));
            if (fAutoCommitBox.getSelection()) {
                fCommitOnCloseBox.setEnabled(false);
            } else
                fCommitOnCloseBox.setEnabled(true);
        }
    });

    return parentComposite;
}

From source file:com.safi.workshop.sqlexplorer.dialogs.SaveOutsideProjectDlg.java

License:Open Source License

@Override
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 www .j a va2s.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:com.ultimatetech.cim.dialogs.FindClass.java

License:Open Source License

protected void createSearchFieldAndList(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);

    GridLayout layout = new GridLayout();
    layout.numColumns = 1;// w w  w. ja va2 s . com
    layout.makeColumnsEqualWidth = false;
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    composite.setLayout(layout);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_CENTER);
    data.minimumWidth = 600;
    data.heightHint = 400;
    composite.setLayoutData(data);
    composite.setFont(parent.getFont());

    Label title = new Label(composite, SWT.NONE);
    title.setText("Type the name of the class you are searching for. OK will select it in the tree.");

    //GridData gd = new GridData();
    //gd.horizontalAlignment = SWT.LEFT;      
    //title.setLayoutData(gd);

    GridData gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.minimumWidth = 400;
    findClassName = new Text(composite, SWT.SINGLE | SWT.BORDER);
    findClassName.setLayoutData(gridData);
    findClassName.addKeyListener(new SearchKeyListener());

    Composite tableComp = new Composite(composite, SWT.NONE);
    GridData tcgd = new GridData();
    tcgd.grabExcessHorizontalSpace = true;
    tcgd.minimumWidth = 400;
    tableComp.setLayoutData(tcgd);

    //add table with all classes
    viewer = new TableViewer(tableComp, SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
    viewer.setContentProvider(new ViewContentProvider());
    viewer.setLabelProvider(new ViewLabelProvider());
    viewer.setInput(elements);
    viewer.getTable().setSize(400, 300);
    addTableColumns(viewer.getTable());
    viewer.getTable().setHeaderVisible(false);
    viewer.addSelectionChangedListener(new SelectionListener());
    //viewer.setSorter(new ViewerSorter());

}

From source file:com.ultimatetech.cim.dialogs.UsernamePasswordDialog.java

License:Open Source License

protected void createUsernameAndPasswordFields(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);

    GridLayout layout = new GridLayout();
    layout.numColumns = 2;/*from w ww .  j  a  v a2s .c o m*/
    layout.makeColumnsEqualWidth = false;
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    composite.setLayout(layout);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_CENTER);
    data.minimumWidth = 300;
    composite.setLayoutData(data);
    composite.setFont(parent.getFont());

    GridData gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.minimumWidth = 150;
    Label title = new Label(composite, SWT.NONE);
    title.setText("Enter username and password to connect to CIMOM");
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.LEFT;
    gd.horizontalSpan = 2;
    title.setLayoutData(gd);

    Label usernameLabel = new Label(composite, SWT.NONE);
    usernameLabel.setText("Username:");
    usernameValue = new Text(composite, SWT.SINGLE | SWT.BORDER);

    usernameValue.setLayoutData(gridData);
    Label passLabel = new Label(composite, SWT.NONE);
    passLabel.setText("Password:");
    passValue = new Text(composite, SWT.SINGLE | SWT.BORDER);
    passValue.setEchoChar('*');
    passValue.setLayoutData(gridData);
}

From source file:de.babe.eclipse.plugins.quickREx.dialogs.OrganizeREsDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    getShell().setText(Messages.getString("dialogs.OrganizeREsDialog.title")); //$NON-NLS-1$
    // create a composite with standard margins and spacing
    Composite composite = new Composite(parent, SWT.NONE | SWT.RESIZE);
    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;//from www .  j a  v  a2  s  .c o  m
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    applyDialogFont(composite);
    messageLabel = new Label(composite, SWT.NULL);
    messageLabel.setText(Messages.getString("dialogs.OrganizeREsDialog.messageLabel1")); //$NON-NLS-1$
    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    gd.widthHint = 400;
    messageLabel.setLayoutData(gd);
    Label nameLabel = new Label(composite, SWT.NULL);
    nameLabel.setText(Messages.getString("dialogs.OrganizeREsDialog.nameLabel1")); //$NON-NLS-1$
    gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    gd.grabExcessHorizontalSpace = false;
    nameLabel.setLayoutData(gd);
    reList = new List(composite, SWT.MULTI | SWT.V_SCROLL);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = true;
    gd.heightHint = 100;
    reList.setLayoutData(gd);
    reList.setItems(QuickRExPlugin.getDefault().getRegularExpressions());
    return composite;
}

From source file:de.babe.eclipse.plugins.quickREx.dialogs.OrganizeTestTextDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    getShell().setText(Messages.getString("dialogs.OrganizeTestTextDialog.title")); //$NON-NLS-1$
    // create a composite with standard margins and spacing
    Composite composite = new Composite(parent, SWT.NONE | SWT.RESIZE);
    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;/* w ww.  jav  a 2 s  . co m*/
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    applyDialogFont(composite);
    switch (type) {
    case TYPE_SAVE:
        return createDialogAreaContentsForSave(composite);
    case TYPE_LOAD:
        return createDialogAreaContentsForLoad(composite);
    case TYPE_ORGANIZE:
        return createDialogAreaContentsForOrganize(composite);
    default:
        throw new IllegalStateException(
                Messages.getString("dialogs.OrganizeTestTextDialog.errror.message1") + type); //$NON-NLS-1$
    }
}

From source file:de.babe.eclipse.plugins.quickREx.dialogs.REEditDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    getShell().setText(Messages.getString("dialogs.REEditDialog.title")); //$NON-NLS-1$
    // create a composite with standard margins and spacing
    Composite composite = new Composite(parent, SWT.NONE | SWT.RESIZE);
    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 = 3;//  w w  w.jav  a2 s.c  o  m
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    createTextLine(composite);
    createSnippetControls(composite);

    updateMarkup();

    applyDialogFont(composite);
    return composite;
}

From source file:de.babe.eclipse.plugins.quickREx.dialogs.RESearchInputDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    getShell().setText(Messages.getString("dialogs.RESearchInputDialog.title")); //$NON-NLS-1$
    // create a composite with standard margins and spacing
    Composite composite = new Composite(parent, SWT.NONE | SWT.RESIZE);
    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;// ww w  .j  av a 2 s  .co  m
    composite.setLayout(layout);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = 250;
    composite.setLayoutData(gd);
    applyDialogFont(composite);
    Label searchForLabel = new Label(composite, SWT.NULL);
    searchForLabel.setText(Messages.getString("dialogs.RESearchInputDialog.label.searchFor.text")); //$NON-NLS-1$
    gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    gd.grabExcessHorizontalSpace = false;
    searchForLabel.setLayoutData(gd);
    textField = new Text(composite, SWT.BORDER | SWT.SINGLE | SWT.LEAD | SWT.RESIZE);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.grabExcessHorizontalSpace = true;
    textField.setLayoutData(gd);

    Label searchInLabel = new Label(composite, SWT.NULL);
    searchInLabel.setText(Messages.getString("dialogs.RESearchInputDialog.label.searchIn.text")); //$NON-NLS-1$
    gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    gd.grabExcessHorizontalSpace = false;
    gd.verticalSpan = 5;
    searchInLabel.setLayoutData(gd);
    buttonTitle = new Button(composite, SWT.CHECK);
    buttonTitle.setText(Messages.getString("dialogs.RESearchInputDialog.checkbox.searchIn.title.text")); //$NON-NLS-1$
    buttonTitle.setSelection((QuickRExPlugin.getDefault().getLastSearchScope()
            & RESearchQuery.SCOPE_TITLE) == RESearchQuery.SCOPE_TITLE);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.grabExcessHorizontalSpace = true;
    buttonTitle.setLayoutData(gd);

    buttonRE = new Button(composite, SWT.CHECK);
    buttonRE.setText(Messages.getString("dialogs.RESearchInputDialog.checkbox.searchIn.re.text")); //$NON-NLS-1$
    buttonRE.setSelection((QuickRExPlugin.getDefault().getLastSearchScope()
            & RESearchQuery.SCOPE_RE) == RESearchQuery.SCOPE_RE);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.grabExcessHorizontalSpace = true;
    buttonRE.setLayoutData(gd);

    buttonTestText = new Button(composite, SWT.CHECK);
    buttonTestText.setText(Messages.getString("dialogs.RESearchInputDialog.checkbox.searchIn.testtext.text")); //$NON-NLS-1$
    buttonTestText.setSelection((QuickRExPlugin.getDefault().getLastSearchScope()
            & RESearchQuery.SCOPE_TESTTEXT) == RESearchQuery.SCOPE_TESTTEXT);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.grabExcessHorizontalSpace = true;
    buttonTestText.setLayoutData(gd);

    buttonDesc = new Button(composite, SWT.CHECK);
    buttonDesc.setText(Messages.getString("dialogs.RESearchInputDialog.checkbox.searchIn.desc.text")); //$NON-NLS-1$
    buttonDesc.setSelection((QuickRExPlugin.getDefault().getLastSearchScope()
            & RESearchQuery.SCOPE_DESC) == RESearchQuery.SCOPE_DESC);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.grabExcessHorizontalSpace = true;
    buttonDesc.setLayoutData(gd);

    buttonSource = new Button(composite, SWT.CHECK);
    buttonSource.setText(Messages.getString("dialogs.RESearchInputDialog.checkbox.searchIn.source.text")); //$NON-NLS-1$
    buttonSource.setSelection((QuickRExPlugin.getDefault().getLastSearchScope()
            & RESearchQuery.SCOPE_SOURCE) == RESearchQuery.SCOPE_SOURCE);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.grabExcessHorizontalSpace = true;
    buttonSource.setLayoutData(gd);
    return composite;
}

From source file:de.babe.eclipse.plugins.quickREx.dialogs.SimpleTextDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    getShell().setText(title);/* ww w. j a v a2 s.c  om*/
    // create a composite with standard margins and spacing
    Composite composite = new Composite(parent, SWT.NONE | SWT.RESIZE);
    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 = 1;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    applyDialogFont(composite);
    textField = new Text(composite,
            SWT.READ_ONLY | SWT.LEAD | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.RESIZE);
    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = true;
    gd.heightHint = 250;
    gd.widthHint = 400;
    textField.setLayoutData(gd);
    textField.setBackground(new Color(getShell().getDisplay(), new RGB(255, 255, 255)));
    textField.setText(contents);

    return composite;
}