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.radrails.rails.internal.ui.dialogs.RailsServerDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite dialogArea = (Composite) super.createDialogArea(parent); setTitle(Messages.RailsServerDialog_Title); getShell().setText(Messages.RailsServerDialog_Message); Composite composite = new Composite(dialogArea, SWT.NONE); composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); PixelConverter converter = new PixelConverter(composite); composite.setLayout(GridLayoutFactory.swtDefaults() .margins(converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN), converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN)) .spacing(converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING), converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING)) .numColumns(3).create());/*from w w w. ja va2s. c o m*/ /* name of the server */ Label label = new Label(composite, SWT.NONE); label.setLayoutData(GridDataFactory.swtDefaults() .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create()); label.setText(StringUtil.makeFormLabel(Messages.RailsServerDialog_NameLabel)); nameText = new Text(composite, SWT.SINGLE | SWT.BORDER); nameText.setLayoutData(GridDataFactory.fillDefaults() .hint(convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT).span(2, 1) .grab(true, false).create()); /* Project we're running server for */ label = new Label(composite, SWT.NONE); label.setLayoutData(GridDataFactory.swtDefaults() .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create()); label.setText(StringUtil.makeFormLabel(Messages.RailsServerDialog_ProjectLabel)); projectCombo = new Combo(composite, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); projectCombo.setLayoutData(GridDataFactory.fillDefaults() .hint(convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT).span(2, 1) .grab(true, false).create()); // Populate combo with all the rails projects for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) { try { if (project.isOpen() && project.hasNature(RailsProjectNature.ID)) { projectCombo.add(project.getName()); } } catch (CoreException e) { IdeLog.logError(RailsUIPlugin.getDefault(), e); } } if (projectCombo.getItemCount() > 0) { projectCombo.setText(projectCombo.getItems()[0]); } /* host/ip to bind to: 0.0.0.0, 127.0.0.1? */ label = new Label(composite, SWT.NONE); label.setLayoutData(GridDataFactory.swtDefaults() .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create()); label.setText(StringUtil.makeFormLabel(Messages.RailsServerDialog_BindingLabel)); hostNameText = new Text(composite, SWT.SINGLE | SWT.BORDER); hostNameText.setLayoutData(GridDataFactory.swtDefaults() .hint(new PixelConverter(hostNameText) .convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT) .span(2, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).create()); hostNameText.setText(RailsServer.DEFAULT_BINDING); /* Port: default is 3000 */ label = new Label(composite, SWT.NONE); label.setLayoutData(GridDataFactory.swtDefaults() .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create()); label.setText(StringUtil.makeFormLabel(Messages.RailsServerDialog_PortLabel)); portText = new Text(composite, SWT.SINGLE | SWT.BORDER); portText.setLayoutData(GridDataFactory.swtDefaults() .hint(new PixelConverter(portText) .convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT) .grab(true, false).create()); portText.setText(Integer.toString(RailsServer.DEFAULT_PORT)); // Set up values to reflect server we're editing. if (source != null) { String name = source.getName(); nameText.setText((name != null) ? name : StringUtil.EMPTY); String host = source.getHostname(); hostNameText.setText((host != null) ? host : RailsServer.DEFAULT_BINDING); portText.setText(Integer.toString(source.getPort())); IProject project = source.getProject(); if (project != null) { projectCombo.setText(project.getName()); } } addListeners(); return dialogArea; }
From source file:org.robovm.eclipse.internal.TemplateChooser.java
License:Open Source License
private GridLayout initGridLayout(GridLayout layout) { layout.horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING); layout.marginWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN); return layout; }
From source file:org.rssowl.ui.internal.dialogs.ActivityDialog.java
License:Open Source License
@SuppressWarnings("restriction") private void updateViewerSize() { Point size = fViewer.getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT); size.x += IDialogConstants.HORIZONTAL_SPACING; size.y += IDialogConstants.VERTICAL_SPACING; ((ScrolledComposite) fViewer.getControl()).setMinSize(size); }
From source file:org.rssowl.ui.internal.dialogs.ActivityDialog.java
License:Open Source License
@Override protected Control createButtonBar(Composite parent) { GridLayout layout = new GridLayout(1, 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 buttonBar = new Composite(parent, SWT.NONE); buttonBar.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); buttonBar.setLayout(layout);/*www.j a v a 2 s . c o m*/ /* Keep or Hide Completed Downloads */ fHideCompletedCheck = new Button(buttonBar, SWT.CHECK); fHideCompletedCheck.setText(Messages.ActivityDialog_REMOVE_COMPLETED); fHideCompletedCheck.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); fHideCompletedCheck.setSelection(fPreferences.getBoolean(DefaultPreferences.HIDE_COMPLETED_DOWNLOADS)); fHideCompletedCheck.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final boolean hideCompleted = fHideCompletedCheck.getSelection(); refreshProgressViewer(hideCompleted); JobRunner.runInBackgroundThread(new Runnable() { public void run() { fPreferences.putBoolean(DefaultPreferences.HIDE_COMPLETED_DOWNLOADS, hideCompleted); } }); } }); /* OK */ createButton(buttonBar, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); return buttonBar; }
From source file:org.rssowl.ui.internal.dialogs.CustomizeToolbarDialog.java
License:Open Source License
@Override protected Control createButtonBar(Composite parent) { GridLayout layout = new GridLayout(1, 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 buttonBar = new Composite(parent, SWT.NONE); buttonBar.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); buttonBar.setLayout(layout);//from w w w. j av a2 s. c om /* Info Container */ Composite infoContainer = new Composite(buttonBar, SWT.None); infoContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true)); infoContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 0)); ((GridLayout) infoContainer.getLayout()).marginRight = 10; Label infoImg = new Label(infoContainer, SWT.NONE); infoImg.setImage(OwlUI.getImage(fResources, "icons/obj16/info.gif")); //$NON-NLS-1$ infoImg.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); Label infoText = new Label(infoContainer, SWT.WRAP); infoText.setText(Messages.CustomizeToolbarDialog_USE_MOUSE_INFO); infoText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); applyDialogFont(infoContainer); /* Create Ok / Cancel Buttons */ createButtonsForButtonBar(buttonBar); return buttonBar; }
From source file:org.rssowl.ui.internal.dialogs.NewsFilterDialog.java
License:Open Source License
@Override protected Control createButtonBar(Composite parent) { GridLayout layout = new GridLayout(1, 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 buttonBar = new Composite(parent, SWT.NONE); buttonBar.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); buttonBar.setLayout(layout);//from ww w .java 2 s . co m /* Preview Link */ Link previewLink = new Link(buttonBar, SWT.NONE); previewLink.setText(Messages.NewsFilterDialog_PREVIEW_SEARCH); applyDialogFont(previewLink); previewLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true)); previewLink.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onPreview(); } }); /* Create Buttons */ createButtonsForButtonBar(buttonBar); return buttonBar; }
From source file:org.rssowl.ui.internal.dialogs.PreviewFeedDialog.java
License:Open Source License
@Override protected Control createButtonBar(Composite parent) { GridLayout layout = new GridLayout(1, 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 buttonBar = new Composite(parent, SWT.NONE); buttonBar.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); buttonBar.setLayout(layout);/*from www . j av a 2 s. c om*/ /* Status Label */ fStatusLabel = new Link(buttonBar, SWT.NONE); applyDialogFont(fStatusLabel); fStatusLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true)); if (StringUtils.isSet(fBookmark.getName())) fStatusLabel.setText(fBookmark.getName()); /* Close */ Button closeButton = createButton(buttonBar, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, false); closeButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { close(); } }); return buttonBar; }
From source file:org.rssowl.ui.internal.dialogs.SearchMarkDialog.java
License:Open Source License
@Override protected Control createButtonBar(Composite parent) { GridLayout layout = new GridLayout(1, 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 buttonBar = new Composite(parent, SWT.NONE); buttonBar.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); buttonBar.setLayout(layout);/*from w w w. ja va 2s. com*/ /* Status Label */ Link previewLink = new Link(buttonBar, SWT.NONE); previewLink.setText(Messages.SearchMarkDialog_PREVIEW_RESULTS); applyDialogFont(previewLink); previewLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true)); previewLink.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onPreview(); } }); /* OK */ Button okButton = createButton(buttonBar, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); ((GridData) okButton.getLayoutData()).horizontalAlignment = SWT.END; /* Cancel */ createButton(buttonBar, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); return buttonBar; }
From source file:org.rssowl.ui.internal.dialogs.SearchNewsDialog.java
License:Open Source License
@Override protected Control createButtonBar(Composite parent) { GridLayout layout = new GridLayout(1, 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 buttonBar = new Composite(parent, SWT.NONE); buttonBar.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); buttonBar.setLayout(layout);/*from www. j ava 2s .c om*/ /* Status Label */ fStatusLabel = new Link(buttonBar, SWT.NONE); fStatusLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true)); fStatusLabel.setText(""); //$NON-NLS-1$ applyDialogFont(fStatusLabel); fStatusLabel.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { onSave(); } }); /* Search */ Button searchButton = createButton(buttonBar, BUTTON_SEARCH, Messages.SearchNewsDialog_SEARCH, true); ((GridData) searchButton.getLayoutData()).horizontalAlignment = SWT.END; ((GridData) searchButton.getLayoutData()).grabExcessHorizontalSpace = false; /* Clear */ createButton(buttonBar, BUTTON_CLEAR, Messages.SearchNewsDialog_CLEAR, false); /* Close */ Button closeButton = createButton(buttonBar, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, false); closeButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { close(); } }); return buttonBar; }
From source file:org.rubypeople.rdt.internal.ui.filters.CustomFiltersDialog.java
License:Open Source License
/** * Overrides method in Dialog/*w ww. jav a 2 s .c o m*/ * * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite) */ protected Control createDialogArea(Composite parent) { initializeDialogUnits(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)); composite.setFont(parent.getFont()); Composite group = composite; // Checkbox fEnableUserDefinedPatterns = new Button(group, SWT.CHECK); fEnableUserDefinedPatterns.setFocus(); fEnableUserDefinedPatterns.setText(FilterMessages.CustomFiltersDialog_enableUserDefinedPattern); // Pattern field fUserDefinedPatterns = new Text(group, SWT.SINGLE | SWT.BORDER); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); data.widthHint = convertWidthInCharsToPixels(59); fUserDefinedPatterns.setLayoutData(data); String patterns = convertToString(fPatterns, SEPARATOR); fUserDefinedPatterns.setText(patterns); // Info text final Label info = new Label(group, SWT.LEFT); info.setText(FilterMessages.CustomFiltersDialog_patternInfo); // Enabling / disabling of pattern group fEnableUserDefinedPatterns.setSelection(fEnablePatterns); fUserDefinedPatterns.setEnabled(fEnablePatterns); info.setEnabled(fEnablePatterns); fEnableUserDefinedPatterns.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { boolean state = fEnableUserDefinedPatterns.getSelection(); fUserDefinedPatterns.setEnabled(state); info.setEnabled(fEnableUserDefinedPatterns.getSelection()); if (state) fUserDefinedPatterns.setFocus(); } }); // Filters provided by extension point if (fBuiltInFilters.length > 0) createCheckBoxList(group); applyDialogFont(parent); return parent; }