blob: 3f66f24fb0e3852d6519fd89c1e5f52a5b9a4282 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/*******************************************************************************
* Copyright (c) 2011 Mia-Software.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Nicolas Bros (Mia-Software) - initial API and implementation
* Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns
*******************************************************************************/
package org.eclipse.emf.facet.common.ui.internal.controls.wrappers;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.ViewerSorter;
/**
* Implements {@link SortableWidget}'s unified API for the JFace {@link TreeViewer}.
*/
public class SortableTree implements SortableWidget {
private final TreeViewer treeViewer;
public SortableTree(final TreeViewer treeViewer) {
this.treeViewer = treeViewer;
}
public void setSorter(final ViewerSorter viewerSorter) {
this.treeViewer.setSorter(viewerSorter);
}
public int getSortDirection() {
return this.treeViewer.getTree().getSortDirection();
}
public void setSortDirection(final int direction) {
this.treeViewer.getTree().setSortDirection(direction);
}
public void setSortColumn(final Column column) {
this.treeViewer.getTree().setSortColumn(
(org.eclipse.swt.widgets.TreeColumn) column.getColumn());
}
public void refresh() {
this.treeViewer.refresh();
}
}
|