List of usage examples for org.eclipse.jface.dialogs IDialogConstants VERTICAL_SPACING
int VERTICAL_SPACING
To view the source code for org.eclipse.jface.dialogs IDialogConstants VERTICAL_SPACING.
Click Source Link
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./* w ww . j a va 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;/*from w ww. j a va2 s . co 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 av a 2 s . c om 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 ww . j av a 2 s . co m*/ layout.marginHeight = 0; layout.marginWidth = 0; } return layout; }
From source file:org.eclipse.edt.ide.ui.preferences.CompilerPropertyAndPreferencePage.java
License:Open Source License
/** * Create a composite to hold generator tabs for a property * page or a preference page for a compiler. * /*w w w . java 2 s . c o m*/ * @param composite */ protected void createGeneratorTabsComposite(Composite composite) { this.tabComposite = new Composite(composite, SWT.NONE); GridLayout tabLayout = new GridLayout(); tabLayout.marginWidth = 0; tabLayout.numColumns = 1; PixelConverter pixelConverter = new PixelConverter(composite); tabLayout.verticalSpacing = (int) (1.5 * pixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING)); tabLayout.horizontalSpacing = pixelConverter .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); tabLayout.marginTop = 3; tabLayout.marginWidth = pixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); this.tabComposite.setLayout(tabLayout); this.tabComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); this.tabFolder = new TabFolder(this.tabComposite, SWT.NONE); this.tabFolder.setLayout(new TabFolderLayout()); this.tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH)); }
From source file:org.eclipse.egit.ui.internal.SWTUtils.java
License:Open Source License
/** * Creates a grid layout with the specified number of columns and the * standard spacings.//from w w w .j a v a 2 s . c om * * @param numColumns * the number of columns * @param converter * the pixel converter * @param margins * one of <code>MARGINS_DEFAULT</code>, <code>MARGINS_NONE</code> * or <code>MARGINS_DIALOG</code>. * * @return the created grid layout */ public static GridLayout createGridLayout(int numColumns, PixelConverter converter, int margins) { Assert.isTrue(margins == MARGINS_DEFAULT || margins == MARGINS_NONE || margins == MARGINS_DIALOG); final GridLayout layout = new GridLayout(numColumns, false); layout.horizontalSpacing = converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); switch (margins) { case MARGINS_NONE: layout.marginLeft = layout.marginRight = 0; layout.marginTop = layout.marginBottom = 0; break; case MARGINS_DIALOG: layout.marginLeft = layout.marginRight = converter .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.marginTop = layout.marginBottom = converter .convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); break; case MARGINS_DEFAULT: layout.marginLeft = layout.marginRight = layout.marginWidth; layout.marginTop = layout.marginBottom = layout.marginHeight; } layout.marginWidth = layout.marginHeight = 0; return layout; }
From source file:org.eclipse.emf.eef.runtime.ui.widgets.ElementSelectionDialog.java
License:Open Source License
/** * Used to display a page//from w w w . ja v a2s. co m * * @param parent * composite which contains the tree * @return the composite of this page */ public Control fillModelpage(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.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout); // use pattern filter PatternFilter patternFilter = new TreeSelectionPatternFilter(); patternFilter.setIncludeLeadingWildcard(true); FilteredTree filteredTree = new FilteredTree(composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.RESIZE, patternFilter, true); // use of EMF facilities final TreeViewer treeViewer = filteredTree.getViewer(); treeViewer.setFilters(new ViewerFilter[0]); treeViewer.setUseHashlookup(true); if (input instanceof EEFEditorSettings) treeViewer.setContentProvider( new HideResourcesContentProvider(new AdvancedEEFEditorContentProvider(adapterFactory))); else treeViewer.setContentProvider( new HideResourcesContentProvider(new AdapterFactoryContentProvider(adapterFactory))); ArrayList<ViewerFilter> filters = new ArrayList<ViewerFilter>(); if (viewerFilters != null && !viewerFilters.isEmpty()) { for (ViewerFilter filter : viewerFilters) { filters.add(filter); } } // for now, add the businessRuleFilters to the 'normal' filters if (brFilters != null && !brFilters.isEmpty()) { for (ViewerFilter filter : brFilters) { filters.add(filter); } } filters.add(patternFilter); ViewerFilter[] v = filters.toArray(new ViewerFilter[filters.size()]); treeViewer.setFilters(v); treeViewer.setLabelProvider(new EEFLabelProvider() { @Override public Color getForeground(Object element) { if (input instanceof ReferencesTableSettings && element instanceof EObject && ((ReferencesTableSettings) input).contains((EObject) element)) { return getShell().getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW); } return super.getForeground(element); } }); filteredTree.setLayoutData(new GridData(550, 300)); // handle selection change if (input instanceof EEFEditorSettings) { treeViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { if (event.getSelection() instanceof IStructuredSelection) { // Check selection IStructuredSelection structuredSelection = (IStructuredSelection) event.getSelection(); if (structuredSelection != null && !structuredSelection.isEmpty()) { Object o = structuredSelection.getFirstElement(); // Check type matching Button okButton = getButton(IDialogConstants.OK_ID); if (((List<?>) ((EEFEditorSettings) input).choiceOfValues(adapterFactory)) .contains(o)) { if (input instanceof ReferencesTableSettings) { if (o instanceof EObject && !((ReferencesTableSettings) input).contains((EObject) o)) { selection = structuredSelection; if (okButton != null) { okButton.setEnabled(true); } } else { // Reject selection if (okButton != null) { okButton.setEnabled(false); } } } else { selection = structuredSelection; if (okButton != null) { okButton.setEnabled(true); } } } else { // Reject selection if (okButton != null) { okButton.setEnabled(false); } } } } } }); // handle double click to validate treeViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { if (selection != null && !selection.isEmpty()) { Object o = selection.getFirstElement(); if (((List<?>) ((EEFEditorSettings) input).choiceOfValues(adapterFactory)).contains(o) && input instanceof ReferencesTableSettings && o instanceof EObject && !((ReferencesTableSettings) input).contains((EObject) o)) { okPressed(); } } } }); } treeViewer.setInput(input); // Init selected element if (selection != null) { treeViewer.setSelection(selection); } return composite; }
From source file:org.eclipse.emf.eef.runtime.ui.widgets.TabElementTreeSelectionDialog.java
License:Open Source License
/** * Used to display a page in a tab//from w w w . j a v a2 s . com * * @param tabFolder * that contains all tabs * @param specificTabFilter * a specific filter to this page * @return the composite of this page */ public Control fillModelpage(CTabFolder tabFolder, final boolean showResourceItem, final ViewerFilter specificTabFilter) { Composite composite = new Composite(tabFolder, 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); // use pattern filter PatternFilter patternFilter = new TreeSelectionPatternFilter(); patternFilter.setIncludeLeadingWildcard(true); FilteredTree filteredTree = new FilteredTree(composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.RESIZE, patternFilter); // use of EMF facilities final TreeViewer treeViewer = filteredTree.getViewer(); treeViewer.setFilters(new ViewerFilter[0]); treeViewer.setUseHashlookup(true); if (input instanceof EEFEditorSettings) treeViewer.setContentProvider(new AdvancedEEFEditorContentProvider(adapterFactory)); else treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); ArrayList<ViewerFilter> filters = new ArrayList<ViewerFilter>(); if (specificTabFilter != null) { filters.add(specificTabFilter); } if (viewerFilters != null && !viewerFilters.isEmpty()) { for (ViewerFilter filter : viewerFilters) { filters.add(filter); } } // for now, add the businessRuleFilters to the 'normal' filters if (brFilters != null && !brFilters.isEmpty()) { for (ViewerFilter filter : brFilters) { filters.add(filter); } } filters.add(patternFilter); ViewerFilter[] v = filters.toArray(new ViewerFilter[filters.size()]); treeViewer.setFilters(v); treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); filteredTree.setLayoutData(new GridData(550, 300)); // handle selection change if (input instanceof EEFEditorSettings) { treeViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { if (event.getSelection() instanceof IStructuredSelection) { // Check selection IStructuredSelection structuredSelection = (IStructuredSelection) event.getSelection(); if (structuredSelection != null && !structuredSelection.isEmpty()) { Object o = structuredSelection.getFirstElement(); // Check type matching Button okButton = getButton(IDialogConstants.OK_ID); if (((List<?>) ((EEFEditorSettings) input).choiceOfValues(adapterFactory)) .contains(o)) { selection = structuredSelection; if (okButton != null) { okButton.setEnabled(true); } } else { // Reject selection if (okButton != null) { okButton.setEnabled(false); } } } } } }); // handle double click to validate treeViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { if (selection != null && !selection.isEmpty()) { Object o = selection.getFirstElement(); if (((List<?>) ((EEFEditorSettings) input).choiceOfValues(adapterFactory)).contains(o)) { okPressed(); } } } }); } treeViewer.setInput(input); // Init selected element if (selection != null) { treeViewer.setSelection(selection); } return composite; }
From source file:org.eclipse.emf.emfstore.client.ui.views.emfstorebrowser.views.CertificateSelectionDialog.java
License:Open Source License
/** * Overridden method to allow adding further elements onto the dialog * composite.// ww w .ja v a 2 s . c o m * * @see org.eclipse.ui.dialogs.ElementListSelectionDialog#createDialogArea(org.eclipse.swt.widgets.Composite) * @return Control * @param parent * Parent */ @Override protected Control createDialogArea(Composite parent) { // standard layout used by dialogue area 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); // two column layout composite Composite grid = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(grid); // left column composite Composite left = new Composite(grid, SWT.NONE); GridLayoutFactory.fillDefaults().applyTo(left); // right column composite Composite right = new Composite(grid, SWT.NONE); GridLayoutFactory.createFrom(layout).margins(layout.marginWidth, 35).applyTo(right); GridDataFactory.fillDefaults().grab(true, true).hint(300, 200).applyTo(right); applyDialogFont(right); // right column: certificate details new Label(right, SWT.NONE).setText("Certificate Alias: "); final Text certAlias = new Text(right, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).applyTo(certAlias); certAlias.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); certAlias.setEditable(false); new Label(right, SWT.NONE).setText("Certificate Details: "); final Text certDetails = new Text(right, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); GridDataFactory.fillDefaults().grab(true, false).hint(300, 230).applyTo(certDetails); certDetails.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); certDetails.setEditable(false); // left column: dialogue area composite (displays certificates and // filter) Composite dialogArea = new Composite(left, SWT.NONE); GridLayoutFactory.fillDefaults().applyTo(dialogArea); Control control = super.createDialogArea(dialogArea); GridDataFactory.fillDefaults().grab(true, true).applyTo(control); // left column: import button, composite used to ensure correct // alignment Composite certButtonsComposite = new Composite(grid, SWT.NONE); GridLayoutFactory.createFrom(layout).numColumns(3).equalWidth(true).margins(layout.marginWidth, 0) .applyTo(certButtonsComposite); applyDialogFont(certButtonsComposite); Button browse = new Button(certButtonsComposite, SWT.NONE); browse.setText("Import..."); browse.addSelectionListener(new CertificateSelectionListener()); // Delete certificate Button delete = new Button(certButtonsComposite, SWT.NONE); delete.setText("Delete"); delete.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { // nothing to do } public void widgetSelected(SelectionEvent e) { if (selectedTableItem != null && !selectedTableItem.getText().equals("")) { String alias = selectedTableItem.getText(); try { KeyStoreManager.getInstance().deleteCertificate(alias); setListElements(KeyStoreManager.getInstance().getCertificates().toArray()); } catch (CertificateStoreException e1) { setErrorMessage(e1.getMessage()); } } } }); fFilteredList.addSelectionListener(new SelectionListenerImplementation(certDetails, certAlias)); return control; }
From source file:org.eclipse.emf.emfstore.internal.client.ui.views.emfstorebrowser.views.CertificateSelectionDialog.java
License:Open Source License
/** * Overridden method to allow adding further elements onto the dialog * composite./*from www . j av a 2 s.c o m*/ * * @see org.eclipse.ui.dialogs.ElementListSelectionDialog#createDialogArea(org.eclipse.swt.widgets.Composite) * @return Control * @param parent * Parent */ @Override protected Control createDialogArea(Composite parent) { // standard layout used by dialogue area final 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); // two column layout composite final Composite grid = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(grid); // left column composite final Composite left = new Composite(grid, SWT.NONE); GridLayoutFactory.fillDefaults().applyTo(left); // right column composite final Composite right = new Composite(grid, SWT.NONE); GridLayoutFactory.createFrom(layout).margins(layout.marginWidth, 35).applyTo(right); GridDataFactory.fillDefaults().grab(true, true).hint(300, 200).applyTo(right); applyDialogFont(right); // right column: certificate details new Label(right, SWT.NONE).setText(Messages.CertificateSelectionDialog_Alias); final Text certAlias = new Text(right, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).applyTo(certAlias); certAlias.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); certAlias.setEditable(false); new Label(right, SWT.NONE).setText(Messages.CertificateSelectionDialog_Details); final Text certDetails = new Text(right, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); GridDataFactory.fillDefaults().grab(true, false).hint(300, 230).applyTo(certDetails); certDetails.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); certDetails.setEditable(false); // left column: dialogue area composite (displays certificates and // filter) final Composite dialogArea = new Composite(left, SWT.NONE); GridLayoutFactory.fillDefaults().applyTo(dialogArea); final Control control = super.createDialogArea(dialogArea); GridDataFactory.fillDefaults().grab(true, true).applyTo(control); // left column: import button, composite used to ensure correct // alignment final Composite certButtonsComposite = new Composite(grid, SWT.NONE); GridLayoutFactory.createFrom(layout).numColumns(3).equalWidth(true).margins(layout.marginWidth, 0) .applyTo(certButtonsComposite); applyDialogFont(certButtonsComposite); final Button browse = new Button(certButtonsComposite, SWT.NONE); browse.setText(Messages.CertificateSelectionDialog_Import); browse.addSelectionListener(new CertificateSelectionListener()); // Delete certificate final Button delete = new Button(certButtonsComposite, SWT.NONE); delete.setText(Messages.CertificateSelectionDialog_Delete); delete.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { // nothing to do } public void widgetSelected(SelectionEvent e) { if (selectedTableItem != null && StringUtils.isNotBlank(selectedTableItem.getText())) { final String alias = selectedTableItem.getText(); try { KeyStoreManager.getInstance().deleteCertificate(alias); setListElements(KeyStoreManager.getInstance().getCertificates().toArray()); } catch (final ESCertificateException e1) { setErrorMessage(e1.getMessage()); } } } }); fFilteredList.addSelectionListener(new SelectionListenerImplementation(certDetails, certAlias)); return control; }