コード例 #1
0
ファイル: ModulesMiner.java プロジェクト: sprig/MPS
  private <T> void readModuleDescriptorsFromFile(
      IFile file,
      Set<IFile> excludes,
      List<T> result,
      boolean refreshFiles,
      DescriptorReader<T> reader) {
    if (!needProcess(file, excludes)) return;
    if (refreshFiles) {
      FileSystem.getInstance().refresh(file);
    }

    if (file.getName().endsWith(JAR)) {
      IFile jarRoot = FileSystem.getInstance().getFileByPath(file.getPath() + JAR_SEPARATOR);
      if (jarRoot != null) {
        readModuleDescriptorsFromFolder(jarRoot, excludes, result, refreshFiles, reader);
      }
    } else {
      if (!isModuleFile(file)) return;
      ModuleDescriptor moduleDescriptor = loadDescriptorOnly_internal(file, excludes);
      if (moduleDescriptor != null) {
        T descriptor = reader.read(new ModuleHandle(file, moduleDescriptor));
        if (descriptor != null) {
          result.add(descriptor);
        }
      }
    }
  }
コード例 #2
0
ファイル: BaseModuleValidator.java プロジェクト: sprig/MPS
  @Override
  public List<String> getErrors() {
    List<String> errors = new ArrayList<String>();
    Throwable loadException = myModule.getModuleDescriptor().getLoadException();
    if (loadException != null) {
      errors.add("Couldn't load module: " + loadException.getMessage());
      return errors;
    }

    ModuleDescriptor descriptor = myModule.getModuleDescriptor();
    // null?

    for (Dependency dep : descriptor.getDependencies()) {
      SModuleReference moduleRef = dep.getModuleRef();
      if (MPSModuleRepository.getInstance().getModule(moduleRef) == null) {
        errors.add("Can't find dependency: " + moduleRef.getModuleName());
      }
    }
    for (SModuleReference reference : descriptor.getUsedLanguages()) {
      if (ModuleRepositoryFacade.getInstance().getModule(reference, Language.class) == null) {
        errors.add("Can't find used language: " + reference.getModuleName());
      }
    }
    for (SModuleReference reference : descriptor.getUsedDevkits()) {
      if (MPSModuleRepository.getInstance().getModule(reference) == null) {
        errors.add("Can't find used devkit: " + reference.getModuleName());
      }
    }

    if (descriptor.getSourcePaths() != null && !myModule.isPackaged()) {
      for (String sourcePath : descriptor.getSourcePaths()) {
        IFile file = FileSystem.getInstance().getFileByPath(sourcePath);
        if (file == null || !file.exists()) {
          errors.add("Can't find source path: " + sourcePath);
        }
      }
    }
    if (descriptor.getAdditionalJavaStubPaths() != null) {
      for (String path : descriptor.getAdditionalJavaStubPaths()) {
        IFile file = FileSystem.getInstance().getFileByPath(path);
        if (file == null || !file.exists()) {
          if (new File(path).exists()) {
            errors.add("Idea VFS is not up-to-date. Can't find library: " + path);
          } else {
            errors.add("Can't find library: " + path);
          }
        }
      }
    }

    // todo: =(
    if (!(myModule instanceof Generator)) {
      errors.addAll(validateDependenciesOnGenerators());
    }

    return errors;
  }
コード例 #3
0
ファイル: ModulesMiner.java プロジェクト: sprig/MPS
  private void processExcludes(
      @NotNull IFile descriptorFile, ModuleDescriptor descriptor, Set<IFile> excludes) {
    if (descriptor == null || descriptorFile.isReadOnly()) {
      return;
    }

    for (String p : descriptor.getSourcePaths()) {
      excludes.add(FileSystem.getInstance().getFileByPath(p));
    }

    IFile genPath = ProjectPathUtil.getGeneratorOutputPath(descriptorFile.getParent(), descriptor);
    if (genPath != null) {
      excludes.add(genPath);
      if (!descriptorFile.isReadOnly()) {
        FileSystem.getInstance().getFileByPath(FileGenerationUtil.getCachesPath(genPath.getPath()));
      }
    }

    IFile testsGenPath = ProjectPathUtil.getGeneratorTestsOutputPath(descriptorFile, descriptor);
    if (testsGenPath != null) {
      excludes.add(testsGenPath);
      if (!descriptorFile.isReadOnly()) {
        FileSystem.getInstance()
            .getFileByPath(FileGenerationUtil.getCachesPath(testsGenPath.getPath()));
      }
    }

    for (ModelRootDescriptor rootDescriptor : descriptor.getModelRootDescriptors()) {
      ModelRoot root = rootDescriptor.getRoot();
      if (root == null
          || root.getManager() != null && root.getManager() != LanguageID.JAVA_MANAGER) {
        continue;
      }

      excludes.add(FileSystem.getInstance().getFileByPath(root.getPath()));
    }

    IFile classesGen = ProjectPathUtil.getClassesGenFolder(descriptorFile.getParent(), false);
    if (classesGen != null) {
      excludes.add(classesGen);
    }

    // todo: specify what kind of descriptor can be input for this method
    if (descriptor instanceof LanguageDescriptor) {
      IFile generatorClassesGen =
          ProjectPathUtil.getClassesGenFolder(descriptorFile.getParent(), true);
      if (generatorClassesGen != null) {
        excludes.add(generatorClassesGen);
      }
    }

    for (String entry : descriptor.getAdditionalJavaStubPaths()) {
      excludes.add(FileSystem.getInstance().getFileByPath(entry));
    }
  }
コード例 #4
0
 private static IFile getRefactoringsFile(IFile modelFile) {
   String modelPath = modelFile.getPath();
   String refactoringsPath =
       modelPath.substring(0, modelPath.length() - MPSExtentions.DOT_MODEL.length())
           + MPSExtentions.DOT_REFACTORINGS;
   return FileSystem.getInstance().getFileByPath(refactoringsPath);
 }
コード例 #5
0
ファイル: FileMPSProject.java プロジェクト: rr-develop/MPS
 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);
   }
 }
コード例 #6
0
ファイル: DefaultModelRoot.java プロジェクト: qyqx/MPS
 public boolean isLanguageAspectsSourceRoot(String sourceRoot) {
   if (!(getModule() instanceof Language)) return false;
   return FileSystem.getInstance()
       .getFileByPath(sourceRoot)
       .getName()
       .equals(Language.LANGUAGE_MODELS);
 }
コード例 #7
0
ファイル: MpsModuleTestSuite.java プロジェクト: sprig/MPS
  private Iterable<SModule> loadModule(String modulePath) {
    final List<ModulesMiner.ModuleHandle> collectModules =
        ModulesMiner.getInstance()
            .collectModules(FileSystem.getInstance().getFileByPath(modulePath), false);

    if (collectModules.isEmpty()) {
      return ListSequence.fromList(new ArrayList<SModule>());
    }

    return ModelAccess.instance()
        .runWriteAction(
            new Computable<List<SModule>>() {
              public List<SModule> compute() {
                List<SModule> modules = new ArrayList<SModule>();
                BaseMPSModuleOwner owner = new BaseMPSModuleOwner() {};
                for (ModulesMiner.ModuleHandle moduleHandle : collectModules) {
                  SModule module = ModuleRepositoryFacade.createModule(moduleHandle, owner);
                  if (module != null) {
                    modules.add(module);
                  }
                }
                CleanupManager.getInstance().cleanup();
                ClassLoaderManager.getInstance().reloadAll(new EmptyProgressMonitor());
                return modules;
              }
            });
  }
  CodeOrchestraStreamHandler(
      SModelDescriptor modelDescriptor,
      IFile outputDir,
      CodeOrchestraGenerationFileProcessor processor) {
    myOriginalOutputDir = outputDir;

    CodeOrchestraGenerateManager codeOrchestraGenerateManager =
        processor.getProject().getComponent(CodeOrchestraGenerateManager.class);
    CodeOrchestraGenerationContext currentContext =
        codeOrchestraGenerateManager.getCurrentContext();
    if (currentContext == null) {
      myOutputDir = outputDir;
      myCachesOutputDir = FileGenerationUtil.getCachesDir(outputDir);
    } else {
      ModuleReference rootModuleReference = currentContext.getRootModule();

      // We override the output path for the AS & JS modules
      if (currentContext.isSingleOutputContext()) {
        IModule rootModule = MPSModuleRepository.getInstance().getModule(rootModuleReference);
        myOutputDir =
            FileSystem.getInstance().getFileByPath(rootModule.getOutputFor(modelDescriptor));
        myCachesOutputDir = FileGenerationUtil.getCachesDir(myOutputDir);
      } else {
        myOutputDir = outputDir;
        myCachesOutputDir = FileGenerationUtil.getCachesDir(outputDir);
      }
    }

    myModelDescriptor = modelDescriptor;
    myProcessor = processor;
  }
コード例 #9
0
 @Override
 public Iterable<SModel> loadModels() {
   IFile path = FileSystem.getInstance().getFileByPath(myPath);
   Set<SModel> models = getModels(path, "");
   // TODO this is probably wrong... models should be registered elsewhere
   // <node>
   return models;
 }
コード例 #10
0
ファイル: ModulesMiner.java プロジェクト: sprig/MPS
 @Nullable
 public static IFile getRealDescriptorFile(
     String filePath, DeploymentDescriptor deploymentDescriptor) {
   if (deploymentDescriptor.getSourcesJar() != null) {
     IFile moduleJar =
         FileSystem.getInstance()
             .getFileByPath(
                 filePath.substring(0, filePath.length() - SLASH_META_INF_MODULE_XML.length()));
     IFile sourcesJar = moduleJar.getParent().getDescendant(deploymentDescriptor.getSourcesJar());
     if (sourcesJar.exists() && deploymentDescriptor.getDescriptorFile() != null) {
       return FileSystem.getInstance()
           .getFileByPath(
               sourcesJar.getPath() + "!/module/" + deploymentDescriptor.getDescriptorFile());
     }
   }
   return null;
 }
コード例 #11
0
 // component stuff
 @Override
 public void initComponent() {
   boolean useIoFile = RuntimeFlags.isTestMode() && RuntimeFlags.isUseIOFile();
   if (!useIoFile) {
     // setup filesystem provider
     FileSystem.getInstance().setFileSystemProvider(this);
   }
 }
コード例 #12
0
ファイル: DefaultModelRoot.java プロジェクト: qyqx/MPS
  protected final void collectModels(
      IFile dir,
      String package_,
      String relativePath,
      Map<String, String> options,
      Collection<SModel> models) {
    if (FileSystem.getInstance().isFileIgnored(dir.getName())) return;
    if (!dir.isDirectory()) return;

    List<IFile> files = dir.getChildren();
    options.put(ModelFactory.OPTION_PACKAGE, package_);
    for (IFile file : files) {
      String fileName = file.getName();
      String extension = FileUtil.getExtension(fileName);

      if (extension == null) continue;
      ModelFactory modelFactory = PersistenceFacade.getInstance().getModelFactory(extension);
      if (modelFactory == null || file.isDirectory()) continue;

      FileDataSource source = new FileDataSource(file, this);
      options.put(ModelFactory.OPTION_RELPATH, combinePath(relativePath, fileName));
      String fileNameWE = FileUtil.getNameWithoutExtension(fileName);
      options.put(
          ModelFactory.OPTION_MODELNAME,
          package_ != null
              ? (package_.isEmpty() ? fileNameWE : package_ + "." + fileNameWE)
              : null);
      try {
        SModel model = modelFactory.load(source, Collections.unmodifiableMap(options));
        ((SModelBase) model).setModelRoot(this);
        models.add(model);
      } catch (UnsupportedDataSourceException ex) {
        /* model factory registration problem: ignore */
      }
    }

    options.put(ModelFactory.OPTION_RELPATH, relativePath);
    for (FolderModelFactory factory : PersistenceRegistry.getInstance().getFolderModelFactories()) {
      for (DataSource dataSource : factory.createDataSources(this, dir)) {
        SModel model = factory.load(dataSource, Collections.unmodifiableMap(options));
        ((SModelBase) model).setModelRoot(this);
        models.add(model);
      }
    }

    for (IFile childDir : files) {
      if (childDir.isDirectory()) {
        String name = childDir.getName();
        String innerPackage =
            package_ != null && JavaNameUtil.isJavaIdentifier(name)
                ? (package_.isEmpty() ? name : package_ + "." + name)
                : null;
        String innerPath = combinePath(relativePath, name);
        collectModels(childDir, innerPackage, innerPath, options, models);
      }
    }
  }
コード例 #13
0
 private static boolean renderingCondition_rpujt6_a1b0(SNode node, EditorContext editorContext) {
   String path = null;
   SModule module = SNodeOperations.getModel(node).getModule();
   if (module instanceof AbstractModule) {
     path =
         MacrosFactory.forModule((AbstractModule) module)
             .expandPath(SPropertyOperations.getString(node, "iconPath"));
   }
   return path != null && FileSystem.getInstance().getFileByPath(path).exists();
 }
コード例 #14
0
 private static boolean renderingCondition_fl5ndt_a2b1b0(
     SNode node, EditorContext editorContext, IScope scope) {
   String path = null;
   IModule module = SNodeOperations.getModel(node).getModelDescriptor().getModule();
   if (module != null) {
     path =
         MacrosFactory.forModuleFile(module.getDescriptorFile())
             .expandPath(SPropertyOperations.getString(node, "icon"));
   }
   return path != null && FileSystem.getInstance().getFileByPath(path).exists();
 }
コード例 #15
0
 public void doExecute(@NotNull final AnActionEvent event, final Map<String, Object> _params) {
   try {
     IModule module = ((SModelDescriptor) MapSequence.fromMap(_params).get("model")).getModule();
     TreeFileChooser treeFileChooser = new TreeFileChooser();
     treeFileChooser.setDirectoriesAreAlwaysVisible(true);
     treeFileChooser.setMode(TreeFileChooser.MODE_DIRECTORIES);
     final SModel sModel =
         ((SModelDescriptor) MapSequence.fromMap(_params).get("model")).getSModel();
     treeFileChooser.setFileFilter(
         new IFileFilter() {
           public boolean accept(IFile file) {
             return JavaCompiler.checkBaseModelMatchesSourceDirectory(
                 sModel, new File(file.getPath()));
           }
         });
     String generatorOutputPath = module.getGeneratorOutputPath();
     File initial = null;
     File output = new File(generatorOutputPath);
     if (output.exists()) {
       initial = output;
       File sourceRoot = new File(initial.getParentFile(), "source");
       if (!(sourceRoot.exists())) {
         sourceRoot = new File(initial.getParentFile(), "src");
       }
       initial = sourceRoot;
       if (sourceRoot.exists()) {
         File modelSource = new File(sourceRoot, NameUtil.pathFromNamespace(sModel.getLongName()));
         if (modelSource.exists()) {
           initial = modelSource;
         }
       }
     }
     if (initial != null) {
       treeFileChooser.setInitialFile(
           FileSystem.getInstance().getFileByPath(initial.getAbsolutePath()));
     }
     IFile result =
         treeFileChooser.showDialog(((Frame) MapSequence.fromMap(_params).get("frame")));
     if (result != null) {
       JavaCompiler javaCompiler =
           new JavaCompiler(
               ((IOperationContext) MapSequence.fromMap(_params).get("context")),
               module,
               new File(result.getPath()),
               false,
               sModel);
       javaCompiler.compile();
     }
   } catch (Throwable t) {
     if (log.isErrorEnabled()) {
       log.error("User's action execute method failed. Action:" + "GetModelContentsFromSource", t);
     }
   }
 }
コード例 #16
0
ファイル: ModulesMiner.java プロジェクト: sprig/MPS
  private <T> void readModuleDescriptorsFromFolder(
      IFile file,
      Set<IFile> excludes,
      List<T> result,
      boolean refreshFiles,
      DescriptorReader<T> reader) {
    if (!needProcess(file, excludes)) return;
    if (refreshFiles) {
      FileSystem.getInstance().refresh(file);
    }

    // if this is a jar dir, we need to go to modules sub dir or check for META-INF/module.xml
    // if this is just good old plain directory, we check every file in it

    if (file.getPath().endsWith(JAR + JAR_SEPARATOR)) {

      IFile moduleXml = file.getDescendant(META_INF).getDescendant(MODULE_XML);
      if (moduleXml.exists() && !moduleXml.isDirectory()) {
        ModuleDescriptor moduleDescriptor = loadModuleDescriptor(moduleXml);
        if (moduleDescriptor != null) {
          T descriptor = reader.read(new ModuleHandle(moduleXml, moduleDescriptor));
          if (descriptor != null) {
            result.add(descriptor);
          }
        }
      } else {
        IFile dirInJar = file.getDescendant(MODULES_DIR);
        if (dirInJar.exists() && dirInJar.isDirectory()) {
          readModuleDescriptorsFromFolder(dirInJar, excludes, result, refreshFiles, reader);
        }
      }

    } else {

      // first, we read from files
      // this way all modules roots, sources/classes folders are in excludes and we do not even go
      // into them
      List<IFile> children = file.getChildren();
      ArrayList<IFile> folders = new ArrayList<IFile>();
      for (IFile child : children) {
        if (!child.isDirectory()) {
          readModuleDescriptorsFromFile(child, excludes, result, refreshFiles, reader);
        } else {
          folders.add(child);
        }
      }

      // now read from folders
      for (IFile child : folders) {
        readModuleDescriptorsFromFolder(child, excludes, result, refreshFiles, reader);
      }
    }
  }
コード例 #17
0
  private IFile getModelFile(AbstractTreeNode treeNode) {
    if (treeNode instanceof MPSPsiModelTreeNode) {
      MPSPsiModelTreeNode fileNode = (MPSPsiModelTreeNode) treeNode;
      VirtualFile virtualFile = fileNode.getVirtualFile();
      if (virtualFile == null
          || virtualFile.getFileType() != MPSFileTypeFactory.MPS_FILE_TYPE
              && virtualFile.getFileType() != MPSFileTypeFactory.MPS_HEADER_FILE_TYPE) {
        return null;
      }
      return FileSystem.getInstance().getFileByPath(virtualFile.getPath());

    } else if (treeNode instanceof PsiDirectoryNode) {
      VirtualFile virtualFile = ((PsiDirectoryNode) treeNode).getVirtualFile();
      if (virtualFile == null) {
        return null;
      }
      IFile ifile = FileSystem.getInstance().getFileByPath(virtualFile.getPath());
      SModel model = SModelFileTracker.getInstance().findModel(ifile);
      if (model != null) return ifile;
    }
    return null;
  }
コード例 #18
0
ファイル: DefaultModelRoot.java プロジェクト: qyqx/MPS
 @Override
 public Iterable<SModel> loadModels() {
   List<SModel> result = new ArrayList<SModel>();
   Map<String, String> options = new HashMap<String, String>();
   String contentHome = getContentRoot();
   SModule module = getModule();
   if (module != null) {
     options.put(ModelFactory.OPTION_MODULEREF, module.getModuleReference().toString());
   }
   for (String path : getFiles(SOURCE_ROOTS)) {
     String relativePath = contentHome != null ? makeRelative(contentHome, path) : null;
     collectModels(
         FileSystem.getInstance().getFileByPath(path), "", relativePath, options, result);
   }
   return result;
 }
コード例 #19
0
ファイル: DefaultModelRoot.java プロジェクト: qyqx/MPS
  @NotNull
  public FileDataSource createSource(
      String modelName, String extension, @Nullable String sourceRoot) throws IOException {

    Set<String> sourceRoots = new LinkedHashSet<String>(getFiles(SOURCE_ROOTS));
    if (sourceRoots.isEmpty()) {
      throw new IOException("empty list of source roots");
    }

    if (sourceRoot == null || !sourceRoots.contains(sourceRoot)) {
      sourceRoot = null;
      for (String sr : sourceRoots) {
        if (isLanguageAspectsSourceRoot(sr)) {
          String prefix = getModule().getModuleName() + ".";
          if (modelName.startsWith(prefix)) {
            String aspectName = modelName.substring(prefix.length());
            if (getAspect(aspectName) != null) {
              sourceRoot = sr;
              break;
            }
          }
          continue;
        }
        sourceRoot = sr;
        break;
      }
      if (sourceRoot == null) {
        throw new IOException("no suitable source root found");
      }
    }

    String filenameSuffix = modelName;
    if (isLanguageAspect(modelName, sourceRoot) || isGeneratorTemplateModel(modelName)) {
      filenameSuffix = NameUtil.shortNameFromLongName(filenameSuffix);
    }

    IFile file =
        FileSystem.getInstance()
            .getFileByPath(
                sourceRoot
                    + File.separator
                    + NameUtil.pathFromNamespace(filenameSuffix)
                    + "."
                    + extension);
    return new FileDataSource(file, this);
  }
コード例 #20
0
ファイル: ModulesMiner.java プロジェクト: sprig/MPS
 public ModuleHandle loadHandle(ModelInputStream stream) throws IOException {
   if (stream.readShort() != 0x1be0) throw new IOException("bad stream: no start marker");
   String file = stream.readString();
   ModuleDescriptor descriptor;
   int type = stream.readByte();
   if (type == 1) {
     descriptor = new LanguageDescriptor();
   } else if (type == 2) {
     descriptor = new SolutionDescriptor();
   } else if (type == 3) {
     descriptor = new DevkitDescriptor();
   } else {
     throw new IOException("broken stream: invalid descriptor type");
   }
   descriptor.load(stream);
   return new ModuleHandle(FileSystem.getInstance().getFileByPath(file), descriptor);
 }
コード例 #21
0
ファイル: ModulesMiner.java プロジェクト: sprig/MPS
  private <T> void readModuleDescriptors(
      IFile file,
      Set<IFile> excludes,
      List<T> result,
      boolean refreshFiles,
      DescriptorReader<T> reader) {
    if (!needProcess(file, excludes)) return;
    if (refreshFiles) {
      FileSystem.getInstance().refresh(file);
    }

    if (file.isDirectory()) {
      readModuleDescriptorsFromFolder(file, excludes, result, refreshFiles, reader);
    } else {
      readModuleDescriptorsFromFile(file, excludes, result, refreshFiles, reader);
    }
  }
コード例 #22
0
ファイル: Gcc_Command.java プロジェクト: wolfhesse/MPS
 public static IFile getSourceFile(final SNode file) {
   final Wrappers._T<IModule> module = new Wrappers._T<IModule>();
   final Wrappers._T<String> sourceName = new Wrappers._T<String>();
   final Wrappers._T<String> packageName = new Wrappers._T<String>();
   ModelAccess.instance()
       .runReadAction(
           new Runnable() {
             public void run() {
               module.value = SNodeOperations.getModel(file).getModelDescriptor().getModule();
               sourceName.value = TraceInfoUtil.getUnitName(file);
               packageName.value = SNodeOperations.getModel(file).getLongName().replace(".", "/");
             }
           });
   return FileSystem.getInstance()
       .getFileByPath(module.value.getGeneratorOutputPath())
       .getDescendant(packageName.value)
       .getDescendant(sourceName.value + Gcc_Command.getSourceExtension());
 }
コード例 #23
0
 @Override
 public void dispose() {
   FileSystem.getInstance().removeListener(this);
   super.dispose();
 }
コード例 #24
0
 @Override
 public void attach() {
   super.attach();
   FileSystem.getInstance().addListener(this);
 }
コード例 #25
0
 @Override
 public IFile getFileToListen() {
   return FileSystem.getInstance().getFileByPath(myPath);
 }
コード例 #26
0
ファイル: ModulesMiner.java プロジェクト: sprig/MPS
 private boolean needProcess(IFile file, Set<IFile> excludes) {
   return !FileSystem.getInstance().isFileIgnored(file.getName()) && !excludes.contains(file);
 }
コード例 #27
0
ファイル: SLibrary.java プロジェクト: brigand/MPS
 void dispose() {
   FileSystem.getInstance().removeListener(this);
   ModuleRepositoryFacade.getInstance().unregisterModules(this);
 }
コード例 #28
0
ファイル: SLibrary.java プロジェクト: brigand/MPS
 void attach(boolean refreshFiles) {
   update(refreshFiles);
   FileSystem.getInstance().addListener(this);
 }
コード例 #29
0
ファイル: AbstractModule.java プロジェクト: JetBrains/MPS
 private static jetbrains.mps.vfs.FileSystem getFSSingleton() {
   return jetbrains.mps.vfs.FileSystem.getInstance();
 }
コード例 #30
0
ファイル: FileMPSProject.java プロジェクト: strategist922/MPS
    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);
        }
      }
    }