mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
IJOB-569 Fix 'The editor has been closed' warning in Declaration and Usages lesson
Do not use `editor` property from the runtime context because it can throw an exception (and then warning in the Learn panel) if currently selected editor is null. Because of the platform implementation, selected editor can be null at the moment between switching the editor tabs. (cherry picked from commit dc3afe43eb8be4ff8e7993a0da35093577e2f118) IJ-CR-147744 GitOrigin-RevId: 37571fa1905b762c6e3c8b2d6bad09ce9af6fdbb
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5395d08330
commit
1051f5cabc
@@ -52,7 +52,7 @@ abstract class DeclarationAndUsagesLesson
|
||||
task("GotoDeclaration") { actionId ->
|
||||
text(LessonsBundle.message("declaration.and.usages.show.usages", action(actionId)))
|
||||
stateCheck l@{
|
||||
val curEditor = editor
|
||||
val curEditor = FileEditorManager.getInstance(project).selectedTextEditor ?: return@l false
|
||||
val psiFile = PsiDocumentManager.getInstance(project).getPsiFile(curEditor.document) ?: return@l false
|
||||
val offset = curEditor.caretModel.offset
|
||||
val element = psiFile.findElementAt(offset) ?: return@l false
|
||||
|
||||
Reference in New Issue
Block a user