mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-06 06:21:16 +07:00
[Workspace Model] Cleanup some usages of updateProjectModelSilent
GitOrigin-RevId: df1bf33515354f2331edbec589295d2227d382a7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
340752ce00
commit
d60f57461d
+1
-1
@@ -317,7 +317,7 @@ class ArtifactManagerBridge(private val project: Project) : ArtifactManager(), D
|
||||
|
||||
@RequiresWriteLock
|
||||
fun dropMappings(selector: (ArtifactEntity) -> Boolean) {
|
||||
// XXX @RequiresReadLock annotation doesn't work for kt now
|
||||
// XXX @RequiresWriteLock annotation doesn't work for kt now
|
||||
ApplicationManager.getApplication().assertWriteAccessAllowed()
|
||||
(project.workspaceModel as WorkspaceModelImpl).updateProjectModelSilent("Drop artifact mappings") {
|
||||
val map = it.mutableArtifactsMap
|
||||
|
||||
-10
@@ -1,7 +1,6 @@
|
||||
// Copyright 2000-2020 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.workspaceModel.ide.impl.legacyBridge.facet
|
||||
|
||||
import com.google.common.collect.HashBiMap
|
||||
import com.intellij.facet.*
|
||||
import com.intellij.facet.impl.FacetModelBase
|
||||
import com.intellij.facet.impl.FacetUtil
|
||||
@@ -202,15 +201,6 @@ open class FacetModelBridge(private val moduleBridge: ModuleBridge) : FacetModel
|
||||
return facet
|
||||
}
|
||||
|
||||
fun populateFrom(mapping: HashBiMap<FacetEntity, Facet<*>>) {
|
||||
updateDiffOrStorage {
|
||||
for ((entity, facet) in mapping) {
|
||||
this.addMapping(entity, facet)
|
||||
}
|
||||
}
|
||||
facetsChanged()
|
||||
}
|
||||
|
||||
public override fun facetsChanged() {
|
||||
super.facetsChanged()
|
||||
}
|
||||
|
||||
+5
-5
@@ -140,12 +140,12 @@ class ProjectLibraryTableBridgeImpl(
|
||||
}
|
||||
|
||||
if (targetBuilder == null) {
|
||||
(WorkspaceModel.getInstance(project) as WorkspaceModelImpl).updateProjectModelSilent("Add project library mapping") {
|
||||
for ((entity, library) in libraries) {
|
||||
it.mutableLibraryMap.addIfAbsent(entity, library)
|
||||
}
|
||||
}
|
||||
withContext(Dispatchers.EDT) {
|
||||
(WorkspaceModel.getInstance(project) as WorkspaceModelImpl).updateProjectModelSilent("Add project library mapping") {
|
||||
for ((entity, library) in libraries) {
|
||||
it.mutableLibraryMap.addIfAbsent(entity, library)
|
||||
}
|
||||
}
|
||||
ApplicationManager.getApplication().runWriteAction {
|
||||
for ((_, library) in libraries) {
|
||||
dispatcher.multicaster.afterLibraryAdded(library)
|
||||
|
||||
+3
-12
@@ -8,8 +8,6 @@ import com.intellij.openapi.roots.impl.libraries.LibraryEx
|
||||
import com.intellij.openapi.roots.libraries.Library
|
||||
import com.intellij.openapi.roots.libraries.PersistentLibraryKind
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.workspaceModel.ide.WorkspaceModel
|
||||
import com.intellij.workspaceModel.ide.impl.WorkspaceModelImpl
|
||||
import com.intellij.workspaceModel.ide.impl.legacyBridge.library.LibraryBridgeImpl
|
||||
import com.intellij.workspaceModel.ide.impl.legacyBridge.library.ProjectLibraryTableBridgeImpl.Companion.libraryMap
|
||||
import com.intellij.workspaceModel.ide.impl.legacyBridge.library.ProjectLibraryTableBridgeImpl.Companion.mutableLibraryMap
|
||||
@@ -28,7 +26,7 @@ class ModuleLibraryTableBridgeImpl(private val moduleBridge: ModuleBridge) : Mod
|
||||
Disposer.register(moduleBridge, this)
|
||||
}
|
||||
|
||||
fun registerModuleLibraryInstances(builder: MutableEntityStorage?) {
|
||||
fun registerModuleLibraryInstances(builder: MutableEntityStorage) {
|
||||
libraryEntities().forEach { addLibrary(it, builder) }
|
||||
}
|
||||
|
||||
@@ -55,7 +53,7 @@ class ModuleLibraryTableBridgeImpl(private val moduleBridge: ModuleBridge) : Mod
|
||||
return false
|
||||
}
|
||||
|
||||
fun addLibrary(entity: LibraryEntity, storageBuilder: MutableEntityStorage?): LibraryBridgeImpl {
|
||||
fun addLibrary(entity: LibraryEntity, storageBuilder: MutableEntityStorage): LibraryBridgeImpl {
|
||||
val library = LibraryBridgeImpl(
|
||||
libraryTable = this,
|
||||
project = module.project,
|
||||
@@ -63,14 +61,7 @@ class ModuleLibraryTableBridgeImpl(private val moduleBridge: ModuleBridge) : Mod
|
||||
initialEntityStorage = moduleBridge.entityStorage,
|
||||
targetBuilder = storageBuilder
|
||||
)
|
||||
if (storageBuilder != null) {
|
||||
storageBuilder.mutableLibraryMap.addMapping(entity, library)
|
||||
}
|
||||
else {
|
||||
(WorkspaceModel.getInstance(moduleBridge.project) as WorkspaceModelImpl).updateProjectModelSilent("Add module library mapping") {
|
||||
it.mutableLibraryMap.addMapping(entity, library)
|
||||
}
|
||||
}
|
||||
storageBuilder.mutableLibraryMap.addMapping(entity, library)
|
||||
return library
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user