List of usage examples for org.eclipse.jface.dialogs IDialogConstants BUTTON_WIDTH
int BUTTON_WIDTH
To view the source code for org.eclipse.jface.dialogs IDialogConstants BUTTON_WIDTH.
Click Source Link
From source file:org.eclipse.birt.report.item.crosstab.ui.views.dialogs.CrosstabFilterConditionBuilder.java
License:Open Source License
/** * Set the layout data of the button to a GridData with appropriate heights * and widths.//from w ww . j a va 2 s. co m * * @param button */ protected void setButtonCGridLayoutData(Button button) { int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); button.setLayoutData( GridDataFactory.swtDefaults().hint(Math.max(widthHint, minSize.x), SWT.DEFAULT).create()); }
From source file:org.eclipse.cdt.cmake.ui.DestdirFieldEditor.java
License:Open Source License
public void doFillIntoGrid(Composite parent, int numColumns) { super.doFillIntoGrid(parent, numColumns - 2); browseButton = getBrowseControl(parent); GridData browsegd = new GridData(); browsegd.horizontalAlignment = GridData.FILL; int widthHint = convertHorizontalDLUsToPixels(browseButton, IDialogConstants.BUTTON_WIDTH); browsegd.widthHint = Math.max(widthHint, browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); browseButton.setLayoutData(browsegd); variablesButton = getVarControl(parent); GridData vargd = new GridData(); vargd.horizontalAlignment = GridData.FILL; widthHint = convertHorizontalDLUsToPixels(variablesButton, IDialogConstants.BUTTON_WIDTH); vargd.widthHint = Math.max(widthHint, variablesButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); variablesButton.setLayoutData(vargd); }
From source file:org.eclipse.cdt.cpp.ui.internal.dialogs.CustomMessageDialog.java
License:Open Source License
protected Button createButton(Composite parent, int id, String label, boolean defaultButton) { // increment the number of columns in the button bar ((GridLayout) parent.getLayout()).numColumns++; Button button;/* w w w . j a v a2s .c om*/ button = new Button(parent, SWT.PUSH); button.setText(label); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); button.setLayoutData(data); button.setData(new Integer(id)); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { buttonPressed(((Integer) event.widget.getData()).intValue()); } }); if (defaultButton) { Shell shell = parent.getShell(); if (shell != null) { shell.setDefaultButton(button); } } button.setFont(parent.getFont()); return button; }
From source file:org.eclipse.cdt.cpp.ui.internal.dialogs.CustomMessageDialog.java
License:Open Source License
protected Button createExtraButton(Composite parent, int id, String label, int type) { Button button;// w w w.java 2s .com button = new Button(parent, type); button.setText(label); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); button.setLayoutData(data); if (type == 1 << 5) button.setData(new Integer(id)); else button.setData(new Integer(id + 100)); button.setSelection(false); button.addSelectionListener(actionListener); button.setFont(parent.getFont()); return button; }
From source file:org.eclipse.cdt.debug.internal.ui.preferences.SourcePreferencePage.java
License:Open Source License
private GridData getButtonGridData(Button button, FontMetrics fontMetrics) { GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING); int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH); gd.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); return gd;/*from w w w .j av a 2 s . co m*/ }
From source file:org.eclipse.cdt.debug.internal.ui.sourcelookup.CompilationDirectorySourceContainerDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Image image = fNewContainer ? CDebugImages.get(IInternalCDebugUIConstants.IMG_ADD_COMP_DIR_WIZ) : CDebugImages.get(IInternalCDebugUIConstants.IMG_EDIT_COMP_DIR_WIZ); setTitle(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_2); setMessage(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_3); setTitleImage(image);/*w w w.ja va2 s .c om*/ Composite parentComposite = (Composite) super.createDialogArea(parent); Font font = parentComposite.getFont(); 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(font); Composite dirComposite = new Composite(composite, SWT.NONE); layout = new GridLayout(2, false); dirComposite.setLayout(layout); dirComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); dirComposite.setFont(font); Label label = new Label(dirComposite, SWT.NONE); label.setText(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_4); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; label.setLayoutData(data); label.setFont(font); fDirText = new Text(dirComposite, SWT.BORDER); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 1; fDirText.setLayoutData(data); fDirText.setFont(font); fDirText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { validate(); } }); Button button = new Button(dirComposite, SWT.PUSH); button.setText(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_5); data = new GridData(); int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); data.widthHint = Math.max(widthHint, minSize.x); button.setLayoutData(data); button.setFont(JFaceResources.getDialogFont()); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { browse(); } }); fSubfoldersButton = new Button(dirComposite, SWT.CHECK); fSubfoldersButton.setText(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_6); data = new GridData(GridData.FILL_HORIZONTAL); data.verticalIndent = layout.verticalSpacing; // Extra vertical spacing fSubfoldersButton.setLayoutData(data); fSubfoldersButton.setFont(font); return parentComposite; }
From source file:org.eclipse.cdt.debug.internal.ui.SWTUtil.java
License:Open Source License
/** * Returns a width hint for a button control. *///from w w w . j av a 2 s. c om public static int getButtonWidthHint(Button button) { 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.eclipse.cdt.internal.ui.preferences.PathEntryVariableDialog.java
License:Open Source License
/** * Sets the <code>FormData</code> on the specified button to be one that is * spaced for the current dialog page units. The method * <code>initializeDialogUnits</code> must be called once before calling this * method for the first time.//from w w w . ja v a2s. c o m * * @param button the button to set the <code>FormData</code> * @return the <code>FormData</code> set on the specified button */ private FormData setButtonFormLayoutData(Button button) { FormData data = new FormData(); int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); data.width = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); button.setLayoutData(data); return data; }
From source file:org.eclipse.cdt.internal.ui.preferences.PathEntryVariablesGroup.java
License:Open Source License
/** * Sets the <code>GridData</code> on the specified button to * be one that is spaced for the current dialog page units. The * method <code>initializeDialogUnits</code> must be called once * before calling this method for the first time. * * @param button the button to set the <code>GridData</code> * @return the <code>GridData</code> set on the specified button *//*w w w . j a va2 s . c o m*/ private GridData setButtonLayoutData(Button button) { GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH); data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); button.setLayoutData(data); return data; }
From source file:org.eclipse.cdt.managedbuilder.ui.properties.NewVarDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite comp = new Composite(parent, SWT.NULL); comp.setFont(parent.getFont());/* w w w. j av a 2 s. c om*/ comp.setLayout(new GridLayout(3, false)); GridData gd = new GridData(GridData.FILL_BOTH); comp.setLayoutData(gd); fContainer = comp; Label nameLabel = new Label(comp, SWT.LEFT); nameLabel.setFont(comp.getFont()); nameLabel.setText(Messages.NewVarDialog_0); nameLabel.setLayoutData(new GridData()); fMacroNameEdit = new CCombo(comp, SWT.BORDER); fMacroNameEdit.setItems(getMacroNames()); fMacroNameEdit.setFont(comp.getFont()); gd = new GridData(); // don't use GridData.FILL_HORIZONTAL; see bugzilla 229793 gd.horizontalSpan = 2; gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH + 50; fMacroNameEdit.setLayoutData(gd); fMacroNameEdit.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { handleMacroNameModified(); } }); fMacroNameEdit.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleMacroNameSelection(); } }); if (fEditedMacro == null && cfgd != null && !(cfgd instanceof ICMultiItemsHolder)) { Button c_all = new Button(comp, SWT.CHECK); c_all.setText(Messages.NewVarDialog_1); gd = new GridData(GridData.BEGINNING); gd.horizontalSpan = 3; c_all.setLayoutData(gd); c_all.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { isForAllCfgs = ((Button) e.widget).getSelection(); } }); } Label typeLabel = new Label(comp, SWT.LEFT); typeLabel.setFont(comp.getFont()); typeLabel.setText(Messages.NewBuildMacroDialog_label_type); gd = new GridData(); typeLabel.setLayoutData(gd); fTypeSelector = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN | SWT.BORDER); gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd.horizontalSpan = 2; // gd.widthHint = 100; fTypeSelector.setLayoutData(gd); fTypeSelector.setItems(new String[] { Messages.NewBuildMacroDialog_label_type_text, Messages.NewBuildMacroDialog_label_type_text_list, Messages.NewBuildMacroDialog_label_type_path_file, Messages.NewBuildMacroDialog_label_type_path_file_list, Messages.NewBuildMacroDialog_label_type_path_dir, Messages.NewBuildMacroDialog_label_type_path_dir_list, Messages.NewBuildMacroDialog_label_type_path_any, Messages.NewBuildMacroDialog_label_type_path_any_list }); setSelectedType(IBuildMacro.VALUE_TEXT); fTypeSelector.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { handleTypeModified(); } }); fMacroValueLabel = new Label(comp, SWT.LEFT); fMacroValueLabel.setFont(comp.getFont()); fMacroValueLabel.setText(Messages.NewBuildMacroDialog_label_value); gd = new GridData(); gd.horizontalSpan = 1; fMacroValueLabel.setLayoutData(gd); fMacroValueEdit = new Text(comp, SWT.SINGLE | SWT.BORDER); fMacroValueEdit.setFont(comp.getFont()); gd = new GridData(GridData.FILL_HORIZONTAL); gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH + 100; gd.horizontalSpan = 1; fMacroValueEdit.setLayoutData(gd); fMacroValueEdit.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { handleMacroValueModified(); } }); fBrowseButton = new Button(comp, SWT.PUSH); fBrowseButton.setFont(comp.getFont()); fBrowseButton.setText(Messages.NewBuildMacroDialog_label_browse); fBrowseButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleBrowseButtonPressed(); } }); gd = new GridData(); gd.widthHint = IDialogConstants.BUTTON_WIDTH; gd.horizontalSpan = 1; fBrowseButton.setLayoutData(gd); fListEditorContainier = new Composite(comp, 0); gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 3; fListEditorContainier.setLayoutData(gd); fListEditorContainier.setLayout(new GridLayout()); fListEditor = new FileListControl(fListEditorContainier, Messages.NewBuildMacroDialog_label_list_title, IOption.BROWSE_NONE); /* Enable workspace support for list editor */ fListEditor.setWorkspaceSupport(true); // TODO: getContextInfo // fListEditor.setContext(fMacrosBlock.getContextInfo()); if (fEditedMacro != null) { loadVar(fEditedMacro); fMacroNameEdit.setEnabled(false); } return comp; }