List of usage examples for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_SPACING
int HORIZONTAL_SPACING
To view the source code for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_SPACING.
Click Source Link
From source file:ext.org.eclipse.jdt.internal.ui.preferences.NewJavaProjectPreferencePage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { initializeDialogUnits(parent);// ww w . j av a 2 s . c o m Composite result = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = 0; layout.verticalSpacing = convertVerticalDLUsToPixels(10); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.numColumns = 2; result.setLayout(layout); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; Group sourceFolderGroup = new Group(result, SWT.NONE); layout = new GridLayout(); layout.numColumns = 2; sourceFolderGroup.setLayout(layout); sourceFolderGroup.setLayoutData(gd); sourceFolderGroup.setText(PreferencesMessages.NewJavaProjectPreferencePage_sourcefolder_label); int indent = 0; fProjectAsSourceFolder = addRadioButton(sourceFolderGroup, PreferencesMessages.NewJavaProjectPreferencePage_sourcefolder_project, SRCBIN_FOLDERS_IN_NEWPROJ, IPreferenceStore.FALSE, indent); fProjectAsSourceFolder.addSelectionListener(fSelectionListener); fFoldersAsSourceFolder = addRadioButton(sourceFolderGroup, PreferencesMessages.NewJavaProjectPreferencePage_sourcefolder_folder, SRCBIN_FOLDERS_IN_NEWPROJ, IPreferenceStore.TRUE, indent); fFoldersAsSourceFolder.addSelectionListener(fSelectionListener); indent = convertWidthInCharsToPixels(4); fSrcFolderNameLabel = new Label(sourceFolderGroup, SWT.NONE); fSrcFolderNameLabel.setText(PreferencesMessages.NewJavaProjectPreferencePage_folders_src); fSrcFolderNameText = addTextControl(sourceFolderGroup, fSrcFolderNameLabel, SRCBIN_SRCNAME, indent); fSrcFolderNameText.addModifyListener(fModifyListener); fBinFolderNameLabel = new Label(sourceFolderGroup, SWT.NONE); fBinFolderNameLabel.setText(PreferencesMessages.NewJavaProjectPreferencePage_folders_bin); fBinFolderNameText = addTextControl(sourceFolderGroup, fBinFolderNameLabel, SRCBIN_BINNAME, indent); fBinFolderNameText.addModifyListener(fModifyListener); String[] jreNames = getJRENames(); if (jreNames.length > 0) { Label jreSelectionLabel = new Label(result, SWT.NONE); jreSelectionLabel.setText(PreferencesMessages.NewJavaProjectPreferencePage_jrelibrary_label); jreSelectionLabel.setLayoutData(new GridData()); int index = getPreferenceStore().getInt(CLASSPATH_JRELIBRARY_INDEX); fJRECombo = new Combo(result, SWT.READ_ONLY); fJRECombo.setItems(jreNames); fJRECombo.select(index); fJRECombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); } validateFolders(); Dialog.applyDialogFont(result); return result; }
From source file:ext.org.eclipse.jdt.internal.ui.refactoring.reorg.RenameTypeWizardSimilarElementsOptionsDialog.java
License:Open Source License
@Override protected Control createMessageArea(Composite parent) { initializeDialogUnits(parent);//from w ww .ja v a2s. c om Composite messageComposite = new Composite(parent, SWT.NONE); messageComposite.setFont(parent.getFont()); GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); messageComposite.setLayout(layout); messageComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); Label infoLabel = new Label(messageComposite, SWT.WRAP); infoLabel.setText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_select_strategy); GridData gd = new GridData(GridData.FILL, GridData.CENTER, true, false); gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); infoLabel.setLayoutData(gd); infoLabel.setFont(parent.getFont()); int indent = convertWidthInCharsToPixels(3); fExactStrategyRadio = new SelectionButtonDialogField(SWT.RADIO); fExactStrategyRadio .setLabelText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_strategy_1); fExactStrategyRadio.doFillIntoGrid(messageComposite, 1); fExactStrategyRadio.setSelection(fSelectedStrategy == RenamingNameSuggestor.STRATEGY_EXACT); LayoutUtil.setHorizontalIndent(fExactStrategyRadio.getSelectionButton(null), indent); fEmbeddedStrategyRadio = new SelectionButtonDialogField(SWT.RADIO); fEmbeddedStrategyRadio .setLabelText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_strategy_2); fEmbeddedStrategyRadio.doFillIntoGrid(messageComposite, 1); fEmbeddedStrategyRadio.setSelection(fSelectedStrategy == RenamingNameSuggestor.STRATEGY_EMBEDDED); LayoutUtil.setHorizontalIndent(fEmbeddedStrategyRadio.getSelectionButton(null), indent); fSuffixStrategyRadio = new SelectionButtonDialogField(SWT.RADIO); fSuffixStrategyRadio .setLabelText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_strategy_3); fSuffixStrategyRadio.doFillIntoGrid(messageComposite, 1); fSuffixStrategyRadio.setSelection(fSelectedStrategy == RenamingNameSuggestor.STRATEGY_SUFFIX); LayoutUtil.setHorizontalIndent(fSuffixStrategyRadio.getSelectionButton(null), indent); final Composite warningComposite = new Composite(messageComposite, SWT.NONE); layout = new GridLayout(); layout.numColumns = 2; layout.marginWidth = 0; layout.marginHeight = 0; warningComposite.setLayout(layout); warningComposite.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); warningComposite.setFont(messageComposite.getFont()); Image image = Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING); fWarningImageLabel = new Label(warningComposite, SWT.LEFT | SWT.WRAP); fWarningImageLabel.setImage(image); fWarningImageLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 1, 1)); fWarningLabel = new Label(warningComposite, SWT.WRAP); fWarningLabel.setText(RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_warning_short_names); GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1); gridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); fWarningLabel.setLayoutData(gridData); fWarningLabel.setFont(warningComposite.getFont()); fExactStrategyRadio.setDialogFieldListener(new IDialogFieldListener() { public void dialogFieldChanged(DialogField field) { updateLabel(); fSelectedStrategy = RenamingNameSuggestor.STRATEGY_EXACT; } }); fEmbeddedStrategyRadio.setDialogFieldListener(new IDialogFieldListener() { public void dialogFieldChanged(DialogField field) { updateLabel(); fSelectedStrategy = RenamingNameSuggestor.STRATEGY_EMBEDDED; } }); fSuffixStrategyRadio.setDialogFieldListener(new IDialogFieldListener() { public void dialogFieldChanged(DialogField field) { updateLabel(); fSelectedStrategy = RenamingNameSuggestor.STRATEGY_SUFFIX; } }); updateLabel(); return messageComposite; }
From source file:ext.org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.java
License:Open Source License
/** * Informs the user about the fact that there are no enabled categories in the default content * assist set and shows a link to the preferences. * * @return <code>true</code> if the default should be restored * @since 3.3//from www .j a v a2s . c o m */ private boolean informUserAboutEmptyDefaultCategory() { if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell = JavaPlugin.getActiveWorkbenchShell(); String title = JavaTextMessages.ContentAssistProcessor_all_disabled_title; String message = JavaTextMessages.ContentAssistProcessor_all_disabled_message; // see PreferencePage#createControl for the 'defaults' label final String restoreButtonLabel = JFaceResources.getString("defaults"); //$NON-NLS-1$ final String linkMessage = Messages.format( JavaTextMessages.ContentAssistProcessor_all_disabled_preference_link, LegacyActionTools.removeMnemonics(restoreButtonLabel)); final int restoreId = IDialogConstants.CLIENT_ID + 10; final int settingsId = IDialogConstants.CLIENT_ID + 11; final OptionalMessageDialog dialog = new OptionalMessageDialog(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY, shell, title, null /* default image */, message, MessageDialog.WARNING, new String[] { restoreButtonLabel, IDialogConstants.CLOSE_LABEL }, 1) { /* * @see org.eclipse.jdt.internal.ui.dialogs.OptionalMessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite) */ @Override protected Control createCustomArea(Composite composite) { // wrap link and checkbox in one composite without space Composite parent = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = 0; parent.setLayout(layout); Composite linkComposite = new Composite(parent, SWT.NONE); layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); linkComposite.setLayout(layout); Link link = new Link(linkComposite, SWT.NONE); link.setText(linkMessage); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setReturnCode(settingsId); close(); } }); GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); gridData.widthHint = this.getMinimumMessageWidth(); link.setLayoutData(gridData); // create checkbox and "don't show this message" prompt super.createCustomArea(parent); return parent; } /* * @see org.eclipse.jface.dialogs.MessageDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) */ @Override protected void createButtonsForButtonBar(Composite parent) { Button[] buttons = new Button[2]; buttons[0] = createButton(parent, restoreId, restoreButtonLabel, false); buttons[1] = createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true); setButtons(buttons); } }; int returnValue = dialog.open(); if (restoreId == returnValue || settingsId == returnValue) { if (restoreId == returnValue) { IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore(); store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER); store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES); } if (settingsId == returnValue) PreferencesUtil .createPreferenceDialogOn(shell, "org.eclipse.jdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$ .open(); fComputerRegistry.reload(); return true; } } return false; }
From source file:fede.plugin.workspace.filters.CustomFiltersDialog.java
License:Apache License
/** * Overrides method in Dialog//from w w w . j a v a 2 s . c o m * * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite) */ @Override protected Control createDialogArea(Composite parent) { initializeDialogUnits(parent); // create a composite with standard margins and spacing Composite composite = 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); composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); composite.setFont(parent.getFont()); Composite group = composite; // Checkbox fEnableUserDefinedPatterns = new Button(group, SWT.CHECK); fEnableUserDefinedPatterns.setFocus(); fEnableUserDefinedPatterns.setText(FilterMessages.CustomFiltersDialog_enableUserDefinedPattern); // Pattern field fUserDefinedPatterns = new Text(group, SWT.SINGLE | SWT.BORDER); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); data.widthHint = convertWidthInCharsToPixels(59); fUserDefinedPatterns.setLayoutData(data); String patterns = convertToString(fPatterns, SEPARATOR); fUserDefinedPatterns.setText(patterns); // Info text final Label info = new Label(group, SWT.LEFT); info.setText(FilterMessages.CustomFiltersDialog_patternInfo); // Enabling / disabling of pattern group fEnableUserDefinedPatterns.setSelection(fEnablePatterns); fUserDefinedPatterns.setEnabled(fEnablePatterns); info.setEnabled(fEnablePatterns); fEnableUserDefinedPatterns.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean state = fEnableUserDefinedPatterns.getSelection(); fUserDefinedPatterns.setEnabled(state); info.setEnabled(fEnableUserDefinedPatterns.getSelection()); if (state) fUserDefinedPatterns.setFocus(); } }); // Filters provided by extension point if (fBuiltInFilters.length > 0) createCheckBoxList(group); applyDialogFont(parent); return parent; }
From source file:fr.inria.linuxtools.tmf.ui.widgets.timegraph.dialogs.TimeGraphFilterDialog.java
License:Open Source License
/** * Adds the selection and deselection buttons to the dialog. * * @param composite//w ww .j a v a 2s . c o m * the parent composite * @return Composite the composite the buttons were created in. */ protected Composite createSelectionButtons(Composite composite) { Composite buttonComposite = new Composite(composite, SWT.RIGHT); GridLayout layout = new GridLayout(); layout.marginWidth = 0; layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); buttonComposite.setLayout(layout); buttonComposite.setFont(composite.getFont()); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL); data.grabExcessHorizontalSpace = true; buttonComposite.setLayoutData(data); /* Create the buttons in the good order to place them as we want */ Button checkSelectedButton = createButton(buttonComposite, BUTTON_CHECK_SELECTED_ID, Messages.TmfTimeFilterDialog_CHECK_SELECTED, false); Button checkSubtreeButton = createButton(buttonComposite, BUTTON_CHECK_SUBTREE_ID, Messages.TmfTimeFilterDialog_CHECK_SUBTREE, false); Button checkAllButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, Messages.TmfTimeFilterDialog_CHECK_ALL, false); Button uncheckSelectedButton = createButton(buttonComposite, BUTTON_UNCHECK_SELECTED_ID, Messages.TmfTimeFilterDialog_UNCHECK_SELECTED, false); Button uncheckSubtreeButton = createButton(buttonComposite, BUTTON_UNCHECK_SUBTREE_ID, Messages.TmfTimeFilterDialog_UNCHECK_SUBTREE, false); Button uncheckAllButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, Messages.TmfTimeFilterDialog_UNCHECK_ALL, false); /* * Apply the layout again after creating the buttons to override * createButton messing with the columns */ layout.numColumns = 3; buttonComposite.setLayout(layout); /* Add a listener to each button */ checkSelectedButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { TreeSelection selection = (TreeSelection) fTree.getViewer().getSelection(); for (Object element : selection.toArray()) { checkElement(element); } updateOKStatus(); } }); checkSubtreeButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { TreeSelection selection = (TreeSelection) fTree.getViewer().getSelection(); for (Object element : selection.toArray()) { checkElementAndSubtree(element); } } }); checkAllButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Object[] viewerElements = fContentProvider.getElements(fInput); for (int i = 0; i < viewerElements.length; i++) { fTree.setSubtreeChecked(viewerElements[i], true); } updateOKStatus(); } }); uncheckSelectedButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { TreeSelection selection = (TreeSelection) fTree.getViewer().getSelection(); for (Object element : selection.toArray()) { uncheckElement(element); } updateOKStatus(); } }); uncheckSubtreeButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { TreeSelection selection = (TreeSelection) fTree.getViewer().getSelection(); for (Object element : selection.toArray()) { uncheckElement(element); } updateOKStatus(); } }); uncheckAllButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Object[] viewerElements = fContentProvider.getElements(fInput); for (Object element : viewerElements) { if (fTree.getViewer().testFindItem(element) != null) { // uncheck only visible roots and their children uncheckElement(element); } } updateOKStatus(); } }); return buttonComposite; }
From source file:gov.nasa.ensemble.core.plan.editor.lifecycle.TransferableFilePlanChooser.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { // Make view/*from w ww. ja va 2s .c o m*/ Composite composite = 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); composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); // Make file dialog FileDialog fileDialog = new FileDialog(parent.getShell(), SWT.OPEN); fileDialog.setText("Open"); // the current workspace String path = Platform.getInstanceLocation().getURL().getPath(); fileDialog.setFilterPath(path); // fileDialog.setFilterPath(System.getProperty("user.dir")); String[] filterExt = { "*.spife", "*.*" }; fileDialog.setFilterExtensions(filterExt); selectedFileName = fileDialog.open(); // if (selectedFileName == null) return null; }
From source file:gov.redhawk.ide.sdr.ui.internal.handlers.LaunchDomainManagerWithOptionsDialog.java
License:Open Source License
@Override protected Control createDialogArea(final Composite root) { final Composite composite = new Composite(root, SWT.NONE); final 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);// w w w. jav a 2 s.c o m composite.setLayoutData(new GridData(GridData.FILL_BOTH)); final GridLayout gridLayout = new GridLayout(3, false); final GridDataFactory textFactory = GridDataFactory.fillDefaults().grab(true, false).span(2, 1); final GridData data; final Group domainManagerGroup = new Group(composite, SWT.NULL); domainManagerGroup.setText("Domain Manager"); domainManagerGroup.setLayout(gridLayout); domainManagerGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); Label label = new Label(domainManagerGroup, SWT.NULL); label.setText("Domain Name: "); Text text = new Text(domainManagerGroup, SWT.BORDER); data = textFactory.create(); data.horizontalSpan = 2; text.setLayoutData(data); this.nameBinding = this.context.bindValue(SWTObservables.observeText(text, SWT.Modify), PojoObservables.observeValue(this.model, DomainManagerLaunchConfiguration.PROP_DOMAIN_NAME), new UpdateValueStrategy().setAfterConvertValidator(this.nameValidator), null); text.addModifyListener(new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { updateButtonsEnableState((IStatus) LaunchDomainManagerWithOptionsDialog.this.nameBinding .getValidationStatus().getValue()); } }); ControlDecorationSupport.create(this.nameBinding, SWT.TOP | SWT.LEFT); label = new Label(domainManagerGroup, SWT.NULL); label.setText("Debug Level: "); ComboViewer debugViewer = new ComboViewer(domainManagerGroup, SWT.READ_ONLY | SWT.SINGLE | SWT.DROP_DOWN | SWT.BORDER); debugViewer.setLabelProvider(new LabelProvider()); debugViewer.setContentProvider(new ArrayContentProvider()); debugViewer.setInput(DebugLevel.values()); debugViewer.getControl().setLayoutData(data); this.context.bindValue(ViewersObservables.observeSingleSelection(debugViewer), PojoObservables.observeValue(this.model, DomainManagerLaunchConfiguration.PROP_DEBUG_LEVEL)); label = new Label(domainManagerGroup, SWT.NULL); label.setText("Arguments:"); text = new Text(domainManagerGroup, SWT.BORDER); text.setLayoutData(data); this.context.bindValue(SWTObservables.observeText(text, SWT.Modify), PojoObservables.observeValue(this.model, DomainManagerLaunchConfiguration.PROP_ARGUMENTS)); final Group deviceManagerGroup = new Group(composite, SWT.NULL); deviceManagerGroup.setText("Device Manager"); deviceManagerGroup.setLayout(GridLayoutFactory.fillDefaults().create()); deviceManagerGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); deviceManagerGroup.setVisible(!this.sdrRoot.getNodesContainer().getNodes().isEmpty()); final CheckboxTreeViewer treeViewer = createTreeViewer(deviceManagerGroup); treeViewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); final Control buttonComposite = createSelectionButtons(deviceManagerGroup); buttonComposite.setLayoutData(GridDataFactory.fillDefaults().create()); context.bindSet(ViewersObservables.observeCheckedElements(treeViewer, DeviceConfiguration.class), nodes); // Insert a progress monitor this.progressMonitorPart = createProgressMonitorPart(composite, new GridLayout()); final GridData gridData = new GridData(GridData.FILL_HORIZONTAL); this.progressMonitorPart.setLayoutData(gridData); this.progressMonitorPart.setVisible(false); // Build the separator line final Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR); separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Dialog.applyDialogFont(composite); getShell().getDisplay().asyncExec(new Runnable() { @Override public void run() { try { LaunchDomainManagerWithOptionsDialog.this.run(true, true, scanForTakenDomainNames); updateButtonsEnableState(Status.OK_STATUS); } catch (final InvocationTargetException e) { SdrUiPlugin.getDefault().getLog().log( new Status(IStatus.ERROR, SdrUiPlugin.PLUGIN_ID, "Error scanning for domain names", e)); } catch (final InterruptedException e) { updateButtonsEnableState(Status.OK_STATUS); } } }); return composite; }
From source file:hydrograph.ui.parametergrid.dialog.ParamterValueDialog.java
License:Apache License
@Override protected Control createButtonBar(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); // create a layout with spacing and margins appropriate for the font // size.// w w w. j a va2 s . co m GridLayout layout = new GridLayout(); layout.numColumns = 0; // this is incremented by createButton layout.makeColumnsEqualWidth = true; layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN - 4); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING - 2); composite.setLayout(layout); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER); composite.setLayoutData(data); composite.setFont(parent.getFont()); // Add the buttons to the button bar. createButtonsForButtonBar(composite); return composite; }
From source file:ilg.gnumcueclipse.core.ui.preferences.McuPreferencesPage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { initializeDialogUnits(parent);/*from www .j a va 2s. c om*/ Composite container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = 0; layout.verticalSpacing = convertVerticalDLUsToPixels(10); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); container.setLayout(layout); Dialog.applyDialogFont(container); return container; }
From source file:it.isislab.floasys.gui.dialogs.SignUpDialog.java
License:Open Source License
@Override protected Control createButtonBar(Composite parent) { Label line = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL); line.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); final Composite buttonBar = new Composite(parent, SWT.NONE); buttonBar.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); final GridLayout layout = new GridLayout(); layout.numColumns = 2;/*w w w. j a v a 2s . c o m*/ layout.makeColumnsEqualWidth = false; layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); buttonBar.setLayout(layout); Button signupButton = createButton(buttonBar, LoginDialog.SIGNUP, "Sign up", true); signupButton.addSelectionListener(new SelectionAdapter() { private static final long serialVersionUID = 1L; public void widgetSelected(SelectionEvent e) { //Check the fields. if (txtUsername.getText().trim().length() == 0) { MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.OK | SWT.ICON_WARNING); messageBox.setMessage("Invalid User Name."); messageBox.setText("Warning"); messageBox.open(); return; } else if (txtPassword.getText().trim().length() == 0) { MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.OK | SWT.ICON_WARNING); messageBox.setMessage("Invalid Password."); messageBox.setText("Warning"); messageBox.open(); return; } else if (txtPassword.getText().trim().length() == 0) { MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.OK | SWT.ICON_WARNING); messageBox.setMessage("Invalid Password."); messageBox.setText("Warning"); messageBox.open(); return; } else if (!txtPassword.getText().equals(txtPassword2.getText())) { MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.OK | SWT.ICON_WARNING); messageBox.setMessage("Passwords do not match."); messageBox.setText("Warning"); messageBox.open(); return; } userAccount = new UserAccount(txtUsername.getText(), txtPassword.getText()); setReturnCode(LoginDialog.SIGNUP); close(); } }); createButton(buttonBar, CANCEL, "Cancel", true); return buttonBar; }