List of usage examples for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_MARGIN
int HORIZONTAL_MARGIN
To view the source code for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_MARGIN.
Click Source Link
From source file:org.eclipse.dltk.ui.preferences.EditTemplateDialog.java
License:Open Source License
protected Control createDialogArea(Composite ancestor) { Composite parent = new Composite(ancestor, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2;//w w w .j av a 2s . com layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); parent.setLayout(layout); parent.setLayoutData(new GridData(GridData.FILL_BOTH)); ModifyListener listener = new ModifyListener() { public void modifyText(ModifyEvent e) { doTextWidgetChanged(e.widget); } }; if (fIsNameModifiable) { createLabel(parent, PreferencesMessages.EditTemplateDialog_name); Composite composite = new Composite(parent, SWT.NONE); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); layout = new GridLayout(); layout.numColumns = 4; layout.marginWidth = 0; layout.marginHeight = 0; composite.setLayout(layout); fNameText = createText(composite); fNameText.addFocusListener(new FocusListener() { public void focusGained(FocusEvent e) { } public void focusLost(FocusEvent e) { if (fSuppressError) { fSuppressError = false; updateStatusAndButtons(); } } }); if (fIsContextTypeModifiable) { createLabel(composite, PreferencesMessages.EditTemplateDialog_context); fContextCombo = new Combo(composite, SWT.READ_ONLY); SWTUtil.setDefaultVisibleItemCount(fContextCombo); for (int i = 0; i < fContextTypes.length; i++) { fContextCombo.add(fContextTypes[i][1]); } fContextCombo.addModifyListener(listener); // fAutoInsertCheckbox = createCheckbox(composite, // PreferencesMessages.EditTemplateDialog_autoinsert); // fAutoInsertCheckbox.setSelection(fTemplate.isAutoInsertable()); } } createLabel(parent, PreferencesMessages.EditTemplateDialog_description); int descFlags = fIsNameModifiable ? SWT.BORDER : SWT.BORDER | SWT.READ_ONLY; fDescriptionText = new Text(parent, descFlags); fDescriptionText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fDescriptionText.addModifyListener(listener); Label patternLabel = createLabel(parent, PreferencesMessages.EditTemplateDialog_pattern); patternLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); fPatternEditor = createEditor(parent); Label filler = new Label(parent, SWT.NONE); filler.setLayoutData(new GridData()); Composite composite = new Composite(parent, SWT.NONE); layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; composite.setLayout(layout); composite.setLayoutData(new GridData()); fInsertVariableButton = new Button(composite, SWT.NONE); fInsertVariableButton.setLayoutData(getButtonGridData()); fInsertVariableButton.setText(PreferencesMessages.EditTemplateDialog_insert_variable); fInsertVariableButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { fPatternEditor.getTextWidget().setFocus(); fPatternEditor.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS); } public void widgetDefaultSelected(SelectionEvent e) { } }); fDescriptionText.setText(fTemplate.getDescription()); if (fIsNameModifiable) { fNameText.setText(fTemplate.getName()); fNameText.addModifyListener(listener); fContextCombo.select(getIndex(fTemplate.getContextTypeId())); } else { fPatternEditor.getControl().setFocus(); } initializeActions(); applyDialogFont(parent); return composite; }
From source file:org.eclipse.dltk.ui.text.completion.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 ww w . j av a 2s. co m private boolean informUserAboutEmptyDefaultCategory() { if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell = DLTKUIPlugin.getActiveWorkbenchShell(); String title = ScriptTextMessages.ContentAssistProcessor_all_disabled_title; String message = ScriptTextMessages.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( ScriptTextMessages.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.dltk.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.dltk.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; } 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()) { /* * FIXME Restore default settings in DLTKUIPlugin preferences, * since at the moment this is the only IPreferenceStore these * preferences are read from. */ IPreferenceStore store = DLTKUIPlugin.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.eclipse.e4.ui.dialogs.SelectionStatusDialog.java
License:Open Source License
protected Control createButtonBar(Composite parent) { Font font = parent.getFont(); Composite composite = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); if (!fStatusLineAboveButtons) { layout.numColumns = 2;// w ww . j av a2s . c o m } layout.marginHeight = 0; layout.marginLeft = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.marginWidth = 0; composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); composite.setFont(font); if (!fStatusLineAboveButtons && isHelpAvailable()) { createHelpControl(composite); } GridData statusData = new GridData(GridData.FILL_HORIZONTAL); if (fStatusLineAboveButtons && isHelpAvailable()) { statusData.horizontalSpan = 2; createHelpControl(composite); } /* * Create the rest of the button bar, but tell it not to * create a help button (we've already created it). */ boolean helpAvailable = isHelpAvailable(); setHelpAvailable(false); super.createButtonBar(composite); setHelpAvailable(helpAvailable); return composite; }
From source file:org.eclipse.eatop.workspace.ui.wizards.pages.EastADLProjectWizardFirstPage.java
License:Open Source License
private Layout initGridLayout(GridLayout gridLayout, boolean margins) { gridLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); gridLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); if (margins) { gridLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); gridLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); } else {/* w w w.j av a 2 s.c om*/ gridLayout.marginWidth = 0; gridLayout.marginHeight = 0; } return gridLayout; }
From source file:org.eclipse.edt.ide.ui.internal.contentassist.EGLContentAssistProcessor.java
License:Open Source License
private boolean informUserAboutEmptyDefaultCategory() { if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell = EDTUIPlugin.getActiveWorkbenchShell(); String title = EGLTextMessages.ContentAssistProcessor_all_disabled_title; String message = EGLTextMessages.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( EGLTextMessages.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) { /*/*from w w w.java 2 s . c om*/ * @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) { setReturnCode(settingsId); close(); } }); GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); gridData.widthHint = this.getMinimumMessageWidth(); link.setLayoutData(gridData); super.createCustomArea(parent); return parent; } 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 = EDTUIPlugin.getDefault().getPreferenceStore(); store.setToDefault(EDTUIPreferenceConstants.CODEASSIST_CATEGORY_ORDER); store.setToDefault(EDTUIPreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES); } if (settingsId == returnValue) PreferencesUtil .createPreferenceDialogOn(shell, "org.eclipse.edt.ide.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$ .open(); fComputerRegistry.reload(); return true; } } return false; }
From source file:org.eclipse.edt.ide.ui.internal.formatting.ui.CreateProfileDialog.java
License:Open Source License
public Control createDialogArea(Composite parent) { final int numColumns = 2; GridData gd;// ww w . j a va 2 s . c om 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(NewWizardMessages.ProfileName); 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(NewWizardMessages.InitProfileSetting); 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(NewWizardMessages.OpenEditDlg); fEditCheckbox.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { fOpenEditDialog = ((Button) e.widget).getSelection(); } public void widgetDefaultSelected(SelectionEvent e) { } }); final IDialogSettings dialogSettings = EDTUIPlugin.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(fSortedNames[0]); updateStatus(fEmpty); applyDialogFont(composite); fNameText.setFocus(); return composite; }
From source file:org.eclipse.edt.ide.ui.internal.formatting.ui.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 w w.ja v a 2 s .c o m*/ * @param parent The parent composite * @return Created content control */ public final Composite createContents(Composite parent) { final int numColumns = 4; if (fPixelConverter == null) { fPixelConverter = new PixelConverter(parent); } final SashForm fSashForm = new SashForm(parent, SWT.HORIZONTAL); fSashForm.setFont(parent.getFont()); final Composite settingsPane = new Composite(fSashForm, SWT.NONE); settingsPane.setFont(fSashForm.getFont()); final GridLayout 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); final Composite previewPane = new Composite(fSashForm, SWT.NONE); previewPane.setLayout(createGridLayout(numColumns, true)); previewPane.setFont(fSashForm.getFont()); doCreatePreviewPane(previewPane, numColumns); initializePage(); fSashForm.setWeights(new int[] { 3, 3 }); return fSashForm; }
From source file:org.eclipse.edt.ide.ui.internal.formatting.ui.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;/*w ww . j a v a 2 s. c o 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(NewWizardMessages.EnterNewName); 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); String profileDisplayName = fProfileManager.getProfileDisplayName(fProfileOrDefaultProfile); fNameText.setText(profileDisplayName); fNameText.setSelection(0, profileDisplayName.length()); fNameText.setLayoutData(gd); fNameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { doValidation(); } }); fNameText.setText(profileDisplayName); fNameText.selectAll(); applyDialogFont(composite); return composite; }
From source file:org.eclipse.edt.ide.ui.preferences.CompilerAndGeneratorControls.java
License:Open Source License
public void createGeneratorsComposite(Composite parent) { if (fPixelConverter == null) { fPixelConverter = new PixelConverter(parent); }/* ww w . j ava2 s . c o m*/ Composite settingsPane = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); layout.verticalSpacing = (int) (1.5 * fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING)); layout.horizontalSpacing = fPixelConverter .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.marginHeight = 0; layout.marginWidth = fPixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); settingsPane.setLayout(layout); settingsPane.setLayoutData(new GridData(GridData.FILL_BOTH)); createPageBookAndTree(settingsPane); initializePage(); }
From source file:org.eclipse.edt.ide.ui.preferences.CompilerAndGeneratorControls.java
License:Open Source License
protected GridLayout createGridLayout(int numColumns, boolean margins) { GridLayout layout = new GridLayout(numColumns, false); layout.verticalSpacing = fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = fPixelConverter .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); if (margins) { layout.marginHeight = fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = fPixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); } else {//from w w w.j ava 2 s . co m layout.marginHeight = 0; layout.marginWidth = 0; } return layout; }