List of usage examples for org.eclipse.jface.dialogs IDialogConstants VERTICAL_MARGIN
int VERTICAL_MARGIN
To view the source code for org.eclipse.jface.dialogs IDialogConstants VERTICAL_MARGIN.
Click Source Link
From source file:descent.internal.ui.preferences.AppearancePreferencePage.java
License:Open Source License
protected Control createContents(Composite parent) { initializeDialogUnits(parent);/*from w w w .j av a 2s .c om*/ int nColumns = 1; Composite result = new Composite(parent, SWT.NONE); result.setFont(parent.getFont()); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = 0; layout.numColumns = nColumns; result.setLayout(layout); fShowMethodReturnType.doFillIntoGrid(result, nColumns); fShowMethodTypeParameters.doFillIntoGrid(result, nColumns); fShowCategory.doFillIntoGrid(result, nColumns); fShowMembersInPackageView.doFillIntoGrid(result, nColumns); fFoldPackagesInPackageExplorer.doFillIntoGrid(result, nColumns); new Separator().doFillIntoGrid(result, nColumns); fCompressPackageNames.doFillIntoGrid(result, nColumns); fPackageNamePattern.doFillIntoGrid(result, 2); LayoutUtil.setHorizontalGrabbing(fPackageNamePattern.getTextControl(null)); LayoutUtil.setWidthHint(fPackageNamePattern.getLabelControl(null), convertWidthInCharsToPixels(65)); new Separator().doFillIntoGrid(result, nColumns); fStackBrowsingViewsVertically.doFillIntoGrid(result, nColumns); String noteTitle = PreferencesMessages.AppearancePreferencePage_note; String noteMessage = PreferencesMessages.AppearancePreferencePage_preferenceOnlyEffectiveForNewPerspectives; Composite noteControl = createNoteComposite(JFaceResources.getDialogFont(), result, noteTitle, noteMessage); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan = 2; noteControl.setLayoutData(gd); initFields(); Dialog.applyDialogFont(result); return result; }
From source file:descent.internal.ui.preferences.formatter.CreateProfileDialog.java
License:Open Source License
public Control createDialogArea(Composite parent) { final int numColumns = 2; GridData gd;/*from www.j a va2s .com*/ 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 = JavaPlugin.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:descent.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 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 ScrolledComposite scrollPane = new ScrolledComposite(fSashForm, SWT.V_SCROLL); scrollPane.setExpandHorizontal(true); scrollPane.setExpandVertical(true); final Composite settingsPane = new Composite(scrollPane, SWT.NONE); settingsPane.setFont(fSashForm.getFont()); scrollPane.setContent(settingsPane); 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); scrollPane.setMinSize(settingsPane.computeSize(SWT.DEFAULT, SWT.DEFAULT)); 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:descent.internal.ui.preferences.JavaBasePreferencePage.java
License:Open Source License
protected Control createContents(Composite parent) { initializeDialogUnits(parent);/*ww w .j a v 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); result.setLayout(layout); // new Label(composite, SWT.NONE); // spacer // Group linkSettings= new Group(result, SWT.NONE); // linkSettings.setLayout(new GridLayout()); // linkSettings.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // linkSettings.setText(PreferencesMessages.getString("JavaBasePreferencePage.linkSettings.text")); //$NON-NLS-1$ //addCheckBox(linkSettings, PreferencesMessages.getString("JavaBasePreferencePage.linkJavaBrowsingViewsCheckbox.text"), LINK_BROWSING_VIEW_TO_EDITOR); //$NON-NLS-1$ //addCheckBox(linkSettings, PreferencesMessages.getString("JavaBasePreferencePage.linkPackageView"), LINK_PACKAGES_TO_EDITOR); //$NON-NLS-1$ //addCheckBox(linkSettings, PreferencesMessages.getString("JavaBasePreferencePage.linkTypeHierarchy"), LINK_TYPEHIERARCHY_TO_EDITOR); //$NON-NLS-1$ // new Label(result, SWT.NONE); // spacer Group doubleClickGroup = new Group(result, SWT.NONE); doubleClickGroup.setLayout(new GridLayout()); doubleClickGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); doubleClickGroup.setText(PreferencesMessages.JavaBasePreferencePage_doubleclick_action); addRadioButton(doubleClickGroup, PreferencesMessages.JavaBasePreferencePage_doubleclick_gointo, DOUBLE_CLICK, DOUBLE_CLICK_GOES_INTO); addRadioButton(doubleClickGroup, PreferencesMessages.JavaBasePreferencePage_doubleclick_expand, DOUBLE_CLICK, DOUBLE_CLICK_EXPANDS); // new Label(result, SWT.NONE); // spacer Group typeHierarchyGroup = new Group(result, SWT.NONE); typeHierarchyGroup.setLayout(new GridLayout()); typeHierarchyGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); typeHierarchyGroup.setText(PreferencesMessages.JavaBasePreferencePage_openTypeHierarchy); addRadioButton(typeHierarchyGroup, PreferencesMessages.JavaBasePreferencePage_inPerspective, OPEN_TYPE_HIERARCHY, OPEN_TYPE_HIERARCHY_IN_PERSPECTIVE); addRadioButton(typeHierarchyGroup, PreferencesMessages.JavaBasePreferencePage_inView, OPEN_TYPE_HIERARCHY, OPEN_TYPE_HIERARCHY_IN_VIEW_PART); Group refactoringGroup = new Group(result, SWT.NONE); refactoringGroup.setLayout(new GridLayout()); refactoringGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); refactoringGroup.setText(PreferencesMessages.JavaBasePreferencePage_refactoring_title); addCheckBox(refactoringGroup, PreferencesMessages.JavaBasePreferencePage_refactoring_auto_save, RefactoringSavePreferences.PREF_SAVE_ALL_EDITORS); Group group = new Group(result, SWT.NONE); group.setLayout(new GridLayout()); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); group.setText(PreferencesMessages.JavaBasePreferencePage_search); addCheckBox(group, PreferencesMessages.JavaBasePreferencePage_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.JavaBasePreferencePage_dialogs); Label label = new Label(dontAskGroup, SWT.WRAP); label.setText(PreferencesMessages.JavaBasePreferencePage_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.JavaBasePreferencePage_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:descent.internal.ui.preferences.NewJavaProjectPreferencePage.java
License:Open Source License
protected Control createContents(Composite parent) { initializeDialogUnits(parent);//from w w w.j a 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); 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:descent.internal.ui.preferences.WorkInProgressPreferencePage.java
License:Open Source License
protected Control createContents(Composite parent) { initializeDialogUnits(parent);/*w w w. j a v a 2 s . 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); result.setLayout(layout); // Add your controls here applyDialogFont(result); return result; }
From source file:descent.internal.ui.refactoring.MessageWizardPage.java
License:Open Source License
public void createControl(Composite parent) { initializeDialogUnits(parent);/*from w w w . j ava2 s. c om*/ Composite result = new Composite(parent, SWT.NONE); setControl(result); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN) * 3 / 2; layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING) * 2; layout.numColumns = 2; result.setLayout(layout); Image image = getMessageImage(); if (image != null) { Label label = new Label(result, SWT.NULL); image.setBackground(label.getBackground()); label.setImage(image); label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_BEGINNING)); } String message = getMessageString(); if (message != null) { Label messageLabel = new Label(result, SWT.WRAP); messageLabel.setText(message); GridData data = new GridData( GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING); data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); messageLabel.setLayoutData(data); messageLabel.setFont(result.getFont()); } Dialog.applyDialogFont(result); }
From source file:descent.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. * /* ww w. j a v a2 s . co m*/ * @since 3.3 */ 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 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 descent.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, "descent.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 = JavaPlugin.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:descent.internal.ui.wizards.buildpaths.newsourcepage.LinkFolderDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { initializeDialogUnits(parent);// w ww . j a v a 2 s . c o m int numOfColumns = 3; Composite composite = new Composite(parent, SWT.NONE); composite.setFont(parent.getFont()); GridLayout layout = new GridLayout(numOfColumns, false); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); composite.setLayout(layout); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); gridData.minimumWidth = convertWidthInCharsToPixels(80); composite.setLayoutData(gridData); Label label = new Label(composite, SWT.NONE); label.setFont(composite.getFont()); label.setText(Messages.format(NewWizardMessages.LinkFolderDialog_createIn, fContainer.getFullPath().makeRelative().toString())); label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, numOfColumns, 1)); fDependenciesGroup = new LinkFields(composite, numOfColumns); if (fTarget != null) { fDependenciesGroup.setLinkTarget(fTarget); } fFolderNameField = new FolderNameField(composite, numOfColumns); if (fName != null) { fFolderNameField.setText(fName); } Validator validator = new Validator(); fDependenciesGroup.addObserver(validator); fFolderNameField.addObserver(validator); return composite; }
From source file:descent.internal.ui.wizards.JavaProjectWizardFirstPage.java
License:Open Source License
/** * Initialize a grid layout with the default Dialog settings. */// w w w. j ava 2s . c o m protected GridLayout initGridLayout(GridLayout layout, boolean margins) { layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); if (margins) { layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); } else { layout.marginWidth = 0; layout.marginHeight = 0; } return layout; }