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:org.rubypeople.rdt.internal.ui.preferences.formatter.CreateProfileDialog.java
License:Open Source License
public Control createDialogArea(Composite parent) { final int numColumns = 2; GridData gd;//from ww w .j ava 2 s . c o m final GridLayout layout = new GridLayout(numColumns, 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); final Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(layout); // Create "Profile name:" label gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = numColumns; gd.widthHint = convertWidthInCharsToPixels(60); final Label nameLabel = new Label(composite, SWT.WRAP); nameLabel.setText(FormatterMessages.CreateProfileDialog_profile_name_label_text); nameLabel.setLayoutData(gd); // Create text field to enter name gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = numColumns; fNameText = new Text(composite, SWT.SINGLE | SWT.BORDER); fNameText.setLayoutData(gd); fNameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { doValidation(); } }); // Create "Initialize settings ..." label gd = new GridData(); gd.horizontalSpan = numColumns; Label profileLabel = new Label(composite, SWT.WRAP); profileLabel.setText(FormatterMessages.CreateProfileDialog_base_profile_label_text); profileLabel.setLayoutData(gd); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = numColumns; fProfileCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY); fProfileCombo.setLayoutData(gd); // "Open the edit dialog now" checkbox gd = new GridData(); gd.horizontalSpan = numColumns; fEditCheckbox = new Button(composite, SWT.CHECK); fEditCheckbox.setText(FormatterMessages.CreateProfileDialog_open_edit_dialog_checkbox_text); fEditCheckbox.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { fOpenEditDialog = ((Button) e.widget).getSelection(); } public void widgetDefaultSelected(SelectionEvent e) { } }); final IDialogSettings dialogSettings = RubyPlugin.getDefault().getDialogSettings();// .get(PREF_OPEN_EDIT_DIALOG); if (dialogSettings.get(PREF_OPEN_EDIT_DIALOG) != null) { fOpenEditDialog = dialogSettings.getBoolean(PREF_OPEN_EDIT_DIALOG); } else { fOpenEditDialog = true; } fEditCheckbox.setSelection(fOpenEditDialog); fProfileCombo.setItems(fSortedNames); fProfileCombo.setText(fProfileManager.getProfile(ProfileManager.DEFAULT_PROFILE).getName()); updateStatus(fEmpty); applyDialogFont(composite); fNameText.setFocus(); return composite; }
From source file:org.rubypeople.rdt.internal.ui.preferences.formatter.RenameProfileDialog.java
License:Open Source License
public Control createDialogArea(Composite parent) { final int numColumns = 2; 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); layout.numColumns = numColumns;/*from w ww. j a va 2 s .co m*/ final Composite composite = new Composite(parent, SWT.NULL); composite.setLayout(layout); // Create "Please enter a new name:" label GridData gd = new GridData(); gd.horizontalSpan = numColumns; gd.widthHint = convertWidthInCharsToPixels(60); fNameLabel = new Label(composite, SWT.NONE); fNameLabel.setText(FormatterMessages.RenameProfileDialog_dialog_label_enter_a_new_name); fNameLabel.setLayoutData(gd); // Create text field to enter name gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = numColumns; fNameText = new Text(composite, SWT.SINGLE | SWT.BORDER); if (fProfile instanceof SharedProfile) { fNameText.setText(fProfile.getName()); } fNameText.setSelection(0, fProfile.getName().length()); fNameText.setLayoutData(gd); fNameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { doValidation(); } }); fNameText.setText(fProfile.getName()); fNameText.selectAll(); applyDialogFont(composite); return composite; }
From source file:org.rubypeople.rdt.internal.ui.preferences.NewRubyProjectPreferencePage.java
License:Open Source License
protected Control createContents(Composite parent) { initializeDialogUnits(parent);//from w w w.ja v a2s . c om 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.NewRubyProjectPreferencePage_sourcefolder_label); int indent = 0; fProjectAsSourceFolder = addRadioButton(sourceFolderGroup, PreferencesMessages.NewRubyProjectPreferencePage_sourcefolder_project, SRCBIN_FOLDERS_IN_NEWPROJ, IPreferenceStore.FALSE, indent); fProjectAsSourceFolder.addSelectionListener(fSelectionListener); fFoldersAsSourceFolder = addRadioButton(sourceFolderGroup, PreferencesMessages.NewRubyProjectPreferencePage_sourcefolder_folder, SRCBIN_FOLDERS_IN_NEWPROJ, IPreferenceStore.TRUE, indent); fFoldersAsSourceFolder.addSelectionListener(fSelectionListener); indent = convertWidthInCharsToPixels(4); fSrcFolderNameLabel = new Label(sourceFolderGroup, SWT.NONE); fSrcFolderNameLabel.setText(PreferencesMessages.NewRubyProjectPreferencePage_folders_src); fSrcFolderNameText = addTextControl(sourceFolderGroup, fSrcFolderNameLabel, SRCBIN_SRCNAME, indent); fSrcFolderNameText.addModifyListener(fModifyListener); String[] jreNames = getJRENames(); if (jreNames.length > 0) { Label jreSelectionLabel = new Label(result, SWT.NONE); jreSelectionLabel.setText(PreferencesMessages.NewRubyProjectPreferencePage_jrelibrary_label); jreSelectionLabel.setLayoutData(new GridData()); int index = getPreferenceStore().getInt(LOADPATH_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:org.rubypeople.rdt.internal.ui.preferences.RubyBasePreferencePage.java
License:Open Source License
protected Control createContents(Composite parent) { initializeDialogUnits(parent);//from ww w . ja va 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); result.setLayout(layout); Group doubleClickGroup = new Group(result, SWT.NONE); doubleClickGroup.setLayout(new GridLayout()); doubleClickGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); doubleClickGroup.setText(PreferencesMessages.RubyBasePreferencePage_doubleclick_action); addRadioButton(doubleClickGroup, PreferencesMessages.RubyBasePreferencePage_doubleclick_gointo, DOUBLE_CLICK, DOUBLE_CLICK_GOES_INTO); addRadioButton(doubleClickGroup, PreferencesMessages.RubyBasePreferencePage_doubleclick_expand, DOUBLE_CLICK, DOUBLE_CLICK_EXPANDS); Group group = new Group(result, SWT.NONE); group.setLayout(new GridLayout()); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); group.setText(PreferencesMessages.RubyBasePreferencePage_search); addCheckBox(group, PreferencesMessages.RubyBasePreferencePage_search_small_menu, PreferenceConstants.SEARCH_USE_REDUCED_MENU); layout = new GridLayout(); layout.numColumns = 2; Group dontAskGroup = new Group(result, SWT.NONE); dontAskGroup.setLayout(layout); dontAskGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); dontAskGroup.setText(PreferencesMessages.RubyBasePreferencePage_dialogs); Label label = new Label(dontAskGroup, SWT.WRAP); label.setText(PreferencesMessages.RubyBasePreferencePage_do_not_hide_description); GridData data = new GridData(GridData.FILL, GridData.CENTER, true, false); data.widthHint = convertVerticalDLUsToPixels(50); label.setLayoutData(data); Button clearButton = new Button(dontAskGroup, SWT.PUSH); clearButton.setText(PreferencesMessages.RubyBasePreferencePage_do_not_hide_button); clearButton.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false)); clearButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { unhideAllDialogs(); } public void widgetDefaultSelected(SelectionEvent e) { unhideAllDialogs(); } }); SWTUtil.setButtonDimensionHint(clearButton); Dialog.applyDialogFont(result); return result; }
From source file:org.rubypeople.rdt.internal.ui.text.ruby.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. * /*from w w w. j a v a2 s . c o m*/ * @since 3.3 */ private boolean informUserAboutEmptyDefaultCategory() { if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell = RubyPlugin.getActiveWorkbenchShell(); String title = RubyTextMessages.ContentAssistProcessor_all_disabled_title; String message = RubyTextMessages.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( RubyTextMessages.ContentAssistProcessor_all_disabled_preference_link, LegacyActionTools.removeMnemonics(restoreButtonLabel)); final int restoreId = IDialogConstants.CLIENT_ID + 10; 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) */ 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() { public void widgetSelected(SelectionEvent e) { close(); PreferencesUtil.createPreferenceDialogOn(shell, "org.eclipse.jdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$ .open(); } }); 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) */ 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); } }; if (restoreId == dialog.open()) { IPreferenceStore store = RubyPlugin.getDefault().getPreferenceStore(); store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER); store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES); CompletionProposalComputerRegistry registry = CompletionProposalComputerRegistry.getDefault(); registry.reload(); return true; } } return false; }
From source file:org.sasylf.util.QuickFixPage.java
License:Open Source License
public void createControl(Composite parent) { initializeDialogUnits(parent);//from w w w . j a v a 2s .c o m // Create a new composite as there is the title bar separator // to deal with Composite control = new Composite(parent, SWT.NONE); control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); setControl(control); /*PlatformUI.getWorkbench().getHelpSystem().setHelp(control, IWorkbenchHelpContextIds.PROBLEMS_VIEW);*/ FormLayout layout = new FormLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.spacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); control.setLayout(layout); Label resolutionsLabel = new Label(control, SWT.NONE); resolutionsLabel.setText("Select a fix:"); resolutionsLabel.setLayoutData(new FormData()); createResolutionsList(control); FormData listData = new FormData(); listData.top = new FormAttachment(resolutionsLabel, 0); listData.left = new FormAttachment(0); listData.right = new FormAttachment(100, 0); listData.height = convertHeightInCharsToPixels(10); resolutionsList.getControl().setLayoutData(listData); Label title = new Label(control, SWT.NONE); title.setText("Problems:"); FormData labelData = new FormData(); labelData.top = new FormAttachment(resolutionsList.getControl(), 0); labelData.left = new FormAttachment(0); title.setLayoutData(labelData); createMarkerTable(control); Composite buttons = createTableButtons(control); FormData buttonData = new FormData(); buttonData.top = new FormAttachment(title, 0); buttonData.right = new FormAttachment(100); buttonData.height = convertHeightInCharsToPixels(10); buttons.setLayoutData(buttonData); FormData tableData = new FormData(); tableData.top = new FormAttachment(buttons, 0, SWT.TOP); tableData.left = new FormAttachment(0); tableData.bottom = new FormAttachment(100); tableData.right = new FormAttachment(buttons, 0); tableData.height = convertHeightInCharsToPixels(10); markersTable.getControl().setLayoutData(tableData); Dialog.applyDialogFont(control); resolutionsList.setSelection(new StructuredSelection(resolutionsList.getElementAt(0))); markersTable.setCheckedElements(selectedMarkers); setPageComplete(markersTable.getCheckedElements().length > 0); }
From source file:org.sasylf.util.QuickFixPage.java
License:Open Source License
/** * Create the table buttons for the receiver. * //from ww w .java 2 s .c o m * @param control * @return {@link Composite} */ private Composite createTableButtons(Composite control) { Composite buttonComposite = new Composite(control, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); buttonComposite.setLayout(layout); Button selectAll = new Button(buttonComposite, SWT.PUSH); selectAll.setText("Select All"); selectAll.setLayoutData(new GridData(SWT.FILL, SWT.NONE, false, false)); selectAll.addSelectionListener(new SelectionAdapter() { /* * (non-Javadoc) * * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ public void widgetSelected(SelectionEvent arg0) { markersTable.setAllChecked(true); setPageComplete(!resolutionsList.getSelection().isEmpty()); } }); Button deselectAll = new Button(buttonComposite, SWT.PUSH); deselectAll.setText("Deselect All"); deselectAll.setLayoutData(new GridData(SWT.FILL, SWT.NONE, false, false)); deselectAll.addSelectionListener(new SelectionAdapter() { /* * (non-Javadoc) * * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ public void widgetSelected(SelectionEvent arg0) { markersTable.setAllChecked(false); setPageComplete(false); } }); return buttonComposite; }
From source file:org.search.niem.uml.search.ui.dialog.NiemCheckedTreeSelectionDialog.java
License:Open Source License
private Composite createSelectionButtons(final Composite composite) { final Composite buttonComposite = new Composite(composite, SWT.RIGHT); final GridLayout layout = new GridLayout(); layout.numColumns = 0;// w w w . j a v a 2 s .c o m layout.marginWidth = 0; layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); buttonComposite.setLayout(layout); buttonComposite.setFont(composite.getFont()); final GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL); data.grabExcessHorizontalSpace = true; buttonComposite.setLayoutData(data); final Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, Activator.INSTANCE.getString("_UI_NIEM_CheckedTreeSelectionDialog_select_all"), false); SelectionListener listener = new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { final TreeItem[] visibleExpandedElements = getExpandedTreeItems(theViewer.getTree()); for (final TreeItem treeItem : visibleExpandedElements) { treeItem.setChecked(true); treeItem.setGrayed(true); } updateOKStatus(); } }; selectButton.addSelectionListener(listener); final Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, Activator.INSTANCE.getString("_UI_NIEM_CheckedTreeSelectionDialog_deselect_all"), false); listener = new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { theViewer.setCheckedElements(new Object[0]); updateOKStatus(); } }; deselectButton.addSelectionListener(listener); return buttonComposite; }
From source file:org.seasar.uruma.ui.dialogs.UrumaErrorDialog.java
License:Apache License
@Override protected Control createDialogArea(final Composite parent) { createMessageArea(parent);/*from w w w .ja va2 s.co m*/ // 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); layout.numColumns = 2; composite.setLayout(layout); GridData childData = new GridData(SWT.FILL, SWT.FILL, true, false); childData.horizontalSpan = 2; composite.setLayoutData(childData); composite.setFont(parent.getFont()); return composite; }
From source file:org.springsource.ide.eclipse.commons.frameworks.ui.internal.plugins.CommandDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { setTitle(getTitle());/* ww w . ja v a2 s .c om*/ setMessage(getMessage()); // FIXME setTitleImage(GrailsUiActivator.getImageDescriptor("icons/full/wizban/grails_wizban.png").createImage()); Composite composite = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().margins(getDefaultCompositeHMargin(), getDefaultCompositeVMargin()) .spacing(convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING), convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING)) .applyTo(composite); Dialog.applyDialogFont(composite); GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); createCommandArea(composite); return composite; }