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


Java MavenProjectsManager.isMavenizedProject方法代码示例

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


在下文中一共展示了MavenProjectsManager.isMavenizedProject方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: fillCompletionVariants

import org.jetbrains.idea.maven.project.MavenProjectsManager; //导入方法依赖的package包/类
@Override
public void fillCompletionVariants(@NotNull CompletionParameters parameters, @NotNull CompletionResultSet result) {
  PsiFile psiFile = parameters.getOriginalFile();
  Project project = psiFile.getProject();

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

  MavenProject projectFile = MavenDomUtil.findContainingProject(psiFile);
  if (projectFile == null) return;

  if (!MavenDomUtil.isMavenFile(psiFile) && !MavenDomUtil.isFilteredResourceFile(psiFile)) return;

  String text = psiFile.getText();
  int offset = parameters.getOffset();
  int braceOffset = findOpenBrace(text, offset);
  if (braceOffset == -1) return;

  TextRange range = TextRange.create(braceOffset, offset);
  String prefix = range.substring(text);

  MavenFilteredPropertyPsiReference ref = new MavenFilteredPropertyPsiReference(projectFile, psiFile, prefix, range);

  addVariants(Arrays.asList(ref.getVariants()), result.withPrefixMatcher(prefix));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:MavenPropertyCompletionContributor.java

示例3: 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

示例4: getEditorTabTitle

import org.jetbrains.idea.maven.project.MavenProjectsManager; //导入方法依赖的package包/类
public String getEditorTabTitle(Project project, VirtualFile file) {
  MavenProjectsManager projectsManager = MavenProjectsManager.getInstance(project);
  if (!projectsManager.isMavenizedProject()) return null;

  MavenProject mavenProject = projectsManager.findProject(file);
  if (mavenProject == null) return null;

  return mavenProject.getMavenId().getArtifactId();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:MavenEditorTabTitleProvider.java

示例5: isEnabled

import org.jetbrains.idea.maven.project.MavenProjectsManager; //导入方法依赖的package包/类
private static boolean isEnabled(AnActionEvent e) {
  if(!MavenActionUtil.hasProject(e.getDataContext())) return false;
  final MavenProjectsManager projectsManager = MavenActionUtil.getProjectsManager(e.getDataContext());
  return projectsManager != null && projectsManager.isMavenizedProject();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:DownloadActionGroup.java

示例6: isAvailable

import org.jetbrains.idea.maven.project.MavenProjectsManager; //导入方法依赖的package包/类
@Override
protected boolean isAvailable(AnActionEvent e) {
  if(!super.isAvailable(e)) return false;
  final MavenProjectsManager projectsManager = MavenActionUtil.getProjectsManager(e.getDataContext());
  return projectsManager != null && projectsManager.isMavenizedProject();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:MavenProjectsManagerAction.java


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