예제 #1
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"))) {
     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);
 }
예제 #3
0
    @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;
          }
        }
      }
    }
 @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);
 }