List of usage examples for org.eclipse.jface.dialogs IDialogConstants VERTICAL_SPACING
int VERTICAL_SPACING
To view the source code for org.eclipse.jface.dialogs IDialogConstants VERTICAL_SPACING.
Click Source Link
From source file:com.microsoft.tfs.client.common.ui.framework.wizard.BaseWizardPage.java
License:Open Source License
private final void computeMetrics() { Control control = getControl(); if (control == null && Display.getCurrent() != null) { control = Display.getCurrent().getActiveShell(); }//w w w . ja v a2 s .c o m if (control == null) { return; } /* Compute metrics in pixels */ final GC gc = new GC(control); final FontMetrics fontMetrics = gc.getFontMetrics(); gc.dispose(); 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); initializedMetrics = true; }
From source file:com.microsoft.tfs.client.common.ui.prefs.BasePreferencePage.java
License:Open Source License
private void computeMetrics() { Control control = getControl(); if (control == null && Display.getCurrent() != null) { control = Display.getCurrent().getActiveShell(); }// w ww . j a v a 2 s . com if (control == null) { return; } /* Compute metrics in pixels */ final GC gc = new GC(control); final FontMetrics fontMetrics = gc.getFontMetrics(); gc.dispose(); 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); }
From source file:com.microsoft.tfs.client.common.ui.teambuild.dialogs.BuildDefinitionDialog.java
License:Open Source License
/** * @see org.eclipse.jface.dialogs.Dialog#createButtonBar(org.eclipse.swt.widgets.Composite) *//* w w w. j a v a 2 s .c o m*/ @Override protected Control createButtonBar(final Composite parent) { final Composite bottom = new Composite(parent, SWT.NONE); GridDataBuilder.newInstance().hFill().hGrab().applyTo(bottom); SWTUtil.gridLayout(bottom, 3, false, convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN), convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING)); warningLabel = SWTUtil.createLabel(bottom, imageHelper.getImage("icons/warning.gif")); //$NON-NLS-1$ warningMessage = SWTUtil.createLabel(bottom, Messages.getString("BuildDefinitionDialog.WarningLabelText")); //$NON-NLS-1$ GridDataBuilder.newInstance().hFill().hGrab().applyTo(warningMessage); final Composite composite = new Composite(bottom, SWT.NONE); // create a layout with spacing and margins appropriate for the font // size. final 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); composite.setFont(parent.getFont()); GridDataBuilder.newInstance().hFill().applyTo(composite); // Add the buttons to the button bar. createButtonsForButtonBar(composite); return composite; }
From source file:com.microsoft.tfs.client.common.ui.teambuild.dialogs.BuildDefinitionTemplateSelectionDialog.java
License:Open Source License
@Override protected void hookAddToDialogArea(final Composite dialogArea) { final GridLayout layout = new GridLayout(1, true); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); dialogArea.setLayout(layout);//w w w .ja va2 s .c o m final Label explanationLabel = new Label(dialogArea, SWT.WRAP); explanationLabel.setText(Messages.getString("BuildDefinitionTemplateSelectionDialog.ExplanationLabel")); //$NON-NLS-1$ GridDataBuilder.newInstance().hAlignLeft().vAlignTop().hGrab().hFill().applyTo(explanationLabel); templatesTable = new BuildDefinitionTemplatesTable(dialogArea, SWT.NONE); templatesTable.setTemplates(templates); GridDataBuilder.newInstance().hGrab().hFill().vGrab().cHint(templatesTable, SWT.DEFAULT, 256) .applyTo(templatesTable); }
From source file:com.microsoft.tfs.client.common.ui.teambuild.editors.BuildEditorPage.java
License:Open Source License
private void createControls(final Composite composite) { final GridLayout layout = new GridLayout(1, false); layout.horizontalSpacing = 0;//from w w w .j av a 2 s. c o m layout.verticalSpacing = 0; layout.marginWidth = 0; layout.marginHeight = 0; composite.setLayout(layout); final Composite header = new Composite(composite, SWT.NONE); GridDataBuilder.newInstance().hFill().hGrab().applyTo(header); /* Compute metrics in pixels */ final GC gc = new GC(header); final FontMetrics fontMetrics = gc.getFontMetrics(); gc.dispose(); final GridLayout headerLayout = new GridLayout(3, false); headerLayout.horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_SPACING); headerLayout.verticalSpacing = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING); headerLayout.marginWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN); headerLayout.marginHeight = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN); header.setLayout(headerLayout); SWTUtil.createLabel(header, Messages.getString("BuildEditorPage.BuildDefinitionLabelText")); //$NON-NLS-1$ SWTUtil.createLabel(header, Messages.getString("BuildEditorPage.QualityFilterLabelText")); //$NON-NLS-1$ SWTUtil.createLabel(header, Messages.getString("BuildEditorPage.DateFilterLabelText")); //$NON-NLS-1$ buildDefinitionFilterCombo = new Combo(header, SWT.READ_ONLY); GridDataBuilder.newInstance().fill().hGrab().applyTo(buildDefinitionFilterCombo); qualityFilterCombo = new Combo(header, SWT.READ_ONLY); GridDataBuilder.newInstance().fill().applyTo(qualityFilterCombo); ControlSize.setCharWidthHint(qualityFilterCombo, 30); dateFilterCombo = new Combo(header, SWT.READ_ONLY); GridDataBuilder.newInstance().fill().applyTo(dateFilterCombo); ControlSize.setCharWidthHint(dateFilterCombo, 25); onlyMyBuildsCheck = new Button(header, SWT.CHECK); onlyMyBuildsCheck.setText(Messages.getString("BuildEditorPage.OnlyMyBuilds")); //$NON-NLS-1$ onlyMyBuildsCheck.setEnabled(buildServer.getBuildServerVersion().isV3OrGreater()); GridDataBuilder.newInstance().fill().hSpan(3).applyTo(onlyMyBuildsCheck); final Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL); GridDataBuilder.newInstance().hGrab().hFill().applyTo(separator); buildsTableControl = new BuildsTableControl(composite, SWT.MULTI | SWT.FULL_SELECTION | TableControl.NO_BORDER, buildServer, teamProject); GridDataBuilder.newInstance().grab().fill().applyTo(buildsTableControl); buildsTableControl.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(final DoubleClickEvent event) { onDoubleClick(event); } }); buildsTableControl.getContextMenu().addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager manager) { fillMenu(manager); } }); // Add listener to be informed when build details are changed and our // copy might become stale. Remove the listener on dispose. BuildHelpers.getBuildManager().addBuildManagerListener(buildManagerListener); buildsTableControl.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(final DisposeEvent e) { BuildHelpers.getBuildManager().removeBuildManagerListener(buildManagerListener); } }); populateCombos(false); buildDefinitionFilterCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { filterChanged(); } }); dateFilterCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { filterChanged(); } }); qualityFilterCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { filterChanged(); } }); onlyMyBuildsCheck.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { filterChanged(); } }); getSite().setSelectionProvider(this); if (buildServer.getBuildServerVersion().isV1()) { dateFilterCombo.setText(Messages.getString("BuildEditorPage.AnyTimeChoice")); //$NON-NLS-1$ dateFilterCombo.setEnabled(false); qualityFilterCombo.setEnabled(false); } }
From source file:com.microsoft.tfs.client.common.ui.teambuild.editors.QueueEditorPage.java
License:Open Source License
private void createControls(final Composite composite) { final GridLayout layout = new GridLayout(1, false); layout.horizontalSpacing = 0;/* ww w . j ava2s . c om*/ layout.verticalSpacing = 0; layout.marginWidth = 0; layout.marginHeight = 0; composite.setLayout(layout); final Composite header = new Composite(composite, SWT.NONE); GridDataBuilder.newInstance().hFill().hGrab().applyTo(header); /* Compute metrics in pixels */ final GC gc = new GC(header); final FontMetrics fontMetrics = gc.getFontMetrics(); gc.dispose(); final GridLayout headerLayout = new GridLayout(3, false); headerLayout.horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_SPACING); headerLayout.verticalSpacing = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING); headerLayout.marginWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN); headerLayout.marginHeight = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN); header.setLayout(headerLayout); SWTUtil.createLabel(header, Messages.getString("QueueEditorPage.BuildDefinitionLabelText")); //$NON-NLS-1$ SWTUtil.createLabel(header, Messages.getString("QueueEditorPage.StatusFilterLabelText")); //$NON-NLS-1$ SWTUtil.createLabel(header, buildServer.getBuildServerVersion().isV3OrGreater() ? Messages.getString("QueueEditorPage.ControlFilterLabelText") //$NON-NLS-1$ : Messages.getString("QueueEditorPage.AgentFilterLabelText")); //$NON-NLS-1$ buildDefinitionFilterCombo = new Combo(header, SWT.READ_ONLY); GridDataBuilder.newInstance().fill().hGrab().applyTo(buildDefinitionFilterCombo); statusFilterCombo = new Combo(header, SWT.READ_ONLY); GridDataBuilder.newInstance().fill().applyTo(statusFilterCombo); ControlSize.setCharWidthHint(statusFilterCombo, 25); controllerFilterCombo = new Combo(header, SWT.READ_ONLY); GridDataBuilder.newInstance().fill().applyTo(controllerFilterCombo); ControlSize.setCharWidthHint(controllerFilterCombo, 30); onlyMyBuildsCheck = new Button(header, SWT.CHECK); onlyMyBuildsCheck.setText(Messages.getString("BuildEditorPage.OnlyMyBuilds")); //$NON-NLS-1$ onlyMyBuildsCheck.setEnabled(buildServer.getBuildServerVersion().isV3OrGreater()); GridDataBuilder.newInstance().fill().hSpan(3).applyTo(onlyMyBuildsCheck); final Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL); GridDataBuilder.newInstance().hGrab().hFill().applyTo(separator); queuedBuildsTable = new QueuedBuildsTableControl(composite, SWT.MULTI | SWT.FULL_SELECTION | TableControl.NO_BORDER, buildServer); GridDataBuilder.newInstance().hSpan(layout).grab().fill().applyTo(queuedBuildsTable); queuedBuildsTable.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(final DoubleClickEvent event) { onDoubleClick(event); } }); queuedBuildsTable.getContextMenu().addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager manager) { fillMenu(manager); } }); populateCombos(false); getSite().setSelectionProvider(this); buildDefinitionFilterCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { filterChanged(); } }); statusFilterCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { filterChanged(); } }); controllerFilterCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { filterChanged(); } }); onlyMyBuildsCheck.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { filterChanged(); } }); }
From source file:com.microsoft.tfs.client.common.ui.views.DeprecatedByTeamExplorerView.java
License:Open Source License
@Override public final void createPartControl(final Composite parent) { /* Compute metrics in pixels */ final GC gc = new GC(parent); final FontMetrics fontMetrics = gc.getFontMetrics(); gc.dispose();/*from w ww . java 2 s . c o m*/ final GridLayout layout = new GridLayout(2, false); layout.horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_SPACING) * 2; layout.verticalSpacing = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING); layout.marginWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN); parent.setLayout(layout); final Label imageLabel = new Label(parent, SWT.NONE); imageLabel.setImage(Display.getCurrent().getSystemImage(SWT.ICON_INFORMATION)); final Link textLabel = new Link(parent, SWT.READ_ONLY | SWT.WRAP); textLabel.setText(Messages.getString("DeprecatedByTeamExplorerView.DeprecatedText")); //$NON-NLS-1$ textLabel.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { try { final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getActivePage(); page.showView(TeamExplorerView.ID); } catch (final Exception f) { log.warn("Could not open Team Explorer View", f); //$NON-NLS-1$ MessageDialog.openError(getSite().getShell(), Messages.getString("DeprecatedByTeamExplorerView.OpenViewFailedTitle"), //$NON-NLS-1$ Messages.getString("DeprecatedByTeamExplorerView.OpenViewFailedMessage")); //$NON-NLS-1$ } } }); GridDataBuilder.newInstance().hGrab().hFill().applyTo(textLabel); }
From source file:com.nginious.http.plugin.NewProjectPageOne.java
License:Apache License
public void createControl(Composite parent) { initializeDialogUnits(parent);//from w w w . j av a 2s. c om final Composite composite = new Composite(parent, SWT.NULL); composite.setFont(parent.getFont()); composite.setLayout(initGridLayout(new GridLayout(1, false), true)); composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); // create UI elements Control nameControl = createNameControl(composite); nameControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite nameComposite = (Composite) nameControl; this.nameText = (Text) nameComposite.getChildren()[1]; nameText.addListener(SWT.KeyUp, this); Control locationControl = createLocationControl(composite); locationControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Control jreControl = createJRESelectionControl(composite); jreControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); int marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); int marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); this.block = new PropertiesBlock(horizontalSpacing, verticalSpacing, marginWidth, marginHeight); block.setListenPortValidator(this); block.createControls(composite); Control infoControl = createInfoControl(composite); infoControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); setControl(composite); }
From source file:com.nginious.http.plugin.NewProjectPageOne.java
License:Apache License
private GridLayout initGridLayout(GridLayout layout, boolean margins) { layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); if (margins) { layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); } else {/*from w w w .ja v a 2s.co m*/ layout.marginWidth = 0; layout.marginHeight = 0; } return layout; }
From source file:com.nginious.http.plugin.ProjectPropertyPage.java
License:Apache License
protected Control createContents(Composite parent) { initializeDialogUnits(parent);/*ww w . j a v a2s . c o m*/ IAdaptable element = this.getElement(); if (element instanceof IJavaProject) { IJavaProject javaProject = (IJavaProject) element; this.project = javaProject.getProject(); } else { this.project = (IProject) element; } final Composite composite = new Composite(parent, SWT.NULL); composite.setFont(parent.getFont()); composite.setLayout(initGridLayout(new GridLayout(1, false), true)); composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); int marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); int marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); this.block = new PropertiesBlock(this.project, horizontalSpacing, verticalSpacing, marginWidth, marginHeight); block.createControls(composite); return composite; }