mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
blockingContext is not required anymore (implicit), cleanup
GitOrigin-RevId: 40eb198d27159ee39fa84ce8a9c246df5756d33c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
43a2d8cd3c
commit
3b584c22e2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.ide
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap
|
||||
@@ -67,7 +67,7 @@ private class SetupJavaProjectFromSourcesActivity : ProjectActivity {
|
||||
return
|
||||
}
|
||||
|
||||
if (!project.isOpenedByPlatformProcessor()) {
|
||||
if (!isOpenedByPlatformProcessor(project)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.java.ift
|
||||
|
||||
import com.intellij.ide.impl.NewProjectUtil
|
||||
@@ -14,7 +14,7 @@ import com.intellij.openapi.projectRoots.ex.JavaSdkUtil
|
||||
import com.intellij.openapi.roots.ProjectRootManager
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.platform.PlatformProjectOpenProcessor
|
||||
import com.intellij.platform.PROJECT_OPENED_BY_PLATFORM_PROCESSOR
|
||||
import training.lang.AbstractLangSupport
|
||||
import training.project.ProjectUtils
|
||||
import java.nio.file.Path
|
||||
@@ -30,7 +30,7 @@ abstract class JavaBasedLangSupport : AbstractLangSupport() {
|
||||
// It is required to not run SetupJavaProjectFromSourcesActivity because
|
||||
// Projects created from wizard do not use it now
|
||||
this.beforeOpen = { project ->
|
||||
project.putUserData(PlatformProjectOpenProcessor.PROJECT_OPENED_BY_PLATFORM_PROCESSOR, false)
|
||||
project.putUserData(PROJECT_OPENED_BY_PLATFORM_PROCESSOR, false)
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
+42
-44
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.externalSystem.autolink
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
@@ -6,7 +6,6 @@ import com.intellij.openapi.application.readAction
|
||||
import com.intellij.openapi.components.serviceAsync
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.openapi.extensions.createExtensionDisposable
|
||||
import com.intellij.platform.externalSystem.impl.ExternalSystemImplCoroutineScope.esCoroutineScope
|
||||
import com.intellij.openapi.externalSystem.autoimport.ExternalSystemProjectId
|
||||
import com.intellij.openapi.externalSystem.autoimport.changes.vfs.VirtualFileChangesListener
|
||||
import com.intellij.openapi.externalSystem.autoimport.changes.vfs.VirtualFileChangesListener.Companion.installAsyncVirtualFileListener
|
||||
@@ -26,9 +25,10 @@ import com.intellij.openapi.vfs.isFile
|
||||
import com.intellij.openapi.vfs.newvfs.events.VFileContentChangeEvent
|
||||
import com.intellij.openapi.vfs.newvfs.events.VFileEvent
|
||||
import com.intellij.openapi.vfs.toNioPathOrNull
|
||||
import com.intellij.platform.PlatformProjectOpenProcessor.Companion.isConfiguredByPlatformProcessor
|
||||
import com.intellij.platform.PlatformProjectOpenProcessor.Companion.isNewProject
|
||||
import com.intellij.platform.backend.observation.trackActivity
|
||||
import com.intellij.platform.externalSystem.impl.ExternalSystemImplCoroutineScope.esCoroutineScope
|
||||
import com.intellij.platform.isConfiguredByPlatformProcessor
|
||||
import com.intellij.util.containers.DisposableWrapperList
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
@@ -59,11 +59,11 @@ class UnlinkedProjectStartupActivity : ProjectActivity {
|
||||
}
|
||||
|
||||
private fun isNewPlatformProject(project: Project): Boolean {
|
||||
return project.isNewProject()
|
||||
return isNewProject(project)
|
||||
}
|
||||
|
||||
private fun isOpenedWithEmptyModel(project: Project): Boolean {
|
||||
return project.isConfiguredByPlatformProcessor() || isEmptyModel(project)
|
||||
return isConfiguredByPlatformProcessor(project) || isEmptyModel(project)
|
||||
}
|
||||
|
||||
private fun isEmptyModel(project: Project): Boolean {
|
||||
@@ -263,43 +263,6 @@ class UnlinkedProjectStartupActivity : ProjectActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private class ProjectRoots : Iterable<String> {
|
||||
|
||||
private val projectRoots = CopyOnWriteArrayList<String>()
|
||||
private val addListeners = DisposableWrapperList<suspend (String) -> Unit>()
|
||||
private val removeListeners = DisposableWrapperList<suspend (String) -> Unit>()
|
||||
|
||||
override fun iterator(): Iterator<String> {
|
||||
return projectRoots.iterator()
|
||||
}
|
||||
|
||||
suspend fun addProjectRoot(projectRoot: String) {
|
||||
projectRoots.add(projectRoot)
|
||||
addListeners.forEach { it(projectRoot) }
|
||||
}
|
||||
|
||||
suspend fun removeProjectRoot(projectRoot: String) {
|
||||
projectRoots.remove(projectRoot)
|
||||
removeListeners.forEach { it(projectRoot) }
|
||||
}
|
||||
|
||||
fun whenProjectRootAdded(parentDisposable: Disposable, action: suspend (String) -> Unit) {
|
||||
addListeners.add(action, parentDisposable)
|
||||
}
|
||||
|
||||
fun whenProjectRootRemoved(parentDisposable: Disposable, action: suspend (String) -> Unit) {
|
||||
removeListeners.add(action, parentDisposable)
|
||||
}
|
||||
|
||||
suspend fun withProjectRoot(parentDisposable: Disposable, action: suspend (String) -> Unit) {
|
||||
for (projectRoot in projectRoots) {
|
||||
action(projectRoot)
|
||||
}
|
||||
whenProjectRootAdded(parentDisposable) { projectRoot ->
|
||||
action(projectRoot)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun ExternalSystemUnlinkedProjectAware.createProjectId(externalProjectPath: String): ExternalSystemProjectId {
|
||||
return ExternalSystemProjectId(systemId, externalProjectPath)
|
||||
@@ -311,8 +274,43 @@ class UnlinkedProjectStartupActivity : ProjectActivity {
|
||||
projectRoot?.children?.firstOrNull { isBuildFile(project, it) } != null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val LOG = Logger.getInstance("#com.intellij.openapi.externalSystem.autolink")
|
||||
private class ProjectRoots : Iterable<String> {
|
||||
private val projectRoots = CopyOnWriteArrayList<String>()
|
||||
private val addListeners = DisposableWrapperList<suspend (String) -> Unit>()
|
||||
private val removeListeners = DisposableWrapperList<suspend (String) -> Unit>()
|
||||
|
||||
override fun iterator(): Iterator<String> {
|
||||
return projectRoots.iterator()
|
||||
}
|
||||
|
||||
suspend fun addProjectRoot(projectRoot: String) {
|
||||
projectRoots.add(projectRoot)
|
||||
addListeners.forEach { it(projectRoot) }
|
||||
}
|
||||
|
||||
suspend fun removeProjectRoot(projectRoot: String) {
|
||||
projectRoots.remove(projectRoot)
|
||||
removeListeners.forEach { it(projectRoot) }
|
||||
}
|
||||
|
||||
fun whenProjectRootAdded(parentDisposable: Disposable, action: suspend (String) -> Unit) {
|
||||
addListeners.add(action, parentDisposable)
|
||||
}
|
||||
|
||||
fun whenProjectRootRemoved(parentDisposable: Disposable, action: suspend (String) -> Unit) {
|
||||
removeListeners.add(action, parentDisposable)
|
||||
}
|
||||
|
||||
suspend fun withProjectRoot(parentDisposable: Disposable, action: suspend (String) -> Unit) {
|
||||
for (projectRoot in projectRoots) {
|
||||
action(projectRoot)
|
||||
}
|
||||
whenProjectRootAdded(parentDisposable) { projectRoot ->
|
||||
action(projectRoot)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val LOG = Logger.getInstance("#com.intellij.openapi.externalSystem.autolink")
|
||||
|
||||
+1
-3
@@ -12,9 +12,7 @@ import com.intellij.openapi.project.impl.ProjectServiceInitializer
|
||||
import com.intellij.openapi.projectRoots.ProjectJdkTable
|
||||
import com.intellij.openapi.roots.ProjectRootManager
|
||||
import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar
|
||||
import com.intellij.openapi.util.component1
|
||||
import com.intellij.openapi.util.component2
|
||||
import com.intellij.platform.PlatformProjectOpenProcessor.Companion.PROJECT_LOADED_FROM_CACHE_BUT_HAS_NO_MODULES
|
||||
import com.intellij.platform.PROJECT_LOADED_FROM_CACHE_BUT_HAS_NO_MODULES
|
||||
import com.intellij.platform.backend.workspace.WorkspaceModel
|
||||
import com.intellij.platform.backend.workspace.WorkspaceModelTopics
|
||||
import com.intellij.platform.backend.workspace.impl.WorkspaceModelInternal
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.wm
|
||||
|
||||
import com.intellij.openapi.progress.blockingContext
|
||||
import com.intellij.openapi.project.PossiblyDumbAware
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.annotations.ApiStatus.Experimental
|
||||
@@ -22,10 +21,8 @@ interface ToolWindowFactory : PossiblyDumbAware {
|
||||
* @return false to deactivate the factory
|
||||
*/
|
||||
suspend fun isApplicableAsync(project: Project): Boolean {
|
||||
return blockingContext {
|
||||
@Suppress("DEPRECATION")
|
||||
isApplicable(project)
|
||||
}
|
||||
@Suppress("DEPRECATION")
|
||||
return isApplicable(project)
|
||||
}
|
||||
|
||||
@Suppress("DeprecatedCallableAddReplaceWith")
|
||||
|
||||
@@ -11319,7 +11319,6 @@ f:com.intellij.platform.PlatformProjectOpenProcessor
|
||||
- com.intellij.platform.CommandLineProjectOpenProcessor
|
||||
- sf:Companion:com.intellij.platform.PlatformProjectOpenProcessor$Companion
|
||||
- <init>():V
|
||||
- sf:attachToProject(com.intellij.openapi.project.Project,java.nio.file.Path,com.intellij.projectImport.ProjectOpenedCallback):Z
|
||||
- canOpenProject(com.intellij.openapi.vfs.VirtualFile):Z
|
||||
- sf:doOpenProject(com.intellij.openapi.vfs.VirtualFile,com.intellij.openapi.project.Project,I,com.intellij.projectImport.ProjectOpenedCallback,java.util.EnumSet):com.intellij.openapi.project.Project
|
||||
- doOpenProject(com.intellij.openapi.vfs.VirtualFile,com.intellij.openapi.project.Project,Z):com.intellij.openapi.project.Project
|
||||
@@ -11330,14 +11329,9 @@ f:com.intellij.platform.PlatformProjectOpenProcessor
|
||||
- lookForProjectsInDirectory():Z
|
||||
- openProjectAndFile(java.nio.file.Path,Z,com.intellij.ide.impl.OpenProjectTask,kotlin.coroutines.Continuation):java.lang.Object
|
||||
f:com.intellij.platform.PlatformProjectOpenProcessor$Companion
|
||||
- f:attachToProject(com.intellij.openapi.project.Project,java.nio.file.Path,com.intellij.projectImport.ProjectOpenedCallback):Z
|
||||
- f:doOpenProject(com.intellij.openapi.vfs.VirtualFile,com.intellij.openapi.project.Project,I,com.intellij.projectImport.ProjectOpenedCallback,java.util.EnumSet):com.intellij.openapi.project.Project
|
||||
- f:getInstance():com.intellij.platform.PlatformProjectOpenProcessor
|
||||
- f:getInstanceIfItExists():com.intellij.platform.PlatformProjectOpenProcessor
|
||||
- f:getPROJECT_LOADED_FROM_CACHE_BUT_HAS_NO_MODULES():com.intellij.openapi.util.Key
|
||||
- f:getPROJECT_NEWLY_OPENED():com.intellij.openapi.util.Key
|
||||
- f:getPROJECT_OPENED_BY_PLATFORM_PROCESSOR():com.intellij.openapi.util.Key
|
||||
- f:isConfiguredByPlatformProcessor(com.intellij.openapi.project.Project):Z
|
||||
- f:isNewProject(com.intellij.openapi.project.Project):Z
|
||||
- f:isOpenedByPlatformProcessor(com.intellij.openapi.project.Project):Z
|
||||
- f:isTempProject(com.intellij.openapi.project.Project):Z
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.ide.impl
|
||||
|
||||
import com.intellij.CommonBundle
|
||||
@@ -41,6 +41,7 @@ import com.intellij.openapi.wm.ToolWindowId
|
||||
import com.intellij.openapi.wm.ToolWindowManager
|
||||
import com.intellij.openapi.wm.WindowManager
|
||||
import com.intellij.platform.CommandLineProjectOpenProcessor
|
||||
import com.intellij.platform.PROJECT_OPENED_BY_PLATFORM_PROCESSOR
|
||||
import com.intellij.platform.PlatformProjectOpenProcessor
|
||||
import com.intellij.platform.PlatformProjectOpenProcessor.Companion.createOptionsToOpenDotIdeaOrCreateNewIfNotExists
|
||||
import com.intellij.platform.attachToProjectAsync
|
||||
@@ -228,7 +229,7 @@ object ProjectUtil {
|
||||
useDefaultProjectAsTemplate = true,
|
||||
runConfigurators = true,
|
||||
beforeOpen = {
|
||||
it.putUserData(PlatformProjectOpenProcessor.PROJECT_OPENED_BY_PLATFORM_PROCESSOR, true)
|
||||
it.putUserData(PROJECT_OPENED_BY_PLATFORM_PROCESSOR, true)
|
||||
options.beforeOpen?.invoke(it) ?: true
|
||||
},
|
||||
)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
@file:Suppress("ReplacePutWithAssignment")
|
||||
|
||||
package com.intellij.openapi.project.impl
|
||||
@@ -70,12 +70,13 @@ import com.intellij.openapi.wm.IdeFocusManager
|
||||
import com.intellij.openapi.wm.WindowManager
|
||||
import com.intellij.openapi.wm.ex.WindowManagerEx
|
||||
import com.intellij.openapi.wm.impl.welcomeScreen.WelcomeFrame
|
||||
import com.intellij.platform.PROJECT_NEWLY_OPENED
|
||||
import com.intellij.platform.PlatformProjectOpenProcessor
|
||||
import com.intellij.platform.PlatformProjectOpenProcessor.Companion.isLoadedFromCacheButHasNoModules
|
||||
import com.intellij.platform.attachToProjectAsync
|
||||
import com.intellij.platform.core.nio.fs.MultiRoutingFileSystem
|
||||
import com.intellij.platform.diagnostic.telemetry.impl.span
|
||||
import com.intellij.platform.eel.provider.EelInitialization
|
||||
import com.intellij.platform.eel.provider.EelInitialization
|
||||
import com.intellij.platform.isLoadedFromCacheButHasNoModules
|
||||
import com.intellij.platform.project.ProjectEntitiesStorage
|
||||
import com.intellij.platform.workspace.jps.JpsMetrics
|
||||
import com.intellij.projectImport.ProjectAttachProcessor
|
||||
@@ -105,7 +106,6 @@ import java.util.concurrent.CancellationException
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
import kotlin.coroutines.coroutineContext
|
||||
import kotlin.io.path.Path
|
||||
import kotlin.system.measureTimeMillis
|
||||
|
||||
@Internal
|
||||
@@ -882,7 +882,7 @@ open class ProjectManagerImpl : ProjectManagerEx(), Disposable {
|
||||
}
|
||||
|
||||
val project = instantiateProject(projectStoreBaseDir, projectName, beforeInit)
|
||||
project.putUserData(PlatformProjectOpenProcessor.PROJECT_NEWLY_OPENED, markAsNew)
|
||||
project.putUserData(PROJECT_NEWLY_OPENED, markAsNew)
|
||||
val template = templateAsync?.await()
|
||||
initProject(file = projectStoreBaseDir,
|
||||
project = project,
|
||||
@@ -951,7 +951,8 @@ open class ProjectManagerImpl : ProjectManagerEx(), Disposable {
|
||||
|
||||
open suspend fun configureWorkspace(project: Project, projectStoreBaseDir: Path, options: OpenProjectTask): Module? {
|
||||
if (options.runConfigurators && (options.isNewProject || ModuleManager.getInstance(project).modules.isEmpty())
|
||||
|| project.isLoadedFromCacheButHasNoModules()) {
|
||||
|| isLoadedFromCacheButHasNoModules(project)
|
||||
) {
|
||||
val module = PlatformProjectOpenProcessor.runDirectoryProjectConfigurators(
|
||||
baseDir = projectStoreBaseDir,
|
||||
project = project,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.platform
|
||||
|
||||
import com.intellij.ide.impl.*
|
||||
@@ -46,6 +46,22 @@ import java.util.concurrent.CancellationException
|
||||
private val LOG = logger<PlatformProjectOpenProcessor>()
|
||||
private val EP_NAME = ExtensionPointName<DirectoryProjectConfigurator>("com.intellij.directoryProjectConfigurator")
|
||||
|
||||
@Internal
|
||||
val PROJECT_OPENED_BY_PLATFORM_PROCESSOR: Key<Boolean> = Key.create("PROJECT_OPENED_BY_PLATFORM_PROCESSOR")
|
||||
private val PROJECT_CONFIGURED_BY_PLATFORM_PROCESSOR: Key<Boolean> = Key.create("PROJECT_CONFIGURED_BY_PLATFORM_PROCESSOR")
|
||||
|
||||
@Internal
|
||||
val PROJECT_LOADED_FROM_CACHE_BUT_HAS_NO_MODULES: Key<Boolean> = Key.create("PROJECT_LOADED_FROM_CACHE_BUT_HAS_NO_MODULES")
|
||||
|
||||
internal val PROJECT_NEWLY_OPENED: Key<Boolean> = Key.create("PROJECT_NEWLY_OPENED")
|
||||
|
||||
@Internal
|
||||
fun isConfiguredByPlatformProcessor(project: Project): Boolean = project.getUserData(PROJECT_CONFIGURED_BY_PLATFORM_PROCESSOR) == true
|
||||
|
||||
internal fun isLoadedFromCacheButHasNoModules(project: Project): Boolean {
|
||||
return project.getUserData(PROJECT_LOADED_FROM_CACHE_BUT_HAS_NO_MODULES) == true
|
||||
}
|
||||
|
||||
class PlatformProjectOpenProcessor : ProjectOpenProcessor(), CommandLineProjectOpenProcessor {
|
||||
enum class Option {
|
||||
FORCE_NEW_FRAME,
|
||||
@@ -55,23 +71,11 @@ class PlatformProjectOpenProcessor : ProjectOpenProcessor(), CommandLineProjectO
|
||||
}
|
||||
|
||||
companion object {
|
||||
val PROJECT_OPENED_BY_PLATFORM_PROCESSOR: Key<Boolean> = Key.create("PROJECT_OPENED_BY_PLATFORM_PROCESSOR")
|
||||
fun isOpenedByPlatformProcessor(project: Project): Boolean = project.getUserData(PROJECT_OPENED_BY_PLATFORM_PROCESSOR) == true
|
||||
|
||||
private val PROJECT_CONFIGURED_BY_PLATFORM_PROCESSOR: Key<Boolean> = Key.create("PROJECT_CONFIGURED_BY_PLATFORM_PROCESSOR")
|
||||
fun isNewProject(project: Project): Boolean = project.getUserData(PROJECT_NEWLY_OPENED) == true
|
||||
|
||||
val PROJECT_NEWLY_OPENED: Key<Boolean> = Key.create("PROJECT_NEWLY_OPENED")
|
||||
|
||||
val PROJECT_LOADED_FROM_CACHE_BUT_HAS_NO_MODULES: Key<Boolean> = Key.create("PROJECT_LOADED_FROM_CACHE_BUT_HAS_NO_MODULES")
|
||||
|
||||
fun Project.isOpenedByPlatformProcessor(): Boolean = getUserData(PROJECT_OPENED_BY_PLATFORM_PROCESSOR) == true
|
||||
|
||||
fun Project.isConfiguredByPlatformProcessor(): Boolean = getUserData(PROJECT_CONFIGURED_BY_PLATFORM_PROCESSOR) == true
|
||||
|
||||
fun Project.isNewProject(): Boolean = getUserData(PROJECT_NEWLY_OPENED) == true
|
||||
|
||||
fun Project.isTempProject(): Boolean = service<OpenProjectSettingsService>().state.isLocatedInTempDirectory
|
||||
|
||||
internal fun Project.isLoadedFromCacheButHasNoModules(): Boolean = getUserData(PROJECT_LOADED_FROM_CACHE_BUT_HAS_NO_MODULES) == true
|
||||
fun isTempProject(project: Project): Boolean = project.service<OpenProjectSettingsService>().state.isLocatedInTempDirectory
|
||||
|
||||
@JvmStatic
|
||||
fun getInstance(): PlatformProjectOpenProcessor = EXTENSION_POINT_NAME.findExtensionOrFail(PlatformProjectOpenProcessor::class.java)
|
||||
@@ -119,7 +123,7 @@ class PlatformProjectOpenProcessor : ProjectOpenProcessor(), CommandLineProjectO
|
||||
})
|
||||
TrustedPaths.getInstance().setProjectPathTrusted(baseDir, true)
|
||||
val project = ProjectManagerEx.getInstanceEx().openProject(baseDir, copy) ?: return null
|
||||
openFileFromCommandLine(project, file, copy.line, copy.column)
|
||||
openFileFromCommandLine(project = project, file = file, line = copy.line, column = copy.column)
|
||||
return project
|
||||
}
|
||||
|
||||
@@ -164,7 +168,7 @@ class PlatformProjectOpenProcessor : ProjectOpenProcessor(), CommandLineProjectO
|
||||
return project
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
@Internal
|
||||
fun doOpenProject(file: Path, originalOptions: OpenProjectTask): Project? {
|
||||
if (Files.isDirectory(file)) {
|
||||
val options = runUnderModalProgressIfIsEdt {
|
||||
@@ -298,17 +302,13 @@ class PlatformProjectOpenProcessor : ProjectOpenProcessor(), CommandLineProjectO
|
||||
}
|
||||
else if (configurator.isEdtRequired) {
|
||||
withContext(Dispatchers.EDT) {
|
||||
blockingContext {
|
||||
SlowOperations.knownIssue("IDEA-319905, EA-808639").use {
|
||||
configurator.configureProject(project, virtualFile, moduleRef, newProject)
|
||||
}
|
||||
SlowOperations.knownIssue("IDEA-319905, EA-808639").use {
|
||||
configurator.configureProject(project, virtualFile, moduleRef, newProject)
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
blockingContext {
|
||||
configurator.configureProject(project, virtualFile, moduleRef, newProject)
|
||||
}
|
||||
configurator.configureProject(project, virtualFile, moduleRef, newProject)
|
||||
}
|
||||
}
|
||||
catch (e: ProcessCanceledException) {
|
||||
@@ -325,8 +325,8 @@ class PlatformProjectOpenProcessor : ProjectOpenProcessor(), CommandLineProjectO
|
||||
return moduleRef.get()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@RequiresEdt
|
||||
@Internal
|
||||
fun attachToProject(project: Project, projectDir: Path, callback: ProjectOpenedCallback?): Boolean {
|
||||
return runWithModalProgressBlocking(project, "") {
|
||||
attachToProjectAsync(projectToClose = project, projectDir = projectDir, callback = callback)
|
||||
@@ -342,7 +342,7 @@ class PlatformProjectOpenProcessor : ProjectOpenProcessor(), CommandLineProjectO
|
||||
*
|
||||
* See `OpenProjectTest`.
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
@Internal
|
||||
@JvmStatic
|
||||
suspend fun createOptionsToOpenDotIdeaOrCreateNewIfNotExists(projectDir: Path, projectToClose: Project?): OpenProjectTask {
|
||||
return OpenProjectTask {
|
||||
@@ -353,7 +353,7 @@ class PlatformProjectOpenProcessor : ProjectOpenProcessor(), CommandLineProjectO
|
||||
}
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
@Internal
|
||||
suspend fun OpenProjectTaskBuilder.configureToOpenDotIdeaOrCreateNewIfNotExists(projectDir: Path, projectToClose: Project?) {
|
||||
runConfigurators = true
|
||||
isNewProject = !ProjectUtil.isValidProjectPath(projectDir)
|
||||
@@ -423,7 +423,9 @@ suspend fun attachToProjectAsync(
|
||||
return attachImpl(processor, projectToClose, projectDir, callback)
|
||||
}
|
||||
for (attachProcessor in ProjectAttachProcessor.EP_NAME.lazySequence()) {
|
||||
if (attachImpl(attachProcessor, projectToClose, projectDir, callback)) return true
|
||||
if (attachImpl(attachProcessor, projectToClose, projectDir, callback)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user