IDEA-172680 Don't start auto-import from Gradle while VCS operations are in progress

This commit is contained in:
Vladislav.Soroka
2017-05-12 15:59:20 +03:00
parent a7be4e8beb
commit 6e91069aa0
2 changed files with 8 additions and 10 deletions
@@ -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);
@@ -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);
}
});