List of usage examples for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_MARGIN
int HORIZONTAL_MARGIN
To view the source code for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_MARGIN.
Click Source Link
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);// w w w. j a v a 2 s .c om 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$ }
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;// www . j a v a2 s .com 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 a v a 2s . 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 av 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.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 w w . j ava2s . 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 2 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();/* w w w .ja v a 2s .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 return the margin width or "gutter" (in pixels) for * dialogs on this platform.//from ww w. j ava 2 s. c o m * * @return Width of the margin around dialogs and controls (in pixels) */ public int getHorizontalMargin() { return convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_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 w w w .j a 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 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; }