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

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

Introduction

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

Prototype

int BUTTON_BAR_HEIGHT

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

Click Source Link

Document

Height of button bar in dialog units (value 25).

Usage

From source file:org.eclipse.papyrus.infra.gmfdiag.widgets.editors.ColorPickerEditor.java

License:Open Source License

public ColorPickerEditor(Composite parent, int style) {
    super(parent, style);

    colorPicker = new Button(this, SWT.PUSH);
    doSetColor(0);/*from  w w w.j av a2 s. c o  m*/
    colorPicker.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            ColorPalettePopup colorPickerPopup = new ColorPalettePopup(getShell(),
                    IDialogConstants.BUTTON_BAR_HEIGHT);
            colorPickerPopup.setPreviousColor(getValue());
            Rectangle r = colorPicker.getBounds();
            Point location = colorPicker.getParent().toDisplay(r.x, r.y);
            colorPickerPopup.open(new Point(location.x, location.y + r.height));
            if (colorPickerPopup.getSelectedColor() == null && !colorPickerPopup.useDefaultColor()) {
                return;
            }
            setColor(colorPickerPopup.getSelectedColor());
            commit();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            //Nothing
        }
    });
}

From source file:org.eclipse.papyrus.tabbedproperties.appearance.GradientSection.java

License:Open Source License

/**
 * Allow user to change the color of the given button.
 * /*from  w w w .  j ava  2 s  .  c  om*/
 * @param button
 *        the button
 * @return the selected color or null
 * @see org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ColorPalettePopup
 */
private RGB changeColor(Button button) {
    ColorPalettePopup popup = new ColorPalettePopup(button.getParent().getShell(),
            IDialogConstants.BUTTON_BAR_HEIGHT);
    Rectangle r = button.getBounds();
    Point location = button.getParent().toDisplay(r.x, r.y);
    popup.open(new Point(location.x, location.y + r.height));
    if (popup.getSelectedColor() == null && !popup.useDefaultColor()) {
        return null;
    }
    return popup.getSelectedColor();
}

From source file:org.eclipse.papyrus.widgets.gmf.editors.ColorPickerEditor.java

License:Open Source License

public ColorPickerEditor(Composite parent, int style) {
    super(parent, style);

    colorPicker = new Button(this, SWT.PUSH);
    doSetColor(0);/*w w  w  .ja  va  2 s .c om*/
    colorPicker.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            ColorPalettePopup colorPickerPopup = new ColorPalettePopup(getShell(),
                    IDialogConstants.BUTTON_BAR_HEIGHT);
            Rectangle r = colorPicker.getBounds();
            Point location = colorPicker.getParent().toDisplay(r.x, r.y);
            colorPickerPopup.open(new Point(location.x, location.y + r.height));
            if (colorPickerPopup.getSelectedColor() == null && !colorPickerPopup.useDefaultColor()) {
                return;
            }
            setColor(colorPickerPopup.getSelectedColor());
            commit();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            //Nothing
        }
    });
}

From source file:org.eclipse.php.internal.debug.ui.wizards.DebuggerCompositeFragment.java

License:Open Source License

private void repaint() {
    Shell shell = this.getShell();
    Point previousSize = new Point(shell.getSize().x, shell.getSize().y);
    Rectangle previousClientArea = shell.getClientArea();
    shell.layout(true, true);// w  w w. ja v a2  s.  c  om
    final Point computedSize = shell.computeSize(previousClientArea.width, SWT.DEFAULT, false);
    boolean resize = computedSize.y > previousSize.y;
    if (resize) {
        shell.setSize(shell.computeSize(previousClientArea.width,
                computedSize.y - IDialogConstants.BUTTON_BAR_HEIGHT, true));
    } else {
        // Workaround for incorrect redrawing in GTK 3
        shell.setRedraw(false);
        shell.setSize(shell.computeSize(previousClientArea.width + 1, previousClientArea.height, true));
        shell.setRedraw(true);
        shell.setSize(shell.computeSize(previousClientArea.width, previousClientArea.height, true));
    }
}

From source file:org.eclipse.sirius.diagram.ui.tools.internal.properties.DiagramColorAndFontPropertySection.java

License:Open Source License

/**
 * {@inheritDoc}//from w  ww .  j  a v  a2 s  .co m
 * 
 * @overides
 * 
 * @see org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ColorsAndFontsPropertySection#changeColor(org.eclipse.swt.events.SelectionEvent,
 *      org.eclipse.swt.widgets.Button, java.lang.String, java.lang.String,
 *      org.eclipse.jface.resource.ImageDescriptor)
 */
@Override
protected RGB changeColor(final SelectionEvent event, final Button button, final String propertyId,
        final String commandName, final ImageDescriptor imageDescriptor) {

    RGB colorToReturn = null;

    if (!Properties.ID_FILLCOLOR.equals(propertyId) && !Properties.ID_LINECOLOR.equals(propertyId)
            && !Properties.ID_FONTCOLOR.equals(propertyId)) {
        colorToReturn = super.changeColor(event, button, propertyId, commandName, imageDescriptor);
    } else {
        final ColorPalettePopup popup = new ColorPalettePopup(button.getParent().getShell(),
                IDialogConstants.BUTTON_BAR_HEIGHT);
        final Rectangle r = button.getBounds();
        final Point location = button.getParent().toDisplay(r.x, r.y);
        popup.open(new Point(location.x, location.y + r.height));
        if (popup.getSelectedColor() == null && !popup.useDefaultColor()) {
            return null;
        }
        // selectedColor should be null if we are to use the default color
        final RGB selectedColor = popup.getSelectedColor();

        final EStructuralFeature feature = (EStructuralFeature) PackageUtil.getElement(propertyId);

        // Update model in response to user

        final List<ICommand> commands = new ArrayList<ICommand>();
        final Iterator<?> it = getInputIterator();

        colorToReturn = selectedColor;
        RGB color = selectedColor;
        while (it.hasNext()) {
            final IGraphicalEditPart ep = (IGraphicalEditPart) it.next();
            color = selectedColor;
            if (popup.useDefaultColor()) {
                final Object preferredValue = ep.getPreferredValue(feature);
                if (preferredValue instanceof Integer) {
                    color = FigureUtilities.integerToRGB((Integer) preferredValue);
                }
            }

            // If we are using default colors, we want to return the color
            // of the first selected element to be consistent
            if (colorToReturn == null) {
                colorToReturn = color;
            }

            if (color != null) {
                final RGB finalColor = color; // need a final variable
                commands.add(createCommand(commandName, ((View) ep.getModel()).eResource(), new Runnable() {

                    public void run() {
                        final ENamedElement element = PackageUtil.getElement(propertyId);
                        if (element instanceof EStructuralFeature) {
                            ep.setStructuralFeatureValue(feature, FigureUtilities.RGBToInteger(finalColor));
                        }

                        // get the view.
                        final View view = (View) ep.getModel();
                        // change the color.
                        final UserFixedColor newColor = DescriptionFactory.eINSTANCE.createUserFixedColor();
                        newColor.setName("<anonymous>");
                        newColor.setBlue(finalColor.blue);
                        newColor.setGreen(finalColor.green);
                        newColor.setRed(finalColor.red);

                        IInterpreter interpreter = new EObjectQuery(view).getSession().getInterpreter();
                        new ViewPropertiesSynchronizer().synchronizeDDiagramElementStyleColorProperties(view,
                                newColor, propertyId, interpreter);
                    }
                }));
            }
        }
        if (!commands.isEmpty()) {
            executeAsCompositeCommand(commandName, commands);
            final Image overlyedImage = new ColorOverlayImageDescriptor(imageDescriptor.getImageData(), color)
                    .createImage();
            disposeImage(button.getImage());
            button.setImage(overlyedImage);
        }
    }
    return colorToReturn;

}

From source file:org.eclipse.sirius.diagram.ui.tools.internal.properties.DiagramConnectionAppearancePropertySection.java

License:Open Source License

/**
 * {@inheritDoc}/*from ww w . ja v  a  2 s.co m*/
 * 
 * @see org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ColorsAndFontsPropertySection#changeColor(org.eclipse.swt.events.SelectionEvent,
 *      org.eclipse.swt.widgets.Button, java.lang.String, java.lang.String,
 *      org.eclipse.jface.resource.ImageDescriptor)
 */
@Override
protected RGB changeColor(final SelectionEvent event, final Button button, final String propertyId,
        final String commandName, final ImageDescriptor imageDescriptor) {

    RGB colorToReturn = null;
    if (!Properties.ID_FILLCOLOR.equals(propertyId) && !Properties.ID_LINECOLOR.equals(propertyId)
            && !Properties.ID_FONTCOLOR.equals(propertyId)) {
        colorToReturn = super.changeColor(event, button, propertyId, commandName, imageDescriptor);
    } else {
        final ColorPalettePopup popup = new ColorPalettePopup(button.getParent().getShell(),
                IDialogConstants.BUTTON_BAR_HEIGHT);
        // popup.setPreviousColor(previousColor);
        final Rectangle r = button.getBounds();
        final Point location = button.getParent().toDisplay(r.x, r.y);
        popup.open(new Point(location.x, location.y + r.height));
        if (popup.getSelectedColor() == null && !popup.useDefaultColor()) {
            return null;
        }
        // selectedColor should be null if we are to use the default color
        final RGB selectedColor = popup.getSelectedColor();

        final EStructuralFeature feature = (EStructuralFeature) PackageUtil.getElement(propertyId);

        // Update model in response to user

        final List<ICommand> commands = new ArrayList<ICommand>();
        final Iterator<?> it = getInputIterator();

        colorToReturn = selectedColor;
        RGB color = selectedColor;
        while (it.hasNext()) {
            final IGraphicalEditPart ep = (IGraphicalEditPart) it.next();

            color = selectedColor;
            if (popup.useDefaultColor()) {
                final Object preferredValue = ep.getPreferredValue(feature);
                if (preferredValue instanceof Integer) {
                    color = FigureUtilities.integerToRGB((Integer) preferredValue);
                }
            }

            // If we are using default colors, we want to return the color
            // of the first selected element to be consistent
            if (colorToReturn == null) {
                colorToReturn = color;
            }

            if (color != null) {
                final RGB finalColor = color; // need a final variable
                commands.add(createCommand(commandName, ((View) ep.getModel()).eResource(), new Runnable() {

                    public void run() {
                        final ENamedElement element = PackageUtil.getElement(propertyId);
                        if (element instanceof EStructuralFeature) {
                            ep.setStructuralFeatureValue(feature, FigureUtilities.RGBToInteger(finalColor));
                        }

                        // get the view.
                        final View view = (View) ep.getModel();

                        // change the color.
                        final UserFixedColor newColor = DescriptionFactory.eINSTANCE.createUserFixedColor();
                        newColor.setName("<anonymous>");
                        newColor.setBlue(finalColor.blue);
                        newColor.setGreen(finalColor.green);
                        newColor.setRed(finalColor.red);

                        IInterpreter interpreter = new EObjectQuery(view).getSession().getInterpreter();
                        new ViewPropertiesSynchronizer().synchronizeDDiagramElementStyleColorProperties(view,
                                newColor, propertyId, interpreter);
                    }
                }));
            }
        }
        if (!commands.isEmpty()) {
            executeAsCompositeCommand(commandName, commands);
            final Image overlyedImage = new ColorOverlayImageDescriptor(imageDescriptor.getImageData(), color)
                    .createImage();
            disposeImage(button.getImage());
            button.setImage(overlyedImage);
        }
    }
    return colorToReturn;
}

From source file:org.eclipse.sirius.diagram.ui.tools.internal.properties.DiagramShapeColorAndFontPropertySection.java

License:Open Source License

/**
 * {@inheritDoc}//from  w ww. j a v  a  2s  .  c o m
 * 
 * @overrides
 * 
 * @see org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ColorsAndFontsPropertySection#changeColor(org.eclipse.swt.events.SelectionEvent,
 *      org.eclipse.swt.widgets.Button, java.lang.String, java.lang.String,
 *      org.eclipse.jface.resource.ImageDescriptor)
 */
@Override
protected RGB changeColor(final SelectionEvent event, final Button button, final String propertyId,
        final String commandName, final ImageDescriptor imageDescriptor) {

    RGB colorToReturn = null;

    if (!Properties.ID_FILLCOLOR.equals(propertyId) && !Properties.ID_LINECOLOR.equals(propertyId)
            && !Properties.ID_FONTCOLOR.equals(propertyId)) {
        colorToReturn = super.changeColor(event, button, propertyId, commandName, imageDescriptor);
    } else {
        final ColorPalettePopup popup = new ColorPalettePopup(button.getParent().getShell(),
                IDialogConstants.BUTTON_BAR_HEIGHT);
        final Rectangle r = button.getBounds();
        final Point location = button.getParent().toDisplay(r.x, r.y);
        popup.open(new Point(location.x, location.y + r.height));
        if (popup.getSelectedColor() == null && !popup.useDefaultColor()) {
            return null;
        }
        // selectedColor should be null if we are to use the default color
        final RGB selectedColor = popup.getSelectedColor();

        final EStructuralFeature feature = (EStructuralFeature) PackageUtil.getElement(propertyId);

        // Update model in response to user

        final List<ICommand> commands = new ArrayList<ICommand>();
        final Iterator<?> it = getInputIterator();

        colorToReturn = selectedColor;
        RGB color = selectedColor;
        while (it.hasNext()) {
            final IGraphicalEditPart ep = (IGraphicalEditPart) it.next();
            color = selectedColor;
            if (popup.useDefaultColor()) {
                final Object preferredValue = ep.getPreferredValue(feature);
                if (preferredValue instanceof Integer) {
                    color = FigureUtilities.integerToRGB((Integer) preferredValue);
                }
            }

            // If we are using default colors, we want to return the color
            // of the first selected element to be consistent
            if (colorToReturn == null) {
                colorToReturn = color;
            }

            if (color != null) {
                final RGB finalColor = color; // need a final variable
                commands.add(createCommand(commandName, ((View) ep.getModel()).eResource(), new Runnable() {

                    @Override
                    public void run() {
                        final ENamedElement element = PackageUtil.getElement(propertyId);
                        if (element instanceof EStructuralFeature) {
                            ep.setStructuralFeatureValue(feature, FigureUtilities.RGBToInteger(finalColor));
                        }

                        // get the view.
                        final View view = (View) ep.getModel();
                        // change the color.
                        final UserFixedColor newColor = DescriptionFactory.eINSTANCE.createUserFixedColor();
                        newColor.setName("<anonymous>");
                        newColor.setBlue(finalColor.blue);
                        newColor.setGreen(finalColor.green);
                        newColor.setRed(finalColor.red);

                        IInterpreter interpreter = new EObjectQuery(view).getSession().getInterpreter();
                        // new
                        // ViewPropertiesSynchronizer().synchronizeDDiagramElementStyleProperties(view);
                        new ViewPropertiesSynchronizer().synchronizeDDiagramElementStyleColorProperties(view,
                                newColor, propertyId, interpreter);
                    }

                }));
            }
        }
        if (!commands.isEmpty()) {
            executeAsCompositeCommand(commandName, commands);
            final Image overlyedImage = new ColorOverlayImageDescriptor(imageDescriptor.getImageData(), color)
                    .createImage();
            disposeImage(button.getImage());
            button.setImage(overlyedImage);
        }
    }
    return colorToReturn;

}

From source file:org.eclipse.sirius.diagram.ui.tools.internal.properties.LabelColorAndFontPropertySection.java

License:Open Source License

@Override
protected RGB changeColor(final SelectionEvent event, final Button button, final String propertyId,
        final String commandName, final ImageDescriptor imageDescriptor) {

    RGB colorToReturn = null;//from w  w  w  . j  a  v  a2s .  c  o m

    if (!Properties.ID_FILLCOLOR.equals(propertyId) && !Properties.ID_LINECOLOR.equals(propertyId)
            && !Properties.ID_FONTCOLOR.equals(propertyId)) {
        colorToReturn = super.changeColor(event, button, propertyId, commandName, imageDescriptor);
    } else {
        final ColorPalettePopup popup = new ColorPalettePopup(button.getParent().getShell(),
                IDialogConstants.BUTTON_BAR_HEIGHT);
        final Rectangle r = button.getBounds();
        final Point location = button.getParent().toDisplay(r.x, r.y);
        popup.open(new Point(location.x, location.y + r.height));
        if (popup.getSelectedColor() == null && !popup.useDefaultColor()) {
            return null;
        }
        // selectedColor should be null if we are to use the default color
        final RGB selectedColor = popup.getSelectedColor();

        final EStructuralFeature feature = (EStructuralFeature) PackageUtil.getElement(propertyId);

        // Update model in response to user

        final List<ICommand> commands = new ArrayList<ICommand>();
        final Iterator<?> it = getInputIterator();

        colorToReturn = selectedColor;
        RGB color = selectedColor;
        while (it.hasNext()) {
            final IGraphicalEditPart ep = (IGraphicalEditPart) it.next();
            color = selectedColor;
            if (popup.useDefaultColor()) {
                final Object preferredValue = ep.getPreferredValue(feature);
                if (preferredValue instanceof Integer) {
                    color = FigureUtilities.integerToRGB((Integer) preferredValue);
                }
            }

            // If we are using default colors, we want to return the color
            // of the first selected element to be consistent
            if (colorToReturn == null) {
                colorToReturn = color;
            }

            if (color != null) {
                final RGB finalColor = color; // need a final variable
                commands.add(createCommand(commandName, ((View) ep.getModel()).eResource(), new Runnable() {

                    @Override
                    public void run() {
                        final ENamedElement element = PackageUtil.getElement(propertyId);
                        if (element instanceof EStructuralFeature) {
                            ep.setStructuralFeatureValue(feature, FigureUtilities.RGBToInteger(finalColor));
                        }

                        // get the view.
                        final View view = (View) ep.getModel();
                        // change the color.
                        final UserFixedColor newColor = DescriptionFactory.eINSTANCE.createUserFixedColor();
                        newColor.setName("<anonymous>");
                        newColor.setBlue(finalColor.blue);
                        newColor.setGreen(finalColor.green);
                        newColor.setRed(finalColor.red);

                        IInterpreter interpreter = new EObjectQuery(view).getSession().getInterpreter();
                        // new
                        // ViewPropertiesSynchronizer().synchronizeDDiagramElementStyleProperties(view);
                        new ViewPropertiesSynchronizer().synchronizeDDiagramElementStyleColorProperties(view,
                                newColor, propertyId, interpreter);
                    }

                }));
            }
        }
        if (!commands.isEmpty()) {
            executeAsCompositeCommand(commandName, commands);
            final Image overlyedImage = new ColorOverlayImageDescriptor(imageDescriptor.getImageData(), color)
                    .createImage();
            disposeImage(button.getImage());
            button.setImage(overlyedImage);
        }
    }
    return colorToReturn;

}

From source file:org.eclipse.stp.bpmn.properties.section.ColorsAndFontsPropertySectionEx.java

License:Open Source License

/**
 * @param event -/*from  w  w  w. j a  va2  s. c o m*/
 *            selection event
 * @param button -
 *            event source
 * @param propertyId -
 *            id of the property
 * @param commandName -
 *            name of the command
 * @param imageDescriptor -
 *            the image to draw overlay on the button after the new color is
 *            set
 * @return - new RGB color, or null if none selected
 */
protected RGB changeColor(SelectionEvent event, Button button, final String propertyId, String commandName,
        ImageDescriptor imageDescriptor) {

    ColorPalettePopup popup = new ColorPalettePopup(button.getParent().getShell(),
            IDialogConstants.BUTTON_BAR_HEIGHT);
    //        popup.setPreviousColor(previousColor);
    Rectangle r = button.getBounds();
    Point location = button.getParent().toDisplay(r.x, r.y);
    popup.open(new Point(location.x, location.y + r.height));
    if (popup.getSelectedColor() == null && !popup.useDefaultColor()) {
        return null;
    }
    // selectedColor should be null if we are to use the default color
    final RGB selectedColor = popup.getSelectedColor();

    final EStructuralFeature feature = (EStructuralFeature) PackageUtil.getElement(propertyId);

    // Update model in response to user

    List commands = new ArrayList();
    Iterator it = getInputIterator();

    RGB colorToReturn = selectedColor;
    RGB color = selectedColor;
    while (it.hasNext()) {
        final IGraphicalEditPart ep = (IGraphicalEditPart) it.next();

        color = selectedColor;
        if (popup.useDefaultColor()) {
            Object preferredValue = ep.getPreferredValue(feature);
            if (preferredValue instanceof Integer) {
                color = FigureUtilities.integerToRGB((Integer) preferredValue);
            }
        }

        // If we are using default colors, we want to return the color of the first selected element to be consistent
        if (colorToReturn == null) {
            colorToReturn = color;
        }

        if (color != null) {
            final RGB finalColor = color; // need a final variable
            commands.add(createCommand(commandName, ((View) ep.getModel()).eResource(), new Runnable() {

                public void run() {
                    ENamedElement element = PackageUtil.getElement(propertyId);
                    if (element instanceof EStructuralFeature) {
                        IGraphicalEditPart editP = ep;
                        if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
                            editP = (IGraphicalEditPart) editP.getParent();
                        }
                        editP.setStructuralFeatureValue(feature, FigureUtilities.RGBToInteger(finalColor));
                    }
                }
            }));
        }
    }
    if (!commands.isEmpty()) {
        executeAsCompositeCommand(commandName, commands);
        Image overlyedImage = new ColorOverlayImageDescriptor(imageDescriptor.getImageData(), color)
                .createImage();
        disposeImage(button.getImage());
        button.setImage(overlyedImage);
    }
    return colorToReturn;
}

From source file:org.eclipse.titan.designer.properties.pages.MyListControl.java

License:Open Source License

/**
 * The constructor of the class.//  w  w w.jav a 2 s  . com
 * 
 * @param parent
 *                the parent composite.
 * @param title
 *                the title of this list control.
 * @param itemDescription
 *                the description of an item this list can contain, as
 *                it should be displayed in the add/edit dialog.
 * */
public MyListControl(final Composite parent, final String title, final String itemDescription) {
    Composite mainComposite = new Composite(parent, SWT.NONE);
    GridLayout form1 = new GridLayout();
    form1.numColumns = 1;
    form1.horizontalSpacing = 0;
    form1.verticalSpacing = 0;
    form1.marginHeight = 0;
    form1.marginWidth = 0;
    mainComposite.setLayout(form1);
    mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));

    // title composite
    Composite titleComposite = new Composite(mainComposite, SWT.BORDER);
    GridLayout titleform = new GridLayout(2, false);
    titleform.horizontalSpacing = 0;
    titleform.verticalSpacing = 0;
    titleform.marginHeight = 0;
    titleform.marginWidth = 0;
    titleComposite.setLayout(titleform);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.heightHint = IDialogConstants.BUTTON_BAR_HEIGHT;
    titleComposite.setLayoutData(data);

    this.title = new Label(titleComposite, SWT.NONE | SWT.BOLD);
    this.title.setText(title);
    GridData titleGrid = new GridData(GridData.FILL_HORIZONTAL);
    this.title.setLayoutData(titleGrid);

    // button panel
    Composite buttonPanel = new Composite(titleComposite, SWT.NONE);
    GridLayout form2 = new GridLayout();
    form2.numColumns = 5;
    form2.horizontalSpacing = 0;
    form2.verticalSpacing = 0;
    form2.marginWidth = 0;
    form2.marginHeight = 0;
    buttonPanel.setLayout(form2);

    GridData buttonGrid = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END);
    buttonPanel.setLayoutData(buttonGrid);

    // toolbar
    toolBar = new ToolBar(buttonPanel, SWT.HORIZONTAL | SWT.RIGHT | SWT.FLAT);
    // add toolbar item
    addItem = new ToolItem(toolBar, SWT.PUSH);
    addItem.setImage(imgAdd);
    addItem.setDisabledImage(imgAddDisabled);
    addItem.setToolTipText("Add");
    addItem.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            addNewItem();
        }
    });
    // delete toolbar item
    deleteItem = new ToolItem(toolBar, SWT.PUSH);
    deleteItem.setImage(imgDelete);
    deleteItem.setDisabledImage(imgDeleteDisabled);
    deleteItem.setToolTipText("Delete");
    deleteItem.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            removeSelectedItem();
        }
    });
    // edit toolbar item
    editItem = new ToolItem(toolBar, SWT.PUSH);
    editItem.setImage(imgEdit);
    editItem.setDisabledImage(imgEditDisabled);
    editItem.setToolTipText("Edit");
    editItem.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            editSelectedItem();
        }
    });
    // moveup toolbar item
    moveUpItem = new ToolItem(toolBar, SWT.PUSH);
    moveUpItem.setImage(imgMoveUp);
    moveUpItem.setDisabledImage(imgMoveUpDisabled);
    moveUpItem.setToolTipText("Move up");
    moveUpItem.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            moveUpSelectedItem();
        }
    });
    // movedown toolbar item
    moveDownItem = new ToolItem(toolBar, SWT.PUSH);
    moveDownItem.setImage(imgMoveDown);
    moveDownItem.setDisabledImage(imgMoveDownDisabled);
    moveDownItem.setToolTipText("Move down");
    moveDownItem.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            moveDownSelectedItem();
        }
    });

    // list control
    list = new List(mainComposite, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
    GridData listGrid = new GridData(GridData.FILL_BOTH);
    // force the list to be no wider than the title bar
    Point preferredSize = titleComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    listGrid.widthHint = preferredSize.x;
    listGrid.heightHint = preferredSize.y * 3;
    listGrid.horizontalSpan = 2;
    list.setLayoutData(listGrid);
    list.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            selectionChanged();
        }
    });

    // Add a double-click event handler
    list.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseDoubleClick(final MouseEvent e) {
            editSelectedItem();
        }
    });
    // Add a delete event handler
    list.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(final KeyEvent e) {
            if (e.keyCode == SWT.DEL) {
                removeSelectedItem();
            } else {
                super.keyPressed(e);
            }
        }
    });

    this.itemDescription = itemDescription;
    selectionChanged();
}