1 package org.argeo.slc.client.ui.dist.utils;
2
3 import org.eclipse.jface.viewers.TableViewer;
4 import org.eclipse.jface.viewers.TableViewerColumn;
5 import org.eclipse.jface.viewers.TreeViewer;
6 import org.eclipse.jface.viewers.TreeViewerColumn;
7 import org.eclipse.swt.widgets.Table;
8 import org.eclipse.swt.widgets.TableColumn;
9 import org.eclipse.swt.widgets.TreeColumn;
10
11
12 public class ViewerUtils {
13
14
15
16
17
18 public static TableColumn createColumn(Table parent, String name,
19 int style, int width) {
20 TableColumn result = new TableColumn(parent, style);
21 result.setText(name);
22 result.setWidth(width);
23 result.setResizable(true);
24 return result;
25 }
26
27
28
29
30
31 public static TableViewerColumn createTableViewerColumn(TableViewer parent,
32 String name, int style, int width) {
33 TableViewerColumn tvc = new TableViewerColumn(parent, style);
34 final TableColumn column = tvc.getColumn();
35 column.setText(name);
36 column.setWidth(width);
37 column.setResizable(true);
38 return tvc;
39 }
40
41
42
43
44
45 public static TreeViewerColumn createTreeViewerColumn(TreeViewer parent,
46 String name, int style, int width) {
47 TreeViewerColumn tvc = new TreeViewerColumn(parent, style);
48 final TreeColumn column = tvc.getColumn();
49 column.setText(name);
50 column.setWidth(width);
51 column.setResizable(true);
52 return tvc;
53 }
54 }