Esempio n. 1
0
    private HistoryListDialog(Shell shell, IModelElement[] elements) {
      super(shell);
      setTitle(TypeHierarchyMessages.HistoryListDialog_title);

      String[] buttonLabels =
          new String[] {
            TypeHierarchyMessages.HistoryListDialog_remove_button,
          };

      IListAdapter adapter =
          new IListAdapter() {
            public void customButtonPressed(ListDialogField field, int index) {
              doCustomButtonPressed();
            }

            public void selectionChanged(ListDialogField field) {
              doSelectionChanged();
            }

            public void doubleClicked(ListDialogField field) {
              doDoubleClicked();
            }
          };

      ModelElementLabelProvider labelProvider =
          new ModelElementLabelProvider(
              ModelElementLabelProvider.SHOW_QUALIFIED | ModelElementLabelProvider.SHOW_ROOT);

      fHistoryList = new ListDialogField(adapter, buttonLabels, labelProvider);
      fHistoryList.setLabelText(TypeHierarchyMessages.HistoryListDialog_label);
      fHistoryList.setElements(Arrays.asList(elements));

      ISelection sel;
      if (elements.length > 0) {
        sel = new StructuredSelection(elements[0]);
      } else {
        sel = new StructuredSelection();
      }

      fHistoryList.selectElements(sel);
    }