* Bug #8060 fixed - Improve the display of a list in the variable browser. 33/13133/2
Sylvestre Ledru [Tue, 12 Nov 2013 13:22:04 +0000 (14:22 +0100)]
Change-Id: Icedb4a9d3d8ff01422b792718e3f6b1f389afd91

scilab/CHANGES_5.5.X
scilab/modules/types/src/java/org/scilab/modules/types/ScilabTypeEnumDescription.java
scilab/modules/ui_data/src/java/org/scilab/modules/ui_data/BrowseVar.java

index d76a1e5..38712f6 100644 (file)
@@ -43,6 +43,8 @@ Scilab Bug Fixes
 
 * Bug #8031 fixed - cdfgam error message fixed.
 
+* Bug #8060 fixed - Display of a list improved in the variable browser.
+
 * Bug #8231 fixed - xrect help page did not say that clipping property was inherited.
 
 * Bug #8337 fixed - mtlb_rand now uses the "uniform" rule, whatever the random rule set is.
index cf68571..11cec11 100644 (file)
@@ -63,4 +63,25 @@ public class ScilabTypeEnumDescription {
             return Messages.gettext("Unknown datatype");
         }
     }
+
+    /*
+     * Return the description of the mlist code ('ce' => 'cell', 'st => 'struct', etc)
+     * @param shortCode the short code
+     * @return the full description
+     */
+    public static String getListTypeDescription (String shortCode) {
+        // Once we switch to Java 7, we can replace that by a String switch
+        if (shortCode.equals("ce")) {
+            shortCode = "cell";
+        } else {
+            if (shortCode.equals("st")) {
+                shortCode = "struct";
+            } else {
+                if (shortCode.equals("fptr")) {
+                    shortCode = "built-in";
+                }
+            }
+        }
+        return shortCode;
+    }
 }
\ No newline at end of file
index 54da814..b86e307 100644 (file)
@@ -140,13 +140,18 @@ public class BrowseVar {
             data[i][NAME_COLUMN_INDEX] = dataNames[i];
             data[i][SIZE_COLUMN_INDEX] = dataSizes[i];
             data[i][TYPE_DESC_COLUMN_INDEX] = ScilabTypeEnumDescription.getTypeDescriptionFromId(dataTypes[i]);
+
             if (dataTypes[i] == ScilabTypeEnum.sci_ints.swigValue() && dataIntegerTypes[i] != 0) {
                 // It is an integer. We want to detail the precision of the int
                 data[i][TYPE_DESC_COLUMN_INDEX] = data[i][TYPE_DESC_COLUMN_INDEX] + " " + dataIntegerTypes[i];
             }
+
             if ((dataTypes[i] == ScilabTypeEnum.sci_tlist.swigValue() || dataTypes[i] == ScilabTypeEnum.sci_mlist.swigValue()) && !variableListTypes[i].equals("")) {
+                // Improve the display of the list
+                String varType = ScilabTypeEnumDescription.getListTypeDescription(variableListTypes[i]);
+
                 // It is a tlist and we want to display the user datatype
-                data[i][TYPE_DESC_COLUMN_INDEX] = variableListTypes[i] + " (" + data[i][TYPE_DESC_COLUMN_INDEX] + ")";
+                data[i][TYPE_DESC_COLUMN_INDEX] = varType + " (" + data[i][TYPE_DESC_COLUMN_INDEX] + ")";
             }
             data[i][VISIBILITY_COLUMN_INDEX] = dataVisibility[i];
             data[i][BYTES_COLUMN_INDEX] = dataBytes[i];