Пример #1
0
 private Solution createSolution() {
   SolutionDescriptor d = new SolutionDescriptor();
   String uuid = UUID.randomUUID().toString();
   d.setNamespace(uuid);
   d.setId(ModuleId.fromString(uuid));
   return StubSolution.newInstance(d, OWNER);
 }
 protected Solution addSolution(String name, VirtualFile[] roots) {
   SolutionDescriptor sd = new SolutionDescriptor();
   sd.setNamespace(name);
   sd.setId(ModuleId.foreign(name));
   addModelRoots(sd, roots);
   return StubSolution.newInstance(sd, this);
 }
Пример #3
0
  @Override
  protected void doSetModuleDescriptor(ModuleDescriptor moduleDescriptor) {
    assert moduleDescriptor instanceof SolutionDescriptor;
    SolutionDescriptor newDescriptor = (SolutionDescriptor) moduleDescriptor;
    newDescriptor.setNamespace(myModule.getName());
    //    addLibs(newDescriptor);
    super.doSetModuleDescriptor(newDescriptor);

    try {
      ApplicationManager.getApplication()
          .getComponent(JdkStubSolutionManager.class)
          .claimSdk(myModule);
    } catch (final DifferentSdkException e) {

      // TODO this seems to behave suspiciously in tests
      StartupManager.getInstance(myModule.getProject())
          .runWhenProjectIsInitialized(
              new Runnable() {
                @Override
                public void run() {
                  Messages.showErrorDialog(
                      myModule.getProject(),
                      "There are more than one different SDKs used in modules with MPS facets.\n"
                          + "Trying to use "
                          + e.getRequestedSdk().getName()
                          + " while "
                          + e.getCurrentSdk().getName()
                          + " is already used."
                          + "\n",
                      "Multiple SDKs not supported in MPS plugin");
                }
              });
    }
  }