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.