Medical Imaging Interaction Toolkit  2016.11.0
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
 
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
 

Public Attributes

const QString & namespaze
 

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(IServiceLocator, IContributionRoot) 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 72 of file berryAbstractContributionFactory.h.

Member Function Documentation

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

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.
namespacethe namespace for this contribution. May be null.
See also
#getNamespace()
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
QString berry::AbstractContributionFactory::GetLocation ( ) const

Return the location as a String.

Returns
the location - never null.

Definition at line 28 of file berryAbstractContributionFactory.cpp.

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

Definition at line 33 of file berryAbstractContributionFactory.cpp.

Member Data Documentation

const QString& berry::AbstractContributionFactory::namespaze

Definition at line 96 of file berryAbstractContributionFactory.h.


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