Re: Platform doesn't load adapters in inactive bundles [message #468351] |
Wed, 05 August 2009 08:13 |
Sascha Zak Messages: 11 Registered: July 2009 |
Junior Member |
|
|
Robert Wilson wrote:
> Thanks - that seems to work.
>
> Less neat than adaptable.getAdapter(), but I suppose we have to make do..
>
As I understood, you have a custom IAdaptable implementation, so you
have to implement the adaptable.getAdapter(Class) method yourself, right?
This is what I did:
public Object getAdapter(Class adapterClass) {
if (adapterClass == null) {
return null;
}
IAdapterManager adapterManager = Platform.getAdapterManager();
if (adapterManager == null) {
return null;
}
// first try to get it the 'default way'
Object adapter = adapterManager.getAdapter(this, adapterClass);
if (adapter != null) {
return adapter;
}
// otherwise try by loading with bundle activation
return adapterManager.loadAdapter(this, adapterClass.getName());
}
This works fine and I always use adaptable.getAdapter()...
|
|
|
Powered by
FUDForum. Page generated in 0.03070 seconds