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

The following examples show how to use org.eclipse.swt.widgets.Tree#setSortColumn() . 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 check out the related API usage on the sidebar.
Example 1
Source File: SortTreeColumnSelectionListener.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@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
Source File: AbstractTimeGraphView.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
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 File: NodeStatsTableControl.java    From depan with 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 File: NodeDisplayTableControl.java    From depan with 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);
}