From a77d8ab0acb42db9e16b30522bf00e60ccd3d6fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20C=C3=A9bron?= Date: Tue, 12 Oct 2021 13:45:06 +0200 Subject: [PATCH] persisting_state_of_components.md: add dummy getInstance() method to code sample for clarification --- topics/basics/persisting_state_of_components.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/topics/basics/persisting_state_of_components.md b/topics/basics/persisting_state_of_components.md index 67490110f..8a96b0fde 100644 --- a/topics/basics/persisting_state_of_components.md +++ b/topics/basics/persisting_state_of_components.md @@ -1,6 +1,6 @@ [//]: # (title: Persisting State of Components) - + The IntelliJ Platform provides an API that allows components or services to persist their state between restarts of the IDE. You can use either a simple API to persist a few values or persist the state of more complicated components using the [`PersistentStateComponent`](upsource:///platform/projectModel-api/src/com/intellij/openapi/components/PersistentStateComponent.java) interface. @@ -42,6 +42,10 @@ In the former case, the state class instance is typically stored as a field in t @State(...) class MyService implements PersistentStateComponent { + public static MyService getInstance() { + // implementation according to Application/Project level service + } + static class State { public String value; } @@ -187,4 +191,4 @@ Components save their state in the following files: * Project-level: project (`.ipr`) file. However, if the workspace option in the `plugin.xml` file is set to `true`, then the workspace (`.iws`) file is used instead. -* Module-level: module (`.iml`) file. \ No newline at end of file +* Module-level: module (`.iml`) file.