import org.argeo.jcr.JcrUtils;
import org.argeo.slc.akb.AkbException;
+import org.argeo.slc.akb.AkbTypes;
import org.argeo.slc.akb.ui.AkbUiPlugin;
import org.argeo.slc.akb.ui.editors.AkbNodeEditorInput;
import org.argeo.slc.akb.utils.AkbJcrUtils;
if (nodeJcrId != null)
node = session.getNodeByIdentifier(nodeJcrId);
- // We must be in a template to delete nodes...
- Node template = AkbJcrUtils.getCurrentTemplate(node);
-
- IEditorPart currPart = currentPage
- .findEditor(new AkbNodeEditorInput(
- template.getIdentifier(), nodeJcrId));
- if (currPart != null)
- currPart.dispose();
+ // We must be in a template or on the root of an env instance to
+ // delete nodes.
+ Node template = node.isNodeType(AkbTypes.AKB_ENV) ? node
+ : AkbJcrUtils.getCurrentTemplate(node);
if (node != null) {
Boolean ok = MessageDialog.openConfirm(
"Do you want to delete this item?");
if (ok) {
+ IEditorPart currPart = currentPage
+ .findEditor(new AkbNodeEditorInput(template
+ .getIdentifier(), nodeJcrId));
+ if (currPart != null)
+ currentPage.closeEditor(currPart, false);
+
node.remove();
session.save();
}