| Mechanism to provide IAdapterFactory for classes, not instances? [message #988488] |
Fri, 30 November 2012 03:23  |
Alex Kipling Messages: 212 Registered: July 2012 |
Senior Member |
|
|
I am using Eclipse's IAdapterFactory - IAdapterManager mechanism to provide some decentral Adapters for custom classes.
Now the IAdapterFactory is usually retrieved by doing.
Platform.getAdapterManager().getAdapter(OBJECT adaptable, class adapterType);
This mechanism is great, but unfortunatly requires an INSTANCE of an adaptable Object, to retrieve a fitting adapter.
Sometimes, e.g. when doing some preparations for displaying Objects - I do not have any instances of adoptable objects yet. i only know the objects class I whant to display.
Question:
Is there such a mechanism in Eclipse, which would allow to register an IAdapterFactory for CLASSES (not instances) ?
So that one could do:
Platform.getAdapterManager().getAdapter(CLASS adaptable, class adapterType);
|
|
|
| Re: Mechanism to provide IAdapterFactory for classes, not instances? [message #988490 is a reply to message #988488] |
Fri, 30 November 2012 03:44   |
Dirk Fauth Messages: 525 Registered: July 2012 |
Senior Member |
|
|
First of all I would suggest to use org.eclipse.e4.core.services.Adapter service instead of retrieving it via Platform singleton. Unless you are planning to create an Eclipse 3.x application.
Second, IMO an adapter is some kind of wrapper to an existing object. So it doesn't make sense to retrieve an adapter for a class, because it couldn't wrap anything. So you would need some other mechanism to retrieve what you are looking for, but it's not the adapter pattern.
[Updated on: Fri, 30 November 2012 03:45] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01874 seconds