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:com.jaspersoft.studio.jface.dialogs.DataAdapterErrorDialog.java
License:Open Source License
/** * This implementation of the <code>Dialog</code> framework method creates * and lays out a composite. Subclasses that require a different dialog area * may either override this method, or call the <code>super</code> * implementation and add controls to the created composite. * //w w w .j a v a 2 s. co m * Note: Since 3.4, the created composite no longer grabs excess vertical space. * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=72489. * If the old behavior is desired by subclasses, get the returned composite's * layout data and set grabExcessVerticalSpace to true. */ @Override protected Control createDialogArea(Composite parent) { // Create a composite with standard margins and spacing // Add the messageArea to this composite so that as subclasses add widgets to the messageArea // and dialogArea, the number of children of parent remains fixed and with consistent layout. // Fixes bug #240135 Composite composite = new Composite(parent, SWT.NONE); createMessageArea(composite); createSupportArea(parent); 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); layout.numColumns = 2; composite.setLayout(layout); GridData childData = new GridData(GridData.FILL_BOTH); childData.horizontalSpan = 2; childData.grabExcessVerticalSpace = false; composite.setLayoutData(childData); composite.setFont(parent.getFont()); return composite; }
From source file:com.maccasoft.composer.InstrumentEditor.java
License:Open Source License
protected Control createButtonBar(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 0;//from w ww . ja va2 s . c o m layout.makeColumnsEqualWidth = false; layout.marginWidth = 0; layout.marginTop = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN); layout.horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING); composite.setLayout(layout); composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); Button button = createButton(composite, -1, "Get Spin Data"); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { StringBuilder sb = new StringBuilder(); sb.append("DAT\n\n"); sb.append(name.getText().replace(' ', '_')); sb.append("\n"); for (Command cmd : list) { if (!cmd.isDisabled()) { sb.append(" " + cmd.toSpinString() + "\n"); } } TextDialog dlg = new TextDialog(getShell()); dlg.setString(sb.toString()); dlg.open(); } }); button = createButton(composite, -1, "Get C Data"); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { StringBuilder sb = new StringBuilder(); sb.append(String.format("uint32_t %s[] = {\n", name.getText().replace(' ', '_'))); for (Command cmd : list) { if (!cmd.isDisabled()) { sb.append(" " + cmd.toCString() + ",\n"); } } sb.append("};\n"); TextDialog dlg = new TextDialog(getShell()); dlg.setString(sb.toString()); dlg.open(); } }); Label label = new Label(composite, SWT.NONE); label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); layout.numColumns++; button = createButton(composite, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { okPressed(); setReturnCode(OK); close(); } }); getShell().setDefaultButton(button); button = createButton(composite, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { close(); } }); return composite; }
From source file:com.maccasoft.composer.ListSelectionDialog.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);/* w w w. ja va2 s .c o m*/ composite.setLayoutData(new GridData(GridData.FILL_BOTH)); applyDialogFont(composite); Label label = new Label(composite, SWT.NONE); label.setText(message); label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); viewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION); GridData layoutData = new GridData(GridData.FILL_BOTH); layoutData.widthHint = convertWidthInCharsToPixels(50); layoutData.heightHint = viewer.getTable().getItemHeight() * 20; viewer.getControl().setLayoutData(layoutData); viewer.setContentProvider(new ArrayContentProvider()); viewer.setLabelProvider(new LabelProvider()); viewer.setInput(elements); return composite; }
From source file:com.maccasoft.composer.TextDialog.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 ww w. ja v a 2 s.c om*/ composite.setLayoutData(new GridData(GridData.FILL_BOTH)); applyDialogFont(composite); if ("win32".equals(SWT.getPlatform())) { //$NON-NLS-1$ font = new Font(Display.getDefault(), "Courier New", 10, SWT.NONE); //$NON-NLS-1$ } else { font = new Font(Display.getDefault(), "mono", 10, SWT.NONE); //$NON-NLS-1$ } text = new Text(composite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); text.setFont(font); text.setLayoutData(new GridData(convertWidthInCharsToPixels(80), convertHeightInCharsToPixels(25))); if (data != null) { text.setText(data); } text.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { font.dispose(); } }); return composite; }
From source file:com.maccasoft.composer.TextExportDialog.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);/* ww w.j av a 2s .c o m*/ composite.setLayoutData(new GridData(GridData.FILL_BOTH)); applyDialogFont(composite); if ("win32".equals(SWT.getPlatform())) { //$NON-NLS-1$ font = new Font(Display.getDefault(), "Courier New", 10, SWT.NONE); //$NON-NLS-1$ } else { font = new Font(Display.getDefault(), "mono", 10, SWT.NONE); //$NON-NLS-1$ } Composite container = new Composite(composite, SWT.NONE); GridLayout gridLayout = new GridLayout(2, false); gridLayout.marginWidth = gridLayout.marginHeight = 0; container.setLayout(gridLayout); spin = new Button(container, SWT.RADIO); spin.setText("Spin"); spin.setSelection(true); spin.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { updateTextDump(); text.setFocus(); } }); clang = new Button(container, SWT.RADIO); clang.setText("C Array"); clang.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { updateTextDump(); text.setFocus(); } }); text = new Text(composite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); text.setFont(font); text.setLayoutData(new GridData(convertWidthInCharsToPixels(80), convertHeightInCharsToPixels(25))); text.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { font.dispose(); } }); text.setFocus(); size = new Label(composite, SWT.NONE); size.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false)); updateTextDump(); return composite; }
From source file:com.mercatis.lighthouse3.security.DefaultLoginModule.java
License:Apache License
@Override protected Control createDialogArea(Composite parent) { this.setTitle(header); Composite composite = (Composite) super.createDialogArea(parent); Composite c = new Composite(composite, SWT.NONE); 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); c.setLayout(layout);//from w w w. j a v a 2 s . c o m c.setLayoutData(new GridData(GridData.FILL_BOTH)); applyDialogFont(c); Label label = new Label(c, SWT.NONE); label.setText("Username: "); label.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false)); nameText = new Text(c, SWT.BORDER); nameText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false)); label = new Label(c, SWT.NONE); label.setText("Password: "); label.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false)); passwordText = new Text(c, SWT.BORDER | SWT.PASSWORD); passwordText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false)); return c; }
From source file:com.microsoft.tfs.client.common.ui.controls.generic.BaseControl.java
License:Open Source License
public BaseControl(final Composite parent, final int style) { super(parent, style); /* Compute metrics in pixels */ final GC gc = new GC(this); final FontMetrics fontMetrics = gc.getFontMetrics(); gc.dispose();//from w ww . ja v a 2 s .c o m horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_SPACING); verticalSpacing = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING); spacing = Math.max(horizontalSpacing, verticalSpacing); horizontalMargin = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN); verticalMargin = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN); minimumMessageAreaWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); }
From source file:com.microsoft.tfs.client.common.ui.dialogs.generic.StringInputDialog.java
License:Open Source License
@Override protected Control createDialogArea(final Composite parent) { final Composite container = (Composite) super.createDialogArea(parent); final FormLayout formLayout = new FormLayout(); formLayout.spacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); formLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); formLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); container.setLayout(formLayout);/*from w w w. j ava 2s . c om*/ final Label inputLabel = new Label(container, SWT.NONE); inputText = new Text(container, SWT.BORDER); AutomationIDHelper.setWidgetID(inputText, INPUT_TEXT_ID); inputLabel.setText(label); final FormData fd1 = new FormData(); fd1.left = new FormAttachment(0, 0); fd1.top = new FormAttachment(0, FormHelper.VerticalOffset(inputLabel, inputText)); inputLabel.setLayoutData(fd1); if (text != null) { inputText.setText(text); } if (text != null && selectionStart >= 0 && selectionEnd >= 0) { inputText.setSelection(selectionStart, selectionEnd); } else if (text != null) { inputText.setSelection(text.length()); } final FormData fd2 = new FormData(); fd2.left = new FormAttachment(inputLabel, 0, SWT.RIGHT); fd2.top = new FormAttachment(0, 0); fd2.right = new FormAttachment(100, 0); inputText.setLayoutData(fd2); inputText.addModifyListener(new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { processInput(); } }); ControlSize.setCharWidthHint(inputText, 60); return container; }
From source file:com.microsoft.tfs.client.common.ui.dialogs.vc.ChangesetDetailsDialog.java
License:Open Source License
@Override protected Control createButtonBar(final Composite parent) { final Composite composite = new Composite(parent, SWT.NONE); GridDataBuilder.newInstance().hGrab().hFill().applyTo(composite); final GridLayout layout = new GridLayout(4, 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.setLayout(layout);//from w w w .j a v a 2s.c om Label label = new Label(composite, SWT.NONE); label.setText(Messages.getString("ChangesetDetailsDialog.ChangesetLabelText")); //$NON-NLS-1$ Text text = new Text(composite, SWT.BORDER | SWT.READ_ONLY); text.setText(String.valueOf(changeset.getChangesetID())); GridDataBuilder.newInstance().hFill().applyTo(text); label = new Label(composite, SWT.NONE); label.setText(Messages.getString("ChangesetDetailsDialog.ByUserLabelText")); //$NON-NLS-1$ text = new Text(composite, SWT.BORDER | SWT.READ_ONLY); text.setText(changeset.getOwnerDisplayName()); GridDataBuilder.newInstance().hGrab().hFill().applyTo(text); label = new Label(composite, SWT.NONE); label.setText(Messages.getString("ChangesetDetailsDialog.CreatedOnLabelText")); //$NON-NLS-1$ text = new Text(composite, SWT.BORDER | SWT.READ_ONLY); text.setText(dateFormat.format(changeset.getDate().getTime())); GridDataBuilder.newInstance().hFill().applyTo(text); ControlSize.setCharWidthHint(text, 30); final Control control = super.createButtonBar(composite); GridDataBuilder.newInstance().hSpan(2).hAlign(SWT.END).applyTo(control, true); final GridLayout subLayout = (GridLayout) ((Composite) control).getLayout(); subLayout.marginHeight = 0; subLayout.marginWidth = 0; return composite; }
From source file:com.microsoft.tfs.client.common.ui.dialogs.vc.ConflictDialog.java
License:Open Source License
@Override protected void hookAddToDialogArea(final Composite dialogArea) { final GridLayout dialogLayout = new GridLayout(1, false); dialogLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); dialogLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); dialogArea.setLayout(dialogLayout);/*from ww w. j av a 2 s . com*/ final Label descriptionLabel = new Label(dialogArea, SWT.NONE); descriptionLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false)); descriptionLabel.setText(Messages.getString("ConflictDialog.DescriptionLabelText")); //$NON-NLS-1$ /* Make the label larger so that there's spacing beneath it. */ ControlSize.setCharHeightHint(descriptionLabel, 2); final Label conflictLabel = new Label(dialogArea, SWT.NONE); AutomationIDHelper.setWidgetID(conflictLabel, CONFLICTS_TABLE_ID); conflictLabel.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, true, false)); conflictLabel.setText(Messages.getString("ConflictDialog.ConflictLabelText")); //$NON-NLS-1$ // set up the conflict table conflictTable = new ConflictTable(dialogArea, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER); final GridData conflictTableData = new GridData(SWT.FILL, SWT.FILL, true, true); conflictTableData.grabExcessHorizontalSpace = true; conflictTableData.grabExcessVerticalSpace = true; conflictTable.setLayoutData(conflictTableData); conflictTable.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent event) { if (conflictTable.getSelectedElements().length == 0) { getButton(IDialogConstants.OK_ID).setEnabled(false); } else { getButton(IDialogConstants.OK_ID).setEnabled(true); } } }); conflictTable.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(final DoubleClickEvent event) { resolveSelection(); } }); conflictTable.setFocus(); ControlSize.setCharHeightHint(conflictTable, 12); // add an auto merge all button addButtonDescription(AUTOMERGE, Messages.getString("ConflictDialog.AutoMergeAllButtonText"), false); //$NON-NLS-1$ }