]> gerrit.simantics Code Review - simantics/interop.git/commitdiff
Issue severity and object.
authorluukkainen <luukkainen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 30 Jan 2012 14:55:34 +0000 (14:55 +0000)
committerMarko Luukkainen <marko.luukkainen@vtt.fi>
Thu, 2 Feb 2017 09:22:18 +0000 (11:22 +0200)
Added more data to Issues View
refs #3169

git-svn-id: https://www.simantics.org/svn/simantics/interoperability/trunk@24103 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.interop/src/org/simantics/interop/utils/StringColumnComparator.java
org.simantics.interop/src/org/simantics/interop/utils/TableUtils.java

index e2a338a8c2e963088d991d4d810706c84ec25403..076559c49661682010d138fa32415d065f29f3c7 100644 (file)
@@ -32,56 +32,58 @@ public class StringColumnComparator extends ViewerComparator {
        @Override\r
        public int compare(Viewer viewer, Object e1, Object e2) {\r
                \r
+               int rc = 0;\r
                \r
                int cat1 = category(e1);\r
         int cat2 = category(e2);\r
 \r
         if (cat1 != cat2) {\r
-                       return cat1 - cat2;\r
-               }\r
+                       rc =  cat1 - cat2;\r
+               } else {\r
        \r
-        String name1 = null;\r
-        String name2 = null;\r
-        \r
-        \r
-        \r
-        if (viewer == null || !(viewer instanceof ContentViewer)) {\r
-            name1 = e1.toString();\r
-            name2 = e2.toString();\r
-        } else {\r
-            IBaseLabelProvider prov = ((ContentViewer) viewer).getLabelProvider();\r
-            if (viewer instanceof TableViewer && ((TableViewer)viewer).getLabelProvider(propertyIndex) != null) {\r
-               CellLabelProvider clp = ((TableViewer)viewer).getLabelProvider(propertyIndex);\r
-               if (clp instanceof ILabelProvider) {\r
-                       ILabelProvider ilb = (ILabelProvider)clp;\r
-                       name1 = ilb.getText(e1);\r
-                       name2 = ilb.getText(e2);\r
-               }\r
-            }\r
-            if (name1 == null) {\r
-                   if (prov instanceof ITableLabelProvider) {\r
-                       ITableLabelProvider lprov = (ITableLabelProvider) prov;\r
-                       name1 = lprov.getColumnText(e1,propertyIndex);\r
-                       name2 = lprov.getColumnText(e2,propertyIndex);\r
-                   } else if (prov instanceof ILabelProvider) {\r
-                       ILabelProvider lprov = (ILabelProvider) prov;\r
-                       name1 = lprov.getText(e1);\r
-                       name2 = lprov.getText(e2);\r
-                   } else {\r
-                       name1 = e1.toString();\r
-                       name2 = e2.toString();\r
+               String name1 = null;\r
+               String name2 = null;\r
+               \r
+               \r
+               \r
+               if (viewer == null || !(viewer instanceof ContentViewer)) {\r
+                   name1 = e1.toString();\r
+                   name2 = e2.toString();\r
+               } else {\r
+                   IBaseLabelProvider prov = ((ContentViewer) viewer).getLabelProvider();\r
+                   if (viewer instanceof TableViewer && ((TableViewer)viewer).getLabelProvider(propertyIndex) != null) {\r
+                       CellLabelProvider clp = ((TableViewer)viewer).getLabelProvider(propertyIndex);\r
+                       if (clp instanceof ILabelProvider) {\r
+                               ILabelProvider ilb = (ILabelProvider)clp;\r
+                               name1 = ilb.getText(e1);\r
+                               name2 = ilb.getText(e2);\r
+                       }\r
                    }\r
-            }\r
-        }\r
-        if (name1 == null) {\r
-                       name1 = "";//$NON-NLS-1$\r
-               }\r
-        if (name2 == null) {\r
-                       name2 = "";//$NON-NLS-1$\r
+                   if (name1 == null) {\r
+                           if (prov instanceof ITableLabelProvider) {\r
+                               ITableLabelProvider lprov = (ITableLabelProvider) prov;\r
+                               name1 = lprov.getColumnText(e1,propertyIndex);\r
+                               name2 = lprov.getColumnText(e2,propertyIndex);\r
+                           } else if (prov instanceof ILabelProvider) {\r
+                               ILabelProvider lprov = (ILabelProvider) prov;\r
+                               name1 = lprov.getText(e1);\r
+                               name2 = lprov.getText(e2);\r
+                           } else {\r
+                               name1 = e1.toString();\r
+                               name2 = e2.toString();\r
+                           }\r
+                   }\r
+               }\r
+               if (name1 == null) {\r
+                               name1 = "";//$NON-NLS-1$\r
+                       }\r
+               if (name2 == null) {\r
+                               name2 = "";//$NON-NLS-1$\r
+                       }\r
+       \r
+               // use the comparator to compare the strings\r
+               rc = getComparator().compare(name1, name2);\r
                }\r
-\r
-        // use the comparator to compare the strings\r
-        int rc = getComparator().compare(name1, name2);\r
                if (direction != DESCENDING)\r
                        rc = -rc;\r
                return rc;\r
index debe73262169f9c2dda8c3afb514e339d52126d7..aaf87cdf50c18a23b52450b983aabb975277c0d5 100644 (file)
@@ -14,7 +14,6 @@ public class TableUtils {
        public static TableViewerColumn addColumn(final TableViewer viewer, String text, boolean resize, boolean sort, int width) {\r
                final TableViewerColumn twc = new TableViewerColumn(viewer, SWT.NONE);\r
                final TableColumn tc = twc.getColumn();\r
-               //final TableColumn tc = new TableColumn(viewer.getTable(), SWT.NONE);\r
                tc.setText(text);\r
                tc.setResizable(resize);\r
                tc.setWidth(width);\r
@@ -22,8 +21,13 @@ public class TableUtils {
                        tc.addSelectionListener(new SelectionAdapter() {\r
                                @Override\r
                                public void widgetSelected(SelectionEvent e) {\r
-                                       StringColumnComparator comparator = (StringColumnComparator)viewer.getComparator();\r
-                                       //TableColumn tc = twc.getColumn();\r
+                                       StringColumnComparator comparator = null;\r
+                                       if (viewer.getComparator() instanceof StringColumnComparator) {\r
+                                               comparator = (StringColumnComparator)viewer.getComparator();\r
+                                       } else {\r
+                                               comparator = new StringColumnComparator();\r
+                                               viewer.setComparator(comparator);\r
+                                       }\r
                                        TableColumn tcs[] = viewer.getTable().getColumns();\r
                                        int index = -1;\r
                                        for (int i = 0; i <tcs.length; i++) {\r