CommandProcessor not required for "EditorChange"

GitOrigin-RevId: f6baea5458a2933c2da0d9915e0c59b7834f5f66
This commit is contained in:
Vladimir Krivosheev
2023-05-23 23:24:54 +00:00
committed by intellij-monorepo-bot
parent 4609898b2e
commit 1017264d21
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2023 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.fileEditor.impl
@@ -16,7 +16,6 @@ import com.intellij.openapi.actionSystem.*
import com.intellij.openapi.actionSystem.impl.ActionButton
import com.intellij.openapi.application.EDT
import com.intellij.openapi.application.readAction
import com.intellij.openapi.command.CommandProcessor
import com.intellij.openapi.editor.colors.EditorColorsManager
import com.intellij.openapi.editor.markup.TextAttributes
import com.intellij.openapi.fileEditor.FileEditorManager
@@ -124,8 +123,7 @@ class EditorTabbedContainer internal constructor(private val window: EditorWindo
val oldEditor = if (oldSelection == null) null else window.manager.getSelectedEditor((oldSelection.getObject() as VirtualFile))
oldEditor?.deselectNotify()
val newFile = (newSelection ?: return).getObject() as VirtualFile
val newEditor = newFile.let { window.manager.getSelectedEditor(newFile) }
newEditor?.selectNotify()
window.manager.getSelectedEditor(newFile)?.selectNotify()
if (GeneralSettings.getInstance().isSyncOnFrameActivation) {
VfsUtil.markDirtyAndRefresh(true, false, false, newFile)
}
@@ -135,12 +133,8 @@ class EditorTabbedContainer internal constructor(private val window: EditorWindo
if (window.isDisposed) {
return@setSelectionChangeHandler ActionCallback.DONE
}
val result = ActionCallback()
CommandProcessor.getInstance().executeCommand(project, {
(IdeDocumentHistory.getInstance(project) as IdeDocumentHistoryImpl).onSelectionChanged()
result.notify(doChangeSelection.run())
}, "EditorChange", null)
result
IdeDocumentHistory.getInstance(project).onSelectionChanged()
doChangeSelection.run()
}
editorTabs.presentation.setRequestFocusOnLastFocusedComponent(true)
editorTabs.component.addMouseListener(object : MouseAdapter() {