private void populate() {
    List<IModule> modules = collectModules();
    {
      ModulePoolNamespaceBuilder builder = new ModulePoolNamespaceBuilder();
      TextTreeNode solutions = new TextTreeNode("Solutions");
      for (IModule s : modules) {
        if (s instanceof Solution || s instanceof ProjectStructureModule) {
          builder.addNode(ProjectModuleTreeNode.createFor(myProject, s, true));
        }
      }
      builder.fillNode(solutions);
      add(solutions);
    }

    {
      ModulePoolNamespaceBuilder builder = new ModulePoolNamespaceBuilder();
      TextTreeNode languages = new TextTreeNode("Languages");
      for (Language l : CollectionUtil.filter(Language.class, modules)) {
        builder.addNode(ProjectModuleTreeNode.createFor(myProject, l, true));
      }
      builder.fillNode(languages);
      add(languages);
    }

    {
      ModulePoolNamespaceBuilder builder = new ModulePoolNamespaceBuilder();
      TextTreeNode devkits = new TextTreeNode("DevKits");
      for (DevKit devKit : CollectionUtil.filter(DevKit.class, modules)) {
        builder.addNode(ProjectModuleTreeNode.createFor(myProject, devKit, true));
      }
      builder.fillNode(devkits);
      add(devkits);
    }
  }
Exemplo n.º 2
0
 protected IModule[] getVariants() {
   List<IModule> solutionsList =
       CollectionUtil.filter(
           this.myMpsProject.getModules(),
           new Condition<IModule>() {
             public boolean met(IModule module) {
               return module instanceof Solution;
             }
           });
   return ListSequence.fromList(solutionsList).toGenericArray(IModule.class);
 }
Exemplo n.º 3
0
  @Override
  protected void executeTask(Project project, MpsWorker.ObjectsToProcess go) {
    Set<SModule> toCompile = SetSequence.fromSet(new LinkedHashSet<SModule>());
    SetSequence.fromSet(toCompile).addSequence(SetSequence.fromSet(go.getModules()));
    for (Project p : go.getProjects()) {
      SetSequence.fromSet(toCompile).addSequence(SetSequence.fromSet(go.getModules()));
    }
    for (final SModel modelDescriptor : go.getModels()) {
      SModule owningModule =
          ModelAccess.instance()
              .runReadAction(
                  new Computable<SModule>() {
                    public SModule compute() {
                      return modelDescriptor.getModule();
                    }
                  });
      SetSequence.fromSet(toCompile).addElement(owningModule);
    }
    final Set<SModule> finalToCompile =
        CollectionUtil.filter(
            toCompile,
            new Condition<SModule>() {
              public boolean met(SModule module) {
                boolean compileInMps =
                    !(module instanceof IModule) || ((IModule) module).isCompileInMPS();
                return compileInMps && !(module.isPackaged());
              }
            });
    if (finalToCompile.isEmpty()) {
      return;
    }
    info("Starting compilation:");
    StringBuffer sb = new StringBuffer();
    for (SModule m : finalToCompile) {
      sb.append("    ");
      sb.append(m.getModuleName());
      sb.append("\n");
    }
    info(sb.toString());
    MPSCompilationResult result =
        ModelAccess.instance()
            .runReadAction(
                new Computable<MPSCompilationResult>() {
                  public MPSCompilationResult compute() {
                    return new ModuleMaker()
                        .make(
                            finalToCompile,
                            new EmptyProgressMonitor() {
                              @Override
                              public void step(String text) {
                                info("    " + text);
                              }

                              @Override
                              public void start(String taskName, int work) {
                                info(taskName);
                              }
                            });
                  }
                });
    info(result.toString());
  }
Exemplo n.º 4
0
 protected Collection<Language> getInitialUsedLanguages() {
   return CollectionUtil.filter(Language.class, getInitialModules());
 }