Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
|
#include <berryIAdapterManager.h>
Public Types | |
typedef berry::IAdapterManager | Self |
typedef berry::SmartPointer< Self > | Pointer |
typedef berry::SmartPointer< const Self > | ConstPointer |
typedef berry::WeakPointer< Self > | WeakPtr |
typedef berry::WeakPointer< const Self > | ConstWeakPtr |
Public Types inherited from berry::Object | |
typedef Object | Self |
typedef berry::SmartPointer< Self > | Pointer |
typedef berry::SmartPointer< const Self > | ConstPointer |
typedef berry::WeakPointer< Self > | WeakPtr |
typedef berry::WeakPointer< const Self > | ConstWeakPtr |
Public Member Functions | |
template<typename A > | |
A * | GetAdapter (const Object *adaptable) |
virtual Object * | GetAdapter (const Object *adaptable, const QString &adapterTypeName)=0 |
virtual bool | HasAdapter (const Object *adaptableType, const QString &adapterType)=0 |
template<typename A > | |
int | QueryAdapter (const Object *adaptable) |
virtual int | QueryAdapter (const Object *adaptableType, const QString &adapterType)=0 |
template<typename A > | |
A * | LoadAdapter (const Object *adaptable) |
virtual void | RegisterAdapters (IAdapterFactory *factory, const QString &adaptableTypeName)=0 |
virtual void | UnregisterAdapters (IAdapterFactory *factory)=0 |
virtual void | UnregisterAdapters (IAdapterFactory *factory, const QString &adaptableTypeName)=0 |
Public Member Functions inherited from berry::Object | |
virtual QString | GetClassName () const |
virtual Reflection::TypeInfo | GetTypeInfo () const |
virtual QList< Reflection::TypeInfo > | GetSuperclasses () const |
virtual void | Delete () |
QDebug | Print (QDebug os, Indent Indent=0) const |
virtual QString | ToString () const |
virtual uint | HashCode () const |
virtual bool | operator< (const Object *) const |
void | Register () const |
void | UnRegister (bool del=true) const |
int | GetReferenceCount () const |
void | SetReferenceCount (int) |
void | AddDestroyListener (const MessageAbstractDelegate<> &delegate) const |
void | RemoveDestroyListener (const MessageAbstractDelegate<> &delegate) const |
virtual bool | operator== (const Object *) const |
Static Public Member Functions | |
static const char * | GetStaticClassName () |
Static Public Member Functions inherited from berry::Object | |
static const char * | GetStaticClassName () |
static Reflection::TypeInfo | GetStaticTypeInfo () |
static QList< Reflection::TypeInfo > | GetStaticSuperclasses () |
Static Public Attributes | |
static const int | NONE |
static const int | NOT_LOADED |
static const int | LOADED |
Additional Inherited Members | |
Protected Member Functions inherited from berry::Object | |
Object () | |
virtual | ~Object () |
virtual QDebug | PrintSelf (QDebug os, Indent indent) const |
virtual QDebug | PrintHeader (QDebug os, Indent indent) const |
virtual QDebug | PrintTrailer (QDebug os, Indent indent) const |
Protected Attributes inherited from berry::Object | |
QAtomicInt | m_ReferenceCount |
QMutex | m_ReferenceCountLock |
An adapter manager maintains a registry of adapter factories. Clients directly invoke methods on an adapter manager to register and unregister adapters. All adaptable objects (that is, objects that implement the IAdaptable
interface) tunnel IAdaptable.getAdapter
invocations to their adapter manager's IAdapterManger.getAdapter
method. The adapter manager then forwards this request unmodified to the IAdapterFactory.getAdapter
method on one of the registered adapter factories.
Adapter factories can be registered programmatically using the registerAdapters
method. Alternatively, they can be registered declaratively using the org.blueberry.core.runtime.adapters
extension point. Factories registered with this extension point will not be able to provide adapters until their corresponding plugin has been activated.
The following code snippet shows how one might register an adapter of type com.example.acme.Sticky
on resources in the workspace.
IAdapterFactory pr = new IAdapterFactory() { public Class[] getAdapterList() { return new Class[] { com.example.acme.Sticky.class }; } public Object getAdapter(Object adaptableObject, Class adapterType) { IResource res = (IResource) adaptableObject; QualifiedName key = new QualifiedName("com.example.acme", "sticky-note"); try { com.example.acme.Sticky v = (com.example.acme.Sticky) res.getSessionProperty(key); if (v == null) { v = new com.example.acme.Sticky(); res.setSessionProperty(key, v); } } catch (CoreException e) { // unable to access session property - ignore } return v; } } Platform.getAdapterManager().registerAdapters(pr, IResource.class);
This interface can be used without OSGi running.
This interface is not intended to be implemented by clients.
Definition at line 84 of file berryIAdapterManager.h.
typedef berry::SmartPointer<const Self> berry::IAdapterManager::ConstPointer |
Definition at line 87 of file berryIAdapterManager.h.
typedef berry::WeakPointer<const Self> berry::IAdapterManager::ConstWeakPtr |
Definition at line 87 of file berryIAdapterManager.h.
Definition at line 87 of file berryIAdapterManager.h.
Definition at line 87 of file berryIAdapterManager.h.
Definition at line 87 of file berryIAdapterManager.h.
|
inline |
Returns a Poco::Any object which contains an instance of the given name associated with the given adaptable. Returns an empty Poco::Any if no such object can be found.
Note that this method will never cause plug-ins to be loaded. If the only suitable factory is not yet loaded, this method will return an empty Poco::Any. If activation of the plug-in providing the factory is required, use the LoadAdapter
method instead.
adaptable | the adaptable object being queried (usually an instance of IAdaptable ) |
adapterTypeName | the fully qualified name of the type of adapter to look up |
Definition at line 125 of file berryIAdapterManager.h.
Referenced by mitk::DataStorageEditorInput::GetAdapter(), and berry::PlatformObject::GetAdapter().
|
pure virtual |
Returns an object which is an instance of the given class name associated with the given object. Returns null
if no such object can be found.
Note that this method will never cause plug-ins to be loaded. If the only suitable factory is not yet loaded, this method will return null
. If activation of the plug-in providing the factory is required, use the loadAdapter
method instead.
adaptable | the adaptable object being queried (usually an instance of IAdaptable ) |
adapterTypeName | the fully qualified name of the type of adapter to look up |
null
if the given adaptable object does not have an available adapter of the given type
|
inlinestatic |
Definition at line 87 of file berryIAdapterManager.h.
|
pure virtual |
Returns whether there is an adapter factory registered that may be able to convert adaptable
to an object of type adapterTypeName
.
Note that a return value of true
does not guarantee that a subsequent call to GetAdapter
with the same arguments will return a non-empty result. If the factory's plug-in has not yet been loaded, or if the factory itself returns nothing, then GetAdapter
will still return an empty Poco::Any.
adaptable | the adaptable object being queried (usually an instance of IAdaptable ) |
adapterTypeName | the fully qualified class name of an adapter to look up |
true
if there is an adapter factory that claims it can convert adaptable
to an object of type adapterType
, and false
otherwise.
|
inline |
Returns an object that is an instance of the given class name associated with the given object. Returns an empty Poco::Any if no such object can be found.
Note that unlike the GetAdapter
methods, this method will cause the plug-in that contributes the adapter factory to be loaded if necessary. As such, this method should be used judiciously, in order to avoid unnecessary plug-in activations. Most clients should avoid activation by using GetAdapter
instead.
adaptable | the adaptable object being queried (usually an instance of IAdaptable ) |
adapterTypeName | the fully qualified name of the type of adapter to look up |
Definition at line 227 of file berryIAdapterManager.h.
|
inline |
Definition at line 178 of file berryIAdapterManager.h.
References BERRY_WARN, and berry::Reflection::GetClassName().
|
pure virtual |
Returns a status of an adapter factory registered that may be able to convert adaptable
to an object of type adapterTypeName
.
One of the following values can be returned:
adaptable | the adaptable object being queried (usually an instance of IAdaptable ) |
adapterTypeName | the fully qualified class name of an adapter to look up |
|
pure virtual |
Registers the given adapter factory as extending objects of the given type.
factory | the adapter factory |
adaptableTypeName | the fully qualified typename being extended |
|
pure virtual |
Removes the given adapter factory completely from the list of registered factories. Equivalent to calling UnregisterAdapters(IAdapterFactory*, const std::string&)
on all classes against which it had been explicitly registered. Does nothing if the given factory is not currently registered.
factory | the adapter factory to remove |
|
pure virtual |
Removes the given adapter factory from the list of factories registered as extending the given class. Does nothing if the given factory and type combination is not registered.
factory | the adapter factory to remove |
adaptableTypeName | one of the type names against which the given factory is registered |
|
static |
This value can be returned to indicate that an adapter factory is loaded.
Definition at line 105 of file berryIAdapterManager.h.
|
static |
This value can be returned to indicate that no applicable adapter factory was found.
Definition at line 92 of file berryIAdapterManager.h.
|
static |
This value can be returned to indicate that an adapter factory was found, but has not been loaded.
Definition at line 99 of file berryIAdapterManager.h.