Пример #1
0
 protected void readModules(FileMPSProject.ProjectDescriptor projDesc) {
   myErrors = null;
   //  load solutions
   Set<SModuleReference> existingModules = getModuleReferences();
   for (Path modulePath : projDesc.getModules()) {
     String path = modulePath.getPath();
     IFile descriptorFile = FileSystem.getInstance().getFileByPath(path);
     if (descriptorFile.exists()) {
       ModuleDescriptor descriptor =
           ModulesMiner.getInstance().loadModuleDescriptor(descriptorFile);
       if (descriptor != null) {
         ModulesMiner.ModuleHandle moduleHandle =
             new ModulesMiner.ModuleHandle(descriptorFile, descriptor);
         SModule m = ModuleRepositoryFacade.createModule(moduleHandle, this);
         SModuleReference moduleReference = m.getModuleReference();
         if (!(existingModules.remove(moduleReference))) {
           super.addModule(moduleReference);
         }
       } else {
         error("Can't load module from " + descriptorFile.getPath() + " Unknown file type.");
       }
     } else {
       error("Can't load module from " + descriptorFile.getPath() + " File doesn't exist.");
     }
   }
   for (SModuleReference ref : existingModules) {
     super.removeModule(ref);
   }
 }
Пример #2
0
    private void load(File file, Element root) {
      FileMPSProject.ProjectDescriptor result_dkknya_a0a5o = this;
      final String result_dkknya_a0a0a5o = file.getName();
      result_dkknya_a0a5o.setName(result_dkknya_a0a0a5o);

      if (root == null) {
        return;
      }

      List<Element> moduleList = ListSequence.fromList(new ArrayList<Element>());
      ListSequence.fromList(moduleList)
          .addSequence(
              Sequence.fromIterable(
                  XmlUtil.children(XmlUtil.first(root, "projectSolutions"), "solutionPath")));
      ListSequence.fromList(moduleList)
          .addSequence(
              Sequence.fromIterable(
                  XmlUtil.children(XmlUtil.first(root, "projectLanguages"), "languagePath")));
      ListSequence.fromList(moduleList)
          .addSequence(
              Sequence.fromIterable(
                  XmlUtil.children(XmlUtil.first(root, "projectDevkits"), "devkitPath")));
      ListSequence.fromList(moduleList)
          .addSequence(
              Sequence.fromIterable(
                  XmlUtil.children(XmlUtil.first(root, "projectModules"), "modulePath")));
      for (Element moduleElement : ListSequence.fromList(moduleList)) {
        Path modulePath = new Path();
        Path result_dkknya_a1a9a0a5o = modulePath;
        final String result_dkknya_a0a1a9a0a5o =
            MacrosFactory.forProjectFile(FileSystem.getInstance().getFileByPath(file.getPath()))
                .expandPath(moduleElement.getAttributeValue("path"));
        result_dkknya_a1a9a0a5o.setPath(result_dkknya_a0a1a9a0a5o);
        final String result_dkknya_a1a1a9a0a5o = moduleElement.getAttributeValue("folder");
        result_dkknya_a1a9a0a5o.setMPSFolder(result_dkknya_a1a1a9a0a5o);
        result_dkknya_a0a5o.addModule(modulePath);
      }

      for (Element e :
          Sequence.fromIterable(
              XmlUtil.children(XmlUtil.first(root, "genConfs"), "genConfModels"))) {
        ModelsTestConfiguration tc = new ModelsTestConfiguration();
        tc.setName(e.getAttributeValue("name"));
        for (Element me :
            Sequence.fromIterable(XmlUtil.children(XmlUtil.first(e, "models"), "model"))) {
          tc.addModel(SModelReference.fromString(me.getAttributeValue("modelRef")));
        }
        result_dkknya_a0a5o.getTestConfigurations().add(tc);
      }

      for (Element e :
          Sequence.fromIterable(
              XmlUtil.children(XmlUtil.first(root, "genConfs"), "genConfModule"))) {
        ModuleTestConfiguration tc = new ModuleTestConfiguration();
        tc.setName(e.getAttributeValue("name"));
        String moduleRef = e.getAttributeValue("moduleRef");
        if (moduleRef != null) {
          tc.setModuleRef(ModuleReference.fromString(moduleRef));
          result_dkknya_a0a5o.getTestConfigurations().add(tc);
        }
      }
    }