当前位置: 首页>>代码示例>>Java>>正文


Java MavenProjectsManager.isMavenizedModule方法代码示例

本文整理汇总了Java中org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenizedModule方法的典型用法代码示例。如果您正苦于以下问题:Java MavenProjectsManager.isMavenizedModule方法的具体用法?Java MavenProjectsManager.isMavenizedModule怎么用?Java MavenProjectsManager.isMavenizedModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jetbrains.idea.maven.project.MavenProjectsManager的用法示例。


在下文中一共展示了MavenProjectsManager.isMavenizedModule方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findContainingMavenizedModule

import org.jetbrains.idea.maven.project.MavenProjectsManager; //导入方法依赖的package包/类
@Nullable
public static Module findContainingMavenizedModule(@NotNull PsiFile psiFile) {
  VirtualFile file = psiFile.getVirtualFile();
  if (file == null) return null;

  Project project = psiFile.getProject();

  MavenProjectsManager manager = MavenProjectsManager.getInstance(project);
  if (!manager.isMavenizedProject()) return null;

  ProjectFileIndex index = ProjectRootManager.getInstance(project).getFileIndex();

  Module module = index.getModuleForFile(file);
  if (module == null || !manager.isMavenizedModule(module)) return null;
  return module;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:MavenDomUtil.java

示例2: getMavenProjects

import org.jetbrains.idea.maven.project.MavenProjectsManager; //导入方法依赖的package包/类
public static List<MavenProject> getMavenProjects(DataContext context) {
  Project project = CommonDataKeys.PROJECT.getData(context);
  if (project == null) return Collections.emptyList();

  VirtualFile[] virtualFiles = CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(context);
  if (virtualFiles == null || virtualFiles.length == 0) return Collections.emptyList();

  MavenProjectsManager projectsManager = MavenProjectsManager.getInstance(project);
  if (!projectsManager.isMavenizedProject()) return Collections.emptyList();

  Set<MavenProject> res = new LinkedHashSet<MavenProject>();

  ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();

  for (VirtualFile file : virtualFiles) {
    MavenProject mavenProject;

    if (file.isDirectory()) {
      VirtualFile contentRoot = fileIndex.getContentRootForFile(file);
      if (!file.equals(contentRoot)) return Collections.emptyList();

      Module module = fileIndex.getModuleForFile(file);
      if (module == null || !projectsManager.isMavenizedModule(module)) return Collections.emptyList();

      mavenProject = projectsManager.findProject(module);
    }
    else {
      mavenProject = projectsManager.findProject(file);
    }

    if (mavenProject == null) return Collections.emptyList();

    res.add(mavenProject);
  }

  return new ArrayList<MavenProject>(res);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:MavenActionUtil.java

示例3: isMavenizedModule

import org.jetbrains.idea.maven.project.MavenProjectsManager; //导入方法依赖的package包/类
@Override
public boolean isMavenizedModule(@NotNull Module module) {
  MavenProjectsManager mavenProjectsManager = MavenProjectsManager.getInstance(module.getProject());
  return mavenProjectsManager != null ? mavenProjectsManager.isMavenizedModule(module) : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:AndroidMavenProviderImpl.java

示例4: isApplicable

import org.jetbrains.idea.maven.project.MavenProjectsManager; //导入方法依赖的package包/类
@Override
public boolean isApplicable(@NotNull Module module) {
  final MavenProjectsManager manager = MavenProjectsManager.getInstance(module.getProject());
  return manager.isMavenizedModule(module);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:MavenOrderEnumeratorHandler.java

示例5: dumpModulesPaths

import org.jetbrains.idea.maven.project.MavenProjectsManager; //导入方法依赖的package包/类
private static File dumpModulesPaths(@NotNull Project project) throws IOException {
  ApplicationManager.getApplication().assertReadAccessAllowed();

  Properties res = new Properties();

  MavenProjectsManager manager = MavenProjectsManager.getInstance(project);

  for (Module module : ModuleManager.getInstance(project).getModules()) {
    if (manager.isMavenizedModule(module)) {
      MavenProject mavenProject = manager.findProject(module);
      if (mavenProject != null && !manager.isIgnored(mavenProject)) {
        res.setProperty(mavenProject.getMavenId().getGroupId()
                        + ':' + mavenProject.getMavenId().getArtifactId()
                        + ":pom"
                        + ':' + mavenProject.getMavenId().getVersion(),
                        mavenProject.getFile().getPath());

        res.setProperty(mavenProject.getMavenId().getGroupId()
                        + ':' + mavenProject.getMavenId().getArtifactId()
                        + ":test-jar"
                        + ':' + mavenProject.getMavenId().getVersion(),
                        mavenProject.getTestOutputDirectory());

        res.setProperty(mavenProject.getMavenId().getGroupId()
                        + ':' + mavenProject.getMavenId().getArtifactId()
                        + ':' + mavenProject.getPackaging()
                        + ':' + mavenProject.getMavenId().getVersion(),
                         mavenProject.getOutputDirectory());

      }
    }
  }

  File file = new File(PathManager.getSystemPath(), "Maven/idea-projects-state-" + project.getLocationHash() + ".properties");
  FileUtil.ensureExists(file.getParentFile());

  OutputStream out = new BufferedOutputStream(new FileOutputStream(file));
  try {
    res.store(out, null);
  }
  finally {
    out.close();
  }

  return file;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:47,代码来源:MavenExternalParameters.java


注:本文中的org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenizedModule方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。