@Override
 public void childRemoved(SModelChildEvent event) {
   if (SNodeOperations.isInstanceOf(
       ((SNode) event.getParent()),
       MetaAdapterFactory.getConcept(
           0xf3061a5392264cc5L,
           0xa443f952ceaf5816L,
           0x101d9d3ca30L,
           "jetbrains.mps.baseLanguage.structure.Classifier"))) {
     if (!(SNodeOperations.isInstanceOf(
         ((SNode) event.getChild()),
         MetaAdapterFactory.getConcept(
             0xf3061a5392264cc5L,
             0xa443f952ceaf5816L,
             0xf8cc56b1fcL,
             "jetbrains.mps.baseLanguage.structure.BaseMethodDeclaration")))) {
       return;
     }
   }
   if (SNodeOperations.isInstanceOf(
       ((SNode) event.getParent()),
       MetaAdapterFactory.getConcept(
           0xf3061a5392264cc5L,
           0xa443f952ceaf5816L,
           0xf8cc56b1fcL,
           "jetbrains.mps.baseLanguage.structure.BaseMethodDeclaration"))) {
     String role = event.getChildRole();
     if (!("parameter".equals(role))) {
       return;
     }
   }
   super.childRemoved(event);
 }
 @Override
 public void childRemoved(SModelChildEvent event) {
   if (SNodeOperations.isInstanceOf(
       ((SNode) event.getParent()),
       MetaAdapterFactory.getConcept(
           0xf3061a5392264cc5L,
           0xa443f952ceaf5816L,
           0x101d9d3ca30L,
           "jetbrains.mps.baseLanguage.structure.Classifier"))) {
     SNode child = event.getChild();
     if (!((SNodeOperations.isInstanceOf(
             child,
             MetaAdapterFactory.getConcept(
                 0xf3061a5392264cc5L,
                 0xa443f952ceaf5816L,
                 0xf8c108ca68L,
                 "jetbrains.mps.baseLanguage.structure.FieldDeclaration"))
         || SNodeOperations.isInstanceOf(
             child,
             MetaAdapterFactory.getConcept(
                 0xf3061a5392264cc5L,
                 0xa443f952ceaf5816L,
                 0xf93c84351fL,
                 "jetbrains.mps.baseLanguage.structure.StaticFieldDeclaration"))))) {
       return;
     }
   }
   if (SNodeOperations.isInstanceOf(
       ((SNode) event.getParent()),
       MetaAdapterFactory.getConcept(
           0xf3061a5392264cc5L,
           0xa443f952ceaf5816L,
           0xf8c37a7f6eL,
           "jetbrains.mps.baseLanguage.structure.VariableDeclaration"))) {
     return;
   }
   super.childRemoved(event);
 }
Example #3
0
 private void processEvent(SModelChildEvent event) {
   SetSequence.fromSet(myDependenciesToInvalidate).addElement(event.getParent());
   if (event.isRemoved()) {
     SetSequence.fromSet(myDependenciesToInvalidate).addElement(event.getChild());
   }
   if (event.isAdded()) {
     SetSequence.fromSet(myInvalidNodes)
         .addSequence(
             ListSequence.fromList(
                 SNodeOperations.getNodeDescendants(
                     ((SNode) event.getChild()), null, false, new SAbstractConcept[] {})));
     SetSequence.fromSet(myInvalidNodes).addElement(event.getChild());
   }
 }
 @Override
 public void childRemoved(SModelChildEvent event) {
   if (SNodeOperations.isInstanceOf(
       ((SNode) event.getParent()),
       MetaAdapterFactory.getConcept(
           0xf3061a5392264cc5L,
           0xa443f952ceaf5816L,
           0x101d9d3ca30L,
           "jetbrains.mps.baseLanguage.structure.Classifier"))) {
     String role = event.getChildRole();
     if (!(("typeVariableDeclaration".equals(role)
         || "superclass".equals(role)
         || "implementedInterface".equals(role)
         || "extendedInterface".equals(role)
         || "typeParameter".equals(role)))) {
       return;
     }
   }
   super.childRemoved(event);
 }
Example #5
0
    private void processChild(SModelChildEvent event, Map<SNode, Set<String>> childChanged) {
      SNode parent = event.getParent();
      if (parent.getModel() == null) {
        return;
      }
      final String childRole = event.getChildRole();

      // tyring to avoid update task execution for the same child role twice
      Set<String> childRoles = MapSequence.fromMap(childChanged).get(parent);
      if (childRoles == null) {
        childRoles = SetSequence.fromSet(new HashSet<String>());
        MapSequence.fromMap(childChanged).put(parent, childRoles);
      }
      if (SetSequence.fromSet(childRoles).contains(childRole)) {
        return;
      } else {
        SetSequence.fromSet(childRoles).addElement(childRole);
      }
      final SNodeId parentId = parent.getNodeId();

      final Wrappers._T<List<? extends SNode>> childrenRightAfterEvent =
          new Wrappers._T<List<? extends SNode>>(
              IterableUtil.asList(parent.getChildren(childRole)));
      childrenRightAfterEvent.value =
          ListSequence.fromList(childrenRightAfterEvent.value)
              .select(
                  new ISelector<SNode, SNode>() {
                    public SNode select(SNode n) {
                      return CopyUtil.copyAndPreserveId(n, false);
                    }
                  })
              .toListSequence();
      runUpdateTask(
          new _FunctionTypes._void_P0_E0() {
            public void invoke() {

              removeChanges(
                  parentId,
                  NodeGroupChange.class,
                  new _FunctionTypes._return_P1_E0<Boolean, NodeGroupChange>() {
                    public Boolean invoke(NodeGroupChange ch) {
                      return childRole.equals(ch.getRole());
                    }
                  });
              removeDescendantChanges(parentId, childRole);
              myLastParentAndNewChildrenIds =
                  MultiTuple.<SNodeId, List<SNodeId>>from(
                      parentId,
                      ListSequence.fromList(childrenRightAfterEvent.value)
                          .select(
                              new ISelector<SNode, SNodeId>() {
                                public SNodeId select(SNode n) {
                                  return n.getNodeId();
                                }
                              })
                          .toListSequence());
              buildAndAddChanges(
                  new _FunctionTypes._void_P1_E0<ChangeSetBuilder>() {
                    public void invoke(ChangeSetBuilder b) {
                      b.buildForNodeRole(
                          IterableUtil.asList(getOldNode(parentId).getChildren(childRole)),
                          childrenRightAfterEvent.value,
                          parentId,
                          childRole);
                    }
                  });
            }
          },
          parent,
          event);
    }