]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.eclipse.ui/src/org/argeo/eclipse/ui/utils/ViewerUtils.java
Support localized
[lgpl/argeo-commons.git] / org.argeo.eclipse.ui / src / org / argeo / eclipse / ui / utils / ViewerUtils.java
index 42e9fab991a16d988ab34400461b1803294b1c00..577543ebf9123e8f5d4b832ce62addeb23303c5a 100644 (file)
@@ -15,6 +15,7 @@
  */
 package org.argeo.eclipse.ui.utils;
 
+import org.argeo.cms.i18n.Localized;
 import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.jface.viewers.TableViewerColumn;
 import org.eclipse.jface.viewers.TreeViewer;
@@ -24,17 +25,15 @@ import org.eclipse.swt.widgets.TableColumn;
 import org.eclipse.swt.widgets.TreeColumn;
 
 /**
- * Centralizes useful methods to manage Jface Table, Tree and TreeColumn
- * viewers.
+ * Centralise useful methods to manage JFace Table, Tree and TreeColumn viewers.
  */
 public class ViewerUtils {
 
        /**
         * Creates a basic column for the given table. For the time being, we do not
-        * support moveable columns.
+        * support movable columns.
         */
-       public static TableColumn createColumn(Table parent, String name,
-                       int style, int width) {
+       public static TableColumn createColumn(Table parent, String name, int style, int width) {
                TableColumn result = new TableColumn(parent, style);
                result.setText(name);
                result.setWidth(width);
@@ -43,27 +42,29 @@ public class ViewerUtils {
        }
 
        /**
-        * Creates a TableViewerColumn for the given viewer. For the time being, we
-        * do not support moveable columns.
+        * Creates a TableViewerColumn for the given viewer. For the time being, we do
+        * not support movable columns.
         */
-       public static TableViewerColumn createTableViewerColumn(TableViewer parent,
-                       String name, int style, int width) {
+       public static TableViewerColumn createTableViewerColumn(TableViewer parent, String name, int style, int width) {
                TableViewerColumn tvc = new TableViewerColumn(parent, style);
-               final TableColumn column = tvc.getColumn();
+               TableColumn column = tvc.getColumn();
                column.setText(name);
                column.setWidth(width);
                column.setResizable(true);
                return tvc;
        }
 
+       public static TableViewerColumn createTableViewerColumn(TableViewer parent, Localized name, int style, int width) {
+               return createTableViewerColumn(parent, name.lead(), style, width);
+       }
+
        /**
-        * Creates a TreeViewerColumn for the given viewer. For the time being, we
-        * do not support moveable columns.
+        * Creates a TreeViewerColumn for the given viewer. For the time being, we do
+        * not support movable columns.
         */
-       public static TreeViewerColumn createTreeViewerColumn(TreeViewer parent,
-                       String name, int style, int width) {
+       public static TreeViewerColumn createTreeViewerColumn(TreeViewer parent, String name, int style, int width) {
                TreeViewerColumn tvc = new TreeViewerColumn(parent, style);
-               final TreeColumn column = tvc.getColumn();
+               TreeColumn column = tvc.getColumn();
                column.setText(name);
                column.setWidth(width);
                column.setResizable(true);