- //
- // private void createPropertiesPart(Composite parent) {
- // try {
- //
- // PropertyIterator pi = currentNode.getProperties();
- //
- // // Initializes form part
- // AbstractFormPart part = new AbstractFormPart() {
- // public void commit(boolean onSave) {
- // try {
- // if (onSave) {
- // ListIterator<Control> it = modifyableProperties
- // .listIterator();
- // while (it.hasNext()) {
- // // we only support Text controls for the time
- // // being
- // Text curControl = (Text) it.next();
- // String value = curControl.getText();
- // currentNode.setProperty((String) curControl
- // .getData(JCR_PROPERTY_NAME), value);
- // }
- //
- // // We only commit when onSave = true,
- // // thus it is still possible to save after a tab
- // // change.
- // super.commit(onSave);
- // }
- // } catch (RepositoryException re) {
- // throw new EclipseUiException(
- // "Unexpected error while saving properties", re);
- // }
- // }
- // };
- //
- // while (pi.hasNext()) {
- // Property prop = pi.nextProperty();
- // addPropertyLine(parent, part, prop);
- // }
- //
- // getManagedForm().addPart(part);
- // } catch (RepositoryException re) {
- // throw new EclipseUiException(
- // "Error during creation of network details section", re);
- // }
- //
- // }
- //
- // private void addPropertyLine(Composite parent, AbstractFormPart part,
- // Property prop) {
- // try {
- // tk.createLabel(parent, prop.getName());
- // tk.createLabel(parent,
- // "[" + JcrUtils.getPropertyDefinitionAsString(prop) + "]");
- //
- // if (prop.getDefinition().isProtected()) {
- // tk.createLabel(parent, formatReadOnlyPropertyValue(prop));
- // } else
- // addModifyableValueWidget(parent, part, prop);
- // } catch (RepositoryException re) {
- // throw new EclipseUiException("Cannot get property " + prop, re);
- // }
- // }
- //
- // private String formatReadOnlyPropertyValue(Property prop) {
- // try {
- // String strValue;
- //
- // if (prop.getType() == PropertyType.BINARY)
- // strValue = "<binary>";
- // else if (prop.isMultiple())
- // strValue = Arrays.asList(prop.getValues()).toString();
- // else if (prop.getType() == PropertyType.DATE)
- // strValue = timeFormatter.format(prop.getValue().getDate()
- // .getTime());
- // else
- // strValue = prop.getValue().getString();
- //
- // return strValue;
- // } catch (RepositoryException re) {
- // throw new EclipseUiException(
- // "Unexpected error while formatting read only property value",
- // re);
- // }
- // }
- //
- // private Control addModifyableValueWidget(Composite parent,
- // AbstractFormPart part, Property prop) {
- // GridData gd;
- // try {
- // if (prop.getType() == PropertyType.STRING) {
- // Text txt = tk.createText(parent, prop.getString());
- // gd = new GridData(GridData.FILL_HORIZONTAL);
- // txt.setLayoutData(gd);
- // txt.addModifyListener(new ModifiedFieldListener(part));
- // txt.setData(JCR_PROPERTY_NAME, prop.getName());
- // modifyableProperties.add(txt);
- // } else {
- // // unsupported property type for editing, we create a read only
- // // label.
- // return tk
- // .createLabel(parent, formatReadOnlyPropertyValue(prop));
- // }
- // return null;
- // } catch (RepositoryException re) {
- // throw new EclipseUiException(
- // "Unexpected error while formatting read only property value",
- // re);
- // }
- //
- // }
-
- // Multiple Value Model
- // protected class MultipleValueItem {
- // private int index;
- // private Value value;
- //
- // public MultipleValueItem(int index, Value value) {
- // this.index = index;
- // this.value = value;
- // }
- //
- // public int getIndex() {
- // return index;
- // }
- //
- // public Object getValue() {
- // return value;
- // }
- // }
-