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.org.eclipse.core.utils.platform.dialogs.Dialog.java
License:Open Source License
/** * Creates and returns the contents of this dialog's button bar. * <p>/*w w w . j a v a 2 s .c om*/ * 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>/*from w w w . ja v a 2 s .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);// w w w. j a v a 2 s. c o 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.AbstractInformationDialog.java
License:Open Source License
/** * Toggles the unfolding of the details area. This is triggered by the user pressing the details button. *///from w w w .ja v a 2 s . c o m private void toggleDetailsArea() { Point windowSize = getShell().getSize(); Point oldSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT); if (text != null) { text.dispose(); text = null; getButton(detailButtonIndex).setText(IDialogConstants.SHOW_DETAILS_LABEL); } else { createDropDownText((Composite) getDialogArea()); text.setSize(oldSize.x - this.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING), oldSize.y - convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING)); getButton(detailButtonIndex).setText(IDialogConstants.HIDE_DETAILS_LABEL); } Point newSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT); getContents() .setSize(new Point(windowSize.x + (newSize.x - oldSize.x), windowSize.y + (newSize.y - oldSize.y))); }
From source file:org.org.eclipse.core.utils.platform.dialogs.message.AbstractMessageAndButtonDialog.java
License:Open Source License
protected Control createButtonBar(Composite parent) { Composite composite = new Composite(parent, COMPOSITE_STYLE); // create a layout with spacing and margins appropriate for the font // size./* w w w. ja v a 2s .c o m*/ GridLayout layout = new GridLayout(); layout.numColumns = 0; // this is incremented by createButton layout.makeColumnsEqualWidth = true; layout.marginWidth = 0; layout.marginHeight = 0; 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); data.horizontalSpan = 2; composite.setLayoutData(data); composite.setFont(parent.getFont()); // Add the buttons to the button bar. createButtonsForButtonBar(composite); return composite; }
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);//from w w w . j av a2 s .c o 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.ow2.joram.design.model.export.wizard.SelectElementsWizardPage.java
License:Open Source License
protected void createSelectionButtons(Composite composite) { Composite buttonComposite = new Composite(composite, SWT.RIGHT); GridLayout layout = new GridLayout(); layout.numColumns = 0;//from ww w . j a v a 2 s. c o m layout.marginWidth = 0; layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); buttonComposite.setLayout(layout); buttonComposite.setFont(composite.getFont()); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL); data.grabExcessHorizontalSpace = true; buttonComposite.setLayoutData(data); Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, "Select &All"); SelectionListener listener = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Object[] viewerElements = fContentProvider.getElements(fInput); treeViewer.setCheckedElements(viewerElements); validCheckedElements(); } }; selectButton.addSelectionListener(listener); Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, "&Deselect All"); listener = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { treeViewer.setCheckedElements(new Object[0]); validCheckedElements(); } }; deselectButton.addSelectionListener(listener); }
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 av a 2s. c o m*/ composite.setLayoutData(new GridData(GridData.FILL_BOTH)); createMyContents(composite); applyDialogFont(composite); return composite; }
From source file:org.python.pydev.debug.ui.PyConfigureExceptionDialog.java
License:Open Source License
/** * Add the selection and deselection buttons to the dialog. * /*from w w w . ja v a2 s . co m*/ * @param composite * org.eclipse.swt.widgets.Composite */ protected void createSelectionButtons(Composite composite) { Composite buttonComposite = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 0; layout.marginWidth = 0; layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); buttonComposite.setLayout(layout); buttonComposite.setLayoutData(new GridData(SWT.END, SWT.TOP, true, false)); createSelectAll(buttonComposite); createDeselectAll(buttonComposite); }
From source file:org.python.pydev.ui.pythonpathconf.PyListSelectionDialog.java
License:Open Source License
/** * Add the selection and deselection buttons to the dialog. * @param composite org.eclipse.swt.widgets.Composite *//* w w w. j av a 2 s . com*/ private void addSelectionButtons(Composite composite) { Composite buttonComposite = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 0; layout.marginWidth = 0; layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); buttonComposite.setLayout(layout); buttonComposite.setLayoutData(new GridData(SWT.END, SWT.TOP, true, false)); if (addSelectAllNotInWorkspace) { Button selectNotInWorkspaceButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, "Select All not in Workspace", false); SelectionListener listenerNotInWorkspace = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { HashSet<IPath> rootPaths = InterpreterConfigHelpers.getRootPaths(); TableItem[] children = listViewer.getTable().getItems(); for (int i = 0; i < children.length; i++) { TableItem item = children[i]; item.setChecked( !InterpreterConfigHelpers.isChildOfRootPath((String) item.getData(), rootPaths)); } } }; selectNotInWorkspaceButton.addSelectionListener(listenerNotInWorkspace); } Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, "Select All", false); SelectionListener listener = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { listViewer.setAllChecked(true); } }; selectButton.addSelectionListener(listener); Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, "Deselect All", false); listener = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { listViewer.setAllChecked(false); } }; deselectButton.addSelectionListener(listener); }