diff --git a/topics/basics/faq.md b/topics/basics/faq.md index 3fa9d53a0..9ce73ebb2 100644 --- a/topics/basics/faq.md +++ b/topics/basics/faq.md @@ -38,11 +38,6 @@ for programmatic registration. * [Can I hook into the file save logic?](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206790685-Can-you-tie-into-the-file-save-logic-) * [How do I control what happens when the user tries to edit such a part?](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206791375-Using-locked-regions) * [How can I show several editors for a single file in tabs?](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206795495-Alternative-Editors-ala-HTML-Preview) -* [Can I open an editor which has no underlying file on disk?](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206135449-Create-an-Editor-for-a-non-physical-file) -* [How do I highlight elements in a source code editor?](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206143909-MarkupModel-navigate-highlighted-elements) -* [How do I allow to navigate between highlighted elements using Find Next?](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206143879-HighlightManager-how-to-enable-F3-functionality) -* [How do I clear the read-only status of a file?](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206142039-Clear-read-only-status) -* [How can I show an editor with error highlighting in a tool window?](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206146679-Error-highlighting-in-Editors) ## General diff --git a/topics/reference_guide/editors.md b/topics/reference_guide/editors.md index ac6e92c87..d64b7348c 100644 --- a/topics/reference_guide/editors.md +++ b/topics/reference_guide/editors.md @@ -18,3 +18,8 @@ Current select editor(s) can be queried from [`FileEditorManager`](%gh-ic%/platf From an [Action's `DataContext`](action_system.md#determining-the-action-context), use [`CommonDataKeys.EDITOR`](%gh-ic%/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/CommonDataKeys.java). For a given PSI Element, use [`PsiEditorUtil.findEditor()`](%gh-ic%/platform/editor-ui-api/src/com/intellij/psi/util/PsiEditorUtil.java) + +### 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 +and open it via [`FileEditorManager.openFile()`](%gh-ic%/platform/analysis-api/src/com/intellij/openapi/fileEditor/FileEditorManager.java).