Minor enhancements on the data explorer perspective
[lgpl/argeo-commons.git] / org.argeo.cms.ui.workbench / src / org / argeo / cms / ui / workbench / internal / jcr / PropertyLabelProvider.java
index 3014bb6a649cdc0035550f73fd53db6bedfbe81c..629368c38b688a5857908eec53de8fe2e70e73a2 100644 (file)
@@ -30,14 +30,14 @@ import org.eclipse.jface.viewers.ColumnLabelProvider;
 import org.eclipse.jface.viewers.ViewerCell;
 
 /** Default basic label provider for a given JCR Node's properties */
-public class PropertyLabelProvider extends ColumnLabelProvider implements
-               WorkbenchConstants {
+public class PropertyLabelProvider extends ColumnLabelProvider implements WorkbenchConstants {
        private static final long serialVersionUID = -5405794508731390147L;
 
        // To be able to change column order easily
        public static final int COLUMN_PROPERTY = 0;
        public static final int COLUMN_VALUE = 1;
-       public static final int COLUMN_ATTRIBUTES = 2;
+       public static final int COLUMN_TYPE = 2;
+       public static final int COLUMN_ATTRIBUTES = 3;
 
        // Utils
        protected DateFormat timeFormatter = new SimpleDateFormat(DATE_TIME_FORMAT);
@@ -58,6 +58,8 @@ public class PropertyLabelProvider extends ColumnLabelProvider implements
                                        case COLUMN_VALUE:
                                                // Corresponding values are listed on children
                                                return "";
+                                       case COLUMN_TYPE:
+                                               return JcrBrowserUtils.getPropertyTypeAsString(prop);
                                        case COLUMN_ATTRIBUTES:
                                                return JcrUtils.getPropertyDefinitionAsString(prop);
                                        }
@@ -67,28 +69,30 @@ public class PropertyLabelProvider extends ColumnLabelProvider implements
                                                return prop.getName();
                                        case COLUMN_VALUE:
                                                return formatValueAsString(prop.getValue());
+                                       case COLUMN_TYPE:
+                                               return JcrBrowserUtils.getPropertyTypeAsString(prop);
                                        case COLUMN_ATTRIBUTES:
                                                return JcrUtils.getPropertyDefinitionAsString(prop);
                                        }
                                }
                        } else if (element instanceof Value) {
                                Value val = (Value) element;
-
                                switch (columnIndex) {
                                case COLUMN_PROPERTY:
                                        // Nothing to show
                                        return "";
                                case COLUMN_VALUE:
                                        return formatValueAsString(val);
+                               case COLUMN_TYPE:
+                                       // listed on the parent
+                                       return "";
                                case COLUMN_ATTRIBUTES:
                                        // Corresponding attributes are listed on the parent
                                        return "";
                                }
                        }
-
                } catch (RepositoryException re) {
-                       throw new EclipseUiException(
-                                       "Unexepected error while getting property values", re);
+                       throw new EclipseUiException("Cannot retrieve prop value on "+element, re);
                }
                return null;
        }
@@ -106,8 +110,7 @@ public class PropertyLabelProvider extends ColumnLabelProvider implements
                                strValue = value.getString();
                        return strValue;
                } catch (RepositoryException e) {
-                       throw new EclipseUiException("unexpected error while formatting value",
-                                       e);
+                       throw new EclipseUiException("unexpected error while formatting value", e);
                }
        }
 }