本文整理汇总了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;
}
示例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));
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}