1 package net.sourceforge.phpdt.internal.ui.dialogs;
3 import java.util.Arrays;
6 import org.eclipse.jface.viewers.ILabelProvider;
7 import org.eclipse.swt.widgets.Composite;
8 import org.eclipse.swt.widgets.Control;
9 import org.eclipse.swt.widgets.Shell;
12 * A class to select elements out of a list of elements.
14 public class ElementListSelectionDialog extends
15 AbstractElementListSelectionDialog {
17 private Object[] fElements;
20 * Creates a list selection dialog.
27 public ElementListSelectionDialog(Shell parent, ILabelProvider renderer) {
28 super(parent, renderer);
32 * Sets the elements of the list.
35 * the elements of the list.
37 public void setElements(Object[] elements) {
42 * @see SelectionStatusDialog#computeResult()
44 protected void computeResult() {
45 setResult(Arrays.asList(getSelectedElements()));
49 * @see Dialog#createDialogArea(Composite)
51 protected Control createDialogArea(Composite parent) {
52 Composite contents = (Composite) super.createDialogArea(parent);
54 createMessageArea(contents);
55 createFilterText(contents);
56 createFilteredList(contents);
58 setListElements(fElements);
60 List initialSelections = getInitialElementSelections();
61 if (initialSelections != null)
62 setSelection(initialSelections.toArray());