From 77856944a06e87b94e2891e9dbb1d202e9d54eb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20C=C3=A9bron?= Date: Tue, 10 Dec 2019 14:34:59 +0100 Subject: [PATCH] virtual_file.md/virtual_file_system.md: remove duplication, crosslinks --- basics/architectural_overview/virtual_file.md | 6 ++++-- basics/virtual_file_system.md | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/basics/architectural_overview/virtual_file.md b/basics/architectural_overview/virtual_file.md index 7456a2666..941a8b3f9 100644 --- a/basics/architectural_overview/virtual_file.md +++ b/basics/architectural_overview/virtual_file.md @@ -35,6 +35,8 @@ If you do need to create a file through VFS, you can use the `VirtualFile.create ## How do I get notified when VFS changes? +> **NOTE** See [Virtual file system events](/basics/virtual_file_system.md#virtual-file-system-events) for important details. + Implement the [`BulkFileListener`](upsource:///platform/core-api/src/com/intellij/openapi/vfs/newvfs/BulkFileListener.java) interface and subscribe to the [message bus](/reference_guide/messaging_infrastructure.md) topic `VirtualFileManager.VFS_CHANGES`. For example: ```java @@ -47,9 +49,9 @@ project.getMessageBus().connect().subscribe(VirtualFileManager.VFS_CHANGES, new ``` See [Message Infrastructure](/reference_guide/messaging_infrastructure.md) and [Plugin Listeners](/basics/plugin_structure/plugin_listeners.md) for more details. -For a non-blocking alternative, starting with version 2019.3 of the platform, see [`AsyncFileListener`](upsource:///platform/core-api/src/com/intellij/openapi/vfs/AsyncFileListener.java) +For a non-blocking alternative, starting with version 2019.2 of the platform, see [`AsyncFileListener`](upsource:///platform/core-api/src/com/intellij/openapi/vfs/AsyncFileListener.java) -Plugins targeting versions 2017.2 or older of the platform can use the now deprecated ~`VirtualFileManager.addVirtualFileListener()`~ method which allows you to receive notifications about all changes in the VFS. +Plugins targeting versions 2017.2 or older of the platform can use the now deprecated `VirtualFileManager.addVirtualFileListener()` method which allows you to receive notifications about all changes in the VFS. ## Are there any utilities for analyzing and manipulating virtual files? diff --git a/basics/virtual_file_system.md b/basics/virtual_file_system.md index 806f310ae..0fdeb9316 100644 --- a/basics/virtual_file_system.md +++ b/basics/virtual_file_system.md @@ -57,8 +57,7 @@ All changes happening in the virtual file system, either as a result of refresh The most efficient way to listen to VFS events is to implement the `BulkFileListener` interface and to subscribe with it to the [`VirtualFileManager.VFS_CHANGES`](upsource:///platform/core-api/src/com/intellij/openapi/vfs/VirtualFileManager.java) topic. A non-blocking variant [`AsyncFileListener`](upsource:///platform/core-api/src/com/intellij/openapi/vfs/AsyncFileListener.java) is also available in 2019.2 or later. - -This API gives you all the changes detected during the refresh operation in one list, and lets you process them in batch. Alternatively, you can implement the `VirtualFileListener` interface and register it using [`VirtualFileManager.addVirtualFileListener()`](upsource:///platform/core-api/src/com/intellij/openapi/vfs/VirtualFileManager.java). This will let you process the events one by one. +See [How do I get notified when VFS changes?](/basics/architectural_overview/virtual_file.md#how-do-i-get-notified-when-vfs-changes) for implementation details. > **Note** VFS listeners are application level, and will receive events for changes happening in *all* the projects opened by the user. You may need to filter out events which aren't relevant to your task.