List of usage examples for org.eclipse.jface.dialogs IDialogConstants VERTICAL_MARGIN
int VERTICAL_MARGIN
To view the source code for org.eclipse.jface.dialogs IDialogConstants VERTICAL_MARGIN.
Click Source Link
From source file:org.openmaji.implementation.tool.eclipse.ui.dialog.CreateWorksheetDialog.java
License:Open Source License
/** * @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite) *//*w w w.j av a 2 s. co m*/ protected Control createDialogArea(Composite parent) { setTitle("Create Worksheet"); setMessage( "Enter the name of the new worksheet and select the subsystem it should use to create new Meems"); 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); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); composite.setFont(parentComposite.getFont()); layout.numColumns = 2; int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); //String defaultUserName = MajiPlugin.getDefault().getPreferenceStore().getString(MajiSystemPreferencePage.MAJI_USERNAME_PROPERTIES); Label label = new Label(composite, SWT.WRAP); label.setText("&Worksheet Name"); GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER); //data.widthHint = widthHint; label.setLayoutData(data); label.setFont(parent.getFont()); data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL); data.widthHint = widthHint; txtWorksheetName = new Text(composite, SWT.SINGLE | SWT.BORDER); txtWorksheetName.setFocus(); txtWorksheetName.setLayoutData(data); txtWorksheetName.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validateInput(); } }); label = new Label(composite, SWT.WRAP); label.setText("Subsystem"); data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER); label.setLayoutData(data); label.setFont(parent.getFont()); comboSubsystem = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY); populateCombo(); data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL); data.widthHint = widthHint; // horizontal bar Label bar = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR); data = new GridData(); data.horizontalSpan = 2; data.horizontalAlignment = GridData.FILL; bar.setLayoutData(data); return composite; }
From source file:org.openmaji.implementation.tool.eclipse.ui.dialog.LoginDialog.java
License:Open Source License
/** * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) *//* w w w . j a v a 2 s . c om*/ 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); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); composite.setFont(parentComposite.getFont()); layout.numColumns = 2; int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); String defaultUserName = MajiPlugin.getDefault().getPreferenceStore() .getString(MajiSystemPreferencePage.MAJI_USERNAME_PROPERTIES); // User name Label label = new Label(composite, SWT.WRAP); label.setText("&User Name"); GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER); //data.widthHint = widthHint; label.setLayoutData(data); label.setFont(parent.getFont()); data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL); data.widthHint = widthHint; txtUserName = new Text(composite, SWT.SINGLE | SWT.BORDER); txtUserName.setLayoutData(data); txtUserName.setText(defaultUserName); // Password // User name label = new Label(composite, SWT.WRAP); label.setText("&Password"); // Enable Quick-Password Feature for develper String quickPassword = System.getProperty(QUICK_PASSWORD); if ((quickPassword != null) && (quickPassword.equalsIgnoreCase("true"))) { label.addMouseListener(new MouseListener() { public void mouseDoubleClick(MouseEvent e) { txtPassword.setText(txtUserName.getText() + "99"); } public void mouseDown(MouseEvent e) { } public void mouseUp(MouseEvent e) { } }); } data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER); label.setLayoutData(data); label.setFont(parent.getFont()); txtPassword = new Text(composite, SWT.SINGLE | SWT.BORDER); txtPassword.setEchoChar('*'); data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL); data.widthHint = widthHint; txtPassword.setLayoutData(data); if (defaultUserName.length() > 0) txtPassword.setFocus(); // horizontal bar Label bar = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR); data = new GridData(); data.horizontalSpan = 2; data.horizontalAlignment = GridData.FILL; bar.setLayoutData(data); return composite; }
From source file:org.org.eclipse.core.utils.platform.dialogs.Dialog.java
License:Open Source License
/** * Creates and returns the contents of this dialog's button bar. * <p>/*from w w w. ja v a2 s . c o m*/ * 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(Composite parent) { Composite composite = new Composite(parent, COMPOSITE_STYLE); // create a layout with spacing and margins appropriate for the font // size. GridLayout layout = new GridLayout(); layout.numColumns = 0; // this is incremented by createButton layout.makeColumnsEqualWidth = true; 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); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER); composite.setLayoutData(data); composite.setFont(parent.getFont()); composite.setBackground(JFaceColors.getBannerBackground(parent.getDisplay())); // Add the buttons to the button bar. createButtonsForButtonBar(composite); return composite; }
From source file:org.org.eclipse.core.utils.platform.dialogs.Dialog.java
License:Open Source License
/** * Creates and returns the contents of the upper part of this dialog (above the button bar). * <p>// w w w .ja v a 2s.c o m * The <code>Dialog</code> implementation of this framework method creates and returns a new <code>Composite</code> with standard margins and spacing. * </p> * <p> * The returned control's layout data must be an instance of <code>GridData</code>. This method must not modify the parent's layout. * </p> * <p> * Subclasses must override this method but may call <code>super</code> as in the following example: * </p> * * <pre> * Composite composite = (Composite) super.createDialogArea(parent); * //add controls to composite as necessary * return composite; * </pre> * * @param parent * the parent composite to contain the dialog area * @return the dialog area control */ protected Control createDialogArea(Composite parent) { // create a composite with standard margins and spacing Composite composite = new Composite(parent, SWT.NULL); 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.setBackground(JFaceColors.getBannerBackground(parent.getDisplay())); // org.eclipse.jface.dialogs.Dialog.applyDialogFont(composite); return composite; }
From source file:org.org.eclipse.core.utils.platform.dialogs.input.AbstractInputTrayDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = 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); composite.setLayout(layout);/*from w w w . j ava 2 s . co m*/ composite.setLayoutData(new GridData(GridData.FILL_BOTH)); applyDialogFont(composite); if (title != null) { Composite titleContainer = new Composite(composite, SWT.NONE); titleContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); titleContainer.setBackground(JFaceColors.getBannerBackground(this.getShell().getDisplay())); titleContainer.setLayout(new GridLayout(1, false)); Label nameLabel = new Label(titleContainer, SWT.NONE); nameLabel.setText(title); nameLabel.setFont(JFaceResources.getFontRegistry().get(JFaceResources.BANNER_FONT)); nameLabel.setBackground(JFaceColors.getBannerBackground(this.getShell().getDisplay())); nameLabel.setForeground(JFaceColors.getBannerForeground(this.getShell().getDisplay())); nameLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); } Composite fieldsContainer = new Composite(composite, SWT.BORDER); fieldsContainer.setLayout(new GridLayout(numColumns, false)); fieldsContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); final Composite validationMessageContainer = new Composite(composite, SWT.BORDER); validationMessageContainer.setLayout(new GridLayout(1, false)); validationMessageContainer.setBackground(JFaceColors.getBannerBackground(this.getShell().getDisplay())); validationMessageContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); validationMessageLabel = new Text(validationMessageContainer, SWT.MULTI | SWT.READ_ONLY); validationMessageLabel.setText(""); validationMessageLabel.setForeground(JFaceColors.getErrorText(this.getShell().getDisplay())); validationMessageLabel.setBackground(JFaceColors.getBannerBackground(this.getShell().getDisplay())); validationMessageLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); return fieldsContainer; }
From source file:org.org.eclipse.core.utils.platform.dialogs.message.AbstractMessageAndButtonDialog.java
License:Open Source License
protected Control createContents(Composite parent) { // initialize the dialog units initializeDialogUnits(parent);// w w w. ja v a2 s .co m // create the top level composite for the dialog GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN) * 3 / 2; layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING) * 2; layout.makeColumnsEqualWidth = false; parent.setLayout(layout); parent.setLayoutData(new GridData(GridData.FILL_BOTH)); createDialogAndButtonArea(parent); return parent; }
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 ww . j a v a 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());//w ww . j a v a 2s . c om /* 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);//from ww w .j ava 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; }