use of com.intellij.openapi.externalSystem.model.ProjectSystemId 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);
}
}
Aggregations