Search in sources :

Example 36 with ProjectSystemId

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);
    }
}
Also used : Project(com.intellij.openapi.project.Project) AbstractExternalProjectImportProvider(com.intellij.openapi.externalSystem.service.project.wizard.AbstractExternalProjectImportProvider) ProjectImportProvider(com.intellij.projectImport.ProjectImportProvider) AbstractExternalProjectImportProvider(com.intellij.openapi.externalSystem.service.project.wizard.AbstractExternalProjectImportProvider) AddModuleWizard(com.intellij.ide.util.newProjectWizard.AddModuleWizard) ProjectSystemId(com.intellij.openapi.externalSystem.model.ProjectSystemId)

Aggregations

ProjectSystemId (com.intellij.openapi.externalSystem.model.ProjectSystemId)36 Project (com.intellij.openapi.project.Project)10 Map (java.util.Map)5 ExternalConfigPathAware (com.intellij.openapi.externalSystem.model.project.ExternalConfigPathAware)4 ProjectData (com.intellij.openapi.externalSystem.model.project.ProjectData)4 File (java.io.File)4 NotNull (org.jetbrains.annotations.NotNull)4 ExternalSystemManager (com.intellij.openapi.externalSystem.ExternalSystemManager)3 DataNode (com.intellij.openapi.externalSystem.model.DataNode)3 ExternalProjectInfo (com.intellij.openapi.externalSystem.model.ExternalProjectInfo)3 ModuleData (com.intellij.openapi.externalSystem.model.project.ModuleData)3 TaskData (com.intellij.openapi.externalSystem.model.task.TaskData)3 ExternalProjectSettings (com.intellij.openapi.externalSystem.settings.ExternalProjectSettings)3 Collection (java.util.Collection)3 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)2 Presentation (com.intellij.openapi.actionSystem.Presentation)2 Logger (com.intellij.openapi.diagnostic.Logger)2 ExternalSystemTaskExecutionSettings (com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings)2 ExternalSystemProcessingManager (com.intellij.openapi.externalSystem.service.internal.ExternalSystemProcessingManager)2 AbstractExternalSystemSettings (com.intellij.openapi.externalSystem.settings.AbstractExternalSystemSettings)2