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.php.internal.ui.dialogs.saveFiles.SaveAsDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { // top level composite Composite parentComposite = (Composite) super.createDialogArea(parent); // create a composite with standard margins and spacing 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 ww .ja v a2 s . co m*/ composite.setLayoutData(new GridData(GridData.FILL_BOTH)); composite.setFont(parentComposite.getFont()); Listener listener = new Listener() { public void handleEvent(Event event) { setDialogComplete(validatePage()); } }; resourceGroup = new ResourceAndContainerGroup(composite, listener, "", ""); //$NON-NLS-1$ //$NON-NLS-2$ resourceGroup.setAllowExistingResources(true); return parentComposite; }
From source file:org.eclipse.php.internal.ui.preferences.EditTemplateDialog.java
License:Open Source License
protected Control createDialogArea(Composite ancestor) { Composite parent = new Composite(ancestor, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2;/*from ww w. ja v a 2 s. c om*/ 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() { public void modifyText(ModifyEvent e) { doTextWidgetChanged(e.widget); } }; if (fIsNameModifiable) { createLabel(parent, PreferencesMessages.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); fNameText.addFocusListener(new FocusListener() { public void focusGained(FocusEvent e) { } public void focusLost(FocusEvent e) { if (fSuppressError) { fSuppressError = false; updateStatusAndButtons(); } } }); createLabel(composite, PreferencesMessages.EditTemplateDialog_context); fContextCombo = new Combo(composite, SWT.READ_ONLY); for (int i = 0; i < fContextTypes.length; i++) { fContextCombo.add(fContextTypes[i][1]); } fContextCombo.addModifyListener(listener); fAutoInsertCheckbox = createCheckbox(composite, PreferencesMessages.EditTemplateDialog_autoinsert); fAutoInsertCheckbox.setSelection(fTemplate.isAutoInsertable()); } createLabel(parent, PreferencesMessages.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, PreferencesMessages.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(PreferencesMessages.EditTemplateDialog_insert_variable); fInsertVariableButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { fPatternEditor.getTextWidget().setFocus(); fPatternEditor.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS); } 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(); } initializeActions(); applyDialogFont(parent); return composite; }
From source file:org.eclipse.ptp.internal.rdt.sync.ui.properties.SyncPropertyPage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { Composite controls = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(1, 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); controls.setLayout(layout);// w w w . j av a 2s.c om controls.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); fWidget = new ManageConfigurationWidget(controls, SWT.NONE); fWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); fWidget.setProject(getProject()); return controls; }
From source file:org.eclipse.qvt.declarative.editor.ui.paged.PagedSaveAsDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite contents = (Composite) super.createDialogArea(parent); GridLayout layout = new GridLayout(2, 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 inner = new Composite(contents, SWT.NULL); inner.setLayout(layout);/*from w w w . j a v a2 s . c o m*/ // inner.setFont(parent.getFont()); inner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); createSaveTypeCombo(inner); return contents; }
From source file:org.eclipse.search.internal.ui.SearchDialog.java
License:Open Source License
protected Control createButtonBar(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 0; // create 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 2s. c o m*/ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // create help control if needed if (isHelpAvailable()) { createHelpControl(composite); } fCustomizeButton = createButton(composite, CUSTOMIZE_ID, SearchMessages.SearchDialog_customize, true); Label filler = new Label(composite, SWT.NONE); filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); layout.numColumns++; fReplaceButton = createActionButton(composite, REPLACE_ID, SearchMessages.SearchDialog_replaceAction, true); fReplaceButton.setVisible(fCurrentPage instanceof IReplacePage); Button searchButton = createActionButton(composite, SEARCH_ID, SearchMessages.SearchDialog_searchAction, true); searchButton.setEnabled(fDescriptors.size() > 0); super.createButtonsForButtonBar(composite); // cancel button return composite; }
From source file:org.eclipse.sirius.common.ui.tools.api.dialog.NewFileDialog.java
License:Open Source License
/** * {@inheritDoc}// ww w .j a va 2s . com * * @see org.eclipse.sirius.common.ui.tools.api.dialog.FolderSelectionDialog#createDialogArea(org.eclipse.swt.widgets.Composite) */ @Override protected Control createDialogArea(final Composite parent) { final Control result = super.createDialogArea(parent); final Composite composite = new Composite(parent, SWT.NONE); 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); composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); final Label label = new Label(composite, SWT.NULL); label.setText("File"); //$NON-NLS-1$ newFileNameText = new Text(composite, SWT.BORDER); final GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL); data.heightHint = newFileNameText.getLineHeight(); data.widthHint = newFileNameText.getLineHeight() * 30; newFileNameText.setLayoutData(data); newFileNameText.setText(newFileName); newFileNameText.addModifyListener(new ModifyListener() { public void modifyText(final ModifyEvent e) { updateOKStatus(); } }); return result; }
From source file:org.eclipse.tcf.te.ui.forms.CustomFormToolkit.java
License:Open Source License
/** * Creates an expandable composite within the given parent scrollable form using the given title. * If <code>overwriteBackground</code> is set, the parent background color and background image * is applied to the created expandable composite. * * @param scrolledForm The parent scrolled form. Must not be <code>null</code>. * @param title The expandable composite title. Must not be <code>null</code>. * @param entriesToShow The number of entries to show within the expanded area. Must be greater than 0. * @param expanded The initial expanded state of the expandable composite. * @param overwriteBackground If <code>true</code>, the parent background color and image are applied to the expandable composite. * * @return The expandable composite./*from www . jav a2 s. co m*/ */ public final ExpandableComposite createExpandableComposite(final ScrolledForm scrolledForm, String title, final int entriesToShow, boolean expanded, boolean overwriteBackground) { Assert.isNotNull(scrolledForm); Assert.isNotNull(title); Assert.isTrue(entriesToShow > 0); // Create the expandable composite within the scrollable container final ExpandableComposite expandable = getFormToolkit().createExpandableComposite(scrolledForm.getBody(), ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT); expandable.setText(title); // Overwrite background color and image if requested if (overwriteBackground) { expandable.setBackground(scrolledForm.getBackground()); expandable.setBackgroundImage(scrolledForm.getBackgroundImage()); } expandable.setLayout(new GridLayout()); expandable.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // Create an associate an expansion listener to the expandable form expandable.addExpansionListener(new IExpansionListener() { boolean notExpanded = true; /* (non-Javadoc) * @see org.eclipse.ui.forms.events.IExpansionListener#expansionStateChanged(org.eclipse.ui.forms.events.ExpansionEvent) */ @Override public void expansionStateChanged(ExpansionEvent e) { // Always set the scrolled form to re-flow. Otherwise it wouldn't // re-arrange the controls following this expandable composite on // collapse. scrolledForm.reflow(true); // Get the shell from the scrolled form. Shell shell = scrolledForm.getShell(); if (shell != null && !shell.isDisposed() && e.getState() && notExpanded) { // And recalculate the bounds on expand shell.setRedraw(false); Rectangle shellBounds = shell.getBounds(); // Assume at minimum 4 controls within the expandable area. shellBounds.height += convertHeightInCharsToPixels(expandable, Math.max(4, entriesToShow)) + IDialogConstants.VERTICAL_SPACING; shell.setBounds(shellBounds); shell.setRedraw(true); notExpanded = false; } } /* (non-Javadoc) * @see org.eclipse.ui.forms.events.IExpansionListener#expansionStateChanging(org.eclipse.ui.forms.events.ExpansionEvent) */ @Override public void expansionStateChanging(ExpansionEvent e) { } }); // Create the client area the caller can use as parent for the control Composite client = getFormToolkit().createComposite(expandable); client.setLayout(new GridLayout()); // Overwrite background color and image if requested if (overwriteBackground) { client.setBackground(scrolledForm.getBackground()); client.setBackgroundImage(scrolledForm.getBackgroundImage()); } // Set the initial expansion state expandable.setExpanded(expanded); // And associated the client expandable.setClient(client); return expandable; }
From source file:org.eclipse.tcf.te.ui.forms.CustomFormToolkit.java
License:Open Source License
/** * Creates an expandable section within the given parent scrollable form using the given title. * If <code>overwriteBackground</code> is set, the parent background color and background image * is applied to the created section.// ww w . j a v a 2 s . c o m * * @param parent The parent scrolled form. Must not be <code>null</code>. * @param title The expandable composite title. Must not be <code>null</code>. * @param entriesToShow The number of entries to show within the expanded area. Must be greater than 0. * @param expanded The initial expanded state of the section. * @param overwriteBackground If <code>true</code>, the parent background color and image are applied to the section. * * @return The section. */ public final Section createSection(final ScrolledForm scrolledForm, String title, final int entriesToShow, boolean expanded, boolean overwriteBackground) { Assert.isNotNull(scrolledForm); Assert.isNotNull(title); Assert.isTrue(entriesToShow > 0); // Create the section within the scrollable container final Section section = getFormToolkit().createSection(scrolledForm.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT); section.setText(title); // Overwrite background color and image if requested if (overwriteBackground) { section.setBackground(scrolledForm.getBackground()); section.setBackgroundImage(scrolledForm.getBackgroundImage()); } section.setLayout(new GridLayout()); if (scrolledForm.getBody().getLayout() instanceof GridLayout) { section.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); } // Create an associate an expansion listener to the expandable form section.addExpansionListener(new IExpansionListener() { boolean notExpanded = true; /* (non-Javadoc) * @see org.eclipse.ui.forms.events.IExpansionListener#expansionStateChanged(org.eclipse.ui.forms.events.ExpansionEvent) */ @Override public void expansionStateChanged(ExpansionEvent e) { // Always set the scrolled form to re-flow. Otherwise it wouldn't // re-arrange the controls following this expandable composite on // collapse. scrolledForm.reflow(true); // Get the shell from the scrolled form. Shell shell = scrolledForm.getShell(); if (shell != null && !shell.isDisposed() && e.getState() && notExpanded) { // And recalculate the bounds on expand shell.setRedraw(false); Rectangle shellBounds = shell.getBounds(); // Assume at minimum 4 controls within the expandable area. shellBounds.height += convertHeightInCharsToPixels(section, Math.max(4, entriesToShow)) + IDialogConstants.VERTICAL_SPACING; shell.setBounds(shellBounds); shell.setRedraw(true); notExpanded = false; } } /* (non-Javadoc) * @see org.eclipse.ui.forms.events.IExpansionListener#expansionStateChanging(org.eclipse.ui.forms.events.ExpansionEvent) */ @Override public void expansionStateChanging(ExpansionEvent e) { } }); // Create the client area the caller can use as parent for the control Composite client = getFormToolkit().createComposite(section); client.setLayout(new GridLayout()); // Overwrite background color and image if requested if (overwriteBackground) { client.setBackground(scrolledForm.getBackground()); client.setBackgroundImage(scrolledForm.getBackgroundImage()); } // Set the initial expansion state section.setExpanded(expanded); // And associated the client section.setClient(client); return section; }
From source file:org.eclipse.team.internal.ccvs.ui.AddToVersionControlDialog.java
License:Open Source License
/** * @see org.eclipse.team.internal.ui.DetailsDialog#createDropDownDialogArea(org.eclipse.swt.widgets.Composite) *//* w ww .j a va 2 s.c o m*/ protected Composite createDropDownDialogArea(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); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); addUnaddedResourcesArea(composite); return composite; }
From source file:org.eclipse.team.internal.ccvs.ui.IgnoreResourcesDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { Composite top = new Composite((Composite) super.createDialogArea(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); top.setLayout(layout);/*from w w w . j a v a 2 s . c o m*/ top.setLayoutData(new GridData(GridData.FILL_BOTH)); PlatformUI.getWorkbench().getHelpSystem().setHelp(top, IHelpContextIds.ADD_TO_CVSIGNORE); Listener selectionListener = new Listener() { public void handleEvent(Event event) { updateEnablements(); } }; Listener modifyListener = new Listener() { public void handleEvent(Event event) { validate(); } }; addNameEntryButton = createRadioButton(top, CVSUIMessages.IgnoreResourcesDialog_addNameEntryButton); addNameEntryButton.addListener(SWT.Selection, selectionListener); addNameEntryButton.setSelection(selectedAction == ADD_NAME_ENTRY); Label addNameEntryLabel = createIndentedLabel(top, CVSUIMessages.IgnoreResourcesDialog_addNameEntryExample, LABEL_INDENT_WIDTH); addExtensionEntryButton = createRadioButton(top, CVSUIMessages.IgnoreResourcesDialog_addExtensionEntryButton); addExtensionEntryButton.addListener(SWT.Selection, selectionListener); addExtensionEntryButton.setSelection(selectedAction == ADD_EXTENSION_ENTRY); Label addExtensionEntryLabel = createIndentedLabel(top, CVSUIMessages.IgnoreResourcesDialog_addExtensionEntryExample, LABEL_INDENT_WIDTH); addCustomEntryButton = createRadioButton(top, CVSUIMessages.IgnoreResourcesDialog_addCustomEntryButton); addCustomEntryButton.addListener(SWT.Selection, selectionListener); addCustomEntryButton.setSelection(selectedAction == ADD_CUSTOM_ENTRY); createIndentedLabel(top, CVSUIMessages.IgnoreResourcesDialog_addCustomEntryExample, LABEL_INDENT_WIDTH); if (resourceWithSpaces) { customEntryText = createIndentedText(top, getResourceWithSpace().getName().replaceAll(" ", "?"), //$NON-NLS-1$//$NON-NLS-2$ LABEL_INDENT_WIDTH); ControlDecoration customEntryTextDecoration = new ControlDecoration(customEntryText, SWT.TOP | SWT.LEAD); FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault(); FieldDecoration infoDecoration = registry.getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION); customEntryTextDecoration.setImage(infoDecoration.getImage()); customEntryTextDecoration.setDescriptionText(CVSUIMessages.IgnoreResourcesDialog_filesWithSpaceWarning); customEntryTextDecoration.setShowOnlyOnFocus(false); GridData gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.horizontalIndent = LABEL_INDENT_WIDTH + FieldDecorationRegistry.getDefault().getMaximumDecorationWidth(); customEntryText.setLayoutData(gridData); customEntryText.setFocus(); addNameEntryButton.setEnabled(false); addNameEntryLabel.setEnabled(false); // switch selection to "Custom pattern" if (!addCustomEntryButton.getSelection()) { addNameEntryButton.setSelection(false); addCustomEntryButton.setSelection(true); selectedAction = ADD_CUSTOM_ENTRY; } // when there is at least one resource without extension with spaces // we should disable the "Wildcard extension" option if (!allResourcesWithSpacesHaveExtensions) { addExtensionEntryButton.setEnabled(false); addExtensionEntryLabel.setEnabled(false); // switch selection to "Custom pattern" which is always enabled addExtensionEntryButton.setSelection(false); addCustomEntryButton.setSelection(true); selectedAction = ADD_CUSTOM_ENTRY; } } else { customEntryText = createIndentedText(top, resources[0].getName(), LABEL_INDENT_WIDTH); } customEntryText.addListener(SWT.Modify, modifyListener); applyDialogFont(top); return top; }