|
|
|
Re: RCP: Cannot inject invisible parts [message #1002001 is a reply to message #1001976] |
Thu, 17 January 2013 17:31 |
|
The framework takes care of it. @Creatable is for resources not in the context *AND* not referenced in the running model. Your part class is referenced in your MPart from the running model. The framework automatically creates it for you.
|
|
|
|
Re: RCP: Cannot inject invisible parts [message #1002366 is a reply to message #1002359] |
Fri, 18 January 2013 13:23 |
Eclipse User |
|
|
|
MParts usually are created by the framework (renderer). The creation involves instantiating the contribution object (the URI class), constructing the runtime representation of MPart and putting it to the context. This creation follows the lazy loading approach in that only parts that are visible are created, otherwise Eclipse would start in 10 minutes if it had to instantiate each and every view in the model (which is an MPart). So it creates only what is visible.
The 'one time visible' situation may happen because when you try to force the creation through @Creatable the contribution object is not created. Usually it is not a good idea to force the creation of parts when they are not visible yet, though it depends on the case. If you want to do some form of processing on the part you can register a listener (IEventBroker) on part creation and do your stuff there, and let the renderer (LazyStackRenderer) decide when to instantiate the part.
That said, @Creatable is used to do a CIF.make on a class and @Singleton is used to prevent multiple instances in a given scope.
|
|
|
|
Powered by
FUDForum. Page generated in 0.02926 seconds