- this.session = item.getSession();
- if (!cacheImmediately && (SWT.READ_ONLY == (style & SWT.READ_ONLY))) {
- // (useless?) optimization: we only save a pointer to the session,
- // not even a reference to the item
- this.nodeId = null;
- } else {
- Node node;
- Property property = null;
- if (item instanceof Node) {
- node = (Node) item;
- } else {// Property
- property = (Property) item;
- if (property.isMultiple())// TODO manage property index
- throw new CmsException(
- "Multiple properties not supported yet.");
- this.property = property.getName();
- node = property.getParent();
+ if (item != null)
+ try {
+ this.session = item.getSession();
+// if (!cacheImmediately && (SWT.READ_ONLY == (style & SWT.READ_ONLY))) {
+// // (useless?) optimization: we only save a pointer to the session,
+// // not even a reference to the item
+// this.nodeId = null;
+// } else {
+ Node node;
+ Property property = null;
+ if (item instanceof Node) {
+ node = (Node) item;
+ } else {// Property
+ property = (Property) item;
+ if (property.isMultiple())// TODO manage property index
+ throw new UnsupportedOperationException("Multiple properties not supported yet.");
+ this.property = property.getName();
+ node = property.getParent();
+ }
+ this.nodeId = node.getIdentifier();
+ if (cacheImmediately)
+ this.cache = node;
+// }
+ setLayout(CmsSwtUtils.noSpaceGridLayout());
+ } catch (RepositoryException e) {
+ throw new IllegalStateException("Cannot create composite from " + item, e);