Medical Imaging Interaction Toolkit
2024.06.00
Medical Imaging Interaction Toolkit
|
#include <berryAbstractContributionFactory.h>
Public Member Functions | |
berryObjectMacro (berry::AbstractContributionFactory) | |
AbstractContributionFactory (const QString &location, const QString &namespaze) | |
QString | GetLocation () const |
virtual void | CreateContributionItems (IServiceLocator *serviceLocator, const SmartPointer< IContributionRoot > &additions)=0 |
QString | GetNamespace () const |
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 |
Additional Inherited Members | |
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 |
Static Public Member Functions inherited from berry::Object | |
static const char * | GetStaticClassName () |
static Reflection::TypeInfo | GetStaticTypeInfo () |
static QList< Reflection::TypeInfo > | GetStaticSuperclasses () |
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 |
ContributionFactories are used by the IMenuService to populate ContributionManagers. In CreateContributionItems() you fill in the additions List with IContributionItem to be inserted at this factory's location. For example:
AbstractContributionFactory contributions = new AbstractContributionFactory( "menu:org.eclipse.ui.tests.api.MenuTestHarness?after=additions") { public void CreateContributionItems(IMenuService menuService, List additions) { CommandContributionItem item = new CommandContributionItem( "org.eclipse.ui.tests.menus.helloWorld", "org.eclipse.ui.tests.commands.enabledHelloWorld", null, null, "Say Hello", null); additions.add(item); item = new CommandContributionItem( "org.eclipse.ui.tests.menus.refresh", "org.eclipse.ui.tests.commands.refreshView", null, null, "Refresh", null); menuService.registerVisibleWhen(item, new MyActiveContextExpression( "org.eclipse.ui.tests.myview.context")); additions.add(item); }
public void releaseContributionItems(IMenuService menuService, List items) { // we have nothing to do } }; IMenuService service = (IMenuService) PlatformUI.getWorkbench().getService( IMenuService.class); service.addContributionFactory(contributions);
Only the abstract methods may be implemented.
Definition at line 68 of file berryAbstractContributionFactory.h.
berry::AbstractContributionFactory::AbstractContributionFactory | ( | const QString & | location, |
const QString & | namespaze | ||
) |
The contribution factories must be instantiated with their location, which which specifies the contributions insertion location.
location | the addition location in Menu API URI format. It must not be null . |
namespaze | the namespace for this contribution. May be null . |
berry::AbstractContributionFactory::berryObjectMacro | ( | berry::AbstractContributionFactory | ) |
|
pure virtual |
This factory should create the IContributionItems that it wants to contribute, and add them to the additions list. The menu service will call this method at the appropriate time. It should always return new instances of its contributions in the additions list.
This method is not meant to be called by clients. It will be called by the menu service at the appropriate time.
serviceLocator | a service locator that may be used in the construction of items created by this factory |
additions | A IContributionRoot supplied by the framework. It will never be null . |
QString berry::AbstractContributionFactory::GetLocation | ( | ) | const |
Return the location as a String.
null
. QString berry::AbstractContributionFactory::GetNamespace | ( | ) | const |
Return the namespace for this cache. This corresponds to the plug-in that is contributing this factory.