[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.platform] Re: IAdapterFactory vs. adapters extension
|
Hi Martin
IAdapterFactory and its extension org.eclipse.core.runtime.adapters allow other people to
extend you UI model. They can attach transparently some additional interfaces (i.e.
implementations of those interfaces) to you model.
Look at FAQ 126 Official Eclipse 3.0 FAQs (How do I use IAdaptable and IAdapterFactory?).
It exaclty answers your question.
I think the classical example would be to use:
1. Inherit you UI model from PlatformObject (or implement IAdaptable through look up with
IAdapterFactory)
2. Provide IWorkbenchAdapter (IWorkbenchAdapter2) using extension point
(org.eclipse.core.runtime.adapters) (at the package org.eclipse.ui.model you will find
some base and ready to use classes)
3. Now you can use (or inherit) WorkbenchLabelProvider, BaseWorkbenchContentProvider,
WorkbenchViewerSorter to display for example using TreeViewer you model. You model does
not have any UI code.
And other way somebody could display your object even know nothing about your UI model
interfaces.
---------------------------------------------
This case is described in FAQ 177 (The Official Eclipse 3.0 FAQs):
---------------------------------------------
Another example: you can attach implementation of your interfaces from your plug-in to
existing Models of another plug-in. A lot of extension points support object filters with
adaptable=true/false parameter. That is a hook to you attached implementations.
I hope it gives you a hit where to read more about it
- best regards
Ram
martin wrote:
Hi,
can anyone explain to me why one has to implement IAdapterFactory with
its method getAdapterList AND additionally specify all adapter types in
plugin.xml when using the org.eclipse.core.runtime.adapters extension?
Seems kind of redundant to me...
Regards,
M