Create and access a single Preference Component which is common for all projects

Hi Team,

 I have created a settings page in Preference component.. let's say this has a text field. Now i want this to be a global settings means that the settings information is the same for all the projects. 
Is there any way for accomplishing this? Also how to access the stored value outside this preference component?

2
4 comments

Hi, unfortunately current implementation of PreferencesComponentDeclaration is generated to project component, so persistent properties saved per project.
It is planned to be fixed in 2017.3 - MPS-21024

But there is walk around that can help you for now: you can use com.intellij.ide.util.PropertiesComponent to store your values. If you access it's instance by com.intellij.ide.util.PropertiesComponent#getInstance() method without project as parameter, than values will be saved application wide.
You can save string, boolean, int and float values with this component. Use proper id for each value for example with your plugin name as prefix.

You can access this values by id from anywhere else.


3
Avatar
Permanently deleted user

Also @Victor , when you update the preference component, is it possible to allow the user to have spaces in the page name for ex) 'TestPage' as 'Test Page'? Currently we are unable to have spaces in the page name. If spaces are allowed it will be good. 

1
Avatar
Permanently deleted user

Will check it. Thanks for the response Victor :) .

0

Please sign in to leave a comment.