public Object getValue()

in eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/views/JcrEditingSupport.java [79:127]


        public Object getValue() {
            IPropertyDescriptor pd = (IPropertyDescriptor) element;
            JcrNode jcrNode = getNode();
            Map.Entry me = (Entry) pd.getId();
            
            switch(columnId) {
            case NAME: {
                return String.valueOf(me.getKey());
            }
            case TYPE: {
                final int propertyType = getNode().getPropertyType(getPropertyName());
                if (propertyType!=-1) {
                    return PropertyTypeSupport.indexOfPropertyType(propertyType);
                } else {
                    //TODO: otherwise hardcode to STRING
                    return PropertyTypeSupport.indexOfPropertyType(PropertyType.STRING);
                }
            }
            case VALUE: {
                final int propertyType = getNode().getPropertyType(getPropertyName());
                String rawValue = String.valueOf(me.getValue());
                int index = rawValue.indexOf("}");
                if (index!=-1) {
                    rawValue = rawValue.substring(index+1);
                }
                if ((propertyType!=-1) && (propertyType==PropertyType.BOOLEAN)) {
                    try{
                        if (Boolean.parseBoolean(String.valueOf(rawValue))) {
                            return 1;
                        } else {
                            return 0;
                        }
                    } catch(Exception e) {
                        return 0;
                    }
                } else if ((propertyType!=-1) && (propertyType!=PropertyType.STRING)) {
                    return rawValue;
                }
                return String.valueOf(me.getValue());
            }
            case MULTIPLE: {
                boolean isMultiple = getNode().getProperty(getPropertyName()).isMultiple();
                return isMultiple ? 1 : 0;
            }
            default: {
                throw new IllegalStateException("Unknown columnId: "+columnId);
            }
            }
        }