From b449bf3d72b8e1da9f8e5d30a8acea3a69fff835 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Tue, 11 Jun 2019 08:55:09 -0400 Subject: [PATCH] IDEA-215976 IDEA 192.5118.1 hangs after start on macOs setPath is called now in a more appropriate time, and no any additional wrapper around VFS refresh is required now `isRefreshVfs` GitOrigin-RevId: 76e14c26a94ed7e82e5845b29112a0eee60817b5 --- .../src/ProjectStoreBase.kt | 15 +++++---------- .../src/ProjectStoreImpl.kt | 5 +---- .../openapi/project/impl/ProjectManagerImpl.java | 2 +- .../components/impl/stores/IProjectStore.java | 6 +++--- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/platform/configuration-store-impl/src/ProjectStoreBase.kt b/platform/configuration-store-impl/src/ProjectStoreBase.kt index 3ea6ef1723b0..5be73cc2e009 100644 --- a/platform/configuration-store-impl/src/ProjectStoreBase.kt +++ b/platform/configuration-store-impl/src/ProjectStoreBase.kt @@ -105,8 +105,7 @@ abstract class ProjectStoreBase(final override val project: Project) : Component } } - // used in upsource - protected suspend fun setPath(filePath: String, isRefreshVfs: Boolean) { + override fun setPath(filePath: String, isRefreshVfsNeeded: Boolean) { val storageManager = storageManager val fs = LocalFileSystem.getInstance() val isUnitTestMode = ApplicationManager.getApplication().isUnitTestMode @@ -118,10 +117,8 @@ abstract class ProjectStoreBase(final override val project: Project) : Component val workspacePath = composeFileBasedProjectWorkSpacePath(filePath) storageManager.addMacro(StoragePathMacros.WORKSPACE_FILE, workspacePath) - if (isRefreshVfs) { - withEdtContext { - VfsUtil.markDirtyAndRefresh(false, true, false, fs.refreshAndFindFileByPath(filePath), fs.refreshAndFindFileByPath(workspacePath)) - } + if (isRefreshVfsNeeded) { + VfsUtil.markDirtyAndRefresh(false, true, false, fs.refreshAndFindFileByPath(filePath), fs.refreshAndFindFileByPath(workspacePath)) } if (isUnitTestMode) { @@ -142,10 +139,8 @@ abstract class ProjectStoreBase(final override val project: Project) : Component isOptimiseTestLoadSpeed = !Paths.get(filePath).exists() } - if (isRefreshVfs) { - withEdtContext { - VfsUtil.markDirtyAndRefresh(false, true, true, fs.refreshAndFindFileByPath(configDir)) - } + if (isRefreshVfsNeeded) { + VfsUtil.markDirtyAndRefresh(false, true, true, fs.refreshAndFindFileByPath(configDir)) } } diff --git a/platform/configuration-store-impl/src/ProjectStoreImpl.kt b/platform/configuration-store-impl/src/ProjectStoreImpl.kt index 934f7f6ec695..95cdb0da106f 100644 --- a/platform/configuration-store-impl/src/ProjectStoreImpl.kt +++ b/platform/configuration-store-impl/src/ProjectStoreImpl.kt @@ -23,7 +23,6 @@ import com.intellij.util.containers.computeIfAny import com.intellij.util.io.* import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.launch -import kotlinx.coroutines.runBlocking import org.jetbrains.annotations.ApiStatus import org.jetbrains.annotations.CalledInAny import java.nio.file.AccessDeniedException @@ -46,9 +45,7 @@ open class ProjectStoreImpl(project: Project) : ProjectStoreBase(project) { override val storageManager = ProjectStateStorageManager(TrackingPathMacroSubstitutorImpl(PathMacroManager.getInstance(project)), project) override fun setPath(path: String) { - runBlocking { - setPath(path, true) - } + setPath(path, true) } override fun getProjectName(): String { diff --git a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java index ba0c6cdcd525..d4f1f59ef4cb 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerImpl.java @@ -283,7 +283,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements Disposable { try { project.registerComponents(); IProjectStore stateStore = project.getStateStore(); - stateStore.setPath(filePath); + stateStore.setPath(filePath, true); if (template != null) { stateStore.loadProjectFromTemplate(template); } diff --git a/platform/projectModel-impl/src/com/intellij/openapi/components/impl/stores/IProjectStore.java b/platform/projectModel-impl/src/com/intellij/openapi/components/impl/stores/IProjectStore.java index f8383fcb7d74..6e658679bb0c 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/components/impl/stores/IProjectStore.java +++ b/platform/projectModel-impl/src/com/intellij/openapi/components/impl/stores/IProjectStore.java @@ -1,6 +1,4 @@ -/* - * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.components.impl.stores; import com.intellij.openapi.components.StorageScheme; @@ -69,4 +67,6 @@ public interface IProjectStore extends IComponentStore { @NotNull @SystemIndependent String getDirectoryStorePathOrBase(); + + void setPath(@NotNull @SystemIndependent String path, boolean isRefreshVfsNeeded); }