diff --git a/ijs.tree b/ijs.tree index 2f501423c..f81ea25e2 100644 --- a/ijs.tree +++ b/ijs.tree @@ -65,7 +65,7 @@ - + diff --git a/reference_guide/api_changes_list_2023.md b/reference_guide/api_changes_list_2023.md index 4f1ca8d53..e9de11005 100644 --- a/reference_guide/api_changes_list_2023.md +++ b/reference_guide/api_changes_list_2023.md @@ -74,7 +74,7 @@ NOTE: Entries not starting with code quotes (`name`) can be added to document no ### IntelliJ Platform 2023.3 Threading Model changes -: Please see updated [](general_threading_rules.md). +: Please see updated [](threading_model.md). Removal of commons-lang2 and commons-collections libraries : _commons-lang2_ library is going to be removed, a temporary compatibility layer (marked with `@Deprecated(forRemoval = true)` to highlight usages) is bundled. diff --git a/topics/appendix/api_notable/api_notable_list_2022.md b/topics/appendix/api_notable/api_notable_list_2022.md index 0bb56b7bb..3fa683098 100644 --- a/topics/appendix/api_notable/api_notable_list_2022.md +++ b/topics/appendix/api_notable/api_notable_list_2022.md @@ -28,7 +28,7 @@ Specifying Threading for Actions : Implementations of `AnAction` need to override `getActionUpdateThread()` as detailed in [](basic_action_system.md#principal-implementation-overrides). Threading assertions in tests -: All rules for [threading](general_threading_rules.md) are now checked in tests as well. +: All rules for [threading](threading_model.md) are now checked in tests as well. Mapping New UI icons : See [](icons.md#new-ui-icons) on how to provide additional icons. diff --git a/topics/appendix/api_notable/api_notable_list_2023.md b/topics/appendix/api_notable/api_notable_list_2023.md index cbfdcda78..762060978 100644 --- a/topics/appendix/api_notable/api_notable_list_2023.md +++ b/topics/appendix/api_notable/api_notable_list_2023.md @@ -13,7 +13,7 @@ _Early Access Program_ (EAP) releases of upcoming versions are available [here]( ### IntelliJ Platform 2023.3 Threading Model changes -: Please see updated [](general_threading_rules.md). +: Please see updated [](threading_model.md). External Annotators in Dumb Mode : [](syntax_highlighting_and_error_highlighting.md#external-annotator) can now run in during indexing. diff --git a/topics/appendix/api_notable/api_notable_list_2024.md b/topics/appendix/api_notable/api_notable_list_2024.md index c2ea4227f..6a38a17eb 100644 --- a/topics/appendix/api_notable/api_notable_list_2024.md +++ b/topics/appendix/api_notable/api_notable_list_2024.md @@ -53,7 +53,7 @@ Cached Values and Dumb Mode : Note change for [](psi_performance.md#projectRootManagerDependency). Saving Settings on background thread -: Saving project/application [settings](settings.md) is no longer performed on [EDT](general_threading_rules.md) to avoid freezes. [Issue](https://youtrack.jetbrains.com/issue/IJPL-127/Save-project-application-settings-on-background-thread) +: Saving project/application [settings](settings.md) is no longer performed on [EDT](threading_model.md) to avoid freezes. [Issue](https://youtrack.jetbrains.com/issue/IJPL-127/Save-project-application-settings-on-background-thread) ### IntelliJ IDEA 2024.1 diff --git a/topics/appendix/glossary.md b/topics/appendix/glossary.md index c1dcf3101..dfcc63bfe 100644 --- a/topics/appendix/glossary.md +++ b/topics/appendix/glossary.md @@ -50,7 +50,7 @@ Document Object Model _(DOM)_ ## E Event Dispatch Thread _(EDT)_ -: The [Event Dispatch Thread](https://docs.oracle.com/javase/tutorial/uiswing/concurrency/dispatch.html) handles all Swing events. See also [](general_threading_rules.md) and [](coroutine_dispatchers.md#edt-dispatcher). +: The [Event Dispatch Thread](https://docs.oracle.com/javase/tutorial/uiswing/concurrency/dispatch.html) handles all Swing events. See also [](threading_model.md) and [](coroutine_dispatchers.md#edt-dispatcher). Extension Point _(EP)_ : Most functionality is provided by [Using Extension Points](plugin_extensions.md) provided by the platform or plugins. Plugins can also [define their own](plugin_extension_points.md) to allow extensibility. @@ -101,7 +101,7 @@ JetBrains Runtime _(JBR)_ ## N Non-Blocking Read Action _(NBRA)_ -: A → _Read Action_ that is canceled by a → _Write Action_. See also [](general_threading_rules.md#read-action-cancellability). +: A → _Read Action_ that is canceled by a → _Write Action_. See also [](threading_model.md#read-action-cancellability). ## P @@ -115,7 +115,7 @@ Program Structure Interface _(PSI)_ ## R Read Action _(RA)_ -: Allows accessing code-related data structures for reading purposes. See also [](general_threading_rules.md). +: Allows accessing code-related data structures for reading purposes. See also [](threading_model.md). → _Non-Blocking Read Action_ → _Write Action_ Run Configuration _(RC)_ @@ -156,7 +156,7 @@ Virtual File System _(VFS)_ ## W Write Action _(WA)_ -: Allows accessing code-related data structures for writing purposes. See also [](general_threading_rules.md). +: Allows accessing code-related data structures for writing purposes. See also [](threading_model.md). → _Read Action_ Write Allowing Read Action _(WARA)_ diff --git a/topics/basics/architectural_overview/background_processes.md b/topics/basics/architectural_overview/background_processes.md index 63b4156c7..b66534274 100644 --- a/topics/basics/architectural_overview/background_processes.md +++ b/topics/basics/architectural_overview/background_processes.md @@ -29,7 +29,7 @@ The key classes are: There are many `ProgressIndicator` implementations and the most commonly used are: - [`EmptyProgressIndicator`](%gh-ic%/platform/core-api/src/com/intellij/openapi/progress/EmptyProgressIndicator.java) – invisible (ignores text/fraction-related methods), used only for cancellation tracking. - Remembers its creation [modality state](general_threading_rules.md#invoking-operations-on-edt-and-modality). + Remembers its creation [modality state](threading_model.md#invoking-operations-on-edt-and-modality). - [`ProgressIndicatorBase`](%gh-ic%/platform/analysis-impl/src/com/intellij/openapi/progress/util/ProgressIndicatorBase.java) – invisible but can be made visible by subclassing. Stores text/fraction and allows retrieving them and possibly show in the UI. Non-modal by default. diff --git a/topics/basics/architectural_overview/coroutines/coroutine_dispatchers.md b/topics/basics/architectural_overview/coroutines/coroutine_dispatchers.md index 467216ab9..d0c3bf2aa 100644 --- a/topics/basics/architectural_overview/coroutines/coroutine_dispatchers.md +++ b/topics/basics/architectural_overview/coroutines/coroutine_dispatchers.md @@ -58,7 +58,7 @@ suspend fun readDataFromFile(): Data { ## EDT Dispatcher The [`Dispatchers.EDT`](%gh-ic%/platform/core-api/src/com/intellij/openapi/application/coroutines.kt) dispatcher is used for executing UI actions on the Swing Event Dispatch Thread. -`Dispatchers.EDT` dispatches onto EDT within the context [modality state](general_threading_rules.md#invoking-operations-on-edt-and-modality). +`Dispatchers.EDT` dispatches onto EDT within the context [modality state](threading_model.md#invoking-operations-on-edt-and-modality). ### `Dispatchers.Main` vs. `Dispatchers.EDT` diff --git a/topics/basics/architectural_overview/coroutines/coroutine_read_actions.topic b/topics/basics/architectural_overview/coroutines/coroutine_read_actions.topic index ec1612592..d5a4843dd 100644 --- a/topics/basics/architectural_overview/coroutines/coroutine_read_actions.topic +++ b/topics/basics/architectural_overview/coroutines/coroutine_read_actions.topic @@ -16,8 +16,8 @@ the Threading section:

-
  • Read-Write Lock
  • -
  • Read Action Cancellability
  • +
  • Read-Write Lock
  • +
  • Read Action Cancellability
  • This section explains running read actions (RA) in coroutines specifically.

    @@ -69,7 +69,7 @@ Application.runReadAction and similar methods (without any prefix/suffix) perform RA blocking WA, whereas RA allowing WA are invoked via - the NonBlockingReadAction API. + the NonBlockingReadAction API.

    Be careful when migrating the code running read actions to coroutines.

    diff --git a/topics/basics/architectural_overview/coroutines/coroutine_tips_and_tricks.md b/topics/basics/architectural_overview/coroutines/coroutine_tips_and_tricks.md index a81db7e7b..8ffe752ee 100644 --- a/topics/basics/architectural_overview/coroutines/coroutine_tips_and_tricks.md +++ b/topics/basics/architectural_overview/coroutines/coroutine_tips_and_tricks.md @@ -145,7 +145,7 @@ suspend fun doSomething() { ## Changing Modality State -Avoid [changing modality state](general_threading_rules.md#invoking-operations-on-edt-and-modality) in the middle of a running coroutine: +Avoid [changing modality state](threading_model.md#invoking-operations-on-edt-and-modality) in the middle of a running coroutine: ```kotlin cs.launch { diff --git a/topics/basics/architectural_overview/documents.md b/topics/basics/architectural_overview/documents.md index d0309c743..cabe2e621 100644 --- a/topics/basics/architectural_overview/documents.md +++ b/topics/basics/architectural_overview/documents.md @@ -48,7 +48,7 @@ To create a `Document` instance that isn't bound to anything, use [`EditorFactor ## What are the rules of working with documents? -The general read/write action rules are in effect (see [](general_threading_rules.md)). +The general read/write action rules are in effect (see [](threading_model.md)). Besides, any operations which modify the contents of the document must be wrapped in a command ([`CommandProcessor.executeCommand()`](%gh-ic%/platform/core-api/src/com/intellij/openapi/command/CommandProcessor.java)). `executeCommand()` calls can be nested, and the outermost `executeCommand()` call is added to the undo stack. If multiple documents are modified within a command, undoing this command will, by default, show a confirmation dialog to the user. diff --git a/topics/basics/architectural_overview/psi_performance.md b/topics/basics/architectural_overview/psi_performance.md index 7fd7cb245..f3aa30eba 100644 --- a/topics/basics/architectural_overview/psi_performance.md +++ b/topics/basics/architectural_overview/psi_performance.md @@ -4,7 +4,7 @@ Performance tips on working with PSI. -See also [](general_threading_rules.md#avoiding-ui-freezes) and [](indexing_and_psi_stubs.md#improving-indexing-performance). +See also [](threading_model.md#avoiding-ui-freezes) and [](indexing_and_psi_stubs.md#improving-indexing-performance). > [IDE Perf](https://plugins.jetbrains.com/plugin/15104-ide-perf) plugin provides on-the-fly performance diagnostic tools, including a dedicated view for [`CachedValue`](#cache-results-of-heavy-computations) metrics. diff --git a/topics/basics/architectural_overview/general_threading_rules.md b/topics/basics/architectural_overview/threading_model.md similarity index 100% rename from topics/basics/architectural_overview/general_threading_rules.md rename to topics/basics/architectural_overview/threading_model.md diff --git a/topics/basics/basic_action_system.md b/topics/basics/basic_action_system.md index 8ccb81418..9d36866e7 100644 --- a/topics/basics/basic_action_system.md +++ b/topics/basics/basic_action_system.md @@ -55,7 +55,7 @@ As explained in [Overriding the `AnAction.update()` Method](#overriding-the-ana `AnAction.getActionUpdateThread()` returns an [`ActionUpdateThread`](%gh-ic%/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/ActionUpdateThread.java), -which specifies if the `update()` method is called on a [background thread (BGT) or the event-dispatching thread (EDT)](general_threading_rules.md). +which specifies if the `update()` method is called on a [background thread (BGT) or the event-dispatching thread (EDT)](threading_model.md). The preferred method is to run the update on the BGT, which has the advantage of guaranteeing application-wide read access to [PSI](psi.md), [the virtual file system](virtual_file_system.md) (VFS), or [project models](project_structure.md). Actions that run the update session on the BGT should not access the Swing component hierarchy directly. diff --git a/topics/basics/plugin_structure/plugin_components.md b/topics/basics/plugin_structure/plugin_components.md index d3db70da8..22906c36e 100644 --- a/topics/basics/plugin_structure/plugin_components.md +++ b/topics/basics/plugin_structure/plugin_components.md @@ -66,7 +66,7 @@ Implement `DumbAware` to indicate activity can run in background thread (in para : [`StartupActivity.Background`](%gh-ic%/platform/core-api/src/com/intellij/openapi/startup/StartupActivity.kt) for execution with a 5-second delay in background thread (2019.3 or later). Any long-running or CPU intensive tasks should be made visible to users by using `ProgressManager.run(Task.Backgroundable)`. -Access to indexes must be wrapped with [`DumbService`](indexing_and_psi_stubs.md#dumb-mode), see also [General Threading Rules](general_threading_rules.md). +Access to indexes must be wrapped with [`DumbService`](indexing_and_psi_stubs.md#dumb-mode), see also [General Threading Rules](threading_model.md). See also [](ide_infrastructure.md#running-tasks-once). diff --git a/topics/basics/plugin_structure/plugin_services.md b/topics/basics/plugin_structure/plugin_services.md index ee6953408..2afcf0be2 100644 --- a/topics/basics/plugin_structure/plugin_services.md +++ b/topics/basics/plugin_structure/plugin_services.md @@ -282,7 +282,7 @@ Registration in plugin.xml: {style="warning" title="Correct Service Retrieval"} Getting a service doesn't need a read action and can be performed from any thread. -If a service is requested from several [threads](general_threading_rules.md), it will be initialized in the first thread, and other threads will be blocked until it is fully initialized. +If a service is requested from several [threads](threading_model.md), it will be initialized in the first thread, and other threads will be blocked until it is fully initialized. diff --git a/topics/basics/plugin_user_experience.md b/topics/basics/plugin_user_experience.md index 1fd68a3d6..3ec9e84ef 100644 --- a/topics/basics/plugin_user_experience.md +++ b/topics/basics/plugin_user_experience.md @@ -51,7 +51,7 @@ To reproduce and understand problems in production, use [logging](ide_infrastruc Even if a plugin works correctly and looks pleasing, poor performance will impact user satisfaction. Slow highlighting, code completion, code generation, and other features may break the user's workflow and cause frustration leading to plugin uninstallation. -Always try to follow the performance tips described on the relevant topic pages, e.g., [](psi_performance.md), [](general_threading_rules.md#avoiding-ui-freezes), [](indexing_and_psi_stubs.md#improving-indexing-performance). +Always try to follow the performance tips described on the relevant topic pages, e.g., [](psi_performance.md), [](threading_model.md#avoiding-ui-freezes), [](indexing_and_psi_stubs.md#improving-indexing-performance). Making as much functionality as possible working during [dumb mode](indexing_and_psi_stubs.md#dumb-mode) can also improve perceived performance. diff --git a/topics/basics/virtual_file_system.md b/topics/basics/virtual_file_system.md index 5f265294e..68414ffb6 100644 --- a/topics/basics/virtual_file_system.md +++ b/topics/basics/virtual_file_system.md @@ -68,7 +68,7 @@ The synchronous flag simply means that the calling thread will be blocked until Both synchronous and asynchronous refreshes can be initiated from any thread. If a refresh is initiated from a background thread, the calling thread must not hold a read action, because otherwise, a deadlock would occur. -See [IntelliJ Platform Architectural Overview](general_threading_rules.md) for more details on the threading model and read/write actions. +See [IntelliJ Platform Architectural Overview](threading_model.md) for more details on the threading model and read/write actions. The same threading requirements also apply to functions like [`LocalFileSystem.refreshAndFindFileByPath()`](%gh-ic%/platform/analysis-api/src/com/intellij/openapi/vfs/LocalFileSystem.java), which perform a partial refresh if the file with the specified path is not found in the snapshot. @@ -78,7 +78,7 @@ If there is some code that needs to be executed after the refresh is complete, t * [`RefreshQueue.createSession()`](%gh-ic%/platform/analysis-api/src/com/intellij/openapi/vfs/newvfs/RefreshQueue.java) * [`VirtualFile.refresh()`](%gh-ic%/platform/core-api/src/com/intellij/openapi/vfs/VirtualFile.java) -In some cases, synchronous refreshes can cause deadlocks, depending on which [locks](general_threading_rules.md#readers-writer-lock) are held by the thread invoking the refresh operation. +In some cases, synchronous refreshes can cause deadlocks, depending on which [locks](threading_model.md#readers-writer-lock) are held by the thread invoking the refresh operation. ## Virtual File System Events diff --git a/topics/intro/content_updates.md b/topics/intro/content_updates.md index 590591aef..78c1cc532 100644 --- a/topics/intro/content_updates.md +++ b/topics/intro/content_updates.md @@ -17,7 +17,7 @@ See [GitHub Changelog](https://github.com/JetBrains/intellij-sdk-docs/commits/ma Threading Model : -Revamp the [Threading Model](general_threading_rules.md) page (formerly _General Threading Rules_) and add a new page describing [background processes](background_processes.md), including cancellation and progress tracking. +Revamp the [Threading Model](threading_model.md) page (formerly _General Threading Rules_) and add a new page describing [background processes](background_processes.md), including cancellation and progress tracking. ### June {june-24} @@ -105,7 +105,7 @@ Inlay Hints : Update [](inlay_hints.md) page with the information about new APIs. Threading Model -: Update [](general_threading_rules.md) to reflect changes in 2023.3 platform. +: Update [](threading_model.md) to reflect changes in 2023.3 platform. Minor Changes and Additions : @@ -461,7 +461,7 @@ Plugin Repository moved {#july-19} New page: Optimizing Performance -: Optimizing performance when [working with PSI](psi_performance.md), [during indexing](indexing_and_psi_stubs.md#improving-indexing-performance), and [](general_threading_rules.md#avoiding-ui-freezes). +: Optimizing performance when [working with PSI](psi_performance.md), [during indexing](indexing_and_psi_stubs.md#improving-indexing-performance), and [](threading_model.md#avoiding-ui-freezes). ### May {#may-19} diff --git a/topics/platform/fundamentals.md b/topics/platform/fundamentals.md index 93fa7c1a8..ee06bd222 100644 --- a/topics/platform/fundamentals.md +++ b/topics/platform/fundamentals.md @@ -8,5 +8,5 @@ This section describes the low-level fundamental building blocks of the IntelliJ * The component model - how the application is hosted and composed. Lifetime and dependency management. * [Disposers](disposers.md) - managing object lifetimes and resource cleanup -* [Threading models](general_threading_rules.md) +* [Threading models](threading_model.md) * [Messaging](messaging_infrastructure.md) diff --git a/topics/reference_guide/custom_language_support/additional_minor_features.md b/topics/reference_guide/custom_language_support/additional_minor_features.md index 5ac5b7810..4823c80ae 100644 --- a/topics/reference_guide/custom_language_support/additional_minor_features.md +++ b/topics/reference_guide/custom_language_support/additional_minor_features.md @@ -33,7 +33,7 @@ See also [](#recognizing-complex-multi-block-expressions). #### "Heavy" Brace Matching -If the brace matching is "too heavy" and should not be executed in [EDT](general_threading_rules.md), implement +If the brace matching is "too heavy" and should not be executed in [EDT](threading_model.md), implement [`HeavyBraceHighlighter`](%gh-ic%/platform/lang-impl/src/com/intellij/codeInsight/highlighting/HeavyBraceHighlighter.java) and register in `com.intellij.heavyBracesHighlighter` extension point. diff --git a/topics/reference_guide/custom_language_support/symbols.md b/topics/reference_guide/custom_language_support/symbols.md index bb01c302f..1952690c1 100644 --- a/topics/reference_guide/custom_language_support/symbols.md +++ b/topics/reference_guide/custom_language_support/symbols.md @@ -32,7 +32,7 @@ See also [](websymbols.md). ## Lifecycle -The `Symbol` instance is expected to stay valid within a single [read action](general_threading_rules.md), which means it's safe to pass the instance to different APIs. +The `Symbol` instance is expected to stay valid within a single [read action](threading_model.md), which means it's safe to pass the instance to different APIs. A `Symbol` instance should not be referenced between read actions. One should create a pointer via `Symbol.createPointer()` in the current read action, and then call `Pointer.dereference()` to obtain a `Symbol` instance in the subsequent read action. diff --git a/topics/reference_guide/jcef.md b/topics/reference_guide/jcef.md index 4f25869c2..f132b548e 100644 --- a/topics/reference_guide/jcef.md +++ b/topics/reference_guide/jcef.md @@ -102,7 +102,7 @@ myPanel.add(browser.getComponent()); #### Loading Documents To load a document in the browser, use one of [`JBCefBrowserBase.load*()`](%gh-ic%/platform/platform-api/src/com/intellij/ui/jcef/JBCefBrowserBase.java) methods. -Methods loading documents can be called from both [EDT and background threads](general_threading_rules.md). +Methods loading documents can be called from both [EDT and background threads](threading_model.md). It is possible to set an initial URL (passed to constructor or builder) that will be loaded when browser is created and initialized. ### Browser Client diff --git a/topics/reference_guide/project_model/library.md b/topics/reference_guide/project_model/library.md index 22df44895..52bd7acf0 100644 --- a/topics/reference_guide/project_model/library.md +++ b/topics/reference_guide/project_model/library.md @@ -66,7 +66,7 @@ Messages.showInfoMessage(roots.toString(), "Library Info"); ### Creating a Library To create a library, perform the following steps: - * Get a [write action](general_threading_rules.md#write-actions) + * Get a [write action](threading_model.md#write-actions) * Obtain the library table to which you want to add the library. Use one of the following, depending on the library level: * `LibraryTablesRegistrar.getInstance().getLibraryTable()` * `LibraryTablesRegistrar.getInstance().getLibraryTable(Project)` @@ -80,13 +80,13 @@ You can find an example of using these APIs in the [project_model](%gh-sdk-sampl ### Adding Contents or Modifying a Library To add or change the roots of a library, you need to perform the following steps: - * Get a [write action](general_threading_rules.md#write-actions) + * Get a [write action](threading_model.md#write-actions) * Get a **modifiable model** for the library, using `Library.getModifiableModel()` * Use methods such as `Library.ModifiableModel.addRoot()` to perform the necessary changes * Commit the model using `Library.ModifiableModel.commit()`. ### Adding a Library Dependency to a Module -Use `ModuleRootModificationUtil.addDependency(Module, Library)` from under a [write action](general_threading_rules.md#write-actions). +Use `ModuleRootModificationUtil.addDependency(Module, Library)` from under a [write action](threading_model.md#write-actions). ### Checking Belonging to a Library The [`ProjectFileIndex`](%gh-ic%/platform/projectModel-api/src/com/intellij/openapi/roots/ProjectFileIndex.java) interface implements a number of methods you can use to check whether the specified file belongs to the project library classes or library sources. diff --git a/topics/reference_guide/project_model/project.md b/topics/reference_guide/project_model/project.md index 16b5a9a71..3be9a0205 100644 --- a/topics/reference_guide/project_model/project.md +++ b/topics/reference_guide/project_model/project.md @@ -109,7 +109,7 @@ See [SDK](sdk.md) for more details. Utility classes used for modifying the project structure can be found in the package [`projectModel-impl.openapi`](%gh-ic%/platform/projectModel-impl/src/com/intellij/openapi). Its [`roots`](%gh-ic%/platform/projectModel-impl/src/com/intellij/openapi/roots) subpackage contains instances and utilities intended for work with project and module source roots, including [`ModuleRootModificationUtil`](%gh-ic%/platform/projectModel-api/src/com/intellij/openapi/roots/ModuleRootModificationUtil.java) and [`ProjectRootUtil`](%gh-ic%/platform/projectModel-impl/src/com/intellij/openapi/projectRoots/impl/ProjectRootUtil.java). -Project structure changes need to be performed in [write action](general_threading_rules.md#write-actions). +Project structure changes need to be performed in [write action](threading_model.md#write-actions). Refer to the [project_model](%gh-sdk-samples-master%/project_model/src/main/java/org/intellij/sdk/project/model/ModificationAction.java) code sample to learn how project structure modification can be implemented. diff --git a/topics/tutorials/code_intentions_preview.md b/topics/tutorials/code_intentions_preview.md index 7fec63ddb..378866146 100644 --- a/topics/tutorials/code_intentions_preview.md +++ b/topics/tutorials/code_intentions_preview.md @@ -164,7 +164,7 @@ If the above does not show a preview, there could be further problems of the fol Example: [`DeleteMultiCatchFix.getFileModifierForPreview()`](%gh-ic%/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/DeleteMultiCatchFix.java) Be careful, as there could be subclasses. Better play safe and declare your action/fix class as final. 3. `invoke()`/`applyFix()` starts a write action. If `startsInWriteAction()` returns `true`, then this is unnecessary, and you can remove the write action. -4. `invoke()`/`applyFix()` asserts (directly or indirectly) that it is invoked in the dispatch thread or inside a write action (see also [](general_threading_rules.md)). +4. `invoke()`/`applyFix()` asserts (directly or indirectly) that it is invoked in the dispatch thread or inside a write action (see also [](threading_model.md)). The preview is applied in a background thread without a write action as it works on non-physical elements. You may consider removing these assertions or keeping them only if the preview is not active (use `IntentionPreviewUtils.isIntentionPreviewActive()`). 5. `PsiDocumentManager.getDocument(psiFile)` is used which isn't supported for a non-physical `psiFile`. diff --git a/topics/tutorials/editor_basics.md b/topics/tutorials/editor_basics.md index 7767271d8..8feb3b146 100644 --- a/topics/tutorials/editor_basics.md +++ b/topics/tutorials/editor_basics.md @@ -23,4 +23,4 @@ The following are referenced in the tutorial: **Related topics:** * [](basic_action_system.md) -* [](general_threading_rules.md) +* [](threading_model.md) diff --git a/topics/tutorials/editor_basics/working_with_text.md b/topics/tutorials/editor_basics/working_with_text.md index 04d8169dc..4e967e07e 100644 --- a/topics/tutorials/editor_basics/working_with_text.md +++ b/topics/tutorials/editor_basics/working_with_text.md @@ -119,7 +119,7 @@ Selection information is measured in terms of [Offset](coordinates_system.md#car Text replacement could be done by calling the `Document` object's `replaceString()` method. However, safely replacing the text requires the `Document` to be locked and any changes performed in a write action. -See the [Threading Issues](general_threading_rules.md) section to learn more about synchronization issues and changes safety on the IntelliJ Platform. +See the [Threading Issues](threading_model.md) section to learn more about synchronization issues and changes safety on the IntelliJ Platform. This example changes the document within a [`WriteCommandAction`](%gh-ic%/platform/core-api/src/com/intellij/openapi/command/WriteCommandAction.java). The complete `EditorIllustrationAction.actionPerformed()` method is shown below: diff --git a/topics/user_interface_components/tool_windows.md b/topics/user_interface_components/tool_windows.md index def7bd689..73a2da715 100644 --- a/topics/user_interface_components/tool_windows.md +++ b/topics/user_interface_components/tool_windows.md @@ -76,7 +76,7 @@ To show and hide a tool window dynamically while the user is working with the pr For toolwindows shown only after invoking specific actions, use [`ToolWindowManager.registerToolWindow(String,RegisterToolWindowTaskBuilder)`](%gh-ic%/platform/platform-api/src/com/intellij/openapi/wm/ToolWindowManager.kt). -Always use [`ToolWindowManager.invokeLater()`](%gh-ic%/platform/platform-api/src/com/intellij/openapi/wm/ToolWindowManager.kt) instead of "plain" `Application.invokeLater()` when scheduling EDT tasks related to tool windows (see [](general_threading_rules.md)). +Always use [`ToolWindowManager.invokeLater()`](%gh-ic%/platform/platform-api/src/com/intellij/openapi/wm/ToolWindowManager.kt) instead of "plain" `Application.invokeLater()` when scheduling EDT tasks related to tool windows (see [](threading_model.md)). ## Contents (Tabs)