From 6e91069aa0d03ecfd823017f6ea03016c2b541e4 Mon Sep 17 00:00:00 2001 From: "Vladislav.Soroka" Date: Fri, 12 May 2017 15:58:31 +0300 Subject: [PATCH] IDEA-172680 Don't start auto-import from Gradle while VCS operations are in progress --- .../ExternalSystemProjectsWatcherImpl.java | 4 ++-- .../jetbrains/plugins/gradle/GradleManager.java | 14 ++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/autoimport/ExternalSystemProjectsWatcherImpl.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/autoimport/ExternalSystemProjectsWatcherImpl.java index 1a3a56178907..7fca7f70511e 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/autoimport/ExternalSystemProjectsWatcherImpl.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/autoimport/ExternalSystemProjectsWatcherImpl.java @@ -104,7 +104,7 @@ public class ExternalSystemProjectsWatcherImpl extends ExternalSystemTaskNotific DOCUMENT_SAVE_DELAY, false, ANY_COMPONENT, myProject); myRefreshRequestsQueue = new MergingUpdateQueue("ExternalSystemProjectsWatcher: Refresh requests queue", - 0, false, ANY_COMPONENT, myProject); + 0, false, ANY_COMPONENT, myProject, null, false); myImportAwareManagers = ContainerUtil.newArrayList(); for (ExternalSystemManager manager : ExternalSystemApiUtil.getAllManagers()) { @@ -282,7 +282,7 @@ public class ExternalSystemProjectsWatcherImpl extends ExternalSystemTaskNotific } private void addToRefreshQueue(String projectPath, ProjectSystemId systemId) { - myRefreshRequestsQueue.run(new Update(Pair.create(systemId, projectPath)) { + myRefreshRequestsQueue.queue(new Update(Pair.create(systemId, projectPath)) { @Override public void run() { scheduleRefresh(myProject, projectPath, systemId, false); diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/GradleManager.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/GradleManager.java index d74424e21d1b..2bfd345ea917 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/GradleManager.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/GradleManager.java @@ -35,11 +35,11 @@ import com.intellij.openapi.externalSystem.model.project.ModuleData; import com.intellij.openapi.externalSystem.service.project.ExternalSystemProjectResolver; import com.intellij.openapi.externalSystem.service.project.ProjectDataManager; import com.intellij.openapi.externalSystem.service.project.autoimport.CachingExternalSystemAutoImportAware; +import com.intellij.openapi.externalSystem.service.project.manage.ExternalProjectsManager; import com.intellij.openapi.externalSystem.service.ui.DefaultExternalSystemUiAware; import com.intellij.openapi.externalSystem.task.ExternalSystemTaskManager; import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil; import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; -import com.intellij.openapi.externalSystem.util.ExternalSystemUtil; import com.intellij.openapi.fileChooser.FileChooserDescriptor; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleManager; @@ -384,21 +384,19 @@ public class GradleManager @Override public void onServiceDirectoryPathChange(@Nullable String oldPath, @Nullable String newPath) { - ensureProjectsRefresh(); + for (GradleProjectSettings projectSettings : GradleSettings.getInstance(project).getLinkedProjectsSettings()) { + ExternalProjectsManager.getInstance(project).getExternalProjectsWatcher().markDirty(projectSettings.getExternalProjectPath()); + } } @Override public void onGradleHomeChange(@Nullable String oldPath, @Nullable String newPath, @NotNull String linkedProjectPath) { - ensureProjectsRefresh(); + ExternalProjectsManager.getInstance(project).getExternalProjectsWatcher().markDirty(linkedProjectPath); } @Override public void onGradleDistributionTypeChange(DistributionType currentValue, @NotNull String linkedProjectPath) { - ensureProjectsRefresh(); - } - - private void ensureProjectsRefresh() { - ExternalSystemUtil.refreshProjects(project, GradleConstants.SYSTEM_ID, true); + ExternalProjectsManager.getInstance(project).getExternalProjectsWatcher().markDirty(linkedProjectPath); } });