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

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

Introduction

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

Prototype

int HORIZONTAL_SPACING

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

Click Source Link

Document

Horizontal spacing in dialog units (value 4).

Usage

From source file:org.eclipse.birt.report.designer.ui.dialogs.StyleBuilder.java

License:Open Source License

private void createDialogTitleArea(Composite parent) {

    Composite contents = new Composite(parent, SWT.NONE);
    contents.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    FormLayout layout = new FormLayout();
    contents.setLayout(layout);/*from w w  w . j  a  v  a  2  s.com*/

    dialogTitleArea = new Composite(contents, SWT.NONE);
    initializeDialogUnits(dialogTitleArea);

    FormData titleAreaData = new FormData();
    titleAreaData.top = new FormAttachment(0, 0);
    titleAreaData.left = new FormAttachment(0, 0);
    titleAreaData.right = new FormAttachment(100, 0);
    dialogTitleArea.setLayoutData(titleAreaData);

    layout = new FormLayout();
    dialogTitleArea.setLayout(layout);

    // add a dispose listener
    dialogTitleArea.addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            if (titleAreaColor != null) {
                titleAreaColor.dispose();
            }
        }
    });
    // Determine the background color of the title bar
    Display display = dialogTitleArea.getDisplay();
    Color background;
    Color foreground;
    if (titleAreaRGB != null) {
        titleAreaColor = new Color(display, titleAreaRGB);
        background = titleAreaColor;
        foreground = null;
    } else {
        background = JFaceColors.getBannerBackground(display);
        foreground = JFaceColors.getBannerForeground(display);
    }

    dialogTitleArea.setBackground(background);
    int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    // Dialog image @ right
    titleImageLabel = new Label(dialogTitleArea, SWT.CENTER);
    titleImageLabel.setBackground(background);
    if (titleAreaImage == null)
        titleImageLabel.setImage(JFaceResources.getImage(DLG_IMG_TITLE_BANNER));
    else
        titleImageLabel.setImage(titleAreaImage);

    FormData imageData = new FormData();
    imageData.top = new FormAttachment(0, 0);
    // Note: do not use horizontalSpacing on the right as that would be a
    // regression from
    // the R2.x style where there was no margin on the right and images are
    // flush to the right
    // hand side. see reopened comments in 41172
    imageData.right = new FormAttachment(100, 0); // horizontalSpacing
    titleImageLabel.setLayoutData(imageData);
    // Title label @ top, left
    titleLabel = new Label(dialogTitleArea, SWT.LEFT);
    JFaceColors.setColors(titleLabel, foreground, background);
    titleLabel.setFont(JFaceResources.getBannerFont());
    titleLabel.setText(" ");//$NON-NLS-1$
    FormData titleData = new FormData();
    titleData.top = new FormAttachment(0, verticalSpacing);
    titleData.right = new FormAttachment(titleImageLabel);
    titleData.left = new FormAttachment(0, horizontalSpacing);
    titleLabel.setLayoutData(titleData);
    // Message image @ bottom, left
    messageImageLabel = new Label(dialogTitleArea, SWT.CENTER);
    messageImageLabel.setBackground(background);
    // Message label @ bottom, center
    messageLabel = new Text(dialogTitleArea, SWT.WRAP | SWT.READ_ONLY);
    JFaceColors.setColors(messageLabel, foreground, background);
    messageLabel.setText(" \n "); // two lines//$NON-NLS-1$
    messageLabel.setFont(JFaceResources.getDialogFont());
    messageLabelHeight = messageLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
    // Filler labels
    leftFillerLabel = new Label(dialogTitleArea, SWT.CENTER);
    leftFillerLabel.setBackground(background);
    bottomFillerLabel = new Label(dialogTitleArea, SWT.CENTER);
    bottomFillerLabel.setBackground(background);
    setLayoutsForNormalMessage(verticalSpacing, horizontalSpacing);
    determineTitleImageLargest();

    Label titleBarSeparator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
    titleBarSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}

From source file:org.eclipse.birt.report.designer.ui.dialogs.StyleBuilder.java

License:Open Source License

/**
 * Re-layout the labels for the new message.
 *//*from  www .ja  v  a2 s.c  o m*/
private void layoutForNewMessage() {
    int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    // If there are no images then layout as normal
    if (errorMessage == null && messageImage == null) {
        setImageLabelVisible(false);
        setLayoutsForNormalMessage(verticalSpacing, horizontalSpacing);
    } else {
        messageImageLabel.setVisible(true);
        bottomFillerLabel.setVisible(true);
        leftFillerLabel.setVisible(true);
        /**
         * Note that we do not use horizontalSpacing here as when the
         * background of the messages changes there will be gaps between the
         * icon label and the message that are the background color of the
         * shell. We add a leading space elsewhere to compendate for this.
         */
        FormData data = new FormData();
        data.left = new FormAttachment(0, H_GAP_IMAGE);
        data.top = new FormAttachment(titleLabel, verticalSpacing);
        messageImageLabel.setLayoutData(data);
        data = new FormData();
        data.top = new FormAttachment(messageImageLabel, 0);
        data.left = new FormAttachment(0, 0);
        data.bottom = new FormAttachment(messageLabel, 0, SWT.BOTTOM);
        data.right = new FormAttachment(messageImageLabel, 0, SWT.RIGHT);
        bottomFillerLabel.setLayoutData(data);
        data = new FormData();
        data.top = new FormAttachment(messageImageLabel, 0, SWT.TOP);
        data.left = new FormAttachment(0, 0);
        data.bottom = new FormAttachment(messageImageLabel, 0, SWT.BOTTOM);
        data.right = new FormAttachment(messageImageLabel, 0);
        leftFillerLabel.setLayoutData(data);
        FormData messageLabelData = new FormData();
        messageLabelData.top = new FormAttachment(titleLabel, verticalSpacing);
        messageLabelData.right = new FormAttachment(titleImageLabel);
        messageLabelData.left = new FormAttachment(messageImageLabel, 0);
        messageLabelData.height = messageLabelHeight;
        if (titleImageLargest)
            messageLabelData.bottom = new FormAttachment(titleImageLabel, 0, SWT.BOTTOM);
        messageLabel.setLayoutData(messageLabelData);
    }
    // Do not layout before the dialog area has been created
    // to avoid incomplete calculations.
    if (dialogArea != null) {
        dialogTitleArea.getParent().layout(true);
        dialogTitleArea.layout(true);
    }
}

From source file:org.eclipse.birt.report.designer.ui.ide.wizards.WizardSaveAsPage.java

License:Open Source License

public void createControl(Composite parent) {

    // create a composite with standard margins and spacing
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);//ww w. ja va2s .c o m
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parent.getFont());

    Listener listener = new Listener() {

        public void handleEvent(Event event) {
            validatePage();
            try {
                getContainer().updateButtons();
            } catch (Throwable e) {
                // ignore
            }
        }
    };

    resourceGroup = new ResourceAndContainerGroup(composite, listener,
            Messages.getString("WizardSaveAsPage.FileLabel"), //$NON-NLS-1$
            "file", //$NON-NLS-1$
            false, 200);
    resourceGroup.setAllowExistingResources(true);

    setControl(composite);

    initializeControls();

    UIUtil.bindHelp(getControl(), IHelpContextIds.SAVE_AS_WIZARD_ID);
}

From source file:org.eclipse.birt.report.extension.barcode.BarCodeBuilder.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(3, false);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);/*from ww w. j  ava2s.c  o  m*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    createTextArea(composite);

    Label lb = new Label(composite, SWT.None);
    lb.setText("Barcode Type:"); //$NON-NLS-1$

    barCodeType = new ComboViewer(composite, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
    //      barCodeType.add("");
    //      for (String bcType : BAR_CODE_TYPES) {
    //         barCodeType.add(bcType);
    //      }
    barCodeType.setContentProvider(ArrayContentProvider.getInstance());
    barCodeType.setLabelProvider(new LabelProvider() {
        @Override
        public String getText(Object element) {
            return ((BarCodeGenerator) element).getLabel();
        }
    });
    barCodeType.setInput(BarCodeGenerator.values());
    GridData gd = new GridData();
    gd.widthHint = 100;
    barCodeType.getControl().setLayoutData(gd);

    applyDialogFont(composite);

    try {
        initValues();
    } catch (SemanticException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return composite;
}

From source file:org.eclipse.birt.sample.reportitem.rotatedtext.RotatedTextBuilder.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(3, false);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);/*from  w w w.  j  av a2s  .c om*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    createTextArea(composite);

    Label lb = new Label(composite, SWT.None);
    lb.setText("Rotation Angle:"); //$NON-NLS-1$

    sclAngle = new Scale(composite, SWT.None);
    sclAngle.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    sclAngle.setMinimum(0);
    sclAngle.setMaximum(360);
    sclAngle.setIncrement(10);

    lbAngle = new Label(composite, SWT.None);
    GridData gd = new GridData();
    gd.widthHint = 20;
    lbAngle.setLayoutData(gd);

    sclAngle.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
            lbAngle.setText(String.valueOf(sclAngle.getSelection()));
        }

        public void widgetSelected(SelectionEvent e) {
            lbAngle.setText(String.valueOf(sclAngle.getSelection()));
        }
    });

    applyDialogFont(composite);

    initValues();

    return composite;
}

From source file:org.eclipse.buckminster.jnlp.p2.ui.certificates.ListSelectionDialog.java

License:Open Source License

/**
 * Add the selection and deselection buttons to the dialog.
 * /*from   www  . jav  a 2s.  co  m*/
 * @param composite
 *            org.eclipse.swt.widgets.Composite
 */
private void addSelectionButtons(Composite composite) {
    Composite buttonComposite = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 0;
    layout.marginWidth = 0;
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    buttonComposite.setLayout(layout);
    buttonComposite.setLayoutData(new GridData(SWT.END, SWT.TOP, true, false));

    Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, SELECT_ALL_TITLE,
            false);

    SelectionListener listener = new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            listViewer.setAllChecked(true);
        }
    };
    selectButton.addSelectionListener(listener);

    Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, DESELECT_ALL_TITLE,
            false);

    listener = new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            listViewer.setAllChecked(false);
        }
    };
    deselectButton.addSelectionListener(listener);
}

From source file:org.eclipse.cdt.core.testplugin.util.VerifyDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    // top level composite
    Composite parentComposite = (Composite) super.createDialogArea(parent);

    // create a composite with standard margins and spacing
    Composite composite = new Composite(parentComposite, SWT.NONE);
    composite.setSize(SIZING_WIDTH, SWT.DEFAULT);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);/*  ww  w . j  av  a2s. c o m*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    createTestSelectionGroup(composite);
    createCheckListGroup(composite);

    _queryLabel = new Label(composite, SWT.NONE);
    _queryLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    initializeTest();
    return composite;
}

From source file:org.eclipse.cdt.cpp.ui.internal.dialogs.CustomMessageDialog.java

License:Open Source License

protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);

    // create a layout with spacing and margins appropriate for the font size.
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;/*ww w. j  a  v a2  s. c o m*/
    composite.setLayout(layout);

    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);
    composite.setLayoutData(data);

    composite.setFont(parent.getFont());
    // create composite for the don't show button
    Composite leftPane = new Composite(composite, SWT.NONE);

    // create a layout with spacing and margins appropriate for the font size.
    GridLayout leftPaneLayout = new GridLayout();
    leftPaneLayout.numColumns = 1;
    leftPaneLayout.makeColumnsEqualWidth = true;
    leftPaneLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    leftPaneLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    leftPaneLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    leftPaneLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);

    leftPane.setLayout(leftPaneLayout);

    GridData leftPaneData = new GridData(
            GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_CENTER);
    leftPane.setLayoutData(leftPaneData);

    // Add a check box if needed
    if (extraButtonLabels != null)
        createExtraButtonsForButtonBar(leftPane);
    // create composite to hold the butons
    Composite rightPane = new Composite(composite, SWT.NONE);

    // create a layout with spacing and margins appropriate for the font size.
    GridLayout rightPaneLayout = new GridLayout();
    rightPaneLayout.numColumns = 0; // this is incremented by createButton
    rightPaneLayout.makeColumnsEqualWidth = true;
    rightPaneLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    rightPaneLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    rightPaneLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    rightPaneLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);

    rightPane.setLayout(rightPaneLayout);

    GridData rightPanedata = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);
    rightPane.setLayoutData(rightPanedata);
    // Add the buttons to the button bar.
    createButtonsForButtonBar(rightPane);
    return composite;
}

From source file:org.eclipse.cdt.debug.internal.ui.sourcelookup.CompilationDirectorySourceContainerDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Image image = fNewContainer ? CDebugImages.get(IInternalCDebugUIConstants.IMG_ADD_COMP_DIR_WIZ)
            : CDebugImages.get(IInternalCDebugUIConstants.IMG_EDIT_COMP_DIR_WIZ);
    setTitle(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_2);
    setMessage(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_3);
    setTitleImage(image);/* w  w w.ja v a 2s.  c o  m*/
    Composite parentComposite = (Composite) super.createDialogArea(parent);
    Font font = parentComposite.getFont();
    Composite composite = new Composite(parentComposite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(font);

    Composite dirComposite = new Composite(composite, SWT.NONE);
    layout = new GridLayout(2, false);
    dirComposite.setLayout(layout);
    dirComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    dirComposite.setFont(font);

    Label label = new Label(dirComposite, SWT.NONE);
    label.setText(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_4);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    label.setLayoutData(data);
    label.setFont(font);

    fDirText = new Text(dirComposite, SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 1;
    fDirText.setLayoutData(data);
    fDirText.setFont(font);
    fDirText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            validate();
        }
    });

    Button button = new Button(dirComposite, SWT.PUSH);
    button.setText(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_5);
    data = new GridData();
    int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    data.widthHint = Math.max(widthHint, minSize.x);
    button.setLayoutData(data);
    button.setFont(JFaceResources.getDialogFont());
    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            browse();
        }
    });

    fSubfoldersButton = new Button(dirComposite, SWT.CHECK);
    fSubfoldersButton.setText(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_6);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.verticalIndent = layout.verticalSpacing; // Extra vertical spacing
    fSubfoldersButton.setLayoutData(data);
    fSubfoldersButton.setFont(font);

    return parentComposite;
}

From source file:org.eclipse.cdt.debug.internal.ui.sourcelookup.PathMappingDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    setTitle(SourceLookupUIMessages.PathMappingDialog_11);
    setTitleImage(CDebugImages.get(CDebugImages.IMG_WIZBAN_PATH_MAPPING));

    Font font = parent.getFont();
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;//from  w w w .j  av a  2 s  .  co m
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    GridData data = new GridData(GridData.FILL_BOTH);
    composite.setLayoutData(data);
    composite.setFont(font);

    Dialog.applyDialogFont(composite);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(getShell(),
            ICDebugHelpContextIds.SOURCE_PATH_MAPPING_DIALOG);

    Composite nameComp = new Composite(composite, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    nameComp.setLayout(layout);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    nameComp.setLayoutData(data);
    nameComp.setFont(font);

    Label label = new Label(nameComp, SWT.LEFT);
    data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    label.setLayoutData(data);
    label.setFont(font);
    label.setText(SourceLookupUIMessages.PathMappingDialog_12);
    fNameText = new Text(nameComp, SWT.SINGLE | SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL);
    fNameText.setLayoutData(data);
    fNameText.setFont(font);
    fNameText.setText(getMapping().getName());
    fNameText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
        }
    });

    fViewer = createViewer(composite);
    data = new GridData(GridData.FILL_BOTH);
    fViewer.getControl().setLayoutData(data);
    fViewer.getControl().setFont(font);
    fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            updateButtons();
        }
    });

    Composite buttonComp = new Composite(composite, SWT.NONE);
    GridLayout buttonLayout = new GridLayout();
    buttonLayout.marginHeight = 0;
    buttonLayout.marginWidth = 0;
    buttonComp.setLayout(buttonLayout);
    data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
    buttonComp.setLayoutData(data);
    buttonComp.setFont(font);

    GC gc = new GC(parent);
    gc.setFont(parent.getFont());
    FontMetrics fontMetrics = gc.getFontMetrics();
    gc.dispose();

    fAddButton = createPushButton(buttonComp, SourceLookupUIMessages.PathMappingDialog_13, fontMetrics);
    fAddButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent evt) {
            MapEntryDialog dialog = new MapEntryDialog(getShell());
            if (dialog.open() == Window.OK) {
                getViewer().refresh();
            }
        }
    });

    fEditButton = createPushButton(buttonComp, SourceLookupUIMessages.PathMappingDialog_14, fontMetrics);
    fEditButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent evt) {
            MapEntrySourceContainer[] entries = getSelection();
            if (entries.length > 0) {
                MapEntryDialog dialog = new MapEntryDialog(getShell(), entries[0]);
                if (dialog.open() == Window.OK) {
                    getViewer().refresh();
                }
            }
        }
    });

    fRemoveButton = createPushButton(buttonComp, SourceLookupUIMessages.PathMappingDialog_15, fontMetrics);
    fRemoveButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent evt) {
            MapEntrySourceContainer[] entries = getSelection();
            for (int i = 0; i < entries.length; ++i) {
                fMapping.removeMapEntry(entries[i]);
            }
            getViewer().refresh();
        }
    });

    setMessage(null);
    fViewer.setInput(fMapping);

    return composite;
}