From 25ce1b59afd9fe5bacefb03473f7addab0f5bea1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20C=C3=A9bron?= Date: Wed, 14 May 2025 11:01:36 +0200 Subject: [PATCH] editors.md: editor events --- topics/reference_guide/editors.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/topics/reference_guide/editors.md b/topics/reference_guide/editors.md index d64b7348c..86b9e33b5 100644 --- a/topics/reference_guide/editors.md +++ b/topics/reference_guide/editors.md @@ -1,10 +1,11 @@ - + # Editors The Editors section overview. -This section covers working with text in the IntelliJ Platform editor. +This section covers working with text in the IntelliJ Platform editor: + * [](editor_basics.md) * [](text_selection.md) * [](multiple_carets.md) @@ -19,6 +20,12 @@ From an [Action's `DataContext`](action_system.md#determining-the-action-context For a given PSI Element, use [`PsiEditorUtil.findEditor()`](%gh-ic%/platform/editor-ui-api/src/com/intellij/psi/util/PsiEditorUtil.java) +### How can I be notified about editor events? + +Use project-level listener [`FileEditorManagerListener`](%gh-ic%/platform/analysis-api/src/com/intellij/openapi/fileEditor/FileEditorManagerListener.java) +or [`FileEditorManagerListener$Before`](%gh-ic%/platform/analysis-api/src/com/intellij/openapi/fileEditor/FileEditorManagerListener.java) +to be notified about all file open/closed/selection changed events. + ### How do I open an text editor for a "fake" file? Create a [`LightVirtualFile`](%gh-ic%/platform/core-api/src/com/intellij/testFramework/LightVirtualFile.java) with the contents