]> gerrit.simantics Code Review - simantics/interop.git/commitdiff
git-svn-id: https://www.simantics.org/svn/simantics/interoperability/trunk@22380...
authorluukkainen <luukkainen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 22 Sep 2011 14:58:09 +0000 (14:58 +0000)
committerMarko Luukkainen <marko.luukkainen@vtt.fi>
Thu, 2 Feb 2017 09:22:16 +0000 (11:22 +0200)
org.simantics.interop/src/org/simantics/interop/utils/TableUtils.java

index f373bc2f3cafb34715f9dc08a8d123e75f5ef49a..debe73262169f9c2dda8c3afb514e339d52126d7 100644 (file)
@@ -2,10 +2,13 @@ package org.simantics.interop.utils;
 \r
 import org.eclipse.jface.viewers.TableViewer;\r
 import org.eclipse.jface.viewers.TableViewerColumn;\r
+import org.eclipse.jface.viewers.TreeViewer;\r
+import org.eclipse.jface.viewers.TreeViewerColumn;\r
 import org.eclipse.swt.SWT;\r
 import org.eclipse.swt.events.SelectionAdapter;\r
 import org.eclipse.swt.events.SelectionEvent;\r
 import org.eclipse.swt.widgets.TableColumn;\r
+import org.eclipse.swt.widgets.TreeColumn;\r
 \r
 public class TableUtils {\r
        public static TableViewerColumn addColumn(final TableViewer viewer, String text, boolean resize, boolean sort, int width) {\r
@@ -48,4 +51,13 @@ public class TableUtils {
                }\r
                return twc;\r
        }\r
+       \r
+       public static TreeViewerColumn addColumn(final TreeViewer viewer, String text, boolean resize, int width) {\r
+               final TreeViewerColumn tvc = new TreeViewerColumn(viewer, SWT.NONE);\r
+               TreeColumn tc = tvc.getColumn();\r
+               tc.setResizable(resize);\r
+               tc.setText(text);\r
+               tc.setWidth(width);\r
+               return tvc;\r
+       }\r
 }\r