Activator class - newbie question [message #459668] |
Wed, 06 December 2006 02:53  |
Eclipse User |
|
|
|
Originally posted by: guefeld.spammerslammer.com
Hello NG,
Is it a wise decision to let reside references to application global data in
the application's Activator class?
Or is it better to have separate singleton objects for this purpose?
For example configuration data, database connections, data to be shared
between Editor and View class descendants...
I am quite new to RCP and Java programming.
Thank you for your advice
G
|
|
|
Re: Activator class - newbie question [message #459678 is a reply to message #459668] |
Wed, 06 December 2006 07:27  |
Eclipse User |
|
|
|
If you are using singletons, then a common pattern in eclipse is to
provide them through your Activator. i.e. DatabaseConnectionManager,
ContextManager, ConfigurationManager.
The common pattern is to get your Activator instance and lazily
instantiate the singletons as you need them.
MyPlugin.getDefault().getContextManager()
For sharing data between views and editors, there are actually a couple
of options. The Selection Service is one common method. Also having a
view register an IPartListener2 and checking for your specific type of
editors as they are activated (that's how the Outline View works).
But your singleton DocumentProvider could live in your plugin instance.
Later,
PW
|
|
|
Powered by
FUDForum. Page generated in 0.02348 seconds