コード例 #1
0
  @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;
  }
コード例 #3
0
ファイル: TestJava0005.java プロジェクト: pkdevbox/sapphire
  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);
  }
コード例 #4
0
  @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();
  }
コード例 #5
0
 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;
 }
コード例 #6
0
 @Override
 public void revert() {
   if (element.resource() instanceof IRevertable) {
     ((IRevertable) element.resource()).revert();
   }
 }