[structure view] force file structure update when editor underneath becomes invalid

- if you focus file structure and close the editor tab, the file editor becomes invalid, but the file structure is not disposed automatically
- this also fixes exceptions caused by work with invalid editor

^KTIJ-34720 fixed

GitOrigin-RevId: 20c201cb53b6bb211d925f0f9cb44ef8bbdcedc8
This commit is contained in:
Anna Kozlova
2025-11-25 18:10:17 +00:00
committed by intellij-monorepo-bot
parent 10911f5139
commit b8942e68ca
@@ -249,8 +249,10 @@ class StructureViewWrapperImpl(
return
}
val dataContext = DataManager.getInstance().getDataContext(owner)
if (WRAPPER_DATA_KEY.getData(dataContext) === this) return
if (CommonDataKeys.PROJECT.getData(dataContext) !== project) return
// do not update view if current structure view is in focus, but proceed if a file was closed
if (WRAPPER_DATA_KEY.getData(dataContext) === this && myFileEditor?.isValid == true) return
val aProject = CommonDataKeys.PROJECT.getData(dataContext)
if (aProject != null && aProject !== project) return
if (insideToolwindow) {
if (myFirstRun) {
setFileFromSelectionHistory()