Project wise settings with PersistentStateComponent
Answered
Hi, I need to save settings separately for every project.
I tried various combinations of annotations, but all the time settings are visible to all projects.
How to save settings for every project separately? Thanks
Example code:
@State(name = "Yii2Support", storages = {@Storage()})
public class Yii2SupportSettings implements ApplicationComponent, PersistentStateComponent<Yii2SupportSettings> {
}
Please sign in to leave a comment.
I'm having the exact same problem. I am trying to persist some data from a plugin on a per-project basis.
I started my IDE in plugin test mode, opened a project, it loads my persisted data just fine. I open a new window, from the same instance as the debugged IDE (so the other project window also have my plugin) and try to read the persisted state and getting the same data that was saved in the other window.
I tried debugging and put a breakpoint where I return the object in getInstance() and both windows have different instances of the PersistentStateComponent. I don't understand how the data gets crossed like that.
Is there a way to save that state to be "sandboxed" to that workspace? Anyway, here's my code:
Simon, please create new threads and provide full sources of your plugin as there could be various factors contributing to such behavior. Thanks.