示例#1
0
  @Override
  public List<String> getWarnings() {
    List<String> warnings = new ArrayList<String>(super.getWarnings());
    Set<String> usedLanguages = new HashSet<String>();
    for (SModel model : myModule.getOwnTemplateModels()) {
      if (SModelStereotype.isGeneratorModel(model)) {
        usedLanguages.addAll(ModelContentUtil.getUsedLanguageNamespacesInTemplateModel(model));
      }
    }
    Set<String> extendedLanguages = new HashSet<String>();
    Language sourceLanguage = myModule.getSourceLanguage();
    usedLanguages.remove(sourceLanguage.getModuleName());

    Set<Language> ext = new LinkedHashSet<Language>();
    sourceLanguage.getDependenciesManager().collectAllExtendedLanguages(ext);

    for (Language language : ext) {
      extendedLanguages.add(language.getModuleName());
    }

    for (String lang : usedLanguages) {
      Language language = ModuleRepositoryFacade.getInstance().getModule(lang, Language.class);
      if (language == null) continue;

      if (!extendedLanguages.contains(lang) && !language.getRuntimeModulesReferences().isEmpty()) {
        warnings.add(sourceLanguage + " should extend " + lang);
      }
    }
    return warnings;
  }
示例#2
0
  private static SModule getModuleForModel(MPSProject project, SModel model) {
    // language's and solution's own models (+generator models in language)
    SModule owner = model.getModule();
    SModule mainModule =
        owner instanceof Generator ? ((Generator) owner).getSourceLanguage() : owner;
    if (project.isProjectModule(mainModule)) return owner;

    // accessories models in languages
    /*
      //with this enabled, alt-f1 does not work in case node is in non-owned accessory model to a project language
      for (Language l : project.getProjectLanguages()) {
        if (l.isAccessoryModel(model.getSModelReference())) return l;
      }
    */

    // runtime models in languages
    for (Language l : project.getProjectModules(Language.class)) {
      for (SModuleReference depModule : l.getRuntimeModulesReferences()) {
        if (depModule.equals(mainModule.getModuleReference())) return owner;
      }
    }

    // accessories models in devkits

    // runtime models in devkits

    return owner;
  }
示例#3
0
 public static Iterable sourceNodesQuery_1220369573364040170(
     final IOperationContext operationContext, final SourceSubstituteMacroNodesContext _context) {
   List<SNode> result = new ArrayList<SNode>();
   List<Language> langs =
       SModelOperations.getLanguages(
           SNodeOperations.getModel(_context.getNode()), GlobalScope.getInstance());
   for (Language lang : langs) {
     for (ModuleReference mr : lang.getRuntimeModulesReferences()) {
       for (SModelDescriptor smd :
           MPSModuleRepository.getInstance().getModule(mr).getOwnModelDescriptors()) {
         SModel rtModel = smd.getSModel();
         for (SNode gwtmod :
             jetbrains.mps.lang.smodel.generator.smodelAdapter.SModelOperations.getRoots(
                 rtModel, "jetbrains.mps.gwt.client.structure.GWTModule")) {
           ListSequence.fromList(result).addElement(gwtmod);
         }
       }
     }
   }
   return result;
 }