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.eclipse.cdt.internal.ui.build.BuildPreferencePage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { initializeDialogUnits(parent);/*from ww w . ja va 2 s . co m*/ 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); // Build either default configuration or all. Group gr = addGroup(container, PreferencesMessages.CPluginPreferencePage_build_scope); Label l1 = new Label(gr, SWT.NONE); l1.setText(PreferencesMessages.CPluginPreferencePage_1); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.verticalIndent = GROUP_VINDENT; l1.setLayoutData(gd); boolean needAllConfigBuild = ACBuilder.needAllConfigBuild(); buildActive = new Button(gr, SWT.RADIO); buildActive.setText(PreferencesMessages.CPluginPreferencePage_2); gd = new GridData(GridData.FILL_HORIZONTAL); gd.verticalIndent = GROUP_VINDENT; gd.horizontalIndent = GROUP_HINDENT; buildActive.setLayoutData(gd); buildActive.setSelection(!needAllConfigBuild); buildAll = new Button(gr, SWT.RADIO); buildAll.setText(PreferencesMessages.CPluginPreferencePage_3); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalIndent = GROUP_HINDENT; buildAll.setLayoutData(gd); buildAll.setSelection(needAllConfigBuild); addNote(gr, PreferencesMessages.CPluginPreferencePage_4); // Building project dependencies. Group gr2 = addGroup(container, PreferencesMessages.CPluginPreferencePage_building_configurations); buildOnlyOnRefChange = new Button(gr2, SWT.CHECK); buildOnlyOnRefChange.setText(PreferencesMessages.CPluginPreferencePage_7); GridData gd2 = new GridData(GridData.FILL_HORIZONTAL); gd2.verticalIndent = GROUP_VINDENT; buildOnlyOnRefChange.setLayoutData(gd2); buildOnlyOnRefChange.setSelection(ACBuilder.buildConfigResourceChanges()); Dialog.applyDialogFont(container); return container; }
From source file:org.eclipse.cdt.internal.ui.dialogs.OptionalMessageDialog.java
License:Open Source License
@Override protected Control createCustomArea(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout);//from ww w .j a v a2 s. c o m composite.setLayoutData(new GridData(GridData.FILL_BOTH)); fHideDialogCheckBox = new Button(composite, SWT.CHECK | SWT.LEFT); fHideDialogCheckBox.setText(fHideMessage); fHideDialogCheckBox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setDialogEnabled(fId, !((Button) e.widget).getSelection()); } }); applyDialogFont(fHideDialogCheckBox); return fHideDialogCheckBox; }
From source file:org.eclipse.cdt.internal.ui.filters.CustomFiltersDialog.java
License:Open Source License
/** * Overrides method in Dialog/* w ww. 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.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:org.eclipse.cdt.internal.ui.preferences.CParserPreferencePage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { fOverlayStore.load();//from ww w . j ava 2 s . c o m fOverlayStore.start(); initializeDialogUnits(parent); 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 bufferGroup = new Group(result, SWT.NONE); bufferGroup.setLayout(new GridLayout()); bufferGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); bufferGroup.setText(PreferencesMessages.CBufferPreferences_CodeReaderBuffer_CodeReaderBufferGroup); bufferTextControl = (Text) addTextField(bufferGroup, PreferencesMessages.CBufferPreferences_CodeReaderBuffer_Size, 6, 0); initialize(); return result; }
From source file:org.eclipse.cdt.internal.ui.preferences.CPluginPreferencePage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { initializeDialogUnits(parent);//w w w .jav a 2s .c o m 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); Group outlineViewGroup = addGroup(container, PreferencesMessages.CPluginPreferencePage_outline_view); addCheckBox(outlineViewGroup, PreferencesMessages.CPluginPreferencePage_structuralParseMode_label, PreferenceConstants.PREF_USE_STRUCTURAL_PARSE_MODE); addNote(outlineViewGroup, PreferencesMessages.CPluginPreferencePage_performanceHint); // Refactoring. Group refactoringGroup = addGroup(container, PreferencesMessages.CPluginPreferencePage_refactoring_title); addCheckBox(refactoringGroup, PreferencesMessages.CPluginPreferencePage_refactoring_auto_save, PreferenceConstants.REFACTOR_SAVE_ALL_EDITORS); addCheckBox(refactoringGroup, PreferencesMessages.CPluginPreferencePage_refactoring_lightweight, PreferenceConstants.REFACTOR_LIGHTWEIGHT); Group dontAskGroup = addGroup(container, PreferencesMessages.CPluginPreferencePage_cdtDialogs_group, 2); Label label = new Label(dontAskGroup, SWT.WRAP); label.setText(PreferencesMessages.CPluginPreferencePage_clearDoNotShowAgainSettings_label); 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.CPluginPreferencePage_clear_button); clearButton.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false)); clearButton.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { OptionalMessageDialog.clearAllRememberedStates(); } @Override public void widgetDefaultSelected(SelectionEvent e) { OptionalMessageDialog.clearAllRememberedStates(); } }); SWTUtil.setButtonDimensionHint(clearButton); Dialog.applyDialogFont(container); return container; }
From source file:org.eclipse.cdt.internal.ui.preferences.formatter.CreateProfileDialog.java
License:Open Source License
@Override public Control createDialogArea(Composite parent) { final int numColumns = 2; GridData gd;/*from w w w . j a v a 2s. 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() { @Override 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() { @Override public void widgetSelected(SelectionEvent e) { fOpenEditDialog = ((Button) e.widget).getSelection(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); final IDialogSettings dialogSettings = CUIPlugin.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.getDefaultProfile().getName()); updateStatus(fEmpty); applyDialogFont(composite); fNameText.setFocus(); return composite; }
From source file:org.eclipse.cdt.internal.ui.preferences.formatter.ModifyDialogTabPage.java
License:Open Source License
/** * Create the contents of this tab page. Subclasses cannot override this, * instead they must implement <code>doCreatePreferences</code>. <code>doCreatePreview</code> may also * be overridden as necessary./*from w ww .j av a2 s.com*/ * @param parent The parent composite * @return Created content control */ @Override public final Composite createContents(Composite parent) { final int numColumns = 4; if (fPixelConverter == null) { fPixelConverter = new PixelConverter(parent); } final SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL); sashForm.setFont(parent.getFont()); Composite scrollContainer = new Composite(sashForm, SWT.NONE); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); scrollContainer.setLayoutData(gridData); GridLayout layout = new GridLayout(2, false); layout.marginHeight = 0; layout.marginWidth = 0; layout.horizontalSpacing = 0; layout.verticalSpacing = 0; scrollContainer.setLayout(layout); ScrolledComposite scroll = new ScrolledComposite(scrollContainer, SWT.V_SCROLL | SWT.H_SCROLL); scroll.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); scroll.setExpandHorizontal(true); scroll.setExpandVertical(true); final Composite settingsContainer = new Composite(scroll, SWT.NONE); settingsContainer.setFont(sashForm.getFont()); scroll.setContent(settingsContainer); settingsContainer.setLayout(new PageLayout(scroll, 400, 400)); settingsContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); Composite settingsPane = new Composite(settingsContainer, SWT.NONE); settingsPane.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); layout = new GridLayout(numColumns, false); layout.verticalSpacing = (int) (1.5 * fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING)); layout.horizontalSpacing = fPixelConverter .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.marginHeight = fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = fPixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); settingsPane.setLayout(layout); doCreatePreferences(settingsPane, numColumns); settingsContainer.setSize(settingsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT)); scroll.addControlListener(new ControlListener() { @Override public void controlMoved(ControlEvent e) { } @Override public void controlResized(ControlEvent e) { settingsContainer.setSize(settingsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT)); } }); Label sashHandle = new Label(scrollContainer, SWT.SEPARATOR | SWT.VERTICAL); gridData = new GridData(SWT.RIGHT, SWT.FILL, false, true); sashHandle.setLayoutData(gridData); final Composite previewPane = new Composite(sashForm, SWT.NONE); previewPane.setLayout(createGridLayout(numColumns, true)); previewPane.setFont(sashForm.getFont()); doCreatePreviewPane(previewPane, numColumns); initializePage(); sashForm.setWeights(new int[] { 3, 3 }); return sashForm; }
From source file:org.eclipse.cdt.internal.ui.preferences.WorkInProgressPreferencePage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { initializeDialogUnits(parent);/*from w ww . ja va 2s.co 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); // Add your controls here applyDialogFont(result); return result; }
From source file:org.eclipse.cdt.internal.ui.text.contentassist.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 va 2 s. co m*/ private boolean informUserAboutEmptyDefaultCategory() { if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell = CUIPlugin.getActiveWorkbenchShell(); String title = ContentAssistMessages.ContentAssistProcessor_all_disabled_title; String message = ContentAssistMessages.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( ContentAssistMessages.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.cdt.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 = CUIPlugin.getDefault().getPreferenceStore(); store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER); store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES); } if (settingsId == returnValue) PreferencesUtil .createPreferenceDialogOn(shell, "org.eclipse.cdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$ .open(); CompletionProposalComputerRegistry registry = CompletionProposalComputerRegistry.getDefault(); registry.reload(); return true; } } return false; }
From source file:org.eclipse.cdt.launchbar.ui.internal.dialogs.LaunchConfigurationEditDialog.java
License:Open Source License
@Override protected Control createButtonBar(Composite parent) { // Clone super's implementation, removes the monitor since we don't run from here // And adds in the left button bar. Font font = parent.getFont(); Composite composite = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 2;//from w w w . j a v a2 s. c o m layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); composite.setFont(font); // create help control if needed if (isHelpAvailable()) { createHelpControl(composite); } Composite leftButtonComp = new Composite(composite, SWT.NULL); layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.numColumns = 0; leftButtonComp.setLayout(layout); leftButtonComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); leftButtonComp.setFont(parent.getFont()); createButton(leftButtonComp, DELETE_ID, "Delete", false); createButton(leftButtonComp, DUPLICATE_ID, "Duplicate", false); createButton(leftButtonComp, LAUNCH_ID, "Launch", false); Composite mainButtonComp = new Composite(composite, SWT.NONE); layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.numColumns = 0; mainButtonComp.setLayout(layout); mainButtonComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); mainButtonComp.setFont(parent.getFont()); createButton(mainButtonComp, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(mainButtonComp, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); return composite; }