Java Code Examples for org.eclipse.swt.widgets.Tree#setSortColumn()

The following examples show how to use org.eclipse.swt.widgets.Tree#setSortColumn() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
@Override
protected void sort(SelectionEvent e) {
	// 1) Get tree column which fire this selection event
	TreeColumn treeColumn = (TreeColumn) e.getSource();
	// 2) Get the owner tree
	Tree tree = treeColumn.getParent();
	// 3) Modify the SWT Tree sort
	tree.setSortColumn(treeColumn);
	tree.setSortDirection(getSortDirection());
}
 
Example 2
private void applyViewContext() {
    ViewContext viewContext = fViewContext.remove(fTrace);
    applyExpandedStateContext(viewContext);
    if (fColumnComparators != null) {
        final Tree tree = fTimeGraphViewer.getTree();
        final TreeColumn column = tree.getColumn(fCurrentSortColumn);
        tree.setSortDirection(fSortDirection);
        tree.setSortColumn(column);
    }
    // restore and reveal selection
    if ((viewContext != null) && (viewContext.getSelection() != null)) {
        fTimeGraphViewer.setSelection(viewContext.getSelection(), true);
    }
}
 
Example 3
Source Project: depan   File: NodeStatsTableControl.java    License: Apache License 2.0 5 votes vote down vote up
private void setSortColumn(
    TreeColumn column, int colIndex, int direction) {

  ViewerComparator sorter = buildColumnSorter(colIndex);
  if (SWT.UP == direction) {
    sorter = new InverseSorter(sorter);
  }

  Tree tree = propViewer.getTree();
  tree.setSortColumn(column);
  tree.setSortDirection(direction);

  propViewer.setComparator(sorter);
}
 
Example 4
Source Project: depan   File: NodeDisplayTableControl.java    License: Apache License 2.0 5 votes vote down vote up
private void setSortColumn(
    TreeColumn column, int colIndex, int direction) {

  ViewerComparator sorter = buildColumnSorter(colIndex);
  if (SWT.UP == direction) {
    sorter = new InverseSorter(sorter);
  }

  Tree tree = propViewer.getTree();
  tree.setSortColumn(column);
  tree.setSortDirection(direction);

  propViewer.setComparator(sorter);
}