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.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; }//w ww.j ava 2 s.co 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.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;// www .j ava 2 s .c o m }
From source file:org.jboss.tools.jsf.ui.editor.check.wizards.QuickFixPage.java
License:Open Source License
/** * Create the table buttons for the receiver. * //from w w w . j av a 2 s. c o m * @param control * @return {@link Composite} */ private Composite createTableButtons(Composite control) { Composite buttonComposite = new Composite(control, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); buttonComposite.setLayout(layout); Button selectAll = new Button(buttonComposite, SWT.PUSH); selectAll.setText(MarkerMessages.selectAllAction_title); selectAll.setLayoutData(new GridData(SWT.FILL, SWT.NONE, false, false)); selectAll.addSelectionListener(new SelectionAdapter() { /* * (non-Javadoc) * * @see * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse * .swt.events.SelectionEvent) */ public void widgetSelected(SelectionEvent arg0) { markersTable.setAllChecked(true); setPageComplete(!resolutionsList.getSelection().isEmpty()); } }); Button deselectAll = new Button(buttonComposite, SWT.PUSH); deselectAll.setText(MarkerMessages.filtersDialog_deselectAll); deselectAll.setLayoutData(new GridData(SWT.FILL, SWT.NONE, false, false)); deselectAll.addSelectionListener(new SelectionAdapter() { /* * (non-Javadoc) * * @see * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse * .swt.events.SelectionEvent) */ public void widgetSelected(SelectionEvent arg0) { markersTable.setAllChecked(false); setPageComplete(false); } }); return buttonComposite; }
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 w w w . j a v a2 s. c o 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); 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; }
From source file:org.jboss.tools.project.examples.preferences.SiteDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite parentComposite = (Composite) super.createDialogArea(parent); Composite composite = new Composite(parentComposite, 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 a2 s . c o m*/ composite.setLayoutData(new GridData(GridData.FILL_BOTH)); composite.setFont(parentComposite.getFont()); Composite container = new Composite(parentComposite, SWT.FILL); layout = new GridLayout(3, false); layout.marginWidth = layout.marginHeight = 5; container.setLayout(layout); GridData gd = new GridData(GridData.FILL_BOTH); container.setLayoutData(gd); Label nameLabel = new Label(container, SWT.NONE); nameLabel.setText(Messages.SiteDialog_Name); nameText = new Text(container, SWT.SINGLE | SWT.BORDER); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; nameText.setLayoutData(gd); nameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validatePage(); } }); Label urlLabel = new Label(container, SWT.NONE); urlLabel.setText(Messages.SiteDialog_URL); urlText = new Text(container, SWT.SINGLE | SWT.BORDER); gd = new GridData(GridData.FILL_HORIZONTAL); urlText.setLayoutData(gd); urlText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validatePage(); } }); if (selectedSite != null) { urlText.setText(selectedSite.getUrl().toString()); nameText.setText(selectedSite.getName()); } Button browse = new Button(container, SWT.PUSH); browse.setText(Messages.Browse); browse.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(getShell(), SWT.SINGLE); dialog.setFilterExtensions(new String[] { "*.xml" }); //$NON-NLS-1$; String result = dialog.open(); if (result == null || result.trim().length() == 0) { return; } try { String urlString = new File(result).toURL().toString(); urlText.setText(urlString); } catch (MalformedURLException e1) { urlText.setText("file:///" + result); //$NON-NLS-1$ } } public void widgetDefaultSelected(SelectionEvent e) { } }); return parentComposite; }
From source file:org.kalypso.contribs.eclipse.jface.wizard.view.WizardView.java
License:Open Source License
/** * Creates and returns the contents of this dialog's button bar. * <p>//from w w w. jav a2 s. com * The <code>Dialog</code> implementation of this framework method lays out a button bar and calls the * <code>createButtonsForButtonBar</code> framework method to populate it. Subclasses may override. * </p> * <p> * The returned control's layout data must be an instance of <code>GridData</code>. * </p> * * @param parent * the parent composite to contain the button bar * @return the button bar control */ protected Control createButtonBar(final Composite parent) { final Composite composite = new Composite(parent, SWT.NONE); // create a layout with spacing and margins appropriate for the font // size. final GridLayout layout = new GridLayout(); layout.numColumns = 0; // this is incremented by createButton layout.makeColumnsEqualWidth = false; layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); composite.setLayout(layout); final 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.kalypso.contribs.eclipse.jface.wizard.view.WizardView.java
License:Open Source License
/** * Creates the dialog's title area.//from w ww.j a v a 2s.c om * * @param parent * the SWT parent for the title area widgets * @return Control with the highest x axis value. */ private Control createTitleArea(final Composite parent) { // remeber parent in order to change its colors m_parent = parent; // Determine the background color of the title bar final Display display = parent.getDisplay(); m_defaultTitleBackground = JFaceColors.getBannerBackground(display).getRGB(); m_defaultTitleForeground = JFaceColors.getBannerForeground(display).getRGB(); final int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); final int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); // Dialog image @ right m_titleImage = new Label(parent, SWT.CENTER); m_titleImage.setImage(JFaceResources.getImage(TitleAreaDialog.DLG_IMG_TITLE_BANNER)); final FormData imageData = new FormData(); imageData.top = new FormAttachment(0, verticalSpacing); // Note: do not use horizontalSpacing on the right as that would be a // regression from // the R2.x style where there was no margin on the right and images are // flush to the right // hand side. see reopened comments in 41172 imageData.right = new FormAttachment(100, 0); // horizontalSpacing m_titleImage.setLayoutData(imageData); // Title label @ top, left m_titleLabel = new Label(parent, SWT.LEFT); m_titleLabel.setFont(JFaceResources.getBannerFont()); m_titleLabel.setText(" ");//$NON-NLS-1$ final FormData titleData = new FormData(); titleData.top = new FormAttachment(0, verticalSpacing); titleData.right = new FormAttachment(m_titleImage); titleData.left = new FormAttachment(0, horizontalSpacing); m_titleLabel.setLayoutData(titleData); // Message image @ bottom, left m_messageImageLabel = new Label(parent, SWT.CENTER); // Message label @ bottom, center m_messageLabel = new Text(parent, SWT.WRAP | SWT.READ_ONLY); m_messageLabel.setText(" \n "); // two lines//$NON-NLS-1$ m_messageLabel.setFont(JFaceResources.getDialogFont()); // Filler labels m_leftFillerLabel = new Label(parent, SWT.CENTER); m_bottomFillerLabel = new Label(parent, SWT.CENTER); setLayoutsForNormalMessage(verticalSpacing, horizontalSpacing); determineTitleImageLargest(); if (m_titleImageLargest) return m_titleImage; return m_messageLabel; }
From source file:org.kalypso.contribs.eclipse.jface.wizard.view.WizardView.java
License:Open Source License
/** * Re-layout the labels for the new message. *//*from w w w.ja v a2s. com*/ private void layoutForNewMessage() { final int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); final int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); // If there are no images then layout as normal if (m_errorMessage == null && m_messageImage == null) { setImageLabelVisible(false); setLayoutsForNormalMessage(verticalSpacing, horizontalSpacing); } else { m_messageImageLabel.setVisible(true); m_bottomFillerLabel.setVisible(true); m_leftFillerLabel.setVisible(true); /** * Note that we do not use horizontalSpacing here as when the background of the messages changes there will be * gaps between the icon label and the message that are the background color of the shell. We add a leading space * elsewhere to compendate for this. */ FormData data = new FormData(); data.left = new FormAttachment(0, H_GAP_IMAGE); data.top = new FormAttachment(m_titleLabel, verticalSpacing); m_messageImageLabel.setLayoutData(data); data = new FormData(); data.top = new FormAttachment(m_messageImageLabel, 0); data.left = new FormAttachment(0, 0); data.bottom = new FormAttachment(m_messageLabel, 0, SWT.BOTTOM); data.right = new FormAttachment(m_messageImageLabel, 0, SWT.RIGHT); m_bottomFillerLabel.setLayoutData(data); data = new FormData(); data.top = new FormAttachment(m_messageImageLabel, 0, SWT.TOP); data.left = new FormAttachment(0, 0); data.bottom = new FormAttachment(m_messageImageLabel, 0, SWT.BOTTOM); data.right = new FormAttachment(m_messageImageLabel, 0); m_leftFillerLabel.setLayoutData(data); final FormData messageLabelData = new FormData(); messageLabelData.top = new FormAttachment(m_titleLabel, verticalSpacing); messageLabelData.right = new FormAttachment(m_titleImage); messageLabelData.left = new FormAttachment(m_messageImageLabel, 0); if (m_titleImageLargest) messageLabelData.bottom = new FormAttachment(m_titleImage, 0, SWT.BOTTOM); m_messageLabel.setLayoutData(messageLabelData); } // Do not layout before the dialog area has been created // to avoid incomplete calculations. if (m_pageContainer != null && !m_pageContainer.isDisposed()) getShell().layout(true); }
From source file:org.locationtech.udig.style.sld.editor.StyleEditorDialog.java
License:Open Source License
@Override protected Control createButtonBar(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); composite.setLayout(layout);//from www .j ava 2s . c om GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false); composite.setLayoutData(data); composite.setFont(parent.getFont()); // add import/export buttons addImportExportButtons(composite); // add apply/revert/close buttons addOkCancelRevertApplyButtons(parent, composite); return composite; }
From source file:org.locationtech.udig.style.sld.editor.StyleEditorDialog.java
License:Open Source License
private void addOkCancelRevertApplyButtons(Composite parent, Composite composite) { GridLayout layout;//from ww w . j a va 2 s . c o m GridData data; Composite compRight = new Composite(composite, SWT.NONE); layout = new GridLayout(0, true); // columns are set at end because createButton sets them but we want 2x2 layout.marginWidth = 0; layout.marginHeight = 0; layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); compRight.setLayout(layout); data = new GridData(SWT.END, SWT.CENTER, true, false); compRight.setLayoutData(data); compRight.setFont(parent.getFont()); Button defaultsButton = createButton(compRight, DEFAULTS_ID, Messages.StyleEditorDialog_defaults, false); defaultsButton.setEnabled(true); defaultsButton.addListener(SWT.Selection, new StyleEditorButtonListener(this)); Button revertButton = createButton(compRight, REVERT_ID, Messages.StyleEditor_revert, false); revertButton.setEnabled(false); revertButton.addListener(SWT.Selection, new StyleEditorButtonListener(this)); Button applyButton = createButton(compRight, APPLY_ID, Messages.StyleEditor_apply, false); applyButton.setEnabled(false); applyButton.addListener(SWT.Selection, new StyleEditorButtonListener(this)); new Label(compRight, SWT.None); Button closeButton = createButton(compRight, CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); closeButton.setEnabled(true); closeButton.addListener(SWT.Selection, new StyleEditorButtonListener(this)); Button okButton = createButton(compRight, OK_ID, IDialogConstants.OK_LABEL, false); okButton.setEnabled(true); okButton.addListener(SWT.Selection, new StyleEditorButtonListener(this)); layout.numColumns = 3; }