blob: b99458e453b4c42e5196f5d7abe81840b7be994a (
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
48
49
|
/*******************************************************************************
* 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 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Nicolas Bros (Mia-Software) - initial API and implementation
* Nicolas Bros (Mia-Software) - Bug 334116 - common tree view with columns
*******************************************************************************/
package org.eclipse.papyrus.emf.facet.common.ui.internal.controls.wrappers;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.ViewerSorter;
/**
* Implements {@link SortableWidget}'s unified API for the JFace {@link TableViewer}.
*/
public class SortableTable implements SortableWidget {
private final TableViewer tableViewer;
public SortableTable(final TableViewer tableViewer) {
this.tableViewer = tableViewer;
}
public void setSorter(final ViewerSorter viewerSorter) {
this.tableViewer.setSorter(viewerSorter);
}
public int getSortDirection() {
return this.tableViewer.getTable().getSortDirection();
}
public void setSortDirection(final int direction) {
this.tableViewer.getTable().setSortDirection(direction);
}
public void setSortColumn(final Column column) {
this.tableViewer.getTable().setSortColumn(
(org.eclipse.swt.widgets.TableColumn) column.getColumn());
}
public void refresh() {
this.tableViewer.refresh();
}
}
|