Example usage for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_MARGIN

List of usage examples for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_MARGIN

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_MARGIN.

Prototype

int HORIZONTAL_MARGIN

To view the source code for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_MARGIN.

Click Source Link

Document

Horizontal margin in dialog units (value 7).

Usage

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();
    }/*www.j av a 2  s .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.BuildDefinitionDialog.java

License:Open Source License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createButtonBar(org.eclipse.swt.widgets.Composite)
 *///from   w  ww .  j a va2s.  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 ww  .j  av  a  2 s  .  c  om

    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  .java2s.  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("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;//from w w w  .  j  av  a 2 s .co 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("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.vcexplorer.versioncontrol.FindInSourceControlEditor.java

License:Open Source License

@Override
public void createPartControl(final Composite parent) {
    final IEditorInput editorInput = getEditorInput();
    repository = getEditorInput().getRepository();

    setPartName(editorInput.getName());//from ww  w. j a  v a 2s.  c o m
    setTitleToolTip(editorInput.getToolTipText());

    final Composite partComposite = new Composite(parent, SWT.NONE);

    final GridLayout layout = new GridLayout(1, true);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    partComposite.setLayout(layout);

    final Composite labelComposite = new Composite(partComposite, SWT.NONE);

    /* Compute metrics in pixels */
    final GC gc = new GC(labelComposite);
    final FontMetrics fontMetrics = gc.getFontMetrics();
    gc.dispose();

    final FillLayout labelCompositeLayout = new FillLayout();
    labelCompositeLayout.marginWidth = Dialog.convertVerticalDLUsToPixels(fontMetrics,
            IDialogConstants.HORIZONTAL_MARGIN) / 2;
    labelCompositeLayout.marginHeight = Dialog.convertVerticalDLUsToPixels(fontMetrics,
            IDialogConstants.VERTICAL_MARGIN) / 2;

    labelComposite.setLayout(labelCompositeLayout);
    GridDataBuilder.newInstance().hGrab().hFill().applyTo(labelComposite);

    resultsLabel = new Label(labelComposite, SWT.NONE);

    tableComposite = new Composite(partComposite, SWT.NONE);
    GridDataBuilder.newInstance().grab().fill().applyTo(tableComposite);

    tableStack = new StackLayout();
    tableComposite.setLayout(tableStack);

    pendingChangesTable = new FindInSourceControlPendingChangesTable(tableComposite,
            SWT.FULL_SELECTION | SWT.MULTI);

    createActions();

    menuManager = new MenuManager("menu"); //$NON-NLS-1$
    menuManager.setRemoveAllWhenShown(true);
    menuManager.addMenuListener(new IMenuListener() {
        @Override
        public void menuAboutToShow(final IMenuManager manager) {
            fillContextMenu(manager);
        }
    });

    pendingChangesTable.getTable().setMenu(menuManager.createContextMenu(pendingChangesTable));

    /*
     * Proxy selection changes in both tables to listeners.
     */
    final ISelectionChangedListener selectionChangedListener = new ISelectionChangedListener() {
        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            ((ISelectionChangedListener) selectionChangedListeners.getListener()).selectionChanged(event);
        }
    };

    pendingChangesTable.addSelectionChangedListener(selectionChangedListener);

    pendingChangesTable.addDoubleClickListener(new IDoubleClickListener() {
        @Override
        public void doubleClick(final DoubleClickEvent event) {
            openInSCEAction.run();
        }

    });

    TFSCommonUIClientPlugin.getDefault().getProductPlugin().getRepositoryManager()
            .addListener(repositoryManagerListener);

}

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 www  . j  ava 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.mindquarry.desktop.preferences.dialog.FilteredPreferenceDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    final Composite composite = (Composite) super.createDialogArea(parent);
    GridLayout parentLayout = ((GridLayout) composite.getLayout());
    parentLayout.numColumns = 4;/* w w w .  ja  v  a2  s  .  c o  m*/
    parentLayout.marginHeight = 0;
    parentLayout.marginWidth = 0;
    parentLayout.verticalSpacing = 0;
    parentLayout.horizontalSpacing = 0;

    composite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));

    Control treeControl = createTreeAreaContents(composite);
    createSash(composite, treeControl);

    Label versep = new Label(composite, SWT.SEPARATOR | SWT.VERTICAL);
    GridData verGd = new GridData(GridData.FILL_VERTICAL | GridData.GRAB_VERTICAL);

    versep.setLayoutData(verGd);
    versep.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true));

    Composite pageAreaComposite = new Composite(composite, SWT.NONE);
    pageAreaComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout layout = new GridLayout(1, true);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = 0;
    pageAreaComposite.setLayout(layout);

    formTitleComposite = new Composite(pageAreaComposite, SWT.NONE);
    FormLayout titleLayout = new FormLayout();
    titleLayout.marginWidth = 0;
    titleLayout.marginHeight = 0;
    formTitleComposite.setLayout(titleLayout);

    GridData titleGridData = new GridData(GridData.FILL_HORIZONTAL);
    titleGridData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN;
    formTitleComposite.setLayoutData(titleGridData);

    // Build the title area and separator line
    Composite titleComposite = new Composite(formTitleComposite, SWT.NONE);
    layout = new GridLayout();
    layout.marginBottom = 5;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.horizontalSpacing = 0;
    titleComposite.setLayout(layout);

    FormData titleFormData = new FormData();
    titleFormData.top = new FormAttachment(0, 0);
    titleFormData.left = new FormAttachment(0, 0);
    titleFormData.right = new FormAttachment(100, 0);
    titleFormData.bottom = new FormAttachment(100, 0);

    titleComposite.setLayoutData(titleFormData);
    createTitleArea(titleComposite);

    Label separator = new Label(pageAreaComposite, SWT.HORIZONTAL | SWT.SEPARATOR);

    separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));

    // Build the Page container
    pageContainer = createPageContainer(pageAreaComposite);
    GridData pageContainerData = new GridData(GridData.FILL_BOTH);
    pageContainerData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN;
    pageContainer.setLayoutData(pageContainerData);
    // Build the separator line
    Label bottomSeparator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
    bottomSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    return composite;
}

From source file:com.nginious.http.plugin.NewProjectPageOne.java

License:Apache License

public void createControl(Composite parent) {
    initializeDialogUnits(parent);/*from  ww  w  .  j  a  va 2  s  . c  o  m*/

    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 {/*w  ww  . j  a  v a 2 s .  com*/
        layout.marginWidth = 0;
        layout.marginHeight = 0;
    }
    return layout;
}