@Override
    public void eventsHappenedInCommand(List<SModelEvent> events) {
      for (SModelEvent event : events) {
        if (event.getModelDescriptor() == null) continue;
        if (!myModels.contains(event.getModelDescriptor().getReference())) continue;

        if (event instanceof SModelRootEvent) {
          SModelRootEvent modelRootEvent = (SModelRootEvent) event;
          SNodeReference rootPointer =
              new jetbrains.mps.smodel.SNodePointer(modelRootEvent.getRoot());
          if (modelRootEvent.isRemoved() && myNodes.contains(rootPointer)) {
            myChanged = true;
            return;
          }
        } else if (event instanceof SModelChildEvent) {
          SModelChildEvent modelChildEvent = (SModelChildEvent) event;
          SNodeReference childPointer =
              new jetbrains.mps.smodel.SNodePointer(
                  modelChildEvent.getModel().getReference(),
                  modelChildEvent.getChild().getNodeId());
          if (modelChildEvent.isRemoved() && myNodes.contains(childPointer)) {
            myChanged = true;
            return;
          }
        }
      }
    }
Esempio n. 2
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());
   }
 }