|
Re: Sharing application context between views (and eventually plug-ins) [message #447982 is a reply to message #447979] |
Tue, 18 April 2006 16:31 |
|
Hi.
<philosophy>I wouldn't worry about it so much. Within your plugin, your
"application context" will be as much or as little of a god class as you
give it functionality to be. Outside of it's own functionality, you are
writing your plugin so don't ask for the application context if you
don't need it. Outside of your plugin you can place access restrictions
so that other plugins can't see the class.</philosophy>
The short answer is that your views will only ever have the no-argument
constructor.
But there are ways to specify a String property to your view creation
extension, that will end up in your view part in the call to
setInitializationData(*). Check out IExecutableExtension for a
description of how it is used.
example: Your view is instantiated. Your view get's its
setInitializationData(*) method called (you must extend it). The String
is the name of your application context factory class.
Your view now goes to the factory to request an application context.
The setInitializationData(*) is the step needed to defer any
"view-needed" constructor data. You can never actually get at the
constructor, because you'll be no where near the view when it's actually
constructed due to the support for lazy plugin activation and deferred
view activation.
Later,
PW
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
|
|
|
Powered by
FUDForum. Page generated in 0.02641 seconds