use of org.jetbrains.idea.maven.project.MavenProjectsManager in project moe-ide-integration by multi-os-engine.
the class MOEMavenTask method getMavenProject.
private MavenProject getMavenProject() {
String pomXmlPath = findPomXml(module);
if (pomXmlPath == null || pomXmlPath.isEmpty()) {
return null;
}
VirtualFile file = LocalFileSystem.getInstance().findFileByPath(pomXmlPath);
if (file == null)
return null;
MavenProjectsManager manager = MavenProjectsManager.getInstance(module.getProject());
if (manager == null) {
return null;
}
return manager.findProject(file);
}
use of org.jetbrains.idea.maven.project.MavenProjectsManager in project component-runtime by Talend.
the class TalendModuleBuilder method createModule.
@Override
public Module createModule(final ModifiableModuleModel moduleModel) throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, ConfigurationException, JDOMException {
final Module module = super.createModule(moduleModel);
getApplication().invokeLater(() -> {
ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> {
final ProjectDownloader downloader = new ProjectDownloader(this, request);
try {
downloader.download(ProgressManager.getInstance().getProgressIndicator());
} catch (IOException e) {
getApplication().invokeLater(() -> MessagesEx.showErrorDialog(e.getMessage(), getMessage("download.project.file.error")));
}
}, getMessage("download.project.file"), true, null);
final Project moduleProject = module.getProject();
switch(jsonProject.get("buildType").getAsString()) {
case "Maven":
final VirtualFile pomFile = findFileUnderRootInModule(module, "pom.xml");
if (pomFile != null) {
final MavenProjectsManager mavenProjectsManager = MavenProjectsManager.getInstance(moduleProject);
mavenProjectsManager.addManagedFiles(singletonList(pomFile));
}
break;
case "Gradle":
final VirtualFile gradleFile = findFileUnderRootInModule(module, "build.gradle");
if (gradleFile != null) {
final ProjectDataManager projectDataManager = getService(ProjectDataManager.class);
final GradleProjectImportBuilder importBuilder = new GradleProjectImportBuilder(projectDataManager);
final GradleProjectImportProvider importProvider = new GradleProjectImportProvider(importBuilder);
final AddModuleWizard addModuleWizard = new AddModuleWizard(moduleProject, gradleFile.getPath(), importProvider);
if (addModuleWizard.getStepCount() == 0 && addModuleWizard.showAndGet()) {
// user chose to import via the gradle import prompt
importBuilder.commit(moduleProject, null, null);
}
}
break;
default:
break;
}
}, ModalityState.current());
return module;
}
Aggregations