Ejemplo n.º 1
0
  /**
   * Change the sort icon.
   *
   * @param tableColumn
   */
  protected void handleSorting(TableColumn tableColumn) {

    if (tableColumn.getSortIcon() == TableColumn.SORT_ICON_NONE) {
      // clear all columns
      for (Iterator it = tableViewer.getModel().getColumnIterator(); it.hasNext(); ) {
        TableColumn col = (TableColumn) it.next();
        col.setSortIcon(TableColumn.SORT_ICON_NONE);
      }
    }
    boolean up = true;
    switch (tableColumn.getSortIcon()) {
      case TableColumn.SORT_ICON_NONE:
        tableColumn.setSortIcon(TableColumn.SORT_ICON_UP);
        break;
      case TableColumn.SORT_ICON_UP:
        tableColumn.setSortIcon(TableColumn.SORT_ICON_DOWN);
        up = false;
        break;
      case TableColumn.SORT_ICON_DOWN:
        // once sorted, the list can not be displayed in the
        // original order as we sort the original table,
        // therefor loosing the original order.
        tableColumn.setSortIcon(TableColumn.SORT_ICON_UP);
        // tableColumn.setSortIcon(TableColumn.SORT_ICON_NONE);
        break;
    }

    // do the sort
    contentProvider.sortData((String) tableColumn.getUserObject(), up);

    tableViewer.setRequireRedraw(true);
  }
Ejemplo n.º 2
0
 /** @param folder the folder to set */
 public void setFolder(IFolder folder) {
   this.folder = folder;
   contentProvider.setFolder(folder);
   tableViewer.setRequireRedraw(true);
 }