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:com.google.dart.tools.ui.internal.cleanup.preference.ModifyDialogTabPage.java
License:Open Source License
/** * Create the contents of this tab page. * <p>//from ww w . j a v a 2s .c o m * Subclasses should implement <code>doCreatePreferences</code> and <code>doCreatePreview</code> * may also be overridden as necessary. * </p> * * @param parent The parent composite * @return Created content control */ @Override public Composite createContents(Composite parent) { final int numColumns = 4; if (fPixelConverter == null) { fPixelConverter = new PixelConverter(parent); } final SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL); sashForm.setFont(parent.getFont()); Composite scrollContainer = new Composite(sashForm, SWT.NONE); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); scrollContainer.setLayoutData(gridData); GridLayout layout = new GridLayout(2, false); layout.marginHeight = 0; layout.marginWidth = 0; layout.horizontalSpacing = 0; layout.verticalSpacing = 0; scrollContainer.setLayout(layout); ScrolledComposite scroll = new ScrolledComposite(scrollContainer, SWT.V_SCROLL | SWT.H_SCROLL); scroll.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); scroll.setExpandHorizontal(true); scroll.setExpandVertical(true); final Composite settingsContainer = new Composite(scroll, SWT.NONE); settingsContainer.setFont(sashForm.getFont()); scroll.setContent(settingsContainer); settingsContainer.setLayout(new PageLayout(scroll, 400, 400)); settingsContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); Composite settingsPane = new Composite(settingsContainer, SWT.NONE); settingsPane.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); 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); settingsContainer.setSize(settingsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT)); scroll.addControlListener(new ControlListener() { @Override public void controlMoved(ControlEvent e) { } @Override public void controlResized(ControlEvent e) { settingsContainer.setSize(settingsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT)); } }); Label sashHandle = new Label(scrollContainer, SWT.SEPARATOR | SWT.VERTICAL); gridData = new GridData(SWT.RIGHT, SWT.FILL, false, true); sashHandle.setLayoutData(gridData); final Composite previewPane = new Composite(sashForm, SWT.NONE); previewPane.setLayout(createGridLayout(numColumns, true)); previewPane.setFont(sashForm.getFont()); doCreatePreviewPane(previewPane, numColumns); initializePage(); sashForm.setWeights(new int[] { 3, 3 }); return sashForm; }
From source file:com.google.dart.tools.ui.internal.dialogs.OpenFolderDialog.java
License:Open Source License
private void createFolderBrowseRow(Composite parent) { Composite panel = new Composite(parent, SWT.NONE); 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); panel.setLayout(layout);//from w w w. ja v a 2s. c om panel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); panel.setFont(parent.getFont()); Label label = new Label(panel, SWT.NONE); label.setText(DialogMessages.OpenFolderDialog_label); text = new Text(panel, SWT.BORDER); text.setFocus(); text.setLayoutData(new GridData(400, SWT.DEFAULT)); text.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { folderLocation = text.getText(); Button okButton = getButton(Window.OK); if (okButton != null && !okButton.isDisposed()) { boolean nonWhitespaceFound = false; String characters = getFolderLocation(); for (int i = 0; !nonWhitespaceFound && i < characters.length(); i++) { if (!Character.isWhitespace(characters.charAt(i))) { nonWhitespaceFound = true; } } okButton.setEnabled(nonWhitespaceFound); setCheckBoxState(); } } }); Button browseButton = new Button(panel, SWT.PUSH); browseButton.setText(DialogMessages.OpenFolderDialog_browse); setButtonLayoutData(browseButton); GridData data = (GridData) browseButton.getLayoutData(); data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_END; browseButton.setLayoutData(data); browseButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.SHEET); dialog.setText(DialogMessages.OpenFolderDialog_title); dialog.setMessage(DialogMessages.OpenFolderDialog_dialogMessage); dialog.setFilterPath(getInitialBrowsePath()); String dir = dialog.open(); dir = TextProcessor.process(dir); if (dir != null) { text.setText(dir); } } }); }
From source file:com.google.dart.tools.ui.internal.dialogs.OpenFolderDialog.java
License:Open Source License
private void createRunPubMessage(Composite parent) { Composite panel = 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); panel.setLayout(layout);// w ww . j a va2s . c o m panel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); panel.setFont(parent.getFont()); runPubButton = new Button(panel, SWT.CHECK); runPubButton.setText(DialogMessages.OpenFolderDialog_rubPubMessage); runPubButton.setSelection(true); }
From source file:com.google.dart.tools.ui.internal.dialogs.OptionalMessageDialog.java
License:Open Source License
@Override protected Control createCustomArea(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.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout);//from w w w.j a v a 2s .co m composite.setLayoutData(new GridData(GridData.FILL_BOTH)); fHideDialogCheckBox = new Button(composite, SWT.CHECK | SWT.LEFT); fHideDialogCheckBox.setText(CHECKBOX_TEXT); fHideDialogCheckBox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setDialogEnabled(fId, !((Button) e.widget).getSelection()); } }); applyDialogFont(fHideDialogCheckBox); return fHideDialogCheckBox; }
From source file:com.google.dart.tools.ui.internal.dialogs.SortMembersMessageDialog.java
License:Open Source License
@Override protected Control createMessageArea(Composite parent) { initializeDialogUnits(parent);/*from w ww . j av a 2s. com*/ Composite messageComposite = new Composite(parent, SWT.NONE); messageComposite.setFont(parent.getFont()); GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); messageComposite.setLayout(layout); messageComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); createLinkControl(messageComposite); int indent = convertWidthInCharsToPixels(3); fNotSortAllRadio.doFillIntoGrid(messageComposite, 1); LayoutUtil.setHorizontalIndent(fNotSortAllRadio.getSelectionButton(null), indent); fSortAllRadio.doFillIntoGrid(messageComposite, 1); LayoutUtil.setHorizontalIndent(fSortAllRadio.getSelectionButton(null), indent); final Composite warningComposite = new Composite(messageComposite, SWT.NONE); layout = new GridLayout(); layout.numColumns = 2; layout.marginWidth = 0; layout.marginHeight = 0; warningComposite.setLayout(layout); warningComposite.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); warningComposite.setFont(messageComposite.getFont()); Image image = Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING); final Label imageLabel1 = new Label(warningComposite, SWT.LEFT | SWT.WRAP); imageLabel1.setImage(image); imageLabel1.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 1, 1)); final Label label = new Label(warningComposite, SWT.WRAP); label.setText(DialogsMessages.SortMembersMessageDialog_sort_warning_label); GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1); gridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); label.setLayoutData(gridData); label.setFont(warningComposite.getFont()); fNotSortAllRadio.setDialogFieldListener(new IDialogFieldListener() { @Override public void dialogFieldChanged(DialogField field) { imageLabel1.setEnabled(!fNotSortAllRadio.isSelected()); label.setEnabled(!fNotSortAllRadio.isSelected()); } }); imageLabel1.setEnabled(!fNotSortAllRadio.isSelected()); label.setEnabled(!fNotSortAllRadio.isSelected()); return messageComposite; }
From source file:com.google.dart.tools.ui.internal.dialogs.SourceActionDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { initializeDialogUnits(parent);//from w w w .ja v a 2 s . c om Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); GridData gd = null; 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 messageLabel = createMessageArea(composite); if (messageLabel != null) { gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan = 2; messageLabel.setLayoutData(gd); } Composite inner = new Composite(composite, SWT.NONE); GridLayout innerLayout = new GridLayout(); innerLayout.numColumns = 2; innerLayout.marginHeight = 0; innerLayout.marginWidth = 0; inner.setLayout(innerLayout); inner.setFont(parent.getFont()); CheckboxTreeViewer treeViewer = createTreeViewer(inner); gd = new GridData(GridData.FILL_BOTH); gd.widthHint = convertWidthInCharsToPixels(fWidth); gd.heightHint = convertHeightInCharsToPixels(fHeight); treeViewer.getControl().setLayoutData(gd); Composite buttonComposite = createSelectionButtons(inner); gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL); buttonComposite.setLayoutData(gd); gd = new GridData(GridData.FILL_BOTH); inner.setLayoutData(gd); fInsertPositionComposite = createInsertPositionCombo(composite); fInsertPositionComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite commentComposite = createCommentSelection(composite); commentComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Control linkControl = createLinkControl(composite); if (linkControl != null) { linkControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); } gd = new GridData(GridData.FILL_BOTH); composite.setLayoutData(gd); applyDialogFont(composite); return composite; }
From source file:com.google.dart.tools.ui.internal.text.dart.ContentAssistProcessor.java
License:Open Source License
/** * Informs the user about the fact that there are no enabled categories in the default content * assist set and shows a link to the preferences. *//*from w w w.j ava 2s . c o m*/ private boolean informUserAboutEmptyDefaultCategory() { if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) { final Shell shell = DartToolsPlugin.getActiveWorkbenchShell(); String title = DartTextMessages.ContentAssistProcessor_all_disabled_title; String message = DartTextMessages.ContentAssistProcessor_all_disabled_message; // see PreferencePage#createControl for the 'defaults' label final String restoreButtonLabel = JFaceResources.getString("defaults"); //$NON-NLS-1$ final String linkMessage = Messages.format( DartTextMessages.ContentAssistProcessor_all_disabled_preference_link, LegacyActionTools.removeMnemonics(restoreButtonLabel)); final int restoreId = IDialogConstants.CLIENT_ID + 10; final int settingsId = IDialogConstants.CLIENT_ID + 11; final OptionalMessageDialog dialog = new OptionalMessageDialog(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY, shell, title, null /* * default image */, message, MessageDialog.WARNING, new String[] { restoreButtonLabel, IDialogConstants.CLOSE_LABEL }, 1) { /* * @see org.eclipse.jface.dialogs.MessageDialog#createButtonsForButtonBar * (org.eclipse.swt.widgets.Composite) */ @Override protected void createButtonsForButtonBar(Composite parent) { Button[] buttons = new Button[2]; buttons[0] = createButton(parent, restoreId, restoreButtonLabel, false); buttons[1] = createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true); setButtons(buttons); } /* * @see com.google.dart.tools.ui.dialogs.OptionalMessageDialog#createCustomArea * (org.eclipse.swt.widgets.Composite) */ @Override protected Control createCustomArea(Composite composite) { // wrap link and checkbox in one composite without space Composite parent = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = 0; parent.setLayout(layout); Composite linkComposite = new Composite(parent, SWT.NONE); layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); linkComposite.setLayout(layout); Link link = new Link(linkComposite, SWT.NONE); link.setText(linkMessage); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setReturnCode(settingsId); close(); } }); GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); gridData.widthHint = this.getMinimumMessageWidth(); link.setLayoutData(gridData); // create checkbox and "don't show this message" prompt super.createCustomArea(parent); return parent; } }; int returnValue = dialog.open(); if (restoreId == returnValue || settingsId == returnValue) { if (restoreId == returnValue) { IPreferenceStore store = DartToolsPlugin.getDefault().getPreferenceStore(); store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER); store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES); } if (settingsId == returnValue) { PreferencesUtil.createPreferenceDialogOn(shell, "com.google.dart.tools.ui.internal.preferences.CodeAssistPreferenceAdvanced", null, //$NON-NLS-1$ null).open(); } CompletionProposalComputerRegistry registry = CompletionProposalComputerRegistry.getDefault(); registry.reload(); return true; } } return false; }
From source file:com.google.dart.tools.ui.web.pubspec.PackageSelectionDialog.java
License:Open Source License
@Override 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 = 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);// w ww . j a va 2 s . co m composite.setLayoutData(new GridData(GridData.FILL_BOTH)); applyDialogFont(composite); createMessageArea(composite); Text filterText = createFilterText(composite); filterText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { Status status = new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK, "", //$NON-NLS-1$ null); if (!getFilter().isEmpty() && !isValidDartIdentifier(getFilter())) { status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR, "Not a valid identifier", null); } updateStatus(status); } }); createFilteredList(composite); setListElements(elements); setSelection(getInitialElementSelections().toArray()); return composite; }
From source file:com.google.devtools.depan.nodes.filters.eclipse.ui.widgets.FilterEditorDialog.java
License:Apache License
private Composite setUpSaveAs(Composite parent) { Composite result = new Composite(parent, SWT.NONE); GridLayout layout = Widgets.buildContainerLayout(1); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); result.setLayout(layout);// ww w . jav a 2 s . c om Button saveAs = Widgets.buildCompactPushButton(result, "Save As..."); setButtonLayoutData(saveAs); saveAs.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleSaveAs(); } }); return result; }
From source file:com.gorillalogic.monkeyconsole.editors.utils.TitleAreaDialogStyledTextMessage.java
License:Open Source License
/** * Creates the dialog's title area./* w ww . j a v a2s .co m*/ * * @param parent * the SWT parent for the title area widgets * @return Control with the highest x axis value. */ private Control createTitleArea(Composite parent) { // add a dispose listener parent.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { if (titleAreaColor != null) { titleAreaColor.dispose(); } } }); // Determine the background color of the title bar Display display = parent.getDisplay(); Color background; Color foreground; if (titleAreaRGB != null) { titleAreaColor = new Color(display, titleAreaRGB); background = titleAreaColor; foreground = null; } else { background = JFaceColors.getBannerBackground(display); foreground = JFaceColors.getBannerForeground(display); } parent.setBackground(background); int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); // Dialog image @ right titleImageLabel = new Label(parent, SWT.CENTER); titleImageLabel.setBackground(background); if (titleAreaImage == null) titleImageLabel.setImage(JFaceResources.getImage(DLG_IMG_TITLE_BANNER)); else titleImageLabel.setImage(titleAreaImage); FormData imageData = new FormData(); imageData.top = new FormAttachment(0, 0); // 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 titleImageLabel.setLayoutData(imageData); // Title label @ top, left titleLabel = new Label(parent, SWT.LEFT); JFaceColors.setColors(titleLabel, foreground, background); titleLabel.setFont(JFaceResources.getBannerFont()); titleLabel.setText(" ");//$NON-NLS-1$ FormData titleData = new FormData(); titleData.top = new FormAttachment(0, verticalSpacing); titleData.right = new FormAttachment(titleImageLabel); titleData.left = new FormAttachment(0, horizontalSpacing); titleLabel.setLayoutData(titleData); // Message image @ bottom, left messageImageLabel = new Label(parent, SWT.CENTER); messageImageLabel.setBackground(background); // Message label @ bottom, center messageLabel = new Link(parent, SWT.WRAP | SWT.READ_ONLY); JFaceColors.setColors(messageLabel, foreground, background); messageLabel.setText(" \n "); // two lines//$NON-NLS-1$ messageLabel.setFont(JFaceResources.getDialogFont()); messageLabelHeight = messageLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT).y; // Filler labels leftFillerLabel = new Label(parent, SWT.CENTER); leftFillerLabel.setBackground(background); bottomFillerLabel = new Label(parent, SWT.CENTER); bottomFillerLabel.setBackground(background); setLayoutsForNormalMessage(verticalSpacing, horizontalSpacing); determineTitleImageLargest(); if (titleImageLargest) return titleImageLabel; return messageLabel; }