mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ComponentStore itself uses transactions to commit components and flush on disk (if VFS is used)
This commit is contained in:
@@ -138,7 +138,11 @@ abstract class ComponentStoreImpl : IComponentStore {
|
||||
internal abstract suspend fun doSave(result: SaveResult, isForceSavingAllSettings: Boolean)
|
||||
|
||||
internal suspend fun createSaveSessionManagerAndSaveComponents(saveResult: SaveResult, isForceSavingAllSettings: Boolean): SaveSessionProducerManager {
|
||||
return withContext(AppUIExecutor.onUiThread().coroutineDispatchingContext()) {
|
||||
val uiExecutor = AppUIExecutor.onUiThread()
|
||||
storageManager.componentManager?.let {
|
||||
uiExecutor.inTransaction(it)
|
||||
}
|
||||
return withContext(uiExecutor.coroutineDispatchingContext()) {
|
||||
// todo should we call stopThreadPrioritizing? for some reasons stopThreadPrioritizing was not called by old code in ApplicationImpl/ProjectImpl save
|
||||
// probably because stopThreadPrioritizing is called on start write action (see ApplicationImpl.stopThreadPrioritizing)
|
||||
HeavyProcessLatch.INSTANCE.prioritizeUiActivity()
|
||||
|
||||
@@ -24,7 +24,7 @@ internal class ProjectSaveSessionProducerManager(private val project: Project) :
|
||||
return SaveResult.EMPTY
|
||||
}
|
||||
|
||||
val saveResult = withContext(AppUIExecutor.onUiThread().inUndoTransparentAction().inWriteAction().coroutineDispatchingContext()) {
|
||||
val saveResult = withContext(AppUIExecutor.onUiThread().inTransaction(project).inUndoTransparentAction().inWriteAction().coroutineDispatchingContext()) {
|
||||
val r = SaveResult()
|
||||
saveSessions(extraSessions, r)
|
||||
saveSessions(saveSessions, r)
|
||||
|
||||
@@ -363,7 +363,7 @@ private class ProjectWithModulesStoreImpl(project: Project, pathMacroManager: Pa
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
return withContext(AppUIExecutor.onUiThread().coroutineDispatchingContext()) {
|
||||
return withContext(AppUIExecutor.onUiThread().inTransaction(project).coroutineDispatchingContext()) {
|
||||
// do no create with capacity because very rarely a lot of modules will be modified
|
||||
val saveSessions: MutableList<SaveSession> = SmartList<SaveSession>()
|
||||
// commit components
|
||||
|
||||
@@ -77,9 +77,7 @@ class SaveAndSyncHandlerImpl(private val settings: GeneralSettings) : SaveAndSyn
|
||||
}
|
||||
}
|
||||
else {
|
||||
submitTransaction {
|
||||
doSaveDocumentsAndProjectsAndAppInEdt()
|
||||
}
|
||||
doSaveDocumentsAndProjectsAndAppInEdt()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,13 +177,8 @@ class SaveAndSyncHandlerImpl(private val settings: GeneralSettings) : SaveAndSyn
|
||||
|
||||
override fun refreshOpenFiles() {
|
||||
val files = ArrayList<VirtualFile>()
|
||||
|
||||
for (project in ProjectManager.getInstance().openProjects) {
|
||||
for (file in FileEditorManager.getInstance(project).selectedFiles) {
|
||||
if (file is NewVirtualFile) {
|
||||
files.add(file)
|
||||
}
|
||||
}
|
||||
FileEditorManager.getInstance(project).selectedFiles.filterTo(files) { it is NewVirtualFile }
|
||||
}
|
||||
|
||||
if (!files.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user