@Override public void read(Element element, Project project) throws CantLoadSomethingException { super.read(element, project); List children = element.getChild(NODE).getChildren(); if (children == null || children.size() == 1) { throw new CantLoadSomethingException(); } myNodePointer = ComponentsUtil.nodePointerFromElement((Element) children.get(0)); }
@Override public void write(Element element, Project project) throws CantSaveSomethingException { super.write(element, project); if (myNodePointer.resolve(MPSModuleRepository.getInstance()) != null) { Element nodeXML = new Element(NODE); nodeXML.addContent( ComponentsUtil.nodeToElement(myNodePointer.resolve(MPSModuleRepository.getInstance()))); element.addContent(nodeXML); } else { throw new CantSaveSomethingException(); } }