List of usage examples for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_MARGIN
int HORIZONTAL_MARGIN
To view the source code for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_MARGIN.
Click Source Link
From source file:org.pwsafe.passwordsafeswt.dialog.AboutDialog.java
License:Open Source License
@Override protected Control createDialogArea(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.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout);/*from w w w .j ava 2 s . c o m*/ composite.setLayoutData(new GridData(GridData.FILL_BOTH)); createMyContents(composite); applyDialogFont(composite); return composite; }
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 ww. j ava2 s. co 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
@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);// w w w.ja va 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);// w w w.j av a 2 s . co m /* 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.LoginDialog.java
License:Open Source License
@Override protected Control createButtonBar(Composite parent) { /* Inject Link if showing Sync Login */ if (fIsSyncLogin) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); layout.marginLeft = 5;/*from w w w . j a v a 2s . co m*/ layout.marginWidth = 0; layout.marginHeight = 0; layout.horizontalSpacing = 0; composite.setLayout(layout); composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); composite.setFont(parent.getFont()); if (isHelpAvailable()) { Control helpControl = createHelpControl(composite); ((GridData) helpControl.getLayoutData()).horizontalIndent = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_MARGIN); } Link createAccountLink = new Link(composite, SWT.None); createAccountLink.setText(Messages.LoginDialog_CREATE_NEW_ACCOUNT); createAccountLink.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, true)); createAccountLink.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { BrowserUtils.openLinkExternal(SyncUtils.GOOGLE_NEW_ACCOUNT_URL); } }); Control buttonSection = super.createButtonBar(composite); ((GridData) buttonSection.getLayoutData()).grabExcessHorizontalSpace = true; return composite; } /* Otherwise return super */ return super.createButtonBar(parent); }
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 w w w. ja va2s . 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);/* w w w . j ava 2s .co m*/ /* 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);/* w w w . j a va2s . co m*/ /* 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 w w w. ja v a2s. com*/ /* 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; }