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.bonitasoft.studio.businessobject.ui.wizard.control.AbstractTabItemControl.java
License:Open Source License
protected Button createAddButton(DataBindingContext ctx, final IViewerObservableValue viewerObservableValue, final Composite buttonsComposite) { final Button addButton = new Button(buttonsComposite, SWT.FLAT); addButton.setLayoutData(GridDataFactory.fillDefaults().grab(true, false) .minSize(IDialogConstants.BUTTON_WIDTH, SWT.DEFAULT).create()); addButton.setText(Messages.add);/* ww w .j av a 2 s .c o m*/ addButton.setEnabled(false); return addButton; }
From source file:org.bonitasoft.studio.businessobject.ui.wizard.control.AbstractTabItemControl.java
License:Open Source License
protected Button createDownButton(final IViewerObservableValue viewerObservableValue, final Composite buttonsComposite) { final Button downButton = new Button(buttonsComposite, SWT.FLAT); downButton.setLayoutData(GridDataFactory.fillDefaults().grab(true, false) .minSize(IDialogConstants.BUTTON_WIDTH, SWT.DEFAULT).create()); downButton.setText(Messages.down);/*from w w w. j a va 2 s. c o m*/ downButton.setEnabled(viewerObservableValue.getValue() != null); return downButton; }
From source file:org.bonitasoft.studio.businessobject.ui.wizard.control.AbstractTabItemControl.java
License:Open Source License
protected Button createUpButton(final IViewerObservableValue viewerObservableValue, final Composite buttonsComposite) { final Button upButton = new Button(buttonsComposite, SWT.FLAT); upButton.setLayoutData(GridDataFactory.fillDefaults().grab(true, false) .minSize(IDialogConstants.BUTTON_WIDTH, SWT.DEFAULT).create()); upButton.setText(Messages.up);/*from w ww .j ava 2 s. c o m*/ upButton.setEnabled(viewerObservableValue.getValue() != null); return upButton; }
From source file:org.bonitasoft.studio.businessobject.ui.wizard.QueryWizardPage.java
License:Open Source License
protected void createQueryParametersTable(final Composite parent, final DataBindingContext ctx) { final Composite composite = new Composite(parent, SWT.NONE); composite.setLayoutData(GridDataFactory.fillDefaults().create()); composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).spacing(5, 0).create()); final Composite buttonsComposite = new Composite(composite, SWT.NONE); buttonsComposite.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).indent(0, 20).create()); buttonsComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).spacing(0, 3).create()); final Button addButton = createAddButton(buttonsComposite); addButton.setLayoutData(GridDataFactory.fillDefaults().grab(true, false) .minSize(IDialogConstants.BUTTON_WIDTH, SWT.DEFAULT).create()); addButton.setText(Messages.add);/*from w w w . jav a 2 s .com*/ final Button deleteButton = createAddButton(buttonsComposite); deleteButton.setLayoutData(GridDataFactory.fillDefaults().grab(true, false) .minSize(IDialogConstants.BUTTON_WIDTH, SWT.DEFAULT).create()); deleteButton.setText(Messages.delete); deleteButton.setEnabled(false); final TableViewer parametersTableViewer = new TableViewer(composite, SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI); parametersTableViewer.getControl() .setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(300, 100).create()); parametersTableViewer.getTable().setLinesVisible(true); parametersTableViewer.getTable().setHeaderVisible(true); parametersTableViewer.setContentProvider(new ObservableListContentProvider()); final TableLayout tableLayout = new TableLayout(); tableLayout.addColumnData(new ColumnWeightData(3)); tableLayout.addColumnData(new ColumnWeightData(2)); parametersTableViewer.getTable().setLayout(tableLayout); final IObservableList queryParameterObserveDetailList = PojoObservables.observeList(getQuery(), "queryParameters"); addButton.addSelectionListener(new SelectionAdapter() { /* * (non-Javadoc) * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(final SelectionEvent e) { final QueryParameter param = new QueryParameter(generateName(), String.class.getName()); queryParameterObserveDetailList.add(param); parametersTableViewer.editElement(param, 0); queryBinding.validateTargetToModel(); } }); final UpdateValueStrategy enableStrategy = new UpdateValueStrategy(); enableStrategy.setConverter(new Converter(Object.class, Boolean.class) { @Override public Object convert(final Object fromObject) { return fromObject != null; } }); bindDeleteParameterButtonEnablement(ctx, deleteButton, parametersTableViewer, enableStrategy); deleteButton.addSelectionListener(new SelectionAdapter() { /* * (non-Javadoc) * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(final SelectionEvent e) { final List<?> element = ((IStructuredSelection) parametersTableViewer.getSelection()).toList(); queryParameterObserveDetailList.removeAll(element); queryBinding.validateTargetToModel(); } }); createNameColumn(ctx, parametersTableViewer); createTypeColumn(ctx, parametersTableViewer); parametersTableViewer.setInput(queryParameterObserveDetailList); }
From source file:org.bonitasoft.studio.contract.ui.property.ContractPropertySection.java
License:Open Source License
private Button createButton(final Composite buttonsComposite, final String label) { final Button button = getWidgetFactory().createButton(buttonsComposite, label, SWT.PUSH); button.setLayoutData(GridDataFactory.fillDefaults().grab(true, false) .minSize(IDialogConstants.BUTTON_WIDTH, SWT.DEFAULT).create()); return button; }
From source file:org.bonitasoft.studio.data.ui.property.section.control.DataViewer.java
License:Open Source License
protected Button createButton(final Composite parent, final String text, final String widgetId) { final Button button = widgetFactory.createButton(parent, text, SWT.FLAT); button.setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, widgetId); button.setLayoutData(// w ww . ja v a 2s . c o m GridDataFactory.fillDefaults().minSize(IDialogConstants.BUTTON_WIDTH, SWT.DEFAULT).create()); return button; }
From source file:org.bundlemaker.core.ui.handler.exporter.BinaryBundleExporterConfigurationDialog.java
License:Open Source License
private void createExportToFolder(Composite composite) { _externalFolderRadio = new Button(composite, SWT.RADIO); _externalFolderRadio.setText("External folder"); _externalFolderRadio.addListener(SWT.Selection, new Listener() { @Override/*from w w w. j a va2 s.com*/ public void handleEvent(Event event) { _saveToFileSystem = true; _externalFolder = _externalFolderCombo.getText(); _externalFolderCombo.setFocus(); updateEnablement(); } }); Composite inner = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginWidth = 0; inner.setLayout(layout); GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); inner.setLayoutData(data); _externalFolderCombo = createDropDownCombo(inner); _externalFolder = ""; _externalFolderCombo.setItems(BinaryBundleConfigurationStore.getInstance().getHistory()); _externalFolderCombo.setText(_externalFolder); _externalFolderCombo.addListener(SWT.Modify, new Listener() { @Override public void handleEvent(Event event) { _externalFolder = _externalFolderCombo.getText(); updateEnablement(); } }); final Button browseButton = new Button(inner, SWT.PUSH); browseButton.setText("Browse..."); data = new GridData(); data.horizontalAlignment = GridData.FILL; int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); data.widthHint = Math.max(widthHint, browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); browseButton.setLayoutData(data); browseButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.MULTI); String folder = dialog.open(); if (folder != null) { _saveToFileSystem = true; _externalFolderCombo.setText(folder); _externalFolder = folder; _externalFolderCombo.setFocus(); updateEnablement(); } } }); }
From source file:org.bundlemaker.core.ui.handler.exporter.BinaryBundleExporterConfigurationDialog.java
License:Open Source License
private void createExportToWorkspace(Composite composite) { _workspaceFolderRadio = new Button(composite, SWT.RADIO); _workspaceFolderRadio.setText("Workspace location"); _workspaceFolderRadio.addListener(SWT.Selection, new Listener() { @Override/*from w w w . j a v a 2 s .com*/ public void handleEvent(Event event) { _saveToFileSystem = false; _workspaceText.setFocus(); updateEnablement(); } }); final Composite nameGroup = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginWidth = 0; nameGroup.setLayout(layout); final GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); nameGroup.setLayoutData(data); _workspaceText = createTextField(nameGroup); _workspaceText.setEditable(false); // _workspaceText.addListener(SWT.Modify, new Listener() { // @Override // public void handleEvent(Event event) { // _externalFolder = _workspaceFolder.getLocation().toString(); // updateEnablement(); // } // }); Button wsBrowseButton = new Button(nameGroup, SWT.PUSH); GridData gd = new GridData(); gd.horizontalAlignment = GridData.FILL; int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); gd.widthHint = Math.max(widthHint, wsBrowseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); wsBrowseButton.setLayoutData(gd); wsBrowseButton.setText("Browse..."); wsBrowseButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { _saveToFileSystem = false; FolderSelectionDialog dialog = new FolderSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider()); IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); dialog.setInput(workspaceRoot); dialog.setTitle("Select folder"); dialog.setMessage("Select a destination folder from your workspace"); dialog.addFilter(new TypedViewerFilter(new Class[] { IProject.class, IFolder.class })); if (_workspaceFolder != null) { dialog.setInitialSelection(_workspaceFolder); } if (dialog.open() == Window.OK) { IResource resource = (IResource) dialog.getFirstResult(); if (resource != null) { _saveToFileSystem = false; _workspaceFolder = resource; _workspaceText.setText(resource.getFullPath().toString()); _workspaceText.setFocus(); updateEnablement(); } } } }); }
From source file:org.bundlemaker.core.ui.handler.exporter.PdePluginProjectExporterConfigurationDialog.java
License:Open Source License
@Override protected void createControls(Composite dialogComposite) { setMessage("Configure PDE project exporter"); setTitle("Export PDE projects"); Group destinationGroup = createGroup(dialogComposite, "Destination"); _defaultLocationCheckbox = new Button(destinationGroup, SWT.CHECK); _defaultLocationCheckbox.setText("Default location (directly in your workspace)"); _defaultLocationCheckbox.setSelection(_defaultLocation); _defaultLocationCheckbox.addListener(SWT.Selection, new Listener() { @Override// w w w . j a va 2 s .co m public void handleEvent(Event event) { _defaultLocation = _defaultLocationCheckbox.getSelection(); updateEnablement(); } }); Composite inner = new Composite(destinationGroup, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginWidth = 0; inner.setLayout(layout); GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); inner.setLayoutData(data); _locationCombo = createDropDownCombo(inner); _location = ""; _locationCombo.setItems(PdePluginProjectExporterConfigurationStore.getInstance().getHistory()); // _locationCombo.setText(_externalFolder); _locationCombo.addListener(SWT.Modify, new Listener() { @Override public void handleEvent(Event event) { if (!_defaultLocation) { String newLocation = _locationCombo.getText(); if (!newLocation.equals(_location)) { _location = newLocation; updateEnablement(); } } } }); _browseLocationButton = new Button(inner, SWT.PUSH); _browseLocationButton.setText("Browse..."); data = new GridData(); data.horizontalAlignment = GridData.FILL; int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); data.widthHint = Math.max(widthHint, _browseLocationButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); _browseLocationButton.setLayoutData(data); _browseLocationButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.MULTI); String folder = dialog.open(); if (folder != null) { _locationCombo.setText(folder); _location = folder; updateEnablement(); } } }); Group settingsGroup = createGroup(dialogComposite, "Settings"); Composite dependencyStyleGroup = createComposite(settingsGroup, 2); Label label = new Label(dependencyStyleGroup, SWT.NONE); label.setText("Use Import-Package for Dependencies:"); _dependencyStyleCombo = createReadOnlyDropDownCombo(dependencyStyleGroup); final ComboViewer comboViewer = new ComboViewer(_dependencyStyleCombo); comboViewer.setContentProvider(ArrayContentProvider.getInstance()); comboViewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { DependencyStyle dependencyStyle = (DependencyStyle) element; switch (dependencyStyle) { case PREFER_IMPORT_PACKAGE: return "Preferred"; case STRICT_IMPORT_PACKAGE: return "Always"; case STRICT_REQUIRE_BUNDLE: return "Never"; default: return super.getText(element); } } }); comboViewer.setInput(DependencyStyle.values()); _dependencyStyle = PdePluginProjectExporterConfigurationStore.getInstance().getDependencyStyle(); comboViewer.setSelection(new StructuredSelection(_dependencyStyle)); comboViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection s = (IStructuredSelection) comboViewer.getSelection(); if (s.isEmpty()) { // ??? return; } _dependencyStyle = (DependencyStyle) s.getFirstElement(); } }); _useOptionalResolutionOnMissingImportsCheckBox = new Button(settingsGroup, SWT.CHECK); _useOptionalResolutionOnMissingImportsCheckBox.setText("Use Optional Resolution on missing Packages"); _useOptionalResolutionOnMissingImports = PdePluginProjectExporterConfigurationStore.getInstance() .getOptionalResolutionOnMissingType(); _useOptionalResolutionOnMissingImportsCheckBox.setSelection(_useOptionalResolutionOnMissingImports); _useOptionalResolutionOnMissingImportsCheckBox.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { _useOptionalResolutionOnMissingImports = _useOptionalResolutionOnMissingImportsCheckBox .getSelection(); } }); _useClassificationCheckbox = new Button(settingsGroup, SWT.CHECK); _useClassificationCheckbox.setText("Use classification in output path"); _useClassificationCheckbox.setSelection(_useClassification); _useClassificationCheckbox.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { _useClassification = _useClassificationCheckbox.getSelection(); } }); updateEnablement(); }
From source file:org.compiere.mfg_scm.eclipse.db.editors.ListFieldEditor.java
License:Apache License
/** * Helper method to create a push button. * // w w w . j av a2 s . co m * @param parent * the parent control * @param key * the resource name used to supply the button's label text */ protected Button createPushButton(Composite parent, String label) { Button button = new Button(parent, SWT.PUSH); button.setText(label); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.heightHint = convertVerticalDLUsToPixels(button, IDialogConstants.BUTTON_HEIGHT); int widthHint = convertHorizontalDLUsToPixels(button, IDialogConstants.BUTTON_WIDTH); data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); // data.horizontalSpan = hs; use to have multiple buttons on the same // row button.setLayoutData(data); button.addSelectionListener(getSelectionListener()); return button; }