Medical Imaging Interaction Toolkit  2023.04.00
Medical Imaging Interaction Toolkit
berry::ICommandService Struct Referenceabstract

#include <berryICommandService.h>

Inheritance diagram for berry::ICommandService:
Collaboration diagram for berry::ICommandService:

Public Member Functions

 berryObjectMacro (berry::ICommandService)
 
virtual void AddExecutionListener (IExecutionListener *listener)=0
 
virtual void DefineUncategorizedCategory (const QString &name, const QString &description)=0
 
virtual SmartPointer< ParameterizedCommandDeserialize (const QString &serializedParameterizedCommand) const =0
 
virtual SmartPointer< CommandCategoryGetCategory (const QString &categoryId) const =0
 
virtual SmartPointer< CommandGetCommand (const QString &commandId) const =0
 
virtual QList< SmartPointer< CommandCategory > > GetDefinedCategories () const =0
 
virtual QStringList GetDefinedCategoryIds () const =0
 
virtual QStringList GetDefinedCommandIds () const =0
 
virtual QList< SmartPointer< Command > > GetDefinedCommands () const =0
 
virtual QStringList GetDefinedParameterTypeIds () const =0
 
virtual QList< SmartPointer< ParameterType > > GetDefinedParameterTypes () const =0
 
virtual QString GetHelpContextId (const SmartPointer< const Command > &command) const =0
 
virtual QString GetHelpContextId (const QString &commandId) const =0
 
virtual SmartPointer< ParameterTypeGetParameterType (const QString &parameterTypeId) const =0
 
virtual void ReadRegistry ()=0
 
virtual void RemoveExecutionListener (IExecutionListener *listener)=0
 
virtual void SetHelpContextId (const SmartPointer< IHandler > &handler, const QString &helpContextId)=0
 
virtual SmartPointer< IElementReferenceRegisterElementForCommand (const SmartPointer< ParameterizedCommand > &command, const SmartPointer< UIElement > &element)=0
 
virtual void RegisterElement (const SmartPointer< IElementReference > &elementReference)=0
 
virtual void UnregisterElement (const SmartPointer< IElementReference > &elementReference)=0
 
virtual void RefreshElements (const QString &commandId, const QHash< QString, Object::Pointer > &filter)=0
 
- Public Member Functions inherited from berry::IDisposable
 berryObjectMacro (berry::IDisposable)
 
 ~IDisposable () override
 
virtual void Dispose ()=0
 
- 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
 

Static Public Member Functions

static const QString AUTOGENERATED_CATEGORY_ID ()
 
- Static Public Member Functions inherited from berry::Object
static const char * GetStaticClassName ()
 
static Reflection::TypeInfo GetStaticTypeInfo ()
 
static QList< Reflection::TypeInfoGetStaticSuperclasses ()
 

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
 
- 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

Provides services related to the command architecture within the workbench. This service can be used to access the set of commands and command categories.

This service can be acquired from your service locator:

 ICommandService service = (ICommandService) getSite().getService(ICommandService.class);
  • This service is available globally.
Note
This interface is not intended to be implemented by clients.
This interface is not intended to be extended by clients.

Definition at line 51 of file berryICommandService.h.

Member Function Documentation

◆ AddExecutionListener()

virtual void berry::ICommandService::AddExecutionListener ( IExecutionListener listener)
pure virtual

Adds an execution listener to the command service. This listener will be notified as commands are executed.

Note: listeners should be removed when no longer necessary. If not, they will be removed when the IServiceLocator used to acquire this service is disposed.

Parameters
listenerThe listener to add; must not be null.
See also
RemoveExecutionListener

◆ AUTOGENERATED_CATEGORY_ID()

static const QString berry::ICommandService::AUTOGENERATED_CATEGORY_ID ( )
static

The identifier of the category in which all auto-generated commands will appear. This value must never be null.

◆ berryObjectMacro()

berry::ICommandService::berryObjectMacro ( berry::ICommandService  )

◆ DefineUncategorizedCategory()

virtual void berry::ICommandService::DefineUncategorizedCategory ( const QString &  name,
const QString &  description 
)
pure virtual

Sets the name and description of the category for uncategorized commands. This is the category that will be returned if GetCategory is called with null.

Parameters
nameThe name of the category for uncategorized commands; must not be null.
descriptionThe description of the category for uncategorized commands; may be null.

◆ Deserialize()

virtual SmartPointer<ParameterizedCommand> berry::ICommandService::Deserialize ( const QString &  serializedParameterizedCommand) const
pure virtual

Returns a ParameterizedCommand with a command and parameterizations as specified in the provided serializedParameterizedCommand string. The serializedParameterizedCommand must use the format returned by ParameterizedCommand#Serialize and described in the Javadoc for that method.

If a parameter id encoded in the serializedParameterizedCommand does not exist in the encoded command, that parameter id and value are ignored. A given parameter id should not be used more than once in serializedParameterizedCommand. This will not result in an exception, but the value of the parameter when the command is executed cannot be specified here.

This method will never return null, however it may throw an exception if there is a problem processing the serialization string or the encoded command is undefined.

Parameters
serializedParameterizedCommanda String representing a command id and parameter ids and values
Returns
a ParameterizedCommand with the command and parameterizations encoded in the serializedParameterizedCommand
Exceptions
NotDefinedExceptionif the command indicated in serializedParameterizedCommand is not defined
SerializationExceptionif there is an error deserializing serializedParameterizedCommand
See also
ParameterizedCommand::serialize()
CommandManager::deserialize(String)

◆ GetCategory()

virtual SmartPointer<CommandCategory> berry::ICommandService::GetCategory ( const QString &  categoryId) const
pure virtual

Retrieves the category with the given identifier. If no such category exists, then an undefined category with the given id is created.

Parameters
categoryIdThe identifier to find. If the category is null, then a category suitable for uncategorized items is defined and returned.
Returns
A category with the given identifier, either defined or undefined.

◆ GetCommand()

virtual SmartPointer<Command> berry::ICommandService::GetCommand ( const QString &  commandId) const
pure virtual

Retrieves the command with the given identifier. If no such command exists, then an undefined command with the given id is created.

Parameters
commandIdThe identifier to find; must not be null.
Returns
A command with the given identifier, either defined or undefined.

◆ GetDefinedCategories()

virtual QList<SmartPointer<CommandCategory> > berry::ICommandService::GetDefinedCategories ( ) const
pure virtual

Returns the collection of all of the defined categories in the workbench.

Returns
The collection of categories (Category) that are defined; never null, but may be empty.

◆ GetDefinedCategoryIds()

virtual QStringList berry::ICommandService::GetDefinedCategoryIds ( ) const
pure virtual

Returns the collection of the identifiers for all of the defined categories in the workbench.

Returns
The collection of category identifiers (String) that are defined; never null, but may be empty.

◆ GetDefinedCommandIds()

virtual QStringList berry::ICommandService::GetDefinedCommandIds ( ) const
pure virtual

Returns the collection of the identifiers for all of the defined commands in the workbench.

Returns
The collection of command identifiers (String) that are defined; never null, but may be empty.

◆ GetDefinedCommands()

virtual QList<SmartPointer<Command> > berry::ICommandService::GetDefinedCommands ( ) const
pure virtual

Returns the collection of all of the defined commands in the workbench.

Returns
The collection of commands (Command) that are defined; never null, but may be empty.

◆ GetDefinedParameterTypeIds()

virtual QStringList berry::ICommandService::GetDefinedParameterTypeIds ( ) const
pure virtual

Returns the collection of the identifiers for all of the defined command parameter types in the workbench.

Returns
The collection of command parameter type identifiers (String) that are defined; never null, but may be empty.

◆ GetDefinedParameterTypes()

virtual QList<SmartPointer<ParameterType> > berry::ICommandService::GetDefinedParameterTypes ( ) const
pure virtual

Returns the collection of all of the defined command parameter types in the workbench.

Returns
The collection of command parameter types (ParameterType) that are defined; never null, but may be empty.

◆ GetHelpContextId() [1/2]

virtual QString berry::ICommandService::GetHelpContextId ( const QString &  commandId) const
pure virtual

Gets the help context identifier for a particular command. The command's handler is first checked for a help context identifier. If the handler does not have a help context identifier, then the help context identifier for the command is returned. If neither has a help context identifier, then null is returned.

Parameters
commandIdThe identifier of the command for which the help context should be retrieved; must not be null.
Returns
The help context identifier to use for the given command; may be null.
Exceptions
NotDefinedExceptionIf the command with the given identifier is not defined.

◆ GetHelpContextId() [2/2]

virtual QString berry::ICommandService::GetHelpContextId ( const SmartPointer< const Command > &  command) const
pure virtual

Gets the help context identifier for a particular command. The command's handler is first checked for a help context identifier. If the handler does not have a help context identifier, then the help context identifier for the command is returned. If neither has a help context identifier, then null is returned.

Parameters
commandThe command for which the help context should be retrieved; must not be null.
Returns
The help context identifier to use for the given command; may be null.
Exceptions
NotDefinedExceptionIf the given command is not defined.

◆ GetParameterType()

virtual SmartPointer<ParameterType> berry::ICommandService::GetParameterType ( const QString &  parameterTypeId) const
pure virtual

Retrieves the command parameter type with the given identifier. If no such parameter type exists, then an undefined parameter type with the given id is created.

Parameters
parameterTypeIdThe identifier to find; must not be null.
Returns
A command parameter type with the given identifier, either defined or undefined.

◆ ReadRegistry()

virtual void berry::ICommandService::ReadRegistry ( )
pure virtual

Reads the command information from the registry and the preferences. This will overwrite any of the existing information in the command service. This method is intended to be called during start-up. When this method completes, this command service will reflect the current state of the registry and preference store.

◆ RefreshElements()

virtual void berry::ICommandService::RefreshElements ( const QString &  commandId,
const QHash< QString, Object::Pointer > &  filter 
)
pure virtual

Refresh any elements registered against the command with the given id. It allows the active handler the opportunity to provide user feedback. If the command is parameterized, some of the parameters can be specified to help narrow down which elements to refresh.

The service locator used in registering the element can also be used to scope the search. For example: if you wanted all elements for your command but only within the part's workbench window, you could use:

Map filter = new HashMap();
filter.put(IServiceScopes.WINDOW_SCOPE, getSite().getPage()
   .getWorkbenchWindow());
commandService.refreshElements(commandId, filter);
Parameters
commandIdThe command id to refresh if it has registered eleemnts.
filterkey-value pairs that can narrow down the callbacks to return. The parameters are ANDed together. This may be null.

◆ RegisterElement()

virtual void berry::ICommandService::RegisterElement ( const SmartPointer< IElementReference > &  elementReference)
pure virtual

Re-register a callback element provided by the ICommandService. This element reference must not currently be held by the ICommandService. i.e. it must have been removed using UnregisterElement.

Note: elements should be removed when no longer necessary. If not, they will be removed when the IServiceLocator used to acquire this service is disposed.

Parameters
elementReferenceThe reference to re-register. Must not be null.
See also
UnregisterElement

◆ RegisterElementForCommand()

virtual SmartPointer<IElementReference> berry::ICommandService::RegisterElementForCommand ( const SmartPointer< ParameterizedCommand > &  command,
const SmartPointer< UIElement > &  element 
)
pure virtual

Register that this element accepts callbacks for this parameterized command.

Note: elements should be removed when no longer necessary. If not, they will be removed when the IServiceLocator used to acquire this service is disposed.

Parameters
commandThe parameterized command that is already specialized. Must not be null.
elementThe callback to register for this specialized command instance. Must not be null.
Returns
A reference for the registered element that can be used to unregister it.
Exceptions
NotDefinedExceptionIf the command included in the ParameterizedCommand is not defined, or the element is null.
See also
UnregisterElement

◆ RemoveExecutionListener()

virtual void berry::ICommandService::RemoveExecutionListener ( IExecutionListener listener)
pure virtual

Removes an execution listener from the command service.

Parameters
listenerThe listener to remove; must not be null.

◆ SetHelpContextId()

virtual void berry::ICommandService::SetHelpContextId ( const SmartPointer< IHandler > &  handler,
const QString &  helpContextId 
)
pure virtual

Sets the help context identifier to associate with a particular handler.

Parameters
handlerThe handler with which to register a help context identifier; must not be null.
helpContextIdThe help context identifier to register; may be null if the help context identifier should be removed.

◆ UnregisterElement()

virtual void berry::ICommandService::UnregisterElement ( const SmartPointer< IElementReference > &  elementReference)
pure virtual

Unregister an element callback. It will be removed from the ICommandService. The same service that is used to register an element for a command must be used to unregister the element.

Parameters
elementReferenceThe callback reference that was provided by the command service on registration. Must not be null.

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