Need help with custom plugin configuration settings

Hi all,

I apologize if this has been discussed elsewhere, but in the change from version 7 to 8, and in searching through what documentation exists along with the source code for other plugins, I still can't figure out how to do simple configuration.

I need to specify a single file path - one string, pretty simple. For IntelliJ 8, can someone please explain to me the right way to add a panel to the main IntelliJ settings dialog, and then how I'm supposed to persist this configuration setting?

Thank you very much for you help,
Kurt Christensen

3 comments
Comment actions Permalink

Hello Kurt,

I apologize if this has been discussed elsewhere, but in the change
from version 7 to 8, and in searching through what documentation
exists along with the source code for other plugins, I still can't
figure out how to do simple configuration.

I need to specify a single file path - one string, pretty simple. For
IntelliJ 8, can someone please explain to me the right way to add a
panel to the main IntelliJ settings dialog, and then how I'm supposed
to persist this configuration setting?


Very little changed in this aspect between versions 7 and 8 (the preferred
way of doing things has changed, but the old way still works).

The preferred way in version 8 is as follows:
- Define a bean class to store the settings. Implement the PersistentStateComponent
interface. Add the @State annotation describing where the state should be
stored. Implement the getState() method as returning this and the loadState()
method as XmlSerializerUtil.copyBean(state, this). Register this class as
an or extension in plugin.xml. Example: http://svn.jetbrains.org/idea/Trunk/bundled/git4idea/src/git4idea/config/GitVcsSettings.java - Define a class that implements the Configurable interface. Register it as or ]]> extension in plugin.xml.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Excellent! Thanks for the help!

I have just one more follow-up question - how do you implement the actual form that gets plugged into the settings dialog? Previously I had just created a form and returned it from my config class' "createComponent" method, but now it looks like people iplement SettingEditor, or some such...? Any guidance would be helpful.

Thanks,
Kurt Christensen

0
Comment actions Permalink

Hello Kurt,

Excellent! Thanks for the help!

I have just one more follow-up question - how do you implement the
actual form that gets plugged into the settings dialog? Previously I
had just created a form and returned it from my config class'
"createComponent" method, but now it looks like people iplement
SettingEditor, or some such...? Any guidance would be helpful.


The old API, as usual, is still valid. SettingsEditor does some of the stuff
for you that you previously had to do by yourself, but it's not necessary
to use it.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Please sign in to leave a comment.