Exemplo n.º 1
0
 protected void readModules(FileMPSProject.ProjectDescriptor projDesc) {
   myErrors = null;
   //  load solutions
   Set<ModuleReference> 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);
         IModule m = ModuleRepositoryFacade.createModule(moduleHandle, this);
         ModuleReference 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 (ModuleReference ref : existingModules) {
     super.removeModule(ref);
   }
 }
Exemplo n.º 2
0
    private void load(File file, Element root) {
      Macros macros = MacrosFactory.projectDescriptor();
      FileMPSProject.ProjectDescriptor result_dkknya_a1a1a = this;
      final String result_dkknya_a0a1a1a = file.getName();
      result_dkknya_a1a1a.setName(result_dkknya_a0a1a1a);

      if (root == null) {
        return;
      }

      List<Element> moduleList = ListSequence.fromList(new ArrayList<Element>());
      ListSequence.fromList(moduleList)
          .addSequence(
              ListSequence.fromList(
                  AttributeUtils.elementChildren(
                      ListSequence.fromList(
                              AttributeUtils.elementChildren(root, "projectSolutions"))
                          .first(),
                      "solutionPath")));
      ListSequence.fromList(moduleList)
          .addSequence(
              ListSequence.fromList(
                  AttributeUtils.elementChildren(
                      ListSequence.fromList(
                              AttributeUtils.elementChildren(root, "projectLanguages"))
                          .first(),
                      "languagePath")));
      ListSequence.fromList(moduleList)
          .addSequence(
              ListSequence.fromList(
                  AttributeUtils.elementChildren(
                      ListSequence.fromList(AttributeUtils.elementChildren(root, "projectDevkits"))
                          .first(),
                      "devkitPath")));
      ListSequence.fromList(moduleList)
          .addSequence(
              ListSequence.fromList(
                  AttributeUtils.elementChildren(
                      ListSequence.fromList(AttributeUtils.elementChildren(root, "projectModules"))
                          .first(),
                      "modulePath")));
      for (Element moduleElement : ListSequence.fromList(moduleList)) {
        Path modulePath = new Path();
        Path result_dkknya_a1a9a1a1a = modulePath;
        final String result_dkknya_a0a1a9a1a1a =
            macros.expandPath(moduleElement.getAttributeValue("path"), file);
        result_dkknya_a1a9a1a1a.setPath(result_dkknya_a0a1a9a1a1a);
        final String result_dkknya_a1a1a9a1a1a = moduleElement.getAttributeValue("folder");
        result_dkknya_a1a9a1a1a.setMPSFolder(result_dkknya_a1a1a9a1a1a);
        result_dkknya_a1a1a.addModule(modulePath);
      }

      for (Element e :
          ListSequence.fromList(
              AttributeUtils.elementChildren(
                  ListSequence.fromList(AttributeUtils.elementChildren(root, "genConfs")).first(),
                  "genConfModels"))) {
        ModelsTestConfiguration tc = new ModelsTestConfiguration();
        tc.setName(e.getAttributeValue("name"));
        for (Element me :
            ListSequence.fromList(
                AttributeUtils.elementChildren(
                    ListSequence.fromList(AttributeUtils.elementChildren(e, "models")).first(),
                    "model"))) {
          tc.addModel(SModelReference.fromString(me.getAttributeValue("modelRef")));
        }
        result_dkknya_a1a1a.getTestConfiturations().add(tc);
      }
      for (Element e :
          ListSequence.fromList(
              AttributeUtils.elementChildren(
                  ListSequence.fromList(AttributeUtils.elementChildren(root, "genConfs")).first(),
                  "genConfModule"))) {
        ModuleTestConfiguration tc = new ModuleTestConfiguration();
        tc.setName(e.getAttributeValue("name"));
        if (e.getAttributeValue("moduleRef") != null) {
          tc.setModuleRef(ModuleReference.fromString(e.getAttributeValue("moduleRef")));
          result_dkknya_a1a1a.getTestConfiturations().add(tc);
        }
      }
    }