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.microsoft.tfs.client.common.ui.dialogs.vc.DetectLocalChangesDialog.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);/*from www. j av a2 s .c om*/ final Label explanationLabel = new Label(dialogArea, SWT.WRAP); explanationLabel.setText(Messages.getString("ReturnOnlineDialog.ExplainLabelText")); //$NON-NLS-1$ explanationLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false)); changesTable = new ReturnOnlineChangesTable(dialogArea, SWT.NONE); changesTable.setChanges(changes); changesTable.setCheckedChanges(changes); changesTable.addCheckboxListener(new CheckboxListener() { @Override public void checkedElementsChanged(final CheckboxEvent event) { getButton(IDialogConstants.OK_ID).setEnabled(changesTable.getCheckedElements().length > 0); } }); AutomationIDHelper.setWidgetID(changesTable, RETURNONLINECHANGES_TABLE_ID); ControlSize.setCharHeightHint(changesTable, 10); ControlSize.setCharWidthHint(changesTable, 80); final GridData changesData = new GridData(SWT.FILL, SWT.FILL, true, true); changesData.grabExcessHorizontalSpace = true; changesData.grabExcessVerticalSpace = true; changesTable.setLayoutData(changesData); }
From source file:com.microsoft.tfs.client.common.ui.dialogs.vc.MultipleConflictResolutionDialog.java
License:Open Source License
@Override protected void hookAddToDialogArea(final Composite dialogArea) { final GridLayout dialogLayout = new GridLayout(1, true); dialogLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); dialogLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); dialogLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); dialogArea.setLayout(dialogLayout);/*from w ww . jav a 2 s. c o m*/ controlsByCategory.clear(); final Label explanationLabel = new Label(dialogArea, SWT.WRAP); explanationLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); explanationLabel.setText(Messages.getString("MultipleConflictResolutionDialog.ExplainLabelText")); //$NON-NLS-1$ /* Add some additional spacing */ final Composite spacer = new Composite(dialogArea, SWT.NONE); spacer.setLayoutData(new GridData(1, 1)); // get the conflict types... final Iterator i = descriptionsByCategory.keySet().iterator(); while (i.hasNext()) { final ConflictCategory conflictCategory = (ConflictCategory) i.next(); final List descriptions = (List) descriptionsByCategory.get(conflictCategory); final ConflictCategory category = ((ConflictDescription) descriptions.get(0)).getConflictCategory(); final MultipleConflictResolutionControl resolveControl = new MultipleConflictResolutionControl( dialogArea, SWT.NONE); resolveControl.setConflictCategory(category); resolveControl.setConflictCount(descriptions.size()); resolveControl.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { updateSelection(); } }); resolveControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); controlsByCategory.put(conflictCategory, resolveControl); } }
From source file:com.microsoft.tfs.client.common.ui.editors.ConflictResolutionEditor.java
License:Open Source License
@Override public void createPartControl(final Composite parent) { final Composite composite = new Composite(parent, SWT.NONE); /* Compute metrics in pixels */ final GC gc = new GC(composite); final FontMetrics fontMetrics = gc.getFontMetrics(); gc.dispose();/* ww w .j a v a 2s .co m*/ Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_SPACING); Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING); final int marginWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN); final int marginHeight = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN); final GridLayout layout = new GridLayout(1, false); layout.horizontalSpacing = 0; layout.verticalSpacing = 0; layout.marginWidth = 0; layout.marginHeight = 0; composite.setLayout(layout); final Composite summaryComposite = new Composite(composite, SWT.NONE); GridDataBuilder.newInstance().hGrab().hFill().applyTo(summaryComposite); final GridLayout summaryLayout = new GridLayout(1, false); summaryLayout.horizontalSpacing = 0; summaryLayout.verticalSpacing = 0; summaryLayout.marginWidth = marginWidth; summaryLayout.marginHeight = marginHeight; summaryComposite.setLayout(summaryLayout); summaryComposite.setBackground(getSite().getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); summaryLabel = new Label(summaryComposite, SWT.NONE); summaryLabel.setBackground(getSite().getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); summaryLabel.setForeground(getSite().getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND)); GridDataBuilder.newInstance().hGrab().hFill().applyTo(summaryLabel); final Label separatorLabel = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL); GridDataBuilder.newInstance().hGrab().hFill().applyTo(separatorLabel); final Composite toolbarComposite = new Composite(composite, SWT.NONE); GridDataBuilder.newInstance().hGrab().hFill().applyTo(toolbarComposite); final GridLayout toolbarCompositeLayout = new GridLayout(1, false); toolbarCompositeLayout.horizontalSpacing = 0; toolbarCompositeLayout.verticalSpacing = 0; toolbarCompositeLayout.marginWidth = marginWidth; toolbarCompositeLayout.marginHeight = 0; toolbarComposite.setLayout(toolbarCompositeLayout); toolbar = new ToolBar(toolbarComposite, SWT.HORIZONTAL | SWT.FLAT | SWT.RIGHT); GridDataBuilder.newInstance().hGrab().hFill().applyTo(toolbar); setupToolbar(toolbar); conflictTable = new ConflictTable(composite, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER); conflictTable.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent event) { updateSelection(); } }); final MenuManager menuManager = new MenuManager("#popup"); //$NON-NLS-1$ menuManager.setRemoveAllWhenShown(true); menuManager.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager manager) { fillContextMenu(manager); } }); conflictTable.setMenu(menuManager.createContextMenu(conflictTable)); GridDataBuilder.newInstance().grab().fill().applyTo(conflictTable); getSite().setSelectionProvider(conflictTable); /* * Set up the resolution options control */ conflictResolutionControl = new ConflictResolutionControl(composite, SWT.NONE); conflictResolutionControl.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent e) { conflictTable.setSelection(e.getSelection()); } }); conflictResolutionControl.addConflictResolutionSelectionListener(new ConflictResolutionSelectionListener() { @Override public void conflictResolutionSelected(final ConflictDescription[] conflictDescriptions, final ConflictResolution resolution) { if (conflictDescriptions.length == 1) { resolveConflict(conflictDescriptions[0], resolution); } else { resolveConflicts(conflictDescriptions, resolution); } } }); conflictResolutionControl.addConflictResolutionCancelledListener(new ConflictResolutionCancelledListener() { @Override public void conflictResolutionCancelled(final ConflictDescription conflictDescription, final ConflictResolution resolution) { resolution.removeStatusListener(ConflictResolutionEditor.this); resolution.cancel(); } }); GridDataBuilder.newInstance().hGrab().hFill().applyTo(conflictResolutionControl); setPartName(Messages.getString("ConflictResolutionEditor.PartName")); //$NON-NLS-1$ if (needsPaint == true) { if (initialConflicts == null) { queryConflicts(null); } else { setConflictDescriptions(initialConflicts); } } else { updateSummary(); updateSelection(); } hasPainted = true; }
From source file:com.microsoft.tfs.client.common.ui.editors.HistoryEditor.java
License:Open Source License
@Override public void createPartControl(final Composite parent) { final Composite composite = new Composite(parent, SWT.NONE); /* Compute metrics in pixels */ final GC gc = new GC(composite); final FontMetrics fontMetrics = gc.getFontMetrics(); gc.dispose();/*from w w w. ja v a 2 s. co m*/ final int horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_SPACING); final int verticalSpacing = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING); final int marginWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN); final int marginHeight = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN); final GridLayout layout = new GridLayout(1, false); layout.horizontalSpacing = horizontalSpacing; layout.verticalSpacing = verticalSpacing; layout.marginWidth = 0; layout.marginHeight = 0; composite.setLayout(layout); final Composite locationComposite = new Composite(composite, SWT.NONE); GridDataBuilder.newInstance().hGrab().hFill().applyTo(locationComposite); final GridLayout locationLayout = new GridLayout(3, false); locationLayout.horizontalSpacing = horizontalSpacing; locationLayout.verticalSpacing = verticalSpacing; locationLayout.marginWidth = marginWidth; locationLayout.marginHeight = marginHeight; locationComposite.setLayout(locationLayout); final Label locationLabel = new Label(locationComposite, SWT.NONE); locationLabel.setText(Messages.getString("HistoryEditor.SourceLocationLabel")); //$NON-NLS-1$ locationText = new Text(locationComposite, SWT.BORDER | SWT.READ_ONLY); GridDataBuilder.newInstance().hGrab().hFill().applyTo(locationText); final Button refreshButton = new Button(locationComposite, SWT.PUSH); /* Icons in buttons look good on Windows, strange elsewhere. */ if (Platform.isCurrentPlatform(Platform.WINDOWS)) { refreshButton.setImage( imageHelper.getImage(TFSCommonUIImages.getImageDescriptor(TFSCommonUIImages.IMG_REFRESH))); } refreshButton.setText(Messages.getString("HistoryEditor.RefreshActionText")); //$NON-NLS-1$ GridDataBuilder.newInstance().applyTo(refreshButton); historyControl = new HistoryCombinedControl(composite, SWT.FULL_SELECTION | SWT.MULTI); GridDataBuilder.newInstance().grab().fill().hSpan(3).applyTo(historyControl); historyControl.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent event) { updateStatusLine((IStructuredSelection) event.getSelection()); } }); getSite().setSelectionProvider(historyControl); createActions(); // getEditorSite().getActionBars().setGlobalActionHandler( // ActionFactory.COPY.getId(), // historyControl.getCopyAction()); // getEditorSite().getActionBars().updateActionBars(); refreshButton.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(final SelectionEvent e) { refresh(); } @Override public void widgetDefaultSelected(final SelectionEvent e) { refresh(); } }); setPartName(Messages.getString("HistoryEditor.PartName")); //$NON-NLS-1$ contributeActions(); TFSCommonUIClientPlugin.getDefault().getProductPlugin().getRepositoryManager() .addListener(repositoryManagerListener); }
From source file:com.microsoft.tfs.client.common.ui.framework.dialog.BaseDialog.java
License:Open Source License
/** * This method will return the margin height (in pixels) for dialogs on this * platform./* ww w .ja v a 2s . c o m*/ * * @return Height of the margin around dialogs and controls */ public int getVerticalMargin() { return convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); }
From source file:com.microsoft.tfs.client.common.ui.framework.dialog.ExtendedButtonDialog.java
License:Open Source License
protected Control createExtendedButtonBar(final Composite parent) { final Composite composite = new Composite(parent, SWT.NONE); // create a layout with spacing and margins appropriate for the font // size./*from www.j ava 2 s . c o m*/ final 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); composite.setFont(parent.getFont()); // Add the buttons to the button bar. createButtonsForExtendedButtonBar(composite); return composite; }
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 . j av a 2 s. c om 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 w w . j a v a2s.co 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); }
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 ww. ja v a2s. 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;// ww w .j a v a2 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); } }