ApplicationComponent and PersistentStateComponent

Hello,

How is an ApplicationComponent notified that it's state has been loaded ?

My plugin should start an embedded HTTP service, but the port is configurable.
I would like to start the service as soon as the config has been loaded.

Is there a callback that notifies my component that it's settings have been loaded ?

Apparently, when the loaded state is equal to the default state, then the loadState method is not called,
so in that case it doesn't know that it's ready to start working.

And getState is called very often: on each frame deactivation (when I switch from IDEA to another app) ?

The code is here :

http://code.google.com/p/firewood/source/browse/trunk/plugins/idea/JumpToCode/src/com/googlecode/firewood/plugins/intellij/JumpToCode/logic/JumpToCodeApplicationComponent.java

Thanks
Maarten

1 comment
Comment actions Permalink

Hello Maarten,

There is no such callback for PersistentStateComponent. JDOMExternalizable
doesn't have this optimization (readExternal() will be called even if the
state is equal to the default state), so one possible solution is to switch
back to that.

How is an ApplicationComponent notified that it's state has been
loaded ?

My plugin should start an embedded HTTP service, but the port is
configurable. I would like to start the service as soon as the config
has been loaded.

Is there a callback that notifies my component that it's settings have
been loaded ?

Apparently, when the loaded state is equal to the default state, then
the loadState method is not called,

so in that case it doesn't know that it's ready to start working.

And getState is called very often: on each frame deactivation (when I
switch from IDEA to another app) ?

The code is here :

http://code.google.com/p/firewood/source/browse/trunk/plugins/idea/Jum
pToCode/src/com/googlecode/firewood/plugins/intellij/JumpToCode/logic/
JumpToCodeApplicationComponent.java

Thanks
Maarten

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


0

Please sign in to leave a comment.