Java Code Examples for com.intellij.openapi.module.ModuleManager

The following examples show how to use com.intellij.openapi.module.ModuleManager. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: consulo   Source File: CompileDriver.java    License: Apache License 2.0 6 votes vote down vote up
private boolean validateOutputAndSourcePathsIntersection() {
  final Module[] allModules = ModuleManager.getInstance(myProject).getModules();
  List<VirtualFile> allOutputs = new ArrayList<>();
  ContainerUtil.addAll(allOutputs, CompilerPathsImpl.getOutputDirectories(allModules));
  for (Artifact artifact : ArtifactManager.getInstance(myProject).getArtifacts()) {
    ContainerUtil.addIfNotNull(artifact.getOutputFile(), allOutputs);
  }
  final Set<VirtualFile> affectedOutputPaths = new HashSet<>();
  CompilerUtil.computeIntersectingPaths(myProject, allOutputs, affectedOutputPaths);
  affectedOutputPaths.addAll(ArtifactCompilerUtil.getArtifactOutputsContainingSourceFiles(myProject));

  if (!affectedOutputPaths.isEmpty()) {
    if (CompilerUtil.askUserToContinueWithNoClearing(myProject, affectedOutputPaths)) {
      myShouldClearOutputDirectory = false;
      return true;
    }
    else {
      return false;
    }
  }
  return true;
}
 
Example 2
Source Project: BashSupport   Source File: AddReplAction.java    License: Apache License 2.0 6 votes vote down vote up
@Nullable
private static Module getModule(AnActionEvent e) {
    Module module = e.getData(LangDataKeys.MODULE);
    if (module == null) {
        Project project = e.getData(LangDataKeys.PROJECT);
        if (project == null) {
            return null;
        }

        final Module[] modules = ModuleManager.getInstance(project).getModules();
        if (modules.length == 1) {
            module = modules[0];
        }
    }

    return module;
}
 
Example 3
Source Project: reasonml-idea-plugin   Source File: Platform.java    License: MIT License 6 votes vote down vote up
@NotNull
private static Map<Module, VirtualFile> findContentRootsFor(@NotNull Project project, @NotNull String filename) {
    Map<Module, VirtualFile> rootContents = new HashMap<>();

    ModuleManager moduleManager = ModuleManager.getInstance(project);
    for (Module module : moduleManager.getModules()) {
        for (VirtualFile contentRoot : ModuleRootManager.getInstance(module).getContentRoots()) {
            VirtualFile packageJson = contentRoot.findChild(filename);
            if (packageJson != null && !rootContents.containsKey(module)) {
                rootContents.put(module, packageJson);
            }
        }
    }

    return rootContents;
}
 
Example 4
Source Project: consulo   Source File: VcsStructureChooser.java    License: Apache License 2.0 6 votes vote down vote up
@Nonnull
private Map<VirtualFile, String> calculateModules(@Nonnull List<VirtualFile> roots) {
  Map<VirtualFile, String> result = ContainerUtil.newHashMap();

  final ModuleManager moduleManager = ModuleManager.getInstance(myProject);
  // assertion for read access inside
  Module[] modules = ApplicationManager.getApplication().runReadAction(new Computable<Module[]>() {
    public Module[] compute() {
      return moduleManager.getModules();
    }
  });

  TreeSet<VirtualFile> checkSet = new TreeSet<>(FilePathComparator.getInstance());
  checkSet.addAll(roots);
  for (Module module : modules) {
    VirtualFile[] files = ModuleRootManager.getInstance(module).getContentRoots();
    for (VirtualFile file : files) {
      VirtualFile floor = checkSet.floor(file);
      if (floor != null) {
        result.put(file, module.getName());
      }
    }
  }
  return result;
}
 
Example 5
Source Project: SmartTomcat   Source File: TomcatSettingsEditor.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {

    ModuleManager moduleManager = ModuleManager.getInstance(project);
    Module[] modules = moduleManager.getModules();

    for (Module module : modules) {
        VirtualFile[] excludeRoots = ModuleRootManager.getInstance(module).getExcludeRoots();
        for (VirtualFile excludeFile : excludeRoots) {
            if (excludeFile.getCanonicalPath().equals(file.getCanonicalPath())) {
                return false;
            }
        }

    }
    return super.isFileVisible(file, showHiddenFiles);
}
 
Example 6
Source Project: consulo   Source File: ModuleGroup.java    License: Apache License 2.0 6 votes vote down vote up
public Collection<ModuleGroup> childGroups(ModifiableModuleModel model, Project project) {
  final Module[] allModules;
  if ( model != null ) {
    allModules = model.getModules();
  } else {
    allModules = ModuleManager.getInstance(project).getModules();
  }

  Set<ModuleGroup> result = new THashSet<ModuleGroup>();
  for (Module module : allModules) {
    String[] group;
    if ( model != null ) {
      group = model.getModuleGroupPath(module);
    } else {
      group = ModuleManager.getInstance(project).getModuleGroupPath(module);
    }
    if (group == null) continue;
    final String[] directChild = directChild(myGroupPath, group);
    if (directChild != null) {
      result.add(new ModuleGroup(directChild));
    }
  }

  return result;
}
 
Example 7
private void updateAndroidModuleLibraryDependencies(Module flutterModule) {
  for (final Module module : ModuleManager.getInstance(getProject()).getModules()) {
    if (module != flutterModule) {
      if (null != FacetManager.getInstance(module).findFacet(AndroidFacet.ID, "Android")) {
        Object circularModules = CircularModuleDependenciesDetector.addingDependencyFormsCircularity(module, flutterModule);
        if (circularModules == null) {
          ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
          if (!rootManager.isDependsOn(flutterModule)) {
            JavaProjectModelModifier[] modifiers = JavaProjectModelModifier.EP_NAME.getExtensions(getProject());
            for (JavaProjectModelModifier modifier : modifiers) {
              if (modifier instanceof IdeaProjectModelModifier) {
                modifier.addModuleDependency(module, flutterModule, DependencyScope.COMPILE, false);
              }
            }
          }
        }
      }
    }
  }
}
 
Example 8
Source Project: consulo   Source File: SdkComboBox.java    License: Apache License 2.0 6 votes vote down vote up
@RequiredReadAction
@SuppressWarnings("unchecked")
public <T extends MutableModuleExtension<?>> void insertModuleItems(@Nonnull T moduleExtension,
                                                                    @Nonnull NullableFunction<T, MutableModuleInheritableNamedPointer<Sdk>> sdkPointerFunction) {

  for (Module module : ModuleManager.getInstance(moduleExtension.getModule().getProject()).getModules()) {
    // dont add self module
    if (module == moduleExtension.getModule()) {
      continue;
    }

    ModuleExtension extension = ModuleUtilCore.getExtension(module, moduleExtension.getId());
    if (extension == null) {
      continue;
    }
    MutableModuleInheritableNamedPointer<Sdk> sdkPointer = sdkPointerFunction.fun((T)extension);
    if (sdkPointer != null) {
      // recursive depend
      if (sdkPointer.getModule() == moduleExtension.getModule()) {
        continue;
      }
      addItem(new ModuleExtensionSdkComboBoxItem(extension, sdkPointer));
    }
  }
}
 
Example 9
Source Project: consulo-unity3d   Source File: Unity3dProjectService.java    License: Apache License 2.0 6 votes vote down vote up
@Nullable
@RequiredReadAction
private static Module findRootModuleImpl(@Nonnull Project project)
{
	VirtualFile baseDir = project.getBaseDir();
	if(baseDir == null)
	{
		return null;
	}

	ModuleManager moduleManager = ModuleManager.getInstance(project);
	for(Module module : moduleManager.getModules())
	{
		if(baseDir.equals(module.getModuleDir()))
		{
			return module;
		}
	}
	return null;
}
 
Example 10
Source Project: consulo   Source File: ModulesConfigurator.java    License: Apache License 2.0 6 votes vote down vote up
@RequiredUIAccess
public void resetModuleEditors() {
  myModuleModel = ModuleManager.getInstance(myProject).getModifiableModel();

  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    @Override
    public void run() {
      if (!myModuleEditors.isEmpty()) {
        LOG.error("module editors was not disposed");
        myModuleEditors.clear();
      }
      final Module[] modules = myModuleModel.getModules();
      if (modules.length > 0) {
        for (Module module : modules) {
          getOrCreateModuleEditor(module);
        }
        Collections.sort(myModuleEditors, myModuleEditorComparator);
      }
    }
  });
  myModified = false;
}
 
Example 11
Source Project: intellij-demandware   Source File: DWCleanAction.java    License: MIT License 6 votes vote down vote up
public void actionPerformed(AnActionEvent e) {
    Project project = e.getProject();

    if (project != null) {
        for (Module module : ModuleManager.getInstance(project).getModules()) {
            if (ModuleType.get(module) instanceof DWModuleType) {
                ModuleServiceManager.getService(module, DWServerConnection.class);
                ProgressManager.getInstance().run(
                        new DWCleanTask(project, module, "Cleaning cartridges...", true, PerformInBackgroundOption.ALWAYS_BACKGROUND)
                );

            }
        }
    }

}
 
Example 12
Source Project: consulo   Source File: FormatChangedTextUtil.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Allows to answer if any file that belongs to the given project has changes in comparison with VCS.
 *
 * @param project target project to check
 * @return <code>true</code> if any file that belongs to the given project has changes in comparison with VCS
 * <code>false</code> otherwise
 */
public static boolean hasChanges(@Nonnull final Project project) {
  ThrowableComputable<ModifiableModuleModel,RuntimeException> action = () -> ModuleManager.getInstance(project).getModifiableModel();
  final ModifiableModuleModel moduleModel = AccessRule.read(action);

  try {
    for (Module module : moduleModel.getModules()) {
      if (hasChanges(module)) {
        return true;
      }
    }
    return false;
  }
  finally {
    moduleModel.dispose();
  }
}
 
Example 13
Source Project: consulo   Source File: ModuleDataService.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void removeData(@Nonnull final Collection<? extends Module> modules, @Nonnull final Project project, boolean synchronous) {
  if (modules.isEmpty()) {
    return;
  }
  ExternalSystemApiUtil.executeProjectChangeAction(synchronous, new DisposeAwareProjectChange(project) {
    @RequiredUIAccess
    @Override
    @RequiredWriteAction
    public void execute() {
      ModuleManager moduleManager = ModuleManager.getInstance(project);

      for (Module module : modules) {
        if (module.isDisposed()) continue;
        moduleManager.disposeModule(module);
      }
    }
  });
}
 
Example 14
Source Project: consulo   Source File: RenameProjectAction.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void actionPerformed(AnActionEvent e) {
  final DataContext dataContext = e.getDataContext();
  final Project project = dataContext.getData(CommonDataKeys.PROJECT);
  LOG.assertTrue(project instanceof ProjectEx);
  Module module;
  Module[] modules = ModuleManager.getInstance(project).getModules();
  if (modules.length == 1 && project.getName().equals(modules[0].getName())) {
    module = modules[0];
  }
  else {
    module = null;
  }
  Messages.showInputDialog(project, RefactoringBundle.message("enter.new.project.name"), RefactoringBundle.message("rename.project"),
                           Messages.getQuestionIcon(),
                           project.getName(),
                           new RenameProjectHandler.MyInputValidator((ProjectEx)project, module));
}
 
Example 15
@Before
public void setup() {
  setProjectView(
      "directories:",
      "  com/google/example",
      "targets:",
      "  //com/google/example:main",
      "android_sdk_platform: android-25");
  MockSdkUtil.registerSdk(workspace, "25");

  workspaceDir = workspace.createDirectory(new WorkspacePath("com/google/example"));
  resDir = workspace.createFile(new WorkspacePath("com/google/example/res"));

  setTargetMap(android_binary("//com/google/example:main").res("res"));
  runFullBlazeSync();

  ModuleManager moduleManager = ModuleManager.getInstance(getProject());
  workspaceModule = moduleManager.findModuleByName(".workspace");
  resModule = moduleManager.findModuleByName("com.google.example.main");
}
 
Example 16
private void queueFocusOnImportDirectory() {
  directoryFocusHandle = PantsUtil.scheduledThreadPool.scheduleWithFixedDelay(() -> {
    if (ModuleManager.getInstance(myProject).getModules().length == 0 ||
        !ProjectView.getInstance(myProject).getCurrentViewId().equals(ProjectFilesViewPane.ID)) {
      return;
    }
    ApplicationManager.getApplication().invokeLater(() -> {
      final VirtualFile pathImported = LocalFileSystem.getInstance().findFileByPath(myProjectPath);
      // Skip focusing if directory is not found.
      if (pathImported != null) {
        VirtualFile importDirectory = pathImported.isDirectory() ? pathImported : pathImported.getParent();
        SelectInContext selectInContext = new FileSelectInContext(myProject, importDirectory);
        for (SelectInTarget selectInTarget : ProjectView.getInstance(myProject).getSelectInTargets()) {
          if (selectInTarget instanceof PantsProjectPaneSelectInTarget) {
            selectInTarget.selectIn(selectInContext, false);
            break;
          }
        }
      }
      final boolean mayInterruptIfRunning = true;
      directoryFocusHandle.cancel(mayInterruptIfRunning);
    });
  }, 0, 1, TimeUnit.SECONDS);
}
 
Example 17
Source Project: consulo   Source File: LibraryUsageCollector.java    License: Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
public Set<UsageDescriptor> getProjectUsages(@Nonnull Project project) {
  final Set<LibraryKind> usedKinds = new HashSet<LibraryKind>();
  final Processor<Library> processor = new Processor<Library>() {
    @Override
    public boolean process(Library library) {
      usedKinds.addAll(LibraryPresentationManagerImpl.getLibraryKinds(library, null));
      return true;
    }
  };
  for (Module module : ModuleManager.getInstance(project).getModules()) {
    ModuleRootManager.getInstance(module).orderEntries().librariesOnly().forEachLibrary(processor);
  }

  final HashSet<UsageDescriptor> usageDescriptors = new HashSet<UsageDescriptor>();
  for (LibraryKind kind : usedKinds) {
    usageDescriptors.add(new UsageDescriptor(kind.getKindId(), 1));
  }
  return usageDescriptors;
}
 
Example 18
private VirtualFile[] getRootsForScan(Project project) {
  List<VirtualFile> list = new ArrayList<>();
  Module[] modules = ModuleManager.getInstance(project).getModules();
  List<TranslatingCompilerFilesMonitorHelper> extensions = TranslatingCompilerFilesMonitorHelper.EP_NAME.getExtensionList();
  for (Module module : modules) {
    for (TranslatingCompilerFilesMonitorHelper extension : extensions) {
      VirtualFile[] rootsForModule = extension.getRootsForModule(module);
      if (rootsForModule != null) {
        Collections.addAll(list, rootsForModule);
      }
    }

    VirtualFile[] contentFolderFiles = ModuleRootManager.getInstance(module).getContentFolderFiles(ContentFolderScopes.all(false));
    Collections.addAll(list, contentFolderFiles);
  }
  return VfsUtil.toVirtualFileArray(list);
}
 
Example 19
Source Project: consulo   Source File: ChooseLibrariesDialogBase.java    License: Apache License 2.0 6 votes vote down vote up
protected void collectChildren(Object element, final List<Object> result) {
  if (element instanceof Application) {
    Collections.addAll(result, ProjectManager.getInstance().getOpenProjects());
    final LibraryTablesRegistrar instance = LibraryTablesRegistrar.getInstance();
    result.add(instance.getLibraryTable()); //1
    result.addAll(instance.getCustomLibraryTables()); //2
  }
  else if (element instanceof Project) {
    Collections.addAll(result, ModuleManager.getInstance((Project)element).getModules());
    result.add(LibraryTablesRegistrar.getInstance().getLibraryTable((Project)element));
  }
  else if (element instanceof LibraryTable) {
    Collections.addAll(result, ((LibraryTable)element).getLibraries());
  }
  else if (element instanceof Module) {
    for (OrderEntry entry : ModuleRootManager.getInstance((Module)element).getOrderEntries()) {
      if (entry instanceof LibraryOrderEntry) {
        final LibraryOrderEntry libraryOrderEntry = (LibraryOrderEntry)entry;
        if (LibraryTableImplUtil.MODULE_LEVEL.equals(libraryOrderEntry.getLibraryLevel())) {
          final Library library = libraryOrderEntry.getLibrary();
          result.add(library);
        }
      }
    }
  }
}
 
Example 20
/**
 * Called when application loaded/ when cancelling the settings
 * @param configuration
 */
@Override
protected void resetEditorFrom(EmbeddedLinuxJVMRunConfiguration configuration) {

    getMainClassField().setText(configuration.getRunnerParameters().getMainclass() != null ?
            configuration.getRunnerParameters().getMainclass().replaceAll("\\$", "\\.") : "");

    EmbeddedLinuxJVMRunConfigurationRunnerParameters parameters = configuration.getRunnerParameters();
    Module moduleParam = null;
    if (parameters.getModuleName() != null && parameters.getModuleName().length() > 0) {
        moduleParam = ModuleManager.getInstance(myProject).findModuleByName(parameters.getModuleName());
    }
    vmParameters.setText(parameters.getVmParameters());
    programArguments.setText(parameters.getProgramArguments());
    hostName.setText(parameters.getHostname());
    runAsRootCheckBox.setSelected(parameters.isRunAsRoot());
    usingKey.setSelected(parameters.isUsingKey());
    keyfile.setText(parameters.getKeyPath());
    debugPort.setText(parameters.getPort());
    username.setText(parameters.getUsername());
    password.setText(parameters.getPassword());
    sshPort.setText(Integer.toString(parameters.getSshPort()));
    sshStatus.setVisible(false);
    myModule.getComponent().setSelectedModule(moduleParam);
    keyFileStateChange();
}
 
Example 21
Source Project: consulo   Source File: DirectoryUrl.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Object[] createPath(final Project project) {
  if (moduleName != null) {
    final Module module = ApplicationManager.getApplication().runReadAction(new Computable<Module>() {
      @Nullable
      @Override
      public Module compute() {
        return ModuleManager.getInstance(project).findModuleByName(moduleName);
      }
    });
    if (module == null) return null;
  }
  final VirtualFileManager virtualFileManager = VirtualFileManager.getInstance();
  final VirtualFile file = virtualFileManager.findFileByUrl(url);
  if (file == null) return null;
  final PsiDirectory directory = ApplicationManager.getApplication().runReadAction(new Computable<PsiDirectory>() {
    @Nullable
    @Override
    public PsiDirectory compute() {
      return PsiManager.getInstance(project).findDirectory(file);
    }
  });
  if (directory == null) return null;
  return new Object[]{directory};
}
 
Example 22
protected Module createModule(final String name, final ModuleType type) {
  try {
    return WriteCommandAction.writeCommandAction(myProject).compute(() -> {
      VirtualFile f = createProjectSubFile(name + "/" + name + ".iml");
      Module module = ModuleManager.getInstance(myProject).newModule(f.getPath(), type.getId());
      PsiTestUtil.addContentRoot(module, f.getParent());
      return module;
    });
  }
  catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
Example 23
Source Project: consulo   Source File: ModuleCompileScope.java    License: Apache License 2.0 5 votes vote down vote up
public ModuleCompileScope(final Module module, boolean includeDependentModules) {
  myProject = module.getProject();
  myScopeModules = new HashSet<Module>();
  if (includeDependentModules) {
    buildScopeModulesSet(module);
  }
  else {
    myScopeModules.add(module);
  }
  myModules = ModuleManager.getInstance(myProject).getModules();
}
 
Example 24
Source Project: consulo   Source File: CompileContextImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void recalculateOutputDirs() {
  final Module[] allModules = ModuleManager.getInstance(myProject).getModules();

  final Set<VirtualFile> allDirs = new OrderedSet<VirtualFile>();
  final Set<VirtualFile> testOutputDirs = new java.util.HashSet<VirtualFile>();
  final Set<VirtualFile> productionOutputDirs = new java.util.HashSet<VirtualFile>();

  for (Module module : allModules) {
    ModuleCompilerPathsManager moduleCompilerPathsManager = ModuleCompilerPathsManager.getInstance(module);

    final VirtualFile output = moduleCompilerPathsManager.getCompilerOutput(ProductionContentFolderTypeProvider.getInstance());
    if (output != null && output.isValid()) {
      allDirs.add(output);
      productionOutputDirs.add(output);
    }

    final VirtualFile testsOutput = moduleCompilerPathsManager.getCompilerOutput(TestContentFolderTypeProvider.getInstance());
    if (testsOutput != null && testsOutput.isValid()) {
      allDirs.add(testsOutput);
      testOutputDirs.add(testsOutput);
    }
  }
  myOutputDirectories = VfsUtil.toVirtualFileArray(allDirs);
  // need this to ensure that the sent contains only _dedicated_ test output dirs
  // Directories that are configured for both test and production classes must not be added in the resulting set
  testOutputDirs.removeAll(productionOutputDirs);
  myTestOutputDirectories = Collections.unmodifiableSet(testOutputDirs);
}
 
Example 25
protected void assertModuleGroupPath(String moduleName, String... expected) {
  String[] path = ModuleManager.getInstance(myProject).getModuleGroupPath(getModule(moduleName));

  if (expected.length == 0) {
    assertNull(path);
  }
  else {
    assertNotNull(path);
    assertOrderedElementsAreEqual(Arrays.asList(path), expected);
  }
}
 
Example 26
Source Project: consulo   Source File: FileTreeIterator.java    License: Apache License 2.0 5 votes vote down vote up
@Nonnull
public static List<PsiDirectory> collectProjectDirectories(@Nonnull Project project) {
  List<PsiDirectory> directories = ContainerUtil.newArrayList();

  Module[] modules = ModuleManager.getInstance(project).getModules();
  for (Module module : modules) {
    directories.addAll(collectModuleDirectories(module));
  }

  return directories;
}
 
Example 27
Source Project: consulo   Source File: NamedLibraryUrl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Object[] createPath(Project project) {
  final Module module = moduleName != null ? ModuleManager.getInstance(project).findModuleByName(moduleName) : null;
  if (module == null) return null;
  for (OrderEntry orderEntry : ModuleRootManager.getInstance(module).getOrderEntries()) {
    if (orderEntry instanceof LibraryOrderEntry || orderEntry instanceof ModuleExtensionWithSdkOrderEntry && orderEntry.getPresentableName().equals(url)) {
      return new Object[]{new NamedLibraryElement(module, orderEntry)};
    }
  }
  return null;
}
 
Example 28
Source Project: consulo   Source File: RenameProjectHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean canClose(final String inputString) {
  if (!inputString.equals(myProject.getName())) {
    myProject.setProjectName(inputString);
    myProject.save();
  }

  if (myModule != null && !inputString.equals(myModule.getName())) {
    final ModifiableModuleModel modifiableModel = ModuleManager.getInstance(myProject).getModifiableModel();
    try {
      modifiableModel.renameModule(myModule, inputString);
    }
    catch (ModuleWithNameAlreadyExistsException moduleWithNameAlreadyExists) {
      Messages.showErrorDialog(myProject, IdeBundle.message("error.module.already.exists", inputString),
                               IdeBundle.message("title.rename.module"));
      return false;
    }
    final Ref<Boolean> success = Ref.create(Boolean.TRUE);
    CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
      @Override
      public void run() {
        ApplicationManager.getApplication().runWriteAction(new Runnable() {
          @Override
          public void run() {
            modifiableModel.commit();
          }
        });
      }
    }, IdeBundle.message("command.renaming.module", myModule.getName()), null);
    return success.get().booleanValue();
  }
  return true;
}
 
Example 29
Source Project: Intellij-Plugin   Source File: GlobalInspectionProvider.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void runInspection(@NotNull AnalysisScope scope, @NotNull InspectionManager manager, @NotNull GlobalInspectionContext globalContext, @NotNull ProblemDescriptionsProcessor processor) {
    GaugeErrors.init();
    Module[] modules = ModuleManager.getInstance(globalContext.getProject()).getModules();
    for (Module module : modules) {
        File dir = GaugeUtil.moduleDir(module);
        GaugeErrors.add(dir.getAbsolutePath(), GaugeInspectionHelper.getErrors(dir));
    }
}
 
Example 30
/**
 * Create a new module into the test project from existing in memory POM.
 *
 * @param name the new module name
 * @param xml the project POM
 * @return the created module
 */
protected Module createMavenModule(String name, String xml) throws Exception {
  Module module = myTestFixture.getModule();
  File moduleDir = new File(module.getModuleFilePath()).getParentFile();
  VirtualFile pomFile = createPomFile(LocalFileSystem.getInstance().findFileByIoFile(moduleDir), xml);
  importProject(pomFile);
  Module[] modules = ModuleManager.getInstance(myTestFixture.getProject()).getModules();
  if (modules.length > 0) {
    module = modules[modules.length - 1];
    setupJdkForModule(module.getName());
  }
  return module;
}