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