From a16bfe6ff7566aed4f4bb64af8484a2488244768 Mon Sep 17 00:00:00 2001 From: "Vladislav.Soroka" Date: Fri, 30 May 2014 13:32:49 +0400 Subject: [PATCH] External-system: IDEA-124927 Don't refresh projects on opening when auto-import is disabled --- .../model/ExternalSystemDataKeys.java | 1 + .../service/ExternalSystemStartupActivity.java | 13 ++++++++++--- .../service/project/wizard/GradleModuleBuilder.java | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/model/ExternalSystemDataKeys.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/model/ExternalSystemDataKeys.java index c2f885f4d07d..74295376e59f 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/model/ExternalSystemDataKeys.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/model/ExternalSystemDataKeys.java @@ -40,6 +40,7 @@ public class ExternalSystemDataKeys { = DataKey.create("external.system.recent.tasks.list"); @NotNull public static final Key NEWLY_IMPORTED_PROJECT = new Key("external.system.newly.imported"); + @NotNull public static final Key NEWLY_CREATED_PROJECT = new Key("external.system.newly.created"); private ExternalSystemDataKeys() { } diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ExternalSystemStartupActivity.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ExternalSystemStartupActivity.java index b252e8c0185d..f7040a224c3f 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ExternalSystemStartupActivity.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ExternalSystemStartupActivity.java @@ -52,9 +52,16 @@ public class ExternalSystemStartupActivity implements StartupActivity { } if (project.getUserData(ExternalSystemDataKeys.NEWLY_IMPORTED_PROJECT) != Boolean.TRUE) { for (ExternalSystemManager manager : ExternalSystemManager.EP_NAME.getExtensions()) { - ExternalSystemUtil.refreshProjects( - new ImportSpecBuilder(project, manager.getSystemId()).whenAutoImportEnabled() - ); + if (project.getUserData(ExternalSystemDataKeys.NEWLY_CREATED_PROJECT) == Boolean.TRUE) { + ExternalSystemUtil.refreshProjects( + new ImportSpecBuilder(project, manager.getSystemId()) + ); + } + else { + ExternalSystemUtil.refreshProjects( + new ImportSpecBuilder(project, manager.getSystemId()).whenAutoImportEnabled() + ); + } } } ExternalSystemAutoImporter.letTheMagicBegin(project); diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/wizard/GradleModuleBuilder.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/wizard/GradleModuleBuilder.java index 0f66ebdaf7b8..e5951134e523 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/wizard/GradleModuleBuilder.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/wizard/GradleModuleBuilder.java @@ -22,6 +22,7 @@ import com.intellij.ide.util.projectWizard.ModuleWizardStep; import com.intellij.ide.util.projectWizard.WizardContext; import com.intellij.openapi.Disposable; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.externalSystem.model.ExternalSystemDataKeys; import com.intellij.openapi.externalSystem.service.project.wizard.AbstractExternalModuleBuilder; import com.intellij.openapi.externalSystem.service.project.wizard.ExternalModuleSettingsStep; import com.intellij.openapi.externalSystem.settings.AbstractExternalSystemSettings; @@ -111,6 +112,7 @@ public class GradleModuleBuilder extends AbstractExternalModuleBuilder