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: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 2 s . 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 Control createButtonBar(final Composite parent) { final Composite buttonBar = new Composite(parent, SWT.NONE); final GridLayout layout = new GridLayout(); layout.numColumns = 2;/*from ww w. j ava 2s . co m*/ layout.makeColumnsEqualWidth = false; layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); buttonBar.setLayout(layout); final GridData data = new GridData(SWT.FILL, SWT.BOTTOM, true, false); data.grabExcessHorizontalSpace = true; data.grabExcessVerticalSpace = false; buttonBar.setLayoutData(data); buttonBar.setFont(parent.getFont()); // this is our label (eg "2 remaining, 0 resolved") countLabel = new Label(buttonBar, SWT.NONE); final GridData countLabelData = new GridData(SWT.LEFT, SWT.CENTER, true, true); countLabelData.grabExcessHorizontalSpace = true; countLabelData.horizontalIndent = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); countLabel.setLayoutData(countLabelData); ControlSize.setCharWidthHint(countLabel, 36); // add the dialog's button bar to the right final Control buttonControl = super.createButtonBar(buttonBar); buttonControl.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false)); return buttonBar; }
From source file:com.microsoft.tfs.client.common.ui.dialogs.vc.ConflictResolutionDialog.java
License:Open Source License
@Override protected Control createButtonBar(final Composite parent) { final Composite buttonBar = new Composite(parent, SWT.NONE); final GridLayout layout = new GridLayout(); layout.numColumns = 2;/* w ww . j av a 2 s . c o m*/ layout.makeColumnsEqualWidth = false; layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); buttonBar.setLayout(layout); final GridData data = new GridData(SWT.FILL, SWT.BOTTOM, true, false); data.grabExcessHorizontalSpace = true; data.grabExcessVerticalSpace = false; buttonBar.setLayoutData(data); buttonBar.setFont(parent.getFont()); // this is the button that allows comparisons compareButton = MenuButtonFactory.getMenuButton(buttonBar, SWT.NONE); compareButton.setText(Messages.getString("ConflictResolutionDialog.CompareButtonText")); //$NON-NLS-1$ final GridData compareButtonData = new GridData(SWT.LEFT, SWT.CENTER, true, true); compareButtonData.grabExcessHorizontalSpace = true; compareButtonData.horizontalIndent = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); compareButton.setLayoutData(compareButtonData); // add the dialog's button bar to the right final Control buttonControl = super.createButtonBar(buttonBar); buttonControl.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false)); return buttonBar; }
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 ww w . j a v a 2 s. c o m*/ 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.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();//w w w. j ava2 s. c om 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 ww w .j a va2s .c o 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 provide the horizontal spacing (in pixels) for controls * on this platform./* w w w .j av a2s .c o m*/ * * @return Horizontal spacing of controls (in pixels) */ public int getHorizontalSpacing() { return convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); }
From source file:com.microsoft.tfs.client.common.ui.framework.dialog.ExtendedButtonDialog.java
License:Open Source License
@Override protected Control createButtonBar(final Composite parent) { final Composite fullButtonControl = new Composite(parent, SWT.NONE); fullButtonControl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); fullButtonControl.setFont(parent.getFont()); final GridLayout layout = new GridLayout(); layout.numColumns = 2;//from ww w.j a v a 2 s .c om layout.makeColumnsEqualWidth = false; layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = 0; layout.marginWidth = 0; layout.marginHeight = 0; fullButtonControl.setLayout(layout); /* Set up an "extended" button bar on the left-hand side */ extendedButtonBar = createExtendedButtonBar(fullButtonControl); extendedButtonBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); /* add the dialog's button bar to the right */ standardButtonBar = super.createButtonBar(fullButtonControl); standardButtonBar.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, false)); return fullButtonControl; }
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 . ja v a 2s . 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(); }//from w w w . j a va 2s . 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; }