use of com.intellij.openapi.externalSystem.service.project.wizard.AbstractExternalProjectImportProvider in project intellij-community by JetBrains.
the class AttachExternalProjectAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
ProjectSystemId externalSystemId = ExternalSystemDataKeys.EXTERNAL_SYSTEM_ID.getData(e.getDataContext());
if (externalSystemId == null) {
return;
}
ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(externalSystemId);
if (manager == null) {
return;
}
Project project = e.getProject();
if (project == null) {
return;
}
ProjectImportProvider[] projectImportProviders = new ProjectImportProvider[1];
for (ProjectImportProvider provider : ProjectImportProvider.PROJECT_IMPORT_PROVIDER.getExtensions()) {
if (provider instanceof AbstractExternalProjectImportProvider && externalSystemId.equals(((AbstractExternalProjectImportProvider) provider).getExternalSystemId())) {
projectImportProviders[0] = provider;
break;
}
}
if (projectImportProviders[0] == null) {
return;
}
AddModuleWizard wizard = ImportModuleAction.selectFileAndCreateWizard(project, null, manager.getExternalProjectDescriptor(), projectImportProviders);
if (wizard != null && (wizard.getStepCount() <= 0 || wizard.showAndGet())) {
ImportModuleAction.createFromWizard(project, wizard);
}
}
use of com.intellij.openapi.externalSystem.service.project.wizard.AbstractExternalProjectImportProvider in project azure-tools-for-java by Microsoft.
the class SbtProjectGenerator method importSbtProject.
private void importSbtProject(String root) {
Project project = this.module.getProject();
final ProjectSystemId externalSystemId = new ProjectSystemId("SBT");
final ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(externalSystemId);
if (manager == null) {
return;
}
ProjectImportProvider[] projectImportProviders = new ProjectImportProvider[1];
for (ProjectImportProvider provider : ProjectImportProvider.PROJECT_IMPORT_PROVIDER.getExtensions()) {
if (provider instanceof AbstractExternalProjectImportProvider && externalSystemId.equals(((AbstractExternalProjectImportProvider) provider).getExternalSystemId())) {
projectImportProviders[0] = provider;
break;
}
}
if (projectImportProviders[0] == null) {
return;
}
final VirtualFile projectFile = VfsUtil.findFile(Paths.get(root, "build.sbt"), true);
if (projectFile != null) {
AzureTaskManager.getInstance().runLater(() -> {
AddModuleWizard wizard = ImportModuleAction.createImportWizard(project, null, projectFile, projectImportProviders);
if (wizard != null && (wizard.getStepCount() <= 0 || wizard.showAndGet())) {
ImportModuleAction.createFromWizard(project, wizard);
}
});
}
}
Aggregations