@Override protected final void writeListString(String str) { final Element parent = property().element(); final XmlElement parentXmlElement = ((XmlResource) parent.resource()).getXmlElement(true); final XmlNode listXmlNode = parentXmlElement.getChildNode(this.path, false); if (str == null) { if (listXmlNode != null) { listXmlNode.remove(); } } else { parentXmlElement.setChildNodeText(this.path, str, false); } }
@Override protected boolean evaluate() { final MasterDetailsContentNode node = (MasterDetailsContentNode) getPart(); final Element element = node.getLocalModelElement(); if (element.adapt(SourceEditorService.class) != null) { final MasterDetailsContentNode parent = node.getParentNode(); if (parent == null || parent.getLocalModelElement() != node.getLocalModelElement()) { return true; } } return false; }
private static void test( final Element element, final PropertyDef property, final String... factsExpected) { final SortedSet<String> factsActual = element.property(property).service(FactsAggregationService.class).facts(); assertEquals(set(factsExpected), factsActual); }
@Override protected final String readListString() { final Element parent = property().element(); final XmlElement parentXmlElement = ((XmlResource) parent.resource()).getXmlElement(); if (parentXmlElement == null) { return null; } final XmlNode listXmlNode = parentXmlElement.getChildNode(this.path, false); if (listXmlNode == null) { return null; } return listXmlNode.getText(); }
private ShapeFactoryCaseDef getShapeFactoryCase(Element listEntryModelElement) { for (ShapeFactoryCaseDef shapeFactoryCase : this.shapeFactoryDef.getCases()) { JavaType javaType = shapeFactoryCase.getType().resolve(); Class<?> cl = javaType.artifact(); if (cl.isAssignableFrom(listEntryModelElement.getClass())) { return shapeFactoryCase; } } return null; }
@Override public void revert() { if (element.resource() instanceof IRevertable) { ((IRevertable) element.resource()).revert(); } }