Пример #1
0
  @Override
  public ChangeInfo prepareChangeInfo(
      List /*<? extends Node>*/
          pathToRoot /*,            // TODO Uncomment in NetBeans 6.9.1
                     List<? extends Node> nsContextPathToRoot*/) { // TODO
                                                                                        // Uncomment
                                                                                        // in
                                                                                        // NetBeans
                                                                                        // 6.9.1
    ChangeInfo change =
        super.prepareChangeInfo(
            pathToRoot /*, nsContextPathToRoot*/); // TODO Uncomment in NetBeans 6.9.1
    DocumentComponent parentComponent = findComponent(change.getRootToParentPath());
    if (parentComponent == null) {
      return change;
    }

    // this are conditions where subject element is Literal element
    if (parentComponent instanceof SequenceConstructor
        && !change.isDomainElement()
        && change.getChangedElement() != null) {
      prepareLiterlElementChange(change, parentComponent);
    } else {
      change.setParentComponent(parentComponent);
    }
    return change;
  }
Пример #2
0
 private void prepareLiterlElementChange(ChangeInfo change, DocumentComponent parentComponent) {
   if (change.getOtherNonDomainElementNodes() == null
       || change.getOtherNonDomainElementNodes().isEmpty()) {
     // case add or remove literal result element
     change.setDomainElement(true);
     change.setParentComponent(null);
   } else {
     List<Element> rootToChanged = new ArrayList<Element>(change.getRootToParentPath());
     rootToChanged.add(change.getChangedElement());
     DocumentComponent changedComponent = findComponent(rootToChanged);
     if (changedComponent != null
         && changedComponent.getClass().isAssignableFrom(LiteralResultElement.class)) {
       // case literal result element is changed
       change.markNonDomainChildAsChanged();
       change.setParentComponent(null);
     }
   }
 }