Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
berry::AbstractContributionFactory Class Referenceabstract

#include <berryAbstractContributionFactory.h>

Inheritance diagram for berry::AbstractContributionFactory:
Collaboration diagram for berry::AbstractContributionFactory:

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::TypeInfoGetSuperclasses () 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< SelfPointer
 
typedef berry::SmartPointer< const SelfConstPointer
 
typedef berry::WeakPointer< SelfWeakPtr
 
typedef berry::WeakPointer< const SelfConstWeakPtr
 
- Static Public Member Functions inherited from berry::Object
static const char * GetStaticClassName ()
 
static Reflection::TypeInfo GetStaticTypeInfo ()
 
static QList< Reflection::TypeInfoGetStaticSuperclasses ()
 
- 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
 

Detailed Description

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.

See also
IMenuService
MenuManager
ToolBarManager

Definition at line 68 of file berryAbstractContributionFactory.h.

Constructor & Destructor Documentation

◆ AbstractContributionFactory()

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.

Parameters
locationthe addition location in Menu API URI format. It must not be null.
namespazethe namespace for this contribution. May be null.
See also
GetNamespace

Member Function Documentation

◆ berryObjectMacro()

berry::AbstractContributionFactory::berryObjectMacro ( berry::AbstractContributionFactory  )

◆ CreateContributionItems()

virtual void berry::AbstractContributionFactory::CreateContributionItems ( IServiceLocator serviceLocator,
const SmartPointer< IContributionRoot > &  additions 
)
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.

Parameters
serviceLocatora service locator that may be used in the construction of items created by this factory
additionsA IContributionRoot supplied by the framework. It will never be null.
See also
org.eclipse.ui.menus.CommandContributionItem
org.eclipse.jface.action.MenuManager

◆ GetLocation()

QString berry::AbstractContributionFactory::GetLocation ( ) const

Return the location as a String.

Returns
the location - never null.

◆ GetNamespace()

QString berry::AbstractContributionFactory::GetNamespace ( ) const

Return the namespace for this cache. This corresponds to the plug-in that is contributing this factory.

Returns
the namespace the namespace of this factory

The documentation for this class was generated from the following file: