コード例 #1
0
    @Override
    public boolean met(MPSTreeNode node) {
      if (!super.met(node)) return false;

      if (node instanceof SModelTreeNode) {
        SModelTreeNode modelNode = (SModelTreeNode) node;
        if (!modelNode.hasModelsUnder()) return false;

        String outerName = SNodeOperations.getModelLongName(modelNode.getSModelDescriptor());
        String innerName = SNodeOperations.getModelLongName(myModel);
        return innerName.startsWith(outerName + ".");
      }

      boolean descent = false;

      if (node instanceof ProjectModuleTreeNode) descent = true;
      if (node instanceof NamespaceTextNode) descent = true;
      if (node instanceof AccessoriesModelTreeNode) descent = true;
      if (node instanceof StubsTreeNode) descent = true;
      if (node instanceof AllModelsTreeNode) descent = true;
      if (node instanceof TestsTreeNode) descent = true;

      if (!descent) return false;

      if (!node.isInitialized() && !node.hasInfiniteSubtree()) {
        node.init();
        return true;
      }

      return node.isInitialized();
    }
コード例 #2
0
ファイル: ModelAssert.java プロジェクト: CloudMetal/MPS
 private static void assertPropertyEquals(SNode expectedNode, SNode actualNode) {
   HashSet<String> propertes = new HashSet<String>();
   propertes.addAll(IterableUtil.asCollection(expectedNode.getPropertyNames()));
   propertes.addAll(IterableUtil.asCollection(actualNode.getPropertyNames()));
   for (String key : propertes) {
     String expectedProperty =
         jetbrains.mps.util.SNodeOperations.getProperties(expectedNode).get(key);
     String actualProperty = jetbrains.mps.util.SNodeOperations.getProperties(actualNode).get(key);
     assertEquals(
         getErrorString("property", expectedNode, actualNode), expectedProperty, actualProperty);
   }
 }
コード例 #3
0
 public void relayout(boolean updateFolding) {
   assert SwingUtilities.isEventDispatchThread()
       : "LeftEditorHighlighter.relayout() should be executed in eventDispatchThread";
   SNode editedNode = myEditorComponent.getEditedNode();
   // additional check - during editor dispose process some Folding area painters can be removed
   // calling relayout()..
   if (myEditorComponent.isDisposed()
       || (editedNode != null && jetbrains.mps.util.SNodeOperations.isDisposed(editedNode))) {
     return;
   }
   if (myRightToLeft) {
     recalculateFoldingAreaWidth();
     updateSeparatorLinePosition();
     if (updateFolding) {
       for (AbstractFoldingAreaPainter painter : myFoldingAreaPainters) {
         painter.relayout();
       }
       // wee need to recalculateIconRenderersWidth only if one of collections was folded/unfolded
       recalculateIconRenderersWidth();
     }
     recalculateTextColumnWidth();
   } else {
     recalculateTextColumnWidth();
     if (updateFolding) {
       for (AbstractFoldingAreaPainter painter : myFoldingAreaPainters) {
         painter.relayout();
       }
       // wee need to recalculateIconRenderersWidth only if one of collections was folded/unfolded
       recalculateIconRenderersWidth();
     }
     recalculateFoldingAreaWidth();
     updateSeparatorLinePosition();
   }
   updatePreferredSize();
 }
コード例 #4
0
ファイル: QueriesGenerated.java プロジェクト: java66liu/MPS
  public static Object propertyMacro_GetPropertyValue_7923290658387314322(
      final IOperationContext operationContext, final PropertyMacroContext _context) {
    SNode extendsNode =
        SLinkOperations.getTarget(
            SNodeOperations.cast(
                SLinkOperations.getTarget(_context.getNode(), "concept", false),
                "jetbrains.mps.lang.structure.structure.ConceptDeclaration"),
            "extends",
            false);

    if (SConceptOperations.isExactly(
        SLinkOperations.getTarget(_context.getNode(), "concept", false),
        "jetbrains.mps.lang.core.structure.BaseConcept")) {
      return "jetbrains.mps.smodel.runtime.impl.CompiledBehaviorDescriptor";
    }
    if ((extendsNode == null)) {
      extendsNode =
          SNodeOperations.getNode(
              "r:00000000-0000-4000-0000-011c89590288(jetbrains.mps.lang.core.structure)",
              "1133920641626");
    }

    String behaviorModel =
        jetbrains.mps.util.SNodeOperations.getModelLongName(SNodeOperations.getModel(extendsNode));
    behaviorModel =
        behaviorModel.substring(0, behaviorModel.length() - "structure".length()) + "behavior";
    return behaviorModel
        + "."
        + SPropertyOperations.getString(extendsNode, "name")
        + "_BehaviorDescriptor";
  }
コード例 #5
0
 @Override
 public SLanguage getLanguage() {
   return new SLanguageLanguageAdapter(
       ((Language)
           jetbrains.mps.util.SNodeOperations.getModelFromNodeReference(getConcept())
               .getModule()));
 }
コード例 #6
0
 protected boolean isValidEditor() {
   SNode node = getEditedNode();
   if (node == null) return false;
   SModel model = node.getModel();
   if (model != null && jetbrains.mps.util.SNodeOperations.isModelDisposed(model)) return false;
   return true;
 }
コード例 #7
0
 @Nullable
 @Override
 public SReference create(@NotNull TemplateGenerator generator) {
   if (myInputTargetNode != null) {
     // output target node might has been copied (reduced) from the input target node
     // here accept only one-to-one copying
     SNode ultimateTarget = generator.findCopiedOutputNodeForInputNode_unique(myInputTargetNode);
     if (ultimateTarget != null) {
       return createStaticReference(ultimateTarget);
     }
     String resolveInfo = jetbrains.mps.util.SNodeOperations.getResolveInfo(myInputTargetNode);
     if (resolveInfo != null) {
       return createDynamicReference(resolveInfo, getTargetModelReference(generator), null);
     }
     // if input was copied - return one of its copies
     // this can easy produce incorrect references
     SNode ambiguousTarget = generator.findCopiedOutputNodeForInputNode(myInputTargetNode);
     if (ambiguousTarget != null) {
       // RI_CIN is the only case doResolve_Tricky was implemented and hence checkResolveTarget
       // check moved here.
       if (checkResolvedTarget(generator, ambiguousTarget)) {
         return createStaticReference(ambiguousTarget);
       } else {
         return jetbrains.mps.smodel.SReference.create(
             getReferenceRole(),
             getOutputSourceNode(),
             generator.getOutputModel().getReference(),
             null,
             null);
       }
     }
   }
   return createInvalidReference(generator, null);
 }
コード例 #8
0
ファイル: ModelContentUtil.java プロジェクト: sprig/MPS
 public static Collection<String> getUsedLanguageNamespaces(
     SModel model, boolean isTemplateModel) {
   if (isTemplateModel) {
     return getUsedLanguageNamespacesInTemplateModel(model);
   }
   if (SModelStereotype.isGeneratorModel(model)) {
     TemplateModelScanner templateModelScanner = new TemplateModelScanner(model);
     templateModelScanner.scan();
     Set<String> namespaces = new HashSet<String>(templateModelScanner.getQueryLanguages());
     for (SModuleReference ref :
         ((jetbrains.mps.smodel.SModelInternal) model).engagedOnGenerationLanguages()) {
       namespaces.add(ref.getModuleName());
     }
     return namespaces;
   }
   Set<String> namespaces = new HashSet<String>();
   for (SModuleReference ref :
       ((jetbrains.mps.smodel.SModelInternal) model).engagedOnGenerationLanguages()) {
     namespaces.add(ref.getModuleName());
   }
   for (SNode root : model.getRootNodes()) {
     namespaces.add(NameUtil.namespaceFromConceptFQName(root.getConcept().getId()));
     for (SNode child : jetbrains.mps.util.SNodeOperations.getDescendants(root, null)) {
       namespaces.add(NameUtil.namespaceFromConceptFQName(child.getConcept().getId()));
     }
   }
   // empty behavior model should have it's behavior aspect descriptor generated
   if (model.getModule() instanceof Language && LanguageAspect.BEHAVIOR.is(model)) {
     namespaces.add(BootstrapLanguages.BEHAVIOR.getModuleName());
   }
   return namespaces;
 }
コード例 #9
0
 private static StringBuilder checkModel(final SModel sm) {
   StringBuilder errorMessages = new StringBuilder();
   List<String> validationResult =
       ModelAccess.instance()
           .runReadAction(
               new Computable<List<String>>() {
                 public List<String> compute() {
                   return new ModelValidator(sm).validate();
                 }
               });
   if (!(validationResult.isEmpty())) {
     errorMessages.append("errors in model: ").append(sm.getReference().toString()).append("\n");
     for (String item : validationResult) {
       errorMessages.append("\t");
       errorMessages.append(item);
       errorMessages.append("\n");
     }
   }
   for (SNode node : SNodeUtil.getDescendants(sm)) {
     // Testbench.LOG.debug("Checking node " + node);
     if (SModelUtil.findConceptDeclaration(node.getConcept().getQualifiedName()) == null) {
       errorMessages.append("Unknown concept ");
       errorMessages.append(node.getConcept().getQualifiedName());
       errorMessages.append("\n");
     }
   }
   for (SNode node : SNodeUtil.getDescendants(sm)) {
     for (SReference ref : node.getReferences()) {
       if (jetbrains.mps.smodel.SNodeUtil.hasReferenceMacro(node, ref.getRole())) {
         continue;
       }
       if (SNodeOperations.getTargetNodeSilently(ref) == null) {
         errorMessages
             .append("Broken reference in model {")
             .append(SNodeOperations.getModelLongName(node.getModel()))
             .append("}")
             .append(" node ")
             .append(node.getNodeId().toString())
             .append("(")
             .append(node)
             .append(")\n");
       }
     }
   }
   return errorMessages;
 }
コード例 #10
0
 /*package*/ static String getGeneratedClassFQName_id5FstybB4d8e(@NotNull SNode __thisNode__) {
   return SNodeOperations.getModelLongName(
           jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations.getModel(
               __thisNode__))
       + "."
       + BaseToolDeclaration__BehaviorDescriptor.getGeneratedName_id5FstybB4d83.invoke(
           __thisNode__);
 }
コード例 #11
0
ファイル: QueriesGenerated.java プロジェクト: java66liu/MPS
 public static Object propertyMacro_GetPropertyValue_7923290658387314641(
     final IOperationContext operationContext, final PropertyMacroContext _context) {
   SNode behavior =
       ConceptMethodDeclaration_Behavior.call_getBehaviour_1225196403947(_context.getNode());
   return jetbrains.mps.util.SNodeOperations.getModelLongName(SNodeOperations.getModel(behavior))
       + "."
       + SPropertyOperations.getString(behavior, "name");
 }
コード例 #12
0
 protected boolean check(SNode node) {
   if (SNodeOperations.getModel(node).getModule() instanceof TransientModelsModule) {
     genContext.showErrorMessage(
         dep,
         "returned dependency in transient model: "
             + jetbrains.mps.util.SNodeOperations.getDebugText(node));
     return false;
   }
   if (!(artifacts.contains(node))) {
     genContext.showErrorMessage(
         dep,
         "returned node which is not available in dependencies: "
             + jetbrains.mps.util.SNodeOperations.getDebugText(node));
     return false;
   }
   return true;
 }
コード例 #13
0
    @Override
    public boolean met(MPSTreeNode node) {
      if (node instanceof SNodeTreeNode) return false;
      if (node instanceof SModelTreeNode) {
        SModelTreeNode modelNode = (SModelTreeNode) node;
        if (!modelNode.hasModelsUnder()) return false;

        String outerName = SNodeOperations.getModelLongName(modelNode.getSModelDescriptor());
        String innerName = jetbrains.mps.util.SNodeOperations.getModelLongName(myModel);
        return innerName.startsWith(outerName + ".");
      }
      if (!node.isInitialized() && !node.hasInfiniteSubtree()) {
        node.init();
        return true;
      }
      return node.isInitialized();
    }
コード例 #14
0
 protected boolean checkArtifactId(Object artifactId) {
   if (artifactId instanceof SNode
       && ((SNode) artifactId).getModel().getModule() instanceof TransientModelsModule) {
     genContext.showErrorMessage(
         dep,
         "cannot register artifact in transient model "
             + jetbrains.mps.util.SNodeOperations.getDebugText(((SNode) artifactId)));
     return false;
   }
   return true;
 }
コード例 #15
0
ファイル: QueriesGenerated.java プロジェクト: java66liu/MPS
 public static Object propertyMacro_GetPropertyValue_1144956008583742122(
     final IOperationContext operationContext, final PropertyMacroContext _context) {
   String behaviorModel =
       jetbrains.mps.util.SNodeOperations.getModelLongName(
           SNodeOperations.getModel(_context.getNode()));
   behaviorModel =
       behaviorModel.substring(0, behaviorModel.length() - "structure".length()) + "behavior";
   return behaviorModel
       + "."
       + SPropertyOperations.getString(_context.getNode(), "name")
       + "_BehaviorDescriptor";
 }
コード例 #16
0
ファイル: TestModule.java プロジェクト: handong890/MPS
  public SModel createModel(SModel originalModel) {
    String originalLong = SNodeOperations.getModelLongName(originalModel);
    String newModelName = originalLong + "@999";
    while (!isValidName(newModelName)) {
      newModelName += "_";
    }

    SModel result = new TestSModelDescriptor(newModelName, originalModel);

    myModels.put(result.getReference().getModelName(), result);
    return result;
  }
コード例 #17
0
ファイル: ModelAssert.java プロジェクト: CloudMetal/MPS
  private static void assertReferenceEquals(SNode expectedNode, SNode actualNode) {
    Set<String> roles = new HashSet<String>();
    roles.addAll(jetbrains.mps.util.SNodeOperations.getReferenceRoles(expectedNode));
    roles.addAll(jetbrains.mps.util.SNodeOperations.getReferenceRoles(actualNode));
    Map<String, Set<SReference>> expRoleToReferenceMap = createRoleToReferenceMap(expectedNode);
    Map<String, Set<SReference>> actRoleToReferenceMap = createRoleToReferenceMap(actualNode);

    for (String role : roles) {
      Assert.assertEquals(
          getErrorString("different number of referents in role " + role, expectedNode, actualNode),
          expRoleToReferenceMap.get(role).size(),
          actRoleToReferenceMap.get(role).size());

      SReference expectedReference = expectedNode.getReference(role);
      SReference actualReference = actualNode.getReference(role);

      assertReferenceEquals(
          getErrorString("reference in role " + role, expectedNode, actualNode),
          expectedReference,
          actualReference);
    }
  }
コード例 #18
0
 @Override
 public void doExecute(@NotNull final AnActionEvent event, final Map<String, Object> _params) {
   FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.goto.definition");
   final SNode targetNode =
       APICellAdapter.getSNodeWRTReference(
           ((EditorCell) MapSequence.fromMap(_params).get("cell")));
   NavigationSupport.getInstance()
       .openNode(
           ((IOperationContext) MapSequence.fromMap(_params).get("context")),
           targetNode,
           true,
           !(SNodeOperations.isRoot(targetNode)));
 }
コード例 #19
0
ファイル: TraceBuilderUI.java プロジェクト: rkrijgsheld/MPS
 private Iterable<TraceNodeUI> compactTemplates(Iterable<TraceNodeUI> templateNodes) {
   if (!myCompactTemplates) {
     return templateNodes;
   }
   // compactByNavigateTarget();
   ArrayList<TraceNodeUI> rv = new ArrayList<TraceNodeUI>();
   LinkedHashMap<SNode, TraceNodeUI> mostSpecificTemplates =
       new LinkedHashMap<SNode, TraceNodeUI>();
   L1:
   for (TraceNodeUI n : templateNodes) {
     SNodeReference t = n.getNavigateTarget();
     SNode templateNode = t == null ? null : t.resolve(MPSModuleRepository.getInstance());
     if (templateNode == null) {
       rv.add(n);
       continue;
     }
     for (SNode tn : new ArrayList<SNode>(mostSpecificTemplates.keySet())) {
       if (tn.getContainingRoot() == templateNode.getContainingRoot()) {
         // within same hierarchy
         if (SNodeOperations.isAncestor(tn, templateNode)) {
           // templateNode is more specific template than the one we already got in
           // mostSpecificTemplates
           mostSpecificTemplates.remove(tn);
           mostSpecificTemplates.put(templateNode, n);
           continue L1;
         } else if (SNodeOperations.isAncestor(templateNode, tn)) {
           // templateNode is enclosing template, forget it
           continue L1;
         } // else unrelated, two independent descendants, continue looking through most specific
           // templates found.
       }
     }
     // no related templates found, record present one
     mostSpecificTemplates.put(templateNode, n);
   }
   rv.addAll(mostSpecificTemplates.values());
   return rv;
 }
コード例 #20
0
 public static String virtual_getUnitName_5067982036267369911(SNode thisNode) {
   String fqName = INamedConcept_Behavior.call_getFqName_1213877404258(thisNode);
   if (SNodeOperations.getAncestor(
           thisNode, "jetbrains.mps.baseLanguage.structure.Classifier", false, false)
       == null) {
     return fqName;
   }
   int index = fqName.lastIndexOf(".");
   if (index <= 0) {
     return fqName;
   }
   int length =
       jetbrains.mps.util.SNodeOperations.getModelLongName(SNodeOperations.getModel(thisNode))
           .length();
   return fqName.substring(0, length) + "." + fqName.substring(length + 1).replace(".", "$");
 }
コード例 #21
0
 public static void mappingScript_CodeBlock_1195510384869(final MappingScriptContext _context) {
   // test1 only
   Object object = _context.getStepObject("run post-processing");
   if (object == null) {
     return;
   }
   System.out.println(
       "!!!test post-mapping. model="
           + jetbrains.mps.util.SNodeOperations.getModelLongName(_context.getModel()));
   SNode outputRoot =
       SModelOperations.createNewRootNode(
           _context.getModel(),
           "jetbrains.mps.transformation.test.outputLang.structure.OutputRoot",
           null);
   SPropertyOperations.set(outputRoot, "name", "created by post-processing script");
 }
コード例 #22
0
 private static void execute_id7oNS25df64x(@NotNull SNode __thisNode__, Project project) {
   SNode targetNode =
       SLinkOperations.getTarget(
           __thisNode__,
           MetaAdapterFactory.getReferenceLink(
               0xde1ad86d6e504a02L,
               0xb306d4d17f64c375L,
               0x36ac6f29ae8c1fb5L,
               0x4904fd89e74fc6fL,
               "target"));
   jetbrains.mps.project.Project mpsProject = ProjectHelper.toMPSProject(project);
   if (mpsProject == null) {
     return;
   }
   NavigationSupport.getInstance()
       .openNode(mpsProject, targetNode, true, !(SNodeOperations.isRoot(targetNode)));
 }
コード例 #23
0
 public static void mappingScript_CodeBlock_1195509228078(final MappingScriptContext _context) {
   // test1 only
   if (!(QueriesUtil.isTest1(_context.getModel()))) {
     return;
   }
   _context.putStepObject("run post-processing", new Object());
   System.out.println(
       "!!!test pre-mapping. model="
           + jetbrains.mps.util.SNodeOperations.getModelLongName(_context.getModel()));
   SNode inputRoot =
       SModelOperations.createNewRootNode(
           _context.getModel(),
           "jetbrains.mps.transformation.test.inputLang.structure.InputRoot",
           null);
   SPropertyOperations.set(inputRoot, "name", "Input Root created by pre-process script");
   SPropertyOperations.set(inputRoot, "useInTest", "test1");
 }
コード例 #24
0
  public boolean canExecute(EditorContext context) {
    EditorCell selectedCell = getCellToPasteTo((EditorCell) context.getSelectedCell());
    if (selectedCell == null) {
      return false;
    }
    SNode selectedNode = selectedCell.getSNode();
    if (selectedNode == null || jetbrains.mps.util.SNodeOperations.isDisposed(selectedNode)) {
      return false;
    }
    List<SNode> pasteNodes = CopyPasteUtil.getNodesFromClipboard(selectedNode.getModel());
    if (pasteNodes == null || pasteNodes.isEmpty()) {
      return CopyPasteUtil.isConversionAvailable(selectedNode.getModel(), selectedNode);
    }

    if (!new NodePaster(pasteNodes).canPaste(selectedCell)) {
      LOG.debug("Couldn't paste node here");
      return false;
    }
    return true;
  }
コード例 #25
0
 public static int virtual_getMetaLevel_3981318653438234726(SNode thisNode) {
   if (jetbrains.mps.util.SNodeOperations.isRoot(thisNode)) {
     return 0;
   }
   int metalevel = 0;
   for (SNode metaLevelChanger :
       SNodeOperations.getNodeAncestors(
           thisNode,
           MetaAdapterFactory.getInterfaceConcept(
               0xceab519525ea4f22L,
               0x9b92103b95ca8c0cL,
               0x2cc012b1584bd3aL,
               "jetbrains.mps.lang.core.structure.IMetaLevelChanger"),
           false)) {
     metalevel +=
         BehaviorReflection.invokeVirtual(
             Integer.TYPE,
             metaLevelChanger,
             "virtual_getMetaLevelChange_201537367881074474",
             new Object[] {});
   }
   return metalevel;
 }
コード例 #26
0
ファイル: SLinkOperations.java プロジェクト: rkrijgsheld/MPS
  public static SNode setTarget(SNode node, String role, SNode targetNode, boolean child) {
    if (node != null) {
      if (child) {
        SNode oldChild = SNodeOperations.getChild(node, role);
        if (oldChild != null) {
          node.removeChild(oldChild);
        }

        if (targetNode != null) {
          SNode targetParent = targetNode.getParent();
          if (targetParent != node) {
            if (targetParent != null) {
              targetParent.removeChild(targetNode);
            }
            node.addChild(role, targetNode);
          }
        }
      } else {
        SNodeAccessUtil.setReferenceTarget(node, role, targetNode);
      }
    }
    return targetNode;
  }
コード例 #27
0
 public void execute(final SNode node, final EditorContext editorContext) {
   SNode project =
       SNodeFactoryOperations.createNewNode(
           "jetbrains.mps.buildlanguage.structure.Project", null);
   List<String> externalProps =
       ListSequence.fromListAndArray(
           new ArrayList<String>(), "input.dir", "output.dir", "deploy.dir");
   for (String prop : ListSequence.fromList(externalProps)) {
     SNode property =
         SNodeFactoryOperations.createNewNode(
             "jetbrains.mps.buildlanguage.structure.ExternalPropertyDeclaration", null);
     SPropertyOperations.set(property, "name", prop);
     SLinkOperations.setTarget(
         property,
         "type",
         SNodeFactoryOperations.createNewNode(
             "jetbrains.mps.buildlanguage.structure.FileType", null),
         true);
     ListSequence.fromList(SLinkOperations.getTargets(project, "property", true))
         .addElement(property);
   }
   SModel model = editorContext.getModel();
   model.addRoot(project);
   SLinkOperations.setTarget(node, "project", project, false);
   SLinkOperations.setTarget(
       node,
       "targetDeclaration",
       SLinkOperations.getTarget(
           SLinkOperations.getTarget(project, "default", true), "targetDeclaration", false),
       false);
   NavigationSupport.getInstance()
       .openNode(
           editorContext.getOperationContext(),
           project,
           true,
           !(SNodeOperations.isRoot(project)));
 }
コード例 #28
0
 private static String getGeneratedClassFQName_idhEwJa8g(@NotNull SNode __thisNode__) {
   return jetbrains.mps.util.SNodeOperations.getModelLongName(
           SNodeOperations.getModel(__thisNode__))
       + "."
       + ActionGroupDeclaration_BehaviorDescriptor.getGeneratedName_idhEwJa82.invoke(__thisNode__);
 }
コード例 #29
0
ファイル: ModelChecker.java プロジェクト: sprig/MPS
  public void checkModel(final SModel modelDescriptor, final ProgressMonitor monitor) {
    final Wrappers._T<List<SpecificChecker>> specificCheckers =
        new Wrappers._T<List<SpecificChecker>>(mySpecificCheckers);
    if (specificCheckers.value == null) {
      specificCheckers.value = ModelCheckerSettings.getInstance().getSpecificCheckers();
    }

    monitor.start(
        "Checking " + SNodeOperations.getModelLongName(modelDescriptor),
        ListSequence.fromList(specificCheckers.value).count());
    try {
      ModelAccess.instance()
          .runReadAction(
              new Runnable() {
                public void run() {
                  SModule module = modelDescriptor.getModule();
                  Project project = myOperationContext.getProject();

                  if (module == null) {
                    if (LOG.isEnabledFor(Priority.WARN)) {
                      LOG.warn(
                          "Module is null for "
                              + SNodeOperations.getModelLongName(modelDescriptor)
                              + " model");
                    }
                  }
                  if (project == null) {
                    if (LOG.isEnabledFor(Priority.WARN)) {
                      LOG.warn(
                          "Project is null for IOperationContext in "
                              + SNodeOperations.getModelLongName(modelDescriptor)
                              + " model");
                    }
                  }

                  if (module != null && project != null) {
                    IOperationContext operationContext =
                        new ModelChecker.ModelCheckerOperationContext(project, module);
                    SModel model = modelDescriptor;

                    for (SpecificChecker specificChecker :
                        ListSequence.fromList(specificCheckers.value)) {
                      try {
                        List<SearchResult<ModelCheckerIssue>> specificCheckerResults =
                            specificChecker.checkModel(model, monitor.subTask(1), operationContext);
                        myResults.getSearchResults().addAll(specificCheckerResults);
                      } catch (Throwable t) {
                        if (LOG.isEnabledFor(Priority.ERROR)) {
                          LOG.error(
                              "Error while "
                                  + SNodeOperations.getModelLongName(model)
                                  + " model checking",
                              t);
                        }
                      }
                      if (monitor.isCanceled()) {
                        break;
                      }
                    }
                  }
                }
              });
    } finally {
      monitor.done();
    }
  }
コード例 #30
0
ファイル: GenerationFacade.java プロジェクト: norro/MPS
 public static boolean canGenerate(SModel sm) {
   return SNodeOperations.isGeneratable(sm);
 }