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.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);// ww w .j av a2s .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 w w .j a v a2 s. c o 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.tmt.pages.EJTMTScreenPage.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./*w w w . j av a2 s .c o m*/ GridLayout layout = new GridLayout(); layout.numColumns = 0; // this is incremented by createButton layout.makeColumnsEqualWidth = true; layout.marginWidth = (IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = (IDialogConstants.VERTICAL_MARGIN); layout.horizontalSpacing = (IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = (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); return composite; }
From source file:org.entirej.applicationframework.tmt.pages.EJTMTScreenPage.java
License:Apache License
protected Control createDialogArea(Composite parent) { // create a composite with standard margins and spacing Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = (IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = (IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = (IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = (IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout);// w ww .j av a2 s . c o m composite.setLayoutData(new GridData(GridData.FILL_BOTH)); createBody(composite); return composite; }
From source file:org.hibernate.eclipse.launch.AddPropertyDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { String dialogTitle = HibernateConsoleMessages.AddPropertyDialog_add_exporter_property; String editTitle = HibernateConsoleMessages.AddPropertyDialog_add_property_to; if (flagEdit) { dialogTitle = HibernateConsoleMessages.AddPropertyDialog_edit_exporter_property; editTitle = HibernateConsoleMessages.AddPropertyDialog_edit_property_to; }/*from w w w .ja v a 2 s . c o m*/ getShell().setText(dialogTitle); setTitle(editTitle + ef.getExporterDefinition().getDescription()); Composite control = (Composite) super.createDialogArea(parent); Composite composite = new Composite(control, SWT.NONE); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); GridLayout layout = new GridLayout(3, 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); composite.setLayout(layout); Label label = new Label(composite, SWT.NONE); label.setText(HibernateConsoleMessages.AddPropertyDialog_name); final Combo combo = new Combo(composite, SWT.BORDER | SWT.DROP_DOWN); GridData pgd = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); pgd.horizontalSpan = 2; combo.setLayoutData(pgd); combo.setFocus(); combo.addModifyListener(modifyListener); propertyCombo = new ComboViewer(combo); combo.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent e) { } public void keyReleased(KeyEvent e) { if (e.keyCode == SWT.ARROW_UP || e.keyCode == SWT.ARROW_DOWN) { //linux doesn't call selectionChanged event on this events propertyCombo.setSelection(propertyCombo.getSelection(), false); return; } for (int i = 0; i < combo.getItemCount(); i++) { if (combo.getText().equals(combo.getItem(i))) { if (combo.getSelectionIndex() != i) { combo.select(i); propertyCombo.setSelection(propertyCombo.getSelection(), false); } return; } } disposeBrowseButton(); createTextValueComposite(2); } }); if (flagEdit) { propertyCombo.getControl().setEnabled(false); } label = new Label(composite, SWT.NONE); label.setText(HibernateConsoleMessages.AddPropertyDialog_value); value = new Text(composite, SWT.BORDER); value.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL)); ((Text) value).addModifyListener(modifyListener); initDefaultNames(ef, propertyCombo); return control; }
From source file:org.jboss.tools.browsersim.eclipse.preferences.BrowserSimPreferencesPage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { initializeDialogUnits(parent);//from ww w .j a v a 2s . c o m int nColumns = 2; Composite result = new Composite(parent, SWT.NONE); result.setFont(parent.getFont()); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.marginWidth = 0; layout.numColumns = nColumns; result.setLayout(layout); PreferenceLinkArea contentTypeArea = new PreferenceLinkArea(result, SWT.NONE, "org.eclipse.jdt.debug.ui.preferences.VMPreferencePage", //$NON-NLS-1$ Messages.BrowserSimPreferencesPage_JRE_LINK, (IWorkbenchPreferenceContainer) getContainer(), null); GridData data = new GridData(); data.horizontalSpan = 2; contentTypeArea.getControl().setLayoutData(data); contentTypeArea.getControl().setFont(parent.getFont()); Group jreGroup = new Group(result, SWT.NONE); GridLayout jreGroupLayout = new GridLayout(); jreGroupLayout.numColumns = 3; jreGroup.setLayout(jreGroupLayout); GridData jreGroupLayoutData = new GridData(GridData.FILL_HORIZONTAL); jreGroupLayoutData.horizontalSpan = 2; jreGroup.setLayoutData(jreGroupLayoutData); jreGroup.setText(Messages.BrowserSimPreferencesPage_SELECT_JRE); radioListener = new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { controlChanged(e.widget); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }; automatically = addRadioButton(jreGroup, Messages.BrowserSimPreferencesPage_DETECT_AUTOMATICALLY, BROWSERSIM_JVM_AUTOMATICALLY, IPreferenceStore.TRUE, 0); automatically.addSelectionListener(radioListener); select = addRadioButton(jreGroup, Messages.BrowserSimPreferencesPage_SELECT, BROWSERSIM_JVM_AUTOMATICALLY, IPreferenceStore.FALSE, 0); select.addSelectionListener(radioListener); combo = new Combo(jreGroup, SWT.READ_ONLY); for (int i = 0; i < jvms.size(); i++) { combo.add(jvms.get(i).getName(), i); } combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fillValues(); if (PlatformUtil.OS_LINUX.equals(PlatformUtil.getOs())) { addGtkGroup(result); } Dialog.applyDialogFont(result); return result; }
From source file:org.jboss.tools.common.model.ui.dialog.ErrorDialog.java
License:Open Source License
GridLayout createLayout() { GridLayout gl = new GridLayout(2, false); gl.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); gl.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); gl.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); gl.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); return gl;//w w w .j a v a 2s. com }
From source file:org.jboss.tools.jsf.ui.editor.check.wizards.QuickFixPage.java
License:Open Source License
public void createControl(Composite parent) { initializeDialogUnits(parent);/*w ww . j av a2 s. c o m*/ // Create a new composite as there is the title bar seperator // 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(MarkerMessages.MarkerResolutionDialog_Resolutions_List_Title); 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(MarkerMessages.MarkerResolutionDialog_Problems_List_Title); 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.setAllChecked(true); }
From source file:org.jboss.tools.jst.css.dialog.ImageSelectionDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { final Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2;/*from www. j a v 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); composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); super.applyDialogFont(composite); Label messageLabel = createMessageArea(composite); new Label(composite, SWT.NONE); TreeViewer treeViewer = createTreeViewer(composite); Composite comp = createPreview(composite); GridData browserData = new GridData(GridData.FILL_BOTH); browserData.widthHint = convertWidthInCharsToPixels(fWidth / 2); browserData.heightHint = convertHeightInCharsToPixels(fHeight); browserData.minimumWidth = convertWidthInCharsToPixels(fWidth / 2); browserData.minimumHeight = convertHeightInCharsToPixels(fHeight); comp.setLayoutData(browserData); GridData data = new GridData(GridData.FILL_BOTH); data.widthHint = convertWidthInCharsToPixels(fWidth); data.heightHint = convertHeightInCharsToPixels(fHeight); Tree treeWidget = treeViewer.getTree(); treeWidget.setLayoutData(data); treeWidget.setFont(parent.getFont()); filterCombo = new Combo(composite, SWT.READ_ONLY | SWT.BORDER); filterCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); filterCombo.add(JstUIMessages.ALL_FILES); filterCombo.add(JstUIMessages.ALL_IMAGE_FILES); for (int i = 0; i < fileExtensions.length; i++) { String[] str = fileExtensions[i]; StringBuffer buf = new StringBuffer(); for (int j = 0; j < str.length; j++) { buf.append("*." + str[j].toUpperCase() + "; "); //$NON-NLS-1$ //$NON-NLS-2$ } filterCombo.add(buf.toString()); } filterCombo.select(0); filterCombo.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { if (fViewer != null) { ViewerFilter[] filters = fViewer.getFilters(); if (filters != null) { for (int i = 0; i < filters.length; i++) { fViewer.removeFilter(filters[i]); } } if (filterCombo.getSelectionIndex() != 0) { if (filterCombo.getSelectionIndex() == 1) { Set<String> s = new HashSet<String>(); for (int i = 0; i < fileExtensions.length; i++) { String[] tmp = fileExtensions[i]; for (int j = 0; j < tmp.length; j++) s.add(tmp[j]); } String[] allExtensions = new String[s.size()]; s.toArray(allExtensions); fViewer.addFilter(new FileExtensionFilter(allExtensions)); } else { fViewer.addFilter( new FileExtensionFilter(fileExtensions[filterCombo.getSelectionIndex() - 2])); } } fViewer.refresh(); if (fViewer.getTree().getItemCount() <= 0) { fIsEmpty = true; } else { fIsEmpty = false; } if (fViewer.getTree().getSelectionCount() <= 0) { file = null; canvas.redraw(); } updateOKStatus(); } } }); if (fIsEmpty) { messageLabel.setEnabled(false); treeWidget.setEnabled(false); } //JBIDE-3084, implementation of default validator fValidator = new ISelectionStatusValidator() { public IStatus validate(Object[] selection) { if ((selection != null) && (selection.length == 1)) { Object selecObject = selection[0]; if (selecObject instanceof IFile) { return Status.OK_STATUS; } } return new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR, JstUIMessages.ImageSelectionDialog_InvalidImageFile, null); } }; return composite; }