List of usage examples for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_SPACING
int HORIZONTAL_SPACING
To view the source code for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_SPACING.
Click Source Link
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;/*from w w w . ja va 2s . c o m*/ }
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 a 2s.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.jsf.ui.editor.check.wizards.QuickFixPage.java
License:Open Source License
/** * Create the table buttons for the receiver. * //from w w w. jav a 2 s. com * @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 ww. ja v a 2 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.dialog.xpl.QuickFixPage.java
License:Open Source License
public void createControl(Composite parent) { initializeDialogUnits(parent);/*from w ww . ja v a 2s .c om*/ // 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); if (resolutionsList.getList().getItemCount() > 0) { resolutionsList.setSelection(new StructuredSelection(resolutionsList.getElementAt(0))); } markersTable.setAllChecked(true); }
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 .ja v a 2 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.dialog.ListSelectionComposite.java
License:Open Source License
/** * Add the selection and deselection buttons to the page. *///from w w w .j a v a 2 s . c om private void addSelectionButtons(final CheckboxTableViewer checkboxViewer, final Composite composite) { final Composite buttonComposite = new Composite(composite, SWT.NONE); final GridLayout layout = GridLayoutFactory.fillDefaults().create(); // layout.horizontalSpacing = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_SPACING ); layout.horizontalSpacing = IDialogConstants.HORIZONTAL_SPACING; buttonComposite.setLayout(layout); buttonComposite.setLayoutData(new GridData(SWT.END, SWT.TOP, true, false)); final String SELECT_ALL_TITLE = WorkbenchMessages.SelectionDialog_selectLabel; final String DESELECT_ALL_TITLE = WorkbenchMessages.SelectionDialog_deselectLabel; final Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, SELECT_ALL_TITLE, false); selectButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { checkboxViewer.setAllChecked(true); fireCheckStateChanged(new CheckStateChangedEvent(checkboxViewer, null, true)); } }); final Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, DESELECT_ALL_TITLE, false); deselectButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { checkboxViewer.setAllChecked(false); fireCheckStateChanged(new CheckStateChangedEvent(checkboxViewer, null, true)); } }); }
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 ww . j a v a2s . c om*/ * 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./* w w w . ja v a2s . c o m*/ * * @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. */// ww w . j av a 2 s . c o m 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); }