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:org.eclipse.wst.sse.ui.internal.filter.OutlineCustomFiltersDialog.java
License:Open Source License
/** * Overrides method in Dialog/*w ww .j a va2 s . co m*/ * * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite) */ 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(OutlineFilterMessages.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); SWTUtil.setAccessibilityText(fUserDefinedPatterns, OutlineFilterMessages.CustomFiltersDialog_name_filter_pattern_description); // Info text final Label info = new Label(group, SWT.LEFT); info.setText(OutlineFilterMessages.CustomFiltersDialog_patternInfo); // Enabling / disabling of pattern group fEnableUserDefinedPatterns.setSelection(fEnablePatterns); fUserDefinedPatterns.setEnabled(fEnablePatterns); info.setEnabled(fEnablePatterns); fEnableUserDefinedPatterns.addSelectionListener(new SelectionAdapter() { 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.wst.xquery.internal.ui.wizards.XQDTNewModuleWizardPage.java
License:Open Source License
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 {/*ww w. ja va2 s. co m*/ layout.marginWidth = 0; layout.marginHeight = 0; } return layout; }
From source file:org.eclipse.wst.xsd.ui.internal.widgets.XSDEditSchemaInfoDialog.java
License:Open Source License
protected Control __internalCreateDialogArea(Composite 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);/*from w w w . j a v a 2 s. c o m*/ composite.setLayoutData(new GridData(GridData.FILL_BOTH)); return composite; }
From source file:org.eclipse.xtend.ide.formatting.preferences.FormatterModifyDialog.java
License:Open Source License
@Override @SuppressWarnings("rawtypes") protected Control createDialogArea(Composite parent) { if (isOldAPIVersion()) { return super.createDialogArea(parent); }// w ww .ja va 2 s . co m try { // copied from Eclipse Oxygen to support old dialog in Eclipse Photon final 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)); applyDialogFont(composite); Composite nameComposite = new Composite(composite, SWT.NONE); nameComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); nameComposite.setLayout(new GridLayout(3, false)); // use reflection to not break API Field fProfileNameField = ModifyDialog.class.getDeclaredField("fProfileNameField"); fProfileNameField.setAccessible(true); StringDialogField f = new StringDialogField(); fProfileNameField.set(this, f); f.setLabelText("&Profile name:"); f.setText(fProfile.getName()); f.getLabelControl(nameComposite).setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); f.getTextControl(nameComposite).setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); f.setDialogFieldListener(new IDialogFieldListener() { @Override public void dialogFieldChanged(DialogField field) { try { Method doValidate = ModifyDialog.class.getDeclaredMethod("doValidate"); doValidate.setAccessible(true); doValidate.invoke(FormatterModifyDialog.this); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { XtendActivator.getInstance().getLog() .log(new Status(IStatus.ERROR, XtendActivator.PLUGIN_ID, e.getMessage(), e)); } } }); // use reflection to not break API Field fSaveButton = ModifyDialog.class.getDeclaredField("fSaveButton"); fSaveButton.setAccessible(true); fSaveButton.set(this, createButton(nameComposite, IDialogConstants.CLIENT_ID + 1, "E&xport...", false)); fTabFolder = new TabFolder(composite, SWT.NONE); fTabFolder.setFont(composite.getFont()); fTabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); // use reflection to not break API Field fWorkingValues = ModifyDialog.class.getDeclaredField("fWorkingValues"); fWorkingValues.setAccessible(true); addPages((Map) fWorkingValues.get(this)); applyDialogFont(composite); fTabFolder.addSelectionListener(new SelectionListener() { @Override public void widgetDefaultSelected(SelectionEvent e) { } @Override public void widgetSelected(SelectionEvent e) { final TabItem tabItem = (TabItem) e.item; final IModifyDialogTabPage page = (IModifyDialogTabPage) tabItem.getData(); fDialogSettings.put(fKeyLastFocus, fTabPages.indexOf(page)); page.makeVisible(); } }); // use reflection to not break API Method doValidate = ModifyDialog.class.getDeclaredMethod("doValidate"); doValidate.setAccessible(true); doValidate.invoke(this); PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, getHelpContextId()); return composite; } catch (NoSuchMethodException | SecurityException | IllegalArgumentException | IllegalAccessException | InvocationTargetException | NoSuchFieldException e) { XtendActivator.getInstance().getLog() .log(new Status(IStatus.ERROR, XtendActivator.PLUGIN_ID, e.getMessage(), e)); return null; } }
From source file:org.eclipse.xtext.ui.codetemplates.ui.preferences.EditTemplateDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite ancestor) { Composite parent = new Composite(ancestor, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2;//from w ww . j a va 2 s . co m 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() { @Override public void modifyText(ModifyEvent e) { doTextWidgetChanged(e.widget); } }; if (fIsNameModifiable) { createLabel(parent, TemplateDialogMessages.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); createLabel(composite, TemplateDialogMessages.EditTemplateDialog_context); fContextCombo = new Combo(composite, SWT.READ_ONLY); fContextCombo.setVisibleItemCount(30); // default for (int i = 0; i < fContextTypes.length; i++) { fContextCombo.add(fContextTypes[i][1]); } fContextCombo.addModifyListener(listener); fAutoInsertCheckbox = createCheckbox(composite, TemplateDialogMessages.EditTemplateDialog_autoinsert); fAutoInsertCheckbox.setSelection(fTemplate.isAutoInsertable()); } createLabel(parent, TemplateDialogMessages.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, TemplateDialogMessages.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(TemplateDialogMessages.EditTemplateDialog_insert_variable); fInsertVariableButton.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { fPatternEditor.getTextWidget().setFocus(); fPatternEditor.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS); } @Override 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(); } applyDialogFont(parent); return composite; }
From source file:org.eclipselabs.changelog.ChangeLogFilterDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite topLevel = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2;//ww w. j a v a 2 s.co m layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); topLevel.setLayout(layout); //"and" and "or" search radio buttons Label label = new Label(topLevel, SWT.NONE); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; label.setLayoutData(data); label.setText("Matching"); andRadio = new Button(topLevel, SWT.RADIO); andRadio.setText("Matching All"); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; andRadio.setLayoutData(data); andRadio.setSelection(true); orRadio = new Button(topLevel, SWT.RADIO); orRadio.setText("Matching Any"); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; orRadio.setLayoutData(data); //author label = new Label(topLevel, SWT.NONE); label.setText("Author"); author = new Text(topLevel, SWT.BORDER); author.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); //comment label = new Label(topLevel, SWT.NONE); label.setText("Comment"); comment = new Text(topLevel, SWT.BORDER); comment.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); //"from" date label = new Label(topLevel, SWT.NONE); label.setText("From Date"); GridLayout fdLayout = new GridLayout(); fdLayout.numColumns = 2; fdLayout.marginHeight = 3; fdLayout.marginWidth = 3; Composite fdComposite = new Composite(topLevel, SWT.NONE); fdComposite.setLayout(fdLayout); fromDateEditor = new DateTime(fdComposite, SWT.NONE); disableFromDateCheck = new Button(fdComposite, SWT.CHECK); disableFromDateCheck.setText("Ignore"); disableFromDateCheck.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { fromDateEditor.setEnabled(!disableFromDateCheck.getSelection()); } public void widgetDefaultSelected(SelectionEvent e) { fromDateEditor.setEnabled(!disableFromDateCheck.getSelection()); } }); //"to" date label = new Label(topLevel, SWT.NONE); label.setText("To Date"); GridLayout tdLayout = new GridLayout(); tdLayout.numColumns = 2; tdLayout.marginHeight = 3; tdLayout.marginWidth = 3; Composite tdComposite = new Composite(topLevel, SWT.NONE); tdComposite.setLayout(tdLayout); toDateEditor = new DateTime(tdComposite, SWT.NONE); disableToDateCheck = new Button(tdComposite, SWT.CHECK); disableToDateCheck.setText("Ignore"); disableToDateCheck.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { toDateEditor.setEnabled(!disableToDateCheck.getSelection()); } public void widgetDefaultSelected(SelectionEvent e) { toDateEditor.setEnabled(!disableToDateCheck.getSelection()); } }); initializeValues(); Dialog.applyDialogFont(parent); return topLevel; }
From source file:org.eclipsetrader.ui.internal.ats.SimulationParametersDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(4, false); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); composite.setLayout(layout);/*from ww w.ja va2 s. c om*/ composite.setLayoutData(new GridData(GridData.FILL_BOTH)); applyDialogFont(composite); Label label = new Label(composite, SWT.NONE); label.setText(Messages.SimulationParametersDialog_Begin); begin = new CDateTime(composite, CDT.BORDER | CDT.DATE_SHORT | CDT.DROP_DOWN | CDT.TAB_FIELDS); begin.setPattern(Util.getDateFormatPattern()); begin.setLayoutData(new GridData(convertHorizontalDLUsToPixels("gtk".equals(SWT.getPlatform()) ? 80 : 65), //$NON-NLS-1$ SWT.DEFAULT)); label = new Label(composite, SWT.NONE); label.setText(Messages.SimulationParametersDialog_End); end = new CDateTime(composite, CDT.BORDER | CDT.DATE_SHORT | CDT.DROP_DOWN | CDT.TAB_FIELDS); end.setPattern(Util.getDateFormatPattern()); end.setNullText(TODAY); end.setLayoutData(new GridData(convertHorizontalDLUsToPixels("gtk".equals(SWT.getPlatform()) ? 80 : 65), //$NON-NLS-1$ SWT.DEFAULT)); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, -30); begin.setSelection(calendar.getTime()); IDialogSettings dialogSettings = rootDialogSettings.getSection(getClass().getName()); if (dialogSettings != null) { if (dialogSettings.get(K_BEGIN_DATE) != null) { calendar.setTimeInMillis(dialogSettings.getLong(K_BEGIN_DATE)); begin.setSelection(calendar.getTime()); } if (dialogSettings.get(K_END_DATE) != null && !TODAY.equals(dialogSettings.get(K_END_DATE))) { calendar.setTimeInMillis(dialogSettings.getLong(K_END_DATE)); end.setSelection(calendar.getTime()); } } return composite; }
From source file:org.eclipsetrader.ui.internal.ats.TimeSpanDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(3, false); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); composite.setLayout(layout);//from w w w. j a v a 2s . c o m composite.setLayoutData(new GridData(GridData.FILL_BOTH)); applyDialogFont(composite); Label label = new Label(composite, SWT.NONE); label.setText(Messages.TimeSpanDialog_Value); value = new Spinner(composite, SWT.BORDER); value.setValues(1, 1, 9999, 0, 1, 10); units = new ComboViewer(composite, SWT.DROP_DOWN | SWT.READ_ONLY); units.setContentProvider(new ArrayContentProvider()); units.setLabelProvider(new LabelProvider()); units.setSorter(new ViewerSorter()); units.setInput(new Object[] { TimeSpan.Units.Minutes, TimeSpan.Units.Days }); units.setSelection(new StructuredSelection(TimeSpan.Units.Minutes)); units.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { TimeSpan.Units units = (TimeSpan.Units) ((IStructuredSelection) event.getSelection()) .getFirstElement(); if (units == TimeSpan.Units.Days) { value.setValues(1, 1, 1, 0, 1, 10); } else { value.setValues(1, 1, 9999, 0, 1, 10); } } }); return composite; }
From source file:org.eclipsetrader.ui.internal.charts.PeriodDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(3, false); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); composite.setLayout(layout);/* w ww . ja va 2 s . co m*/ composite.setLayoutData(new GridData(GridData.FILL_BOTH)); applyDialogFont(composite); Label label = new Label(composite, SWT.NONE); label.setText(Messages.PeriodDialog_Description); description = new Text(composite, SWT.BORDER); description.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); ((GridData) description.getLayoutData()).widthHint = convertHorizontalDLUsToPixels(250); label = new Label(composite, SWT.NONE); label.setText(Messages.PeriodDialog_Last); periodLength = new Spinner(composite, SWT.BORDER); periodLength.setValues(1, 1, 9999, 0, 1, 1); periodUnits = new ComboViewer(composite, SWT.DROP_DOWN | SWT.READ_ONLY); periodUnits.setContentProvider(new ArrayContentProvider()); periodUnits.setLabelProvider(new LabelProvider()); periodUnits.setSorter(new ViewerSorter()); periodUnits.setInput(new Object[] { TimeSpan.Units.Days, TimeSpan.Units.Months, TimeSpan.Units.Years, }); periodUnits.setSelection(new StructuredSelection(TimeSpan.Units.Years)); label = new Label(composite, SWT.NONE); label.setText(Messages.PeriodDialog_BarSize); resolutionLength = new Spinner(composite, SWT.BORDER); resolutionLength.setValues(1, 1, 9999, 0, 1, 1); resolutionUnits = new ComboViewer(composite, SWT.DROP_DOWN | SWT.READ_ONLY); resolutionUnits.setContentProvider(new ArrayContentProvider()); resolutionUnits.setLabelProvider(new LabelProvider()); resolutionUnits.setSorter(new ViewerSorter()); resolutionUnits.setInput(new Object[] { TimeSpan.Units.Minutes, TimeSpan.Units.Days, }); resolutionUnits.setSelection(new StructuredSelection(TimeSpan.Units.Days)); if (selection != null) { description.setText(selection.getDescription()); periodLength.setSelection(selection.getPeriod().getLength()); periodUnits.setSelection(new StructuredSelection(selection.getPeriod().getUnits())); resolutionLength.setSelection(selection.getResolution().getLength()); resolutionUnits.setSelection(new StructuredSelection(selection.getResolution().getUnits())); } resolutionUnits.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { TimeSpan.Units units = (TimeSpan.Units) ((IStructuredSelection) event.getSelection()) .getFirstElement(); if (units == TimeSpan.Units.Days) { resolutionLength.setValues(1, 1, 1, 0, 1, 1); } else { resolutionLength.setValues(1, 1, 9999, 0, 1, 1); } } }); return composite; }
From source file:org.entirej.applicationframework.rwt.application.form.containers.EJRWTAbstractDialog.java
License:Apache License
protected Control createButtonBar(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); // create a layout with spacing and margins appropriate for the font // size.//from www.j ava2 s . co m GridLayout layout = new GridLayout(); layout.numColumns = 0; // this is incremented by createButton layout.makeColumnsEqualWidth = true; layout.marginWidth = 0; layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); 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); if (composite.getChildren().length == 0) { data.heightHint = 0; data.widthHint = 0; } return composite; }