コード例 #1
0
ファイル: CatForm.java プロジェクト: utamons/tm2-swt
 @Override
 protected CellEditor getCellEditor(Object element) {
   final TextCellEditor result = new TextCellEditor(viewer.getTable());
   result.setValidator(new NumberCellValidator());
   result.addListener(new CellEditorListener(shell, result));
   return result;
 }
コード例 #2
0
ファイル: CatForm.java プロジェクト: utamons/tm2-swt
  private void setContent() {
    CatFormInit init = new CatFormInit(cfg);

    Label lblName = init.lblName(this);
    txtName = init.txtName(this, lblName);
    Label lblAbbrev = init.lblAbbrev(this, lblName);
    txtAbbrev = init.txtAbbrev(this, lblAbbrev);
    virtCheck = init.virtCheck(this, txtAbbrev);
    Label lblRate = init.lblRate(this, lblAbbrev);

    Composite tableContainer = new Composite(this, SWT.SHADOW_ETCHED_IN);
    rateViewer = init.catRateViewer(tableContainer, getShell(), contentProvider);
    init.tableContainer(lblRate, tableContainer);
    tblRate = rateViewer.getTable();

    addBtn = init.addBtn(this, lblRate, tableContainer);
    delBtn = init.delBtn(this, lblRate, tableContainer);
    Label lblComment = init.lblComment(this, tableContainer);
    txtComment = init.txtComment(this, lblComment);

    txtName.addFocusListener(new RefreshFocusLsnr());
    txtAbbrev.addFocusListener(new RefreshFocusLsnr());
    txtComment.addFocusListener(new RefreshFocusLsnr());

    virtCheck.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            tblRate.setEnabled(!virtCheck.getSelection());
            addBtn.setEnabled(!virtCheck.getSelection());
            delBtn.setEnabled(!virtCheck.getSelection());
            refreshListener.refresh(); // освежим данные в дереве и в базе
          }
        });

    addBtn.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            contentProvider.append();
            rateViewer.refresh();
          }
        });

    delBtn.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            int selIdx = rateViewer.getTable().getSelectionIndex();
            if (selIdx >= 0) {
              contentProvider.deleteAt(selIdx);
            }
            rateViewer.refresh();
            Table table = rateViewer.getTable();
            int lastPos = table.getItemCount() - 1;
            table.setSelection(lastPos);
          }
        });
  }
コード例 #3
0
  @Override
  public void modelChanged(IModelChangedEvent event) {
    if (event.getChangeType() == IModelChangedEvent.WORLD_CHANGED) {
      fHeader = null;
      markStale();
      return;
    }

    if (getExportedPackageHeader().equals(event.getChangedProperty())) {
      refresh();
      // Bug 171896
      // Since the model sends a CHANGE event instead of
      // an INSERT event on the very first addition to the empty table
      // Selection should fire here to take this first insertion into account
      Object lastElement =
          fPackageViewer.getElementAt(fPackageViewer.getTable().getItemCount() - 1);
      if (lastElement != null) {
        fPackageViewer.setSelection(new StructuredSelection(lastElement));
      }

      return;
    }

    Object[] objects = event.getChangedObjects();
    for (Object changedObject : objects) {
      if (changedObject instanceof ExportPackageObject) {
        ExportPackageObject object = (ExportPackageObject) changedObject;
        switch (event.getChangeType()) {
          case IModelChangedEvent.INSERT:
            fPackageViewer.add(object);
            fPackageViewer.setSelection(new StructuredSelection(object), false);
            fPackageViewer.getTable().setFocus();
            break;
          case IModelChangedEvent.REMOVE:
            Table table = fPackageViewer.getTable();
            int index = table.getSelectionIndex();
            fPackageViewer.remove(object);
            table.setSelection(index < table.getItemCount() ? index : table.getItemCount() - 1);
            break;
          default:
            fPackageViewer.refresh(object);
        }
      }
    }
  }
コード例 #4
0
 private void handleAdd() {
   IStructuredSelection ssel = (IStructuredSelection) fAvailableListViewer.getSelection();
   if (ssel.size() > 0) {
     Table table = fAvailableListViewer.getTable();
     int index = table.getSelectionIndices()[0];
     doAdd(ssel.toList());
     table.setSelection(index < table.getItemCount() ? index : table.getItemCount() - 1);
     pageChanged(true, false);
   }
 }
コード例 #5
0
  private void updateButtons() {
    Object[] selected = ((IStructuredSelection) fPackageViewer.getSelection()).toArray();

    TablePart tablePart = getTablePart();
    tablePart.setButtonEnabled(ADD_INDEX, canAddExportedPackages());
    tablePart.setButtonEnabled(REMOVE_INDEX, isEditable() && selected.length > 0);
    tablePart.setButtonEnabled(PROPERTIES_INDEX, shouldEnableProperties(selected));
    tablePart.setButtonEnabled(
        CALCULATE_USE_INDEX, isEditable() && fPackageViewer.getTable().getItemCount() > 0);
  }
コード例 #6
0
ファイル: CatForm.java プロジェクト: utamons/tm2-swt
 @SuppressWarnings({"unchecked"})
 @Override
 protected CellEditor getCellEditor(Object element) {
   EntityManager em = DbHelper.getEm();
   Query query = em.createQuery("select r from RateRbEntity r");
   rates = query.getResultList();
   String rNames[] = new String[rates.size()];
   for (int i = 0; i < rates.size(); ++i) {
     rNames[i] = rates.get(i).getName();
   }
   return new ComboBoxCellEditor(viewer.getTable(), rNames);
 }
コード例 #7
0
  private void updateButtonEnablement(boolean doAddEnablement, boolean doRemoveEnablement) {
    updateCount();
    int availableCount = fAvailableListViewer.getTable().getItemCount();
    int importCount = fImportListViewer.getTable().getItemCount();

    if (doAddEnablement) updateSelectionBasedEnablement(fAvailableListViewer.getSelection(), true);
    if (doRemoveEnablement) updateSelectionBasedEnablement(fImportListViewer.getSelection(), false);

    fAddAllButton.setEnabled(availableCount > 0);
    fRemoveAllButton.setEnabled(importCount > 0);
    fAddRequiredButton.setEnabled(importCount > 0);
  }
コード例 #8
0
  private void handleAddAll() {
    TableItem[] items = fAvailableListViewer.getTable().getItems();

    ArrayList<Object> data = new ArrayList<>();
    for (int i = 0; i < items.length; i++) {
      data.add(items[i].getData());
    }
    if (data.size() > 0) {
      doAdd(data);
      pageChanged(true, false);
    }
  }
コード例 #9
0
 /** @param event */
 private void handleModelEventWorldChanged(IModelChangedEvent event) {
   // This section can get disposed if the configuration is changed from
   // plugins to features or vice versa.  Subsequently, the configuration
   // page is removed and readded.  In this circumstance, abort the
   // refresh
   if (fPluginTable.getTable().isDisposed()) {
     return;
   }
   // Reload the input
   fPluginTable.setInput(getProduct());
   // Perform the refresh
   refresh();
 }
コード例 #10
0
  private void updateCount() {
    if (fCountTotal <= 0) {
      // Since we filter the list of available plug-ins the total may differ from the model count
      fCountTotal = fAvailableListViewer.getTable().getItemCount();
    }

    fCountLabel.setText(
        NLS.bind(
            PDEUIMessages.ImportWizard_DetailedPage_count,
            (new String[] {
              Integer.toString(fImportListViewer.getTable().getItemCount()),
              Integer.toString(fCountTotal)
            })));
    fCountLabel.getParent().layout();
  }
コード例 #11
0
 private void createImpTable(Composite container) {
   fElementViewer = new TableViewer(container, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
   GridData gd = new GridData(GridData.FILL_BOTH);
   gd.heightHint = 250;
   fElementViewer.getControl().setLayoutData(gd);
   fElementViewer.getControl().setFont(container.getFont());
   fElementViewer.setContentProvider(
       new DefaultTableProvider() {
         public Object[] getElements(Object inputElement) {
           ITargetDefinition target = getTargetDefinition();
           if (target != null) {
             NameVersionDescriptor[] bundles = target.getImplicitDependencies();
             if (bundles != null) {
               return bundles;
             }
           }
           return new NameVersionDescriptor[0];
         }
       });
   fElementViewer.setLabelProvider(new StyledBundleLabelProvider(false, false));
   fElementViewer.setInput(PDEPlugin.getDefault());
   fElementViewer.setComparator(
       new ViewerComparator() {
         public int compare(Viewer viewer, Object e1, Object e2) {
           NameVersionDescriptor bundle1 = (NameVersionDescriptor) e1;
           NameVersionDescriptor bundle2 = (NameVersionDescriptor) e2;
           return super.compare(viewer, bundle1.getId(), bundle2.getId());
         }
       });
   fElementViewer.addSelectionChangedListener(
       new ISelectionChangedListener() {
         public void selectionChanged(SelectionChangedEvent event) {
           updateImpButtons();
         }
       });
   fElementViewer
       .getTable()
       .addKeyListener(
           new KeyAdapter() {
             public void keyPressed(KeyEvent e) {
               if (e.character == SWT.DEL && e.stateMask == 0) {
                 handleRemove();
               }
             }
           });
 }
コード例 #12
0
 private void updateRemoveButtons(boolean updateRemove, boolean updateRemoveAll) {
   TablePart tablePart = getTablePart();
   Table table = tablePart.getTableViewer().getTable();
   TableItem[] tableSelection = table.getSelection();
   if (updateRemove) {
     ISelection selection = getViewerSelection();
     tablePart.setButtonEnabled(
         3,
         isEditable()
             && !selection.isEmpty()
             && selection instanceof IStructuredSelection
             && ((IStructuredSelection) selection).getFirstElement() instanceof IProductPlugin);
   }
   int count = fPluginTable.getTable().getItemCount();
   if (updateRemoveAll) tablePart.setButtonEnabled(4, isEditable() && count > 0);
   tablePart.setButtonEnabled(2, isEditable() && count > 0);
   tablePart.setButtonEnabled(5, isEditable() && tableSelection.length == 1);
 }
コード例 #13
0
  private void handleSwap() {
    TableItem[] aItems = fAvailableListViewer.getTable().getItems();
    TableItem[] iItems = fImportListViewer.getTable().getItems();

    ArrayList<Object> data = new ArrayList<>();
    for (int i = 0; i < iItems.length; i++) {
      data.add(iItems[i].getData());
    }
    if (data.size() > 0) {
      doRemove(data);
    }

    data.clear();
    for (int i = 0; i < aItems.length; i++) {
      data.add(aItems[i].getData());
    }
    if (data.size() > 0) {
      doAdd(data);
    }
    pageChanged();
  }
コード例 #14
0
  /* (non-Javadoc)
   * @see org.eclipse.pde.internal.ui.editor.PDESection#modelChanged(org.eclipse.pde.core.IModelChangedEvent)
   */
  public void modelChanged(IModelChangedEvent e) {
    // No need to call super, handling world changed event here
    if (e.getChangeType() == IModelChangedEvent.WORLD_CHANGED) {
      handleModelEventWorldChanged(e);
      return;
    }
    Object[] objects = e.getChangedObjects();
    if (e.getChangeType() == IModelChangedEvent.INSERT) {
      for (int i = 0; i < objects.length; i++) {
        if (objects[i] instanceof IProductPlugin) fPluginTable.add(objects[i]);
      }
    } else if (e.getChangeType() == IModelChangedEvent.REMOVE) {

      Table table = fPluginTable.getTable();
      int index = table.getSelectionIndex();

      for (int i = 0; i < objects.length; i++) {
        if (objects[i] instanceof IProductPlugin) fPluginTable.remove(objects[i]);
      }

      // Update Selection

      int count = table.getItemCount();

      if (count == 0) {
        // Nothing to select
      } else if (index < count) {
        table.setSelection(index);
      } else {
        table.setSelection(count - 1);
      }

    } else if (e.getChangeType() == IModelChangedEvent.CHANGE) {
      fPluginTable.refresh();
    }
    updateRemoveButtons(false, true);
  }
コード例 #15
0
 private void updateImpButtons() {
   boolean empty = fElementViewer.getSelection().isEmpty();
   fRemoveButton.setEnabled(!empty);
   boolean hasElements = fElementViewer.getTable().getItemCount() > 0;
   fRemoveAllButton.setEnabled(hasElements);
 }
コード例 #16
0
 @Override
 public Table getColumnWidget() {
   return mViewer != null ? mViewer.getTable() : null;
 }
コード例 #17
0
  private void createComp(Composite group) {

    GridLayout layout = new GridLayout(1, false);
    layout.verticalSpacing = 10;
    group.setLayout(layout);

    // TableViewer是通过Table来布局的
    // 制作表格   MULTI可多选  H_SCROLL有水平 滚动条、V_SCROLL有垂直滚动条、BORDER有边框、FULL_SELECTION整行选择
    table = new Table(group, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER | SWT.VIRTUAL); // 注意此处的设置
    TableLayout tableLayout = new TableLayout();
    table.setLayout(tableLayout);

    // 指定Table单元格的宽度和高度
    table.addListener(
        SWT.MeasureItem,
        new Listener() { // 向表格增加一个SWT.MeasureItem监听器,每当需要单元内容的大小的时候就会被调用。
          public void handleEvent(Event event) {
            event.width = table.getGridLineWidth(); // 设置宽度
            event.height =
                (int) Math.floor(event.gc.getFontMetrics().getHeight() * 1.5); // 设置高度为字体高度的1.5倍
          }
        });

    // 表格的视图
    tableViewer = new TableViewer(table);
    // 标题和网格线可见
    tableViewer.getTable().setLinesVisible(true);
    tableViewer.getTable().setHeaderVisible(true);
    // 设置填充
    // GridData data = new GridData(SWT.LEFT,SWT.CENTER, true, false);//SWT.FILL, SWT.FILL, true,
    // false  xbm
    GridData data = new GridData(GridData.FILL_BOTH);
    data.widthHint = 350;
    data.heightHint = 295;
    data.grabExcessHorizontalSpace = true;
    tableViewer.getTable().setLayoutData(data); // 表格的布局

    // 创建表格列的标题
    int width = 1;
    for (int i = 0; i < stationData.getColumnCount(); i++) {
      width = stationData.getColumnWidth(i);
      TableColumn column = new TableColumn(table, SWT.NONE);
      column.setWidth((int) (width * 8));
      column.setText(stationData.getColumnHeads()[i]); // 设置表头
      column.setAlignment(SWT.LEFT); // 对齐方式SWT.LEFT
      if (i == 0) // 站名
      {
        // 列的选择事件  实现排序
        column.addSelectionListener(
            new SelectionAdapter() {
              boolean sortType = true; // sortType记录上一次的排序方式,默认为升序

              public void widgetSelected(SelectionEvent e) {
                sortType = !sortType; // 取反。下一次排序方式要和这一次的相反
                tableViewer.setSorter(new StationSorter(sortType, stationData.columnHeads[0]));
              }
            });
      }
    }

    /*tableLayout.addColumnData(new ColumnWeightData(8, 8, false));//设置列宽为8像素
     TableColumn column_one = new TableColumn(table, SWT.NONE);//SWT.LEFT
     column_one.setText(stationData.COLUMN_HEADINGS[0]);//设置表头
     column_one.setAlignment(SWT.LEFT);//对齐方式SWT.LEFT
     column.setWidth(10);//宽度
    */

    // 设置标题的提供者
    tableViewer.setLabelProvider(new TableLabelProvider());

    // 设置表格视图的内容提供者
    tableViewer.setContentProvider(new TableContentProvider());

    // 设置列的属性.
    tableViewer.setColumnProperties(stationData.columnHeads);

    // 定义每一列的别名
    tableViewer.setColumnProperties(new String[] {"name", "down", "up", "map"});

    // 设置每一列的单元格编辑组件CellEditor
    CellEditor[] celleditors = new CellEditor[5];
    // 文本编辑框
    celleditors[0] = null;
    celleditors[1] = new TextCellEditor(table);
    celleditors[2] = new TextCellEditor(table);
    // CheckboxCellEditor(table) 复选框
    celleditors[3] = new ComboBoxCellEditor(table, StationData.MAPS, SWT.READ_ONLY); // 下拉框

    Text text = (Text) celleditors[1].getControl(); // 设置第down列只能输入数值
    text.addVerifyListener(
        new VerifyListener() {
          public void verifyText(VerifyEvent e) {
            // 输入控制键,输入中文,输入字符,输入数字 正整数验证
            Pattern pattern = Pattern.compile("[0-9]\\d*"); // 正则表达式
            Matcher matcher = pattern.matcher(e.text);
            if (matcher.matches()) // 处理数字
            {
              /*if(Integer.parseInt(e.text) != 0)//确保输入的数字不是0
              			e.doit = true;
              		else
              			e.doit = false;
              */
              e.doit = true;
            } else if (e.text.length() > 0) // 字符: 包含中文、空格
            e.doit = false;
            else // 控制键
            e.doit = true;
          }
        });

    Text text1 = (Text) celleditors[2].getControl(); // 设置第up列只能输入数值
    text1.addVerifyListener(
        new VerifyListener() {
          public void verifyText(VerifyEvent e) {
            String inStr = e.text;
            if (inStr.length() > 0) {
              e.doit = NumberUtils.isDigits(inStr);
            }
          }
        });

    table.addMouseMoveListener(
        new MouseMoveListener() {
          public void mouseMove(MouseEvent e) {
            if (StationData.reloadFlag) {
              getStationInfo();
              openCurrentTable(row);
              StationData.reloadFlag = false;
              // System.out.println("entry");
            }
          }
        });
    /*table.addFocusListener(new FocusListener(){
    public void focusGained(FocusEvent e) {
    	getStationInfo();
    	openCurrentTable(row);
    }
    @Override
    public void focusLost(FocusEvent e) {
    }
      });
         */
    tableViewer.setCellEditors(celleditors);

    // 设置单元的更改器
    tableViewer.setCellModifier(new TableCellModifier());

    tableViewer.addFilter(new TableViewerFilter()); // 过滤器

    // 构造工具条
    Composite buttonComposite = new Composite(group, SWT.NONE);
    buttonComposite.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false)); // 使工具条居中
    Action actionModify =
        new Action("更新") {
          public void run() {
            // 取得用户所选择的第一行, 若没有选择则为null
            IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
            // 获取选中的第一行数据
            Station station = (Station) selection.getFirstElement();
            if (station != null) {
              if (updateStationInfo(
                  station.getStation_downnumber(),
                  station.getStation_upnumber(),
                  station.getStation_graph(),
                  station.getStation_name())) {
                showMsg("成功更新!");
                // 表格的刷新方法,界面会重新读取数据并显示

                pushCommand();

                tableViewer.refresh(); // false
              } else {
                showMsg("更新失败!");
                // tableViewer.refresh();//false
              }
            } else {
              showMsg("请选取进行更新的行!");
            }
          }
        };

    Action actionDelete =
        new Action("删除") {
          public void run() {
            // 取得用户所选择的第一行, 若没有选择则为null
            IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
            // 获取选中的第一个数据
            Station station = (Station) selection.getFirstElement();
            if (station != null) {
              // 先预先移动到下一行
              Table table = tableViewer.getTable();

              // int i = table.getSelectionIndex(); //取得当前所选行的序号,如没有则返回-1
              // table.setSelection(i + 1); //当前选择行移下一行
              // 确认删除
              MessageBox messageBox =
                  new MessageBox(shell, SWT.YES | SWT.NO | SWT.ICON_INFORMATION);
              messageBox.setText("提示信息");
              messageBox.setMessage("确定要删除此记录吗?");
              // SWT.YES 是  // SWT.NO 否 // SWT.CANCEL 取消 // SWT.RETRY 重试// SWT.ABORT 放弃// SWT.IGNORE
              // 忽略
              if (messageBox.open() == SWT.YES) {
                if (deleteStationInfo(station.getStation_name())) // 从数据库中删除记录
                {
                  // showMsg("成功删除!");
                  ((List) tableViewer.getInput()).remove(station); // 数据模型的List容器中删除
                  stationData.remove(station.getStation_name());
                  openCurrentTable(row);
                  tableViewer.remove(station); // 从表格界面上删除

                  pushCommand();
                } else showMsg("删除失败!");
              }
            } else {
              showMsg("请选取要删除的纪录!");
            }
          }
        };

    Action actionClear = new Action("清空") { // 清除所显示内容,点击保存后更新库
          public void run() {
            if (clearStationInfo()) {
              showMsg("清空操作成功!");
              stationData.removeAll();
              openCurrentTable(row);

              pushCommand();
            } else showMsg("清空操作失败!");
          }
        };
    Action actionHelp =
        new Action("帮助") {
          public void run() {
            String str = "更新:\n\r" + "先对某行内容进行修改,然后点击更新进行保存\n\r" + "清空:\n\r" + "从库中物理删除所有记录";
            showMsg(str);
          }
        };

    Action nextPage =
        new Action("下一页") {
          public void run() {
            row++;
            if (row > stationData.getTotalPageNum()) {
              row--;
              return;
            }
            openCurrentTable(row);
          }
        };
    Action prevPage =
        new Action("上一页") {
          public void run() {
            row--;
            if (row < 1) {
              row++;
              return;
            }
            openCurrentTable(row);
          }
        };

    Action refresh =
        new Action("刷新") {
          public void run() {
            getStationInfo();
            openCurrentTable(row);
          }
        };

    // 工具条
    ToolBar toolBar = new ToolBar(buttonComposite, SWT.FLAT | SWT.RIGHT); // |SWT.BORDER

    // 工具条管理器
    ToolBarManager manager = new ToolBarManager(toolBar);

    // manager.add(refresh);
    // manager.add(new Separator());

    manager.add(nextPage);
    manager.add(prevPage);

    manager.add(new Separator());

    manager.add(actionModify);
    manager.add(actionDelete);
    manager.add(actionClear);
    manager.add(new Separator());
    manager.add(actionHelp);
    manager.update(true);

    // 选中某行时,改变行的颜色
    table.addListener(
        SWT.EraseItem,
        new Listener() {
          public void handleEvent(Event event) {
            event.detail &= ~SWT.HOT;
            if ((event.detail & SWT.SELECTED) == 0) return;
            int clientWidth = table.getClientArea().width;
            GC gc = event.gc;
            Color oldForeground = gc.getForeground();
            Color oldBackground = gc.getBackground();
            gc.setForeground(red);
            // gc.setBackground(yellow);
            gc.fillGradientRectangle(0, event.y, clientWidth, event.height, false);
            gc.setForeground(oldForeground);
            gc.setBackground(oldBackground);
            event.detail &= ~SWT.SELECTED;
          }
        });

    // 在tableviewer内部为数据记录和tableItem之间的映射创建一个hash表,这样可以加快tableItem的和记录间的查找速度
    // 必须保证存在要显示的数据,否则程序出错。所以这里不能用下面的语句
    // tableViewer.setUseHashlookup(true);//必须在setInput之前加入才有效
    // 从服务器获取数据
    getStationInfo();
    // 通过setInput为table添加了一个list后,只要对这个list里的元素进行添加和删除,
    // table中的数据就会自动添加和删除,当然每次操作后需要调用refresh方法对tableviewer进行刷新。
    // 打开界面所显示的内容
    tableViewer.setInput(stationData.getData()); // 自动输入数据   即将数据显示在表格中
    tableViewer.setItemCount(stationData.PAGE_SIZE); // 设置显示的Item数
  } //// createComp
コード例 #18
0
  @Override
  protected Control createDialogArea(Composite parent) {
    parent.setLayout(new GridLayout());

    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    composite.setLayout(new GridLayout());

    viewer = new TableViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);

    Table table = viewer.getTable();
    table.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    table.setHeaderVisible(true);
    table.setLinesVisible(false);

    TableColumn tc;

    tc = new TableColumn(table, SWT.LEFT);
    tc.setText(""); // $NON-NLS-1$
    tc.setWidth(40);

    tc = new TableColumn(table, SWT.LEFT);
    tc.setText(Messages.ExterneDokumente_file_date);
    tc.setWidth(120);
    tc.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent event) {
            // TODO sort by Datum
            // http://www.vogella.de/articles/EclipseJFaceTable/article.html#sortcolumns
          }
        });

    tc = new TableColumn(table, SWT.LEFT);
    tc.setText(Messages.VerifierDialog_name);
    tc.setWidth(200);
    tc.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent event) {
            // TODO sort by Nummer
          }
        });

    viewer.setContentProvider(new VerifierContentProvider());
    viewer.setLabelProvider(new VerifierLabelProvider());
    viewer.setComparator(new TimestampComparator());
    viewer.setInput(this);

    // edit file properties at if double clicked

    viewer.addDoubleClickListener(
        new IDoubleClickListener() {
          public void doubleClick(DoubleClickEvent event) {
            StructuredSelection selection = (StructuredSelection) viewer.getSelection();
            if (selection != null) {
              Object element = selection.getFirstElement();
              if (element instanceof File) {
                openFileEditorDialog((File) element);
              }
            }
          }
        });

    return composite;
  }