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

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

Introduction

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

Prototype

int BUTTON_WIDTH

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

Click Source Link

Document

Button width in dialog units (value 61).

Usage

From source file:org.jboss.tools.common.model.ui.attribute.editor.HyperlinkStringButtonFieldEditor.java

License:Open Source License

protected Control createTextChangeControl(Composite parent) {
    GridData gd;/*from w w w  .j  a  v  a  2 s. com*/
    Control control;
    composite = new Composite(parent, SWT.NONE);
    composite.setBackgroundMode(SWT.INHERIT_DEFAULT);
    ///      composite.setBackground(parent.getBackground());
    GridLayout gridLayout = new GridLayout(3, false);
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 0;
    composite.setLayout(gridLayout);

    Control textControl = createTextControl(composite);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    textControl.setLayoutData(gd);

    control = new Label(composite, SWT.NONE);
    ///      control.setBackground(parent.getBackground());
    gd = new GridData();
    gd.widthHint = 5;
    control.setLayoutData(gd);

    control = getChangeControl(composite);
    gd = new GridData();
    gd.widthHint = convertHorizontalDLUsToPixels(control, IDialogConstants.BUTTON_WIDTH);
    gd.heightHint = textControl.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
    control.setLayoutData(gd);

    return composite;
}

From source file:org.jboss.tools.common.model.ui.attribute.editor.ListStructuredFieldEditor.java

License:Open Source License

private Button createButton(Composite parent, String key) {
    Button b = new Button(parent, SWT.PUSH);
    b.setText(JFaceResources.getString(key));
    b.setFont(parent.getFont());/* w ww  . j a va 2  s .  c  o  m*/
    GridData d = new GridData(GridData.FILL_HORIZONTAL);
    d.heightHint = convertVerticalDLUsToPixels(b, 14/*IDialogConstants.BUTTON_HEIGHT*/);
    int widthHint = convertHorizontalDLUsToPixels(b, IDialogConstants.BUTTON_WIDTH);
    d.widthHint = Math.max(widthHint, b.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
    b.setLayoutData(d);
    b.addSelectionListener(getSelectionListener());
    return b;
}

From source file:org.jboss.tools.common.model.ui.attribute.editor.MutableComboBoxFieldEditor.java

License:Open Source License

protected Control createTextChangeControl(Composite parent) {
    GridData gd;/*from w w  w.  java  2  s .c  o  m*/
    Control control;
    if (composite == null)
        composite = new Composite(parent, SWT.NONE);
    composite.setBackground(parent.getBackground());
    GridLayout gridLayout = new GridLayout(3, false);
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 0;
    composite.setLayout(gridLayout);

    Control textControl = getComboControl(composite);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    textControl.setLayoutData(gd);

    control = new Label(composite, SWT.NONE);
    control.setBackground(parent.getBackground());
    gd = new GridData();
    gd.widthHint = 5;
    control.setLayoutData(gd);

    control = getChangeControl(composite);
    gd = new GridData();
    gd.widthHint = convertHorizontalDLUsToPixels(control, IDialogConstants.BUTTON_WIDTH);
    gd.heightHint = textControl.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
    control.setLayoutData(gd);

    /*
          // init data
          if (valueProvider!=null) {
             String value = valueProvider.getStringValue(Boolean.TRUE.booleanValue());
             getTextField().setText(value);
             if (getLabelAction()!=null) {
    getLabelAction().setEnabled((value!=null && value.length()>0));
             }
          }
    */
    return composite;
}

From source file:org.jboss.tools.common.model.ui.attribute.editor.StringButtonFieldEditor.java

License:Open Source License

protected void doFillIntoGrid(Composite parent, int numColumns) {
    super.doFillIntoGrid(parent, numColumns - 1);
    button = getChangeControl(parent);//  w  w w.  j  a  v a 2  s  . co m
    GridData gd = new GridData();
    gd.horizontalAlignment = GridData.FILL;
    gd.heightHint = convertVerticalDLUsToPixels(button, 14/*IDialogConstants.BUTTON_HEIGHT*/);
    int widthHint = convertHorizontalDLUsToPixels(button, IDialogConstants.BUTTON_WIDTH);
    gd.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
    button.setLayoutData(gd);
}

From source file:org.jboss.tools.common.model.ui.attribute.editor.StringButtonFieldEditorEx.java

License:Open Source License

protected Control createTextChangeControl(Composite parent) {
    GridData gd;// w ww . j av a 2 s  . c  om
    Control control;
    if (composite == null)
        composite = new Composite(parent, SWT.NONE);
    composite.setBackgroundMode(SWT.INHERIT_DEFAULT);
    ///      composite.setBackground(parent.getBackground());
    GridLayout gridLayout = new GridLayout(3, false);
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 0;
    composite.setLayout(gridLayout);

    Control textControl = createTextControl(composite);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    textControl.setLayoutData(gd);

    control = new Label(composite, SWT.NONE);
    ///      control.setBackground(parent.getBackground());
    gd = new GridData();
    gd.widthHint = 5;
    control.setLayoutData(gd);

    control = getChangeControl(composite);
    gd = new GridData();
    gd.widthHint = convertHorizontalDLUsToPixels(control, IDialogConstants.BUTTON_WIDTH);
    gd.heightHint = textControl.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
    control.setLayoutData(gd);

    // init data
    if (valueProvider != null) {
        String value = valueProvider.getStringValue(Boolean.TRUE.booleanValue());
        getTextField().setText(value);
        if (getLabelAction() != null) {
            getLabelAction().setEnabled((value != null/* && value.length()>0*/));
        }
    }

    // deprecated - now addContentAssist works
    //      IContentAssistProcessor processor = (IContentAssistProcessor)propertyEditor.getAdapter(IContentAssistProcessor.class);
    //      if(processor != null) {
    //         ControlContentAssistHelper.createTextContentAssistant(getTextField(), processor);
    //      }

    return composite;
}

From source file:org.jboss.tools.common.model.ui.objecteditor.XChildrenEditor.java

License:Open Source License

protected void createCommandBar() {
    String[] commands = (areUpDounActionsEnabled()) ? new String[] { ADD, EDIT, DELETE, UP, DOWN }
            : new String[] { ADD, EDIT, DELETE };
    bar.setCommands(commands);//from   ww w  .  j a v a 2 s .com
    bar.getLayout().direction = SWT.VERTICAL;
    bar.getLayout().buttonWidth = convertHorizontalDLUsToPixels(control, IDialogConstants.BUTTON_WIDTH);
    setMargins(bar);
    bar.createControl(control);
    BorderLayout bl = (BorderLayout) control.getLayout();
    bl.eastComposite = bar.getControl();
    bl.eastWidth = SWT.DEFAULT;
}

From source file:org.jboss.tools.common.model.ui.reporting.ReportProblemWizard.java

License:Open Source License

/**
 * Returns a width hint for a button control.
 *//*from   w  w w  .ja  v a  2s  .  co  m*/
private int getButtonWidthHint(Button button) {
    button.setFont(JFaceResources.getDialogFont());
    PixelConverter converter = new PixelConverter(button);
    int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
}

From source file:org.jboss.tools.common.model.ui.wizards.query.AbstractQueryDialog.java

License:Open Source License

protected Control createButtonBar(Composite parent) {
    CommandBar commandBar = view.getCommandBar();
    commandBar.addCommandBarListener(view);
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout(1, false);
    gridLayout.marginHeight = 0;//from  www . j av a2 s .co  m
    gridLayout.marginWidth = 0;
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 0;
    composite.setLayout(gridLayout);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    composite.setLayoutData(gd);

    Label titleBarSeparator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
    titleBarSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    CommandBarLayout cbl = new CommandBarLayout();
    cbl.buttonHeight = convertHorizontalDLUsToPixels(20);
    cbl.buttonWidth = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    cbl.gap = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_MARGIN);
    cbl.left = 10;
    cbl.right = 10;
    cbl.top = 11;
    cbl.bottom = 10;
    commandBar.setLayout(cbl);
    commandBar.setCommands(getCommands());
    commandBar.setDefaultCommand(view.getDefaultCommand());
    Control control = commandBar.createControl(composite);
    commandBar.getLayout().alignment = SWT.RIGHT;
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.heightHint = commandBar.getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
    control.setLayoutData(gd);
    if (view.getHelpKey() == null)
        commandBar.setEnabled(AbstractQueryWizardView.HELP, false);
    view.updateBar();
    return composite;
}

From source file:org.jboss.tools.common.model.ui.wizards.special.DefaultSpecialWizardDialog.java

License:Open Source License

protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout(1, false);
    gridLayout.marginHeight = 0;//from   w  ww . j ava2  s  . c o m
    gridLayout.marginWidth = 0;
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 0;
    composite.setLayout(gridLayout);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    //gd.heightHint = commandBarHeight;
    composite.setLayoutData(gd);

    // Build the separator line
    Label titleBarSeparator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
    titleBarSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // Build the command bar
    commandBar = new CommandBar();
    CommandBarLayout cbl = new CommandBarLayout();
    cbl.buttonHeight = convertHorizontalDLUsToPixels(20);
    cbl.buttonWidth = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    cbl.gap = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_MARGIN);
    cbl.left = 10;
    cbl.right = 10;
    cbl.top = 11;
    cbl.bottom = 10;
    commandBar.setLayout(cbl);
    Control control = commandBar.createControl(composite);
    commandBar.addCommandBarListener(this);
    commandBar.getLayout().alignment = SWT.RIGHT;
    gd = new GridData(GridData.FILL_BOTH);
    gd.heightHint = commandBar.getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
    control.setLayoutData(gd);

    return composite;
}

From source file:org.jboss.tools.common.verification.ui.vrules.wizard.runtime2.VerifyDialog.java

License:Open Source License

protected Control createButtonBar(Composite parent) {
    CommandBar commandBar = view.getCommandBar();
    commandBar.addCommandBarListener(view);
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout(1, false);
    gridLayout.marginHeight = 0;/*  w w  w .  j ava  2s  .  c  o  m*/
    gridLayout.marginWidth = 0;
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 0;
    composite.setLayout(gridLayout);
    GridData gd = new GridData(GridData.FILL_BOTH);
    composite.setLayoutData(gd);

    Label titleBarSeparator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
    titleBarSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    CommandBarLayout cbl = new CommandBarLayout();
    cbl.buttonHeight = convertHorizontalDLUsToPixels(20);
    cbl.buttonWidth = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    cbl.gap = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_MARGIN);
    cbl.left = 10;
    cbl.right = 10;
    cbl.top = 11;
    cbl.bottom = 10;
    commandBar.setLayout(cbl);
    commandBar.setCommands(getCommands());
    commandBar.setDefaultCommand(view.getDefaultCommand());
    Control control = commandBar.createControl(composite);
    commandBar.getLayout().alignment = SWT.RIGHT;
    gd = new GridData(GridData.FILL_BOTH);
    gd.heightHint = commandBar.getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
    control.setLayoutData(gd);
    if (view.getHelpKey() == null)
        commandBar.setEnabled(AbstractQueryWizardView.HELP, false);

    return composite;
}