/** * Sets values for a property in a certain ODocument * * @param propertyName the property name * @param values the values for the property * @param document the document which should contain the data */ protected void setPropertyInternal(ODocument document, QName propertyName, Object... values) { String pName = encodeProperty(propertyName); if (values == null || values.length == 0) { document.removeField(pName); return; } boolean collection = isCollectionProperty(propertyName); if (!collection) { if (values.length > 1) { // TODO log type and property log.warn( "Attempt to set multiple values on a property that supports only one, using only the first value"); } document.field(pName, convertInstance(values[0])); } else { List<Object> valueList = new ArrayList<Object>(); for (Object value : values) { valueList.add(convertInstance(value)); } document.field(pName, valueList, getCollectionType(propertyName)); } }
/** Set the actions icon as {@link ImageDescriptor} if possible */ private void loadImage() { Object icon = action.getValue(javax.swing.Action.SMALL_ICON); if (icon instanceof ImageIcon) { try { setImageDescriptor( ImageDescriptor.createFromImageData(SwingRcpUtilities.convertToSWT((ImageIcon) icon))); } catch (Exception e) { _log.warn("Error converting action icon", e); // $NON-NLS-1$ } } }