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.aptana.ide.ui.editors.preferences.formatter.ModifyDialogTabPage.java

License:Open Source License

/**
 * Convenience method to create a group.
 * //from   www .j ava  2  s .c om
 * @param numColumns 
 * @param parent 
 * @param text 
 * @return group
 */
protected Group createGroup(int numColumns, Composite parent, String text) {
    final Group group = new Group(parent, SWT.NONE);
    group.setFont(parent.getFont());
    group.setLayoutData(createGridData(numColumns, GridData.FILL_HORIZONTAL, SWT.DEFAULT));

    final GridLayout layout = new GridLayout(numColumns, false);
    layout.verticalSpacing = fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = fPixelConverter
            .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.marginHeight = fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);

    //layout.marginHeight= fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    //layout.marginWidth= fPixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);

    group.setLayout(layout);//createGridLayout(numColumns, true));
    group.setText(text);
    return group;
}

From source file:com.aptana.ide.ui.io.auth.PasswordPromptDialog.java

License:Open Source License

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

    titleImage = IOUIPlugin.getImageDescriptor("/icons/full/wizban/security.png").createImage(); //$NON-NLS-1$
    dialogArea.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            if (titleImage != null) {
                setTitleImage(null);/* w w w.j  av  a  2 s . c o  m*/
                titleImage.dispose();
                titleImage = null;
            }
        }
    });

    setTitleImage(titleImage);
    setTitle(title);
    setMessage(message);

    Composite container = new Composite(dialogArea, SWT.NONE);
    container.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    container.setLayout(GridLayoutFactory.swtDefaults()
            .margins(convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN),
                    convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN))
            .spacing(convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING),
                    convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING))
            .numColumns(2).create());

    /* row 1 */
    Label label = new Label(container, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults().create());
    label.setText(StringUtil.makeFormLabel(Messages.PasswordPromptDialog_UserName));

    loginText = new Text(container, SWT.SINGLE | SWT.BORDER);
    loginText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    if (login != null) {
        loginText.setText(login);
    }
    loginText.setEnabled(false);

    /* row 2 */
    label = new Label(container, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults().create());
    label.setText(StringUtil.makeFormLabel(Messages.PasswordPromptDialog_Password));

    passwordText = new Text(container, SWT.SINGLE | SWT.PASSWORD | SWT.BORDER);
    passwordText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    if (password != null) {
        passwordText.setText(String.copyValueOf(password));
    }

    /* row 3 */
    new Label(container, SWT.NONE).setLayoutData(GridDataFactory.swtDefaults().create());

    savePasswordButton = new Button(container, SWT.CHECK);
    savePasswordButton.setLayoutData(GridDataFactory.fillDefaults().create());
    savePasswordButton.setText(Messages.PasswordPromptDialog_SavePassword);
    savePasswordButton.setSelection(savePassword);

    return dialogArea;
}

From source file:com.aptana.ide.update.ui.BrowserDialog.java

License:Open Source License

@Override
protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.None);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;/*from  w  ww  . j a v  a2  s.c o  m*/
    layout.marginHeight = 0;
    layout.horizontalSpacing = 0;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
    composite.setFont(parent.getFont());

    // create help control if needed
    if (isHelpAvailable()) {
        Control helpControl = createHelpControl(composite);
        ((GridData) helpControl.getLayoutData()).horizontalIndent = convertHorizontalDLUsToPixels(
                IDialogConstants.HORIZONTAL_MARGIN);
    }

    Composite checkboxComposite = new Composite(composite, SWT.NONE);
    GridLayout layout2 = new GridLayout();
    layout2.numColumns = 2;
    layout2.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout2.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout2.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout2.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    checkboxComposite.setLayout(layout2);
    checkboxComposite.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
    checkboxComposite.setFont(parent.getFont());

    bTurnOffThisAnnouncement = new Button(checkboxComposite, SWT.CHECK);
    bTurnOffThisAnnouncement.setText(Messages.BrowserDialog_Label_DoNotShowThisAnnouncementAgain);

    new Label(checkboxComposite, SWT.None);

    bTurnOffAllAnnouncements = new Button(checkboxComposite, SWT.CHECK);
    bTurnOffAllAnnouncements.setText(Messages.BrowserDialog_Label_DoNotShowAllAnnouncements);

    Button okButton = createButton(composite, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    GridData okGridData = (GridData) okButton.getLayoutData();
    okGridData.grabExcessVerticalSpace = false;
    okGridData.horizontalSpan = 2;
    okGridData.verticalAlignment = SWT.END;
    okGridData.horizontalAlignment = SWT.END;

    return composite;
}

From source file:com.aptana.ui.dialogs.PasswordPromptDialog.java

License:Open Source License

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

    titleImage = UIPlugin.getImageDescriptor("/icons/full/security.png").createImage(); //$NON-NLS-1$
    dialogArea.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            if (titleImage != null) {
                setTitleImage(null);/*www.ja  va2  s  .co  m*/
                titleImage.dispose();
                titleImage = null;
            }
        }
    });

    setTitleImage(titleImage);
    setTitle(title);
    setMessage(message);

    Composite container = new Composite(dialogArea, SWT.NONE);
    container.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    container.setLayout(GridLayoutFactory.swtDefaults()
            .margins(convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN),
                    convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN))
            .spacing(convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING),
                    convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING))
            .numColumns(2).create());

    /* row 1 */
    Label label = new Label(container, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults().create());
    label.setText(StringUtil.makeFormLabel(Messages.PasswordPromptDialog_UserName));

    loginText = new Text(container, SWT.SINGLE | SWT.BORDER);
    loginText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    if (login != null) {
        loginText.setText(login);
    }
    loginText.setEnabled(false);

    /* row 2 */
    label = new Label(container, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults().create());
    label.setText(StringUtil.makeFormLabel(Messages.PasswordPromptDialog_Password));

    passwordText = new Text(container, SWT.SINGLE | SWT.PASSWORD | SWT.BORDER);
    passwordText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    if (password != null) {
        passwordText.setText(String.copyValueOf(password));
    }

    if (savePasswordPrompt) {
        /* row 3 */
        new Label(container, SWT.NONE).setLayoutData(GridDataFactory.swtDefaults().create());

        savePasswordButton = new Button(container, SWT.CHECK);
        savePasswordButton.setLayoutData(GridDataFactory.fillDefaults().create());
        savePasswordButton.setText(Messages.PasswordPromptDialog_SavePassword);
        savePasswordButton.setSelection(savePassword);
    }

    return dialogArea;
}

From source file:com.aptana.webserver.ui.internal.ExternalWebServerPropertyDialog.java

License:Open Source License

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

    setTitle(Messages.SimpleWebServerPropertyDialog_Title);
    getShell().setText(Messages.SimpleWebServerPropertyDialog_ShellTitle);

    Composite composite = new Composite(dialogArea, SWT.NONE);
    composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    PixelConverter converter = new PixelConverter(composite);
    composite.setLayout(GridLayoutFactory.swtDefaults()
            .margins(converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN),
                    converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN))
            .spacing(converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING),
                    converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING))
            .numColumns(3).create());//from www .  j a v  a2 s .  co m

    /* row 1 */
    Label label = new Label(composite, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create());
    label.setText(StringUtil.makeFormLabel(Messages.SimpleWebServerPropertyDialog_Name_Label));

    nameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    nameText.setLayoutData(GridDataFactory.fillDefaults()
            .hint(convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT).span(2, 1)
            .grab(true, false).create());

    /* row 1 */
    label = new Label(composite, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create());
    label.setText(StringUtil.makeFormLabel(Messages.SimpleWebServerPropertyDialog_BaseURL_Label));

    baseUrlText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    baseUrlText.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(baseUrlText)
                    .convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT)
            .span(2, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).create());
    baseUrlText.setText("http://"); //$NON-NLS-1$

    /* row 2 */
    label = new Label(composite, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create());
    label.setText(StringUtil.makeFormLabel(Messages.SimpleWebServerPropertyDialog_DocRoot_Label));

    documentRootText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    documentRootText.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(documentRootText)
                    .convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT)
            .grab(true, false).create());

    Button browseButton = new Button(composite, SWT.PUSH);
    browseButton.setText('&' + StringUtil.ellipsify(CoreStrings.BROWSE));
    browseButton.setLayoutData(GridDataFactory.fillDefaults()
            .hint(Math.max(
                    new PixelConverter(browseButton)
                            .convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH),
                    browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x), SWT.DEFAULT)
            .create());

    /* -- */
    browseButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            browseFileSystem();
        }
    });

    /* row 3 - start command */
    label = new Label(composite, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create());
    label.setText(StringUtil.makeFormLabel(Messages.ExternalWebServerPropertyDialog_StartCommandLabel));

    startCommandText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    startCommandText.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(baseUrlText)
                    .convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT)
            .span(2, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).create());

    /* row 4 - stop command */
    label = new Label(composite, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create());
    label.setText(StringUtil.makeFormLabel(Messages.ExternalWebServerPropertyDialog_StopCommandLabel));

    stopCommandText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    stopCommandText.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(baseUrlText)
                    .convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT)
            .span(2, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).create());

    // Set up existing values...
    if (source != null) {
        String name = source.getName();
        nameText.setText((name != null) ? name : StringUtil.EMPTY);

        URL url = source.getBaseURL();
        if (url != null) {
            baseUrlText.setText(url.toExternalForm());
        }
        IPath path = source.getDocumentRootPath();
        if (path != null) {
            documentRootText.setText(path.toOSString());
        }

        String startCommand = source.getStartCommand();
        startCommandText.setText((startCommand != null) ? startCommand : StringUtil.EMPTY);

        String stopCommand = source.getStopCommand();
        stopCommandText.setText((stopCommand != null) ? stopCommand : StringUtil.EMPTY);
    }

    addListeners();

    return dialogArea;
}

From source file:com.aptana.webserver.ui.internal.SimpleWebServerPropertyDialog.java

License:Open Source License

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

    setTitle(Messages.SimpleWebServerPropertyDialog_Title);
    getShell().setText(Messages.SimpleWebServerPropertyDialog_ShellTitle);

    Composite composite = new Composite(dialogArea, SWT.NONE);
    composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    PixelConverter converter = new PixelConverter(composite);
    composite.setLayout(GridLayoutFactory.swtDefaults()
            .margins(converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN),
                    converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN))
            .spacing(converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING),
                    converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING))
            .numColumns(3).create());//from  w w w  .  j  a v  a 2  s .  c om

    /* row 1 */
    Label label = new Label(composite, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create());
    label.setText(StringUtil.makeFormLabel(Messages.SimpleWebServerPropertyDialog_Name_Label));

    nameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    nameText.setLayoutData(GridDataFactory.fillDefaults()
            .hint(convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT).span(2, 1)
            .grab(true, false).create());

    /* row 1 */
    label = new Label(composite, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create());
    label.setText(StringUtil.makeFormLabel(Messages.SimpleWebServerPropertyDialog_BaseURL_Label));

    baseUrlText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    baseUrlText.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(baseUrlText)
                    .convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT)
            .span(2, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).create());
    baseUrlText.setText("http://"); //$NON-NLS-1$

    /* row 2 */
    label = new Label(composite, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create());
    label.setText(StringUtil.makeFormLabel(Messages.SimpleWebServerPropertyDialog_DocRoot_Label));

    documentRootText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    documentRootText.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(documentRootText)
                    .convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT)
            .grab(true, false).create());

    Button browseButton = new Button(composite, SWT.PUSH);
    browseButton.setText('&' + StringUtil.ellipsify(CoreStrings.BROWSE));
    browseButton.setLayoutData(GridDataFactory.fillDefaults()
            .hint(Math.max(
                    new PixelConverter(browseButton)
                            .convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH),
                    browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x), SWT.DEFAULT)
            .create());

    /* -- */
    browseButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            browseFileSystem();
        }
    });

    if (source != null) {
        String name = source.getName();
        nameText.setText((name != null) ? name : StringUtil.EMPTY);
        URL url = source.getBaseURL();
        if (url != null) {
            baseUrlText.setText(url.toExternalForm());
        }
        IPath path = source.getDocumentRootPath();
        if (path != null) {
            documentRootText.setText(path.toOSString());
        }
    }

    addListeners();

    return dialogArea;
}

From source file:com.arc.intro.NewWorkspaceDialog.java

License:Open Source License

/**
 * The main area of the dialog is just a row with the current selection information and a drop-down of the most
 * recently used workspaces./*from  ww  w.j  av a 2 s  . co  m*/
 */
private void createWorkspaceBrowseRow(Composite parent) {
    Composite panel = new Composite(parent, SWT.NONE);

    GridLayout layout = new GridLayout(3, 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);
    panel.setLayout(layout);
    panel.setLayoutData(new GridData(GridData.FILL_BOTH));
    panel.setFont(parent.getFont());

    Label label = new Label(panel, SWT.NONE);
    label.setText("Specify a directory:");

    // text = new Combo(panel, SWT.BORDER | SWT.LEAD | SWT.DROP_DOWN);
    text = new Text(panel, SWT.BORDER | SWT.LEAD | SWT.DROP_DOWN);
    text.setFocus();
    //text.setEnabled(false);
    text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
    // setInitialTextValues(text);

    Button browseButton = new Button(panel, SWT.PUSH);
    browseButton.setText("Browse...");
    setButtonLayoutData(browseButton);
    GridData data = (GridData) browseButton.getLayoutData();
    data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_END;
    browseButton.setLayoutData(data);
    browseButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog dialog = new DirectoryDialog(getShell());
            dialog.setText("Select Workspace Directory");
            dialog.setMessage("Select the workspace directory to use.");
            dialog.setFilterPath(getInitialBrowsePath());
            String dir = dialog.open();
            if (dir != null)
                text.setText(dir);
        }
    });
}

From source file:com.arc.intro.NewWorkspaceDialog.java

License:Open Source License

private void createExtraTextInfoMsgPanel(Composite parent) {
    Composite panel = new Composite(parent, SWT.NONE);

    GridLayout layout = new GridLayout(1, true);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    panel.setLayout(layout);//from  w  w w  . ja va2s  .  c  o m
    panel.setLayoutData(new GridData(GridData.FILL_BOTH));
    panel.setFont(parent.getFont());

    Label label = new Label(panel, SWT.NONE);
    label.setText(
            ToolchainPlugin.getTheProductName() + " will automatically restart to complete this operation.");
}

From source file:com.arc.intro.OpenWorkspaceDialog.java

License:Open Source License

/**
 * The main area of the dialog is just a row with the current selection information and a drop-down of the most
 * recently used workspaces./*ww w .j  av  a  2 s . c om*/
 */
private void createWorkspaceBrowseRow(Composite parent) {
    Composite panel = new Composite(parent, SWT.NONE);

    GridLayout layout = new GridLayout(3, 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);
    panel.setLayout(layout);
    panel.setLayoutData(new GridData(GridData.FILL_BOTH));
    panel.setFont(parent.getFont());

    Label label = new Label(panel, SWT.NONE);
    label.setText("Select a workspace");

    text = new Combo(panel, SWT.BORDER | SWT.LEAD | SWT.DROP_DOWN);
    text.setFocus();
    text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
    setInitialTextValues(text);

    Button browseButton = new Button(panel, SWT.PUSH);
    browseButton.setText("Browse...");
    setButtonLayoutData(browseButton);
    GridData data = (GridData) browseButton.getLayoutData();
    data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_END;
    browseButton.setLayoutData(data);
    browseButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog dialog = new DirectoryDialog(getShell());
            dialog.setText("Select Workspace Directory");
            dialog.setMessage("Select the workspace directory to use.");
            dialog.setFilterPath(getInitialBrowsePath());
            String dir = dialog.open();
            if (dir != null)
                text.setText(dir);
        }
    });
}

From source file:com.centurylink.mdw.plugin.designer.editors.ViewLayoutEditAttributeDialog.java

License:Apache License

protected Composite baseCreateDialogArea(Composite parent) {
    // copied from Dialog
    Composite dialogArea = 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);
    dialogArea.setLayout(layout);//from   ww  w .  j  ava2 s  .co  m
    dialogArea.setLayoutData(new GridData(GridData.FILL_BOTH));
    applyDialogFont(dialogArea);
    return dialogArea;
}