Medical Imaging Interaction Toolkit
2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
|
#include <berryCommandManager.h>
Public Member Functions | |
CommandManager () | |
void | AddCommandManagerListener (ICommandManagerListener *listener) |
void | AddExecutionListener (IExecutionListener *listener) |
void | DefineUncategorizedCategory (const QString &name, const QString &description) |
SmartPointer< ParameterizedCommand > | Deserialize (const QString &serializedParameterizedCommand) |
QList< SmartPointer< Command > > | GetAllCommands () const |
SmartPointer< CommandCategory > | GetCategory (const QString &categoryId) |
SmartPointer< Command > | GetCommand (const QString &commandId) |
QList< SmartPointer< CommandCategory > > | GetDefinedCategories () |
QSet< QString > | GetDefinedCategoryIds () const |
QSet< QString > | GetDefinedCommandIds () const |
QList< SmartPointer< Command > > | GetDefinedCommands () const |
QSet< QString > | GetDefinedParameterTypeIds () const |
QList< SmartPointer< ParameterType > > | GetDefinedParameterTypes () |
QString | GetHelpContextId (const SmartPointer< const Command > command) const |
SmartPointer< ParameterType > | GetParameterType (const QString ¶meterTypeId) |
void | RemoveCommandManagerListener (ICommandManagerListener *listener) |
void | RemoveExecutionListener (IExecutionListener *listener) |
void | SetHandlersByCommandId (const QHash< QString, SmartPointer< IHandler > > &handlersByCommandId) |
void | SetHelpContextId (const SmartPointer< IHandler > handler, const QString &helpContextId) |
void | FireNotEnabled (const QString &commandId, const NotEnabledException *exception) |
void | FireNotDefined (const QString &commandId, const NotDefinedException *exception) |
void | FirePreExecute (const QString &commandId, const SmartPointer< const ExecutionEvent > event) |
void | FirePostExecuteSuccess (const QString &commandId, Object::Pointer returnValue) |
void | FirePostExecuteFailure (const QString &commandId, const ExecutionException *exception) |
Static Public Attributes | |
static const QString | AUTOGENERATED_CATEGORY_ID |
Static Protected Attributes | |
static const char | ESCAPE_CHAR |
static const char | ID_VALUE_CHAR |
static const char | PARAMETER_END_CHAR |
static const char | PARAMETER_SEPARATOR_CHAR |
static const char | PARAMETER_START_CHAR |
Additional Inherited Members | |
Protected Types inherited from berry::HandleObjectManager | |
typedef QSet< SmartPointer< HandleObject > > | HandleObjectsSet |
typedef QHash< QString, SmartPointer< HandleObject > > | HandleObjectsByIdMap |
Protected Member Functions inherited from berry::HandleObjectManager | |
void | CheckId (const QString &id) const |
QSet< QString > | GetDefinedHandleObjectIds () const |
Protected Attributes inherited from berry::HandleObjectManager | |
HandleObjectsSet | definedHandleObjects |
HandleObjectsByIdMap | handleObjectsById |
A central repository for commands – both in the defined and undefined states. Commands can be created and retrieved using this manager. It is possible to listen to changes in the collection of commands by attaching a listener to the manager.
Definition at line 49 of file berryCommandManager.h.
berry::CommandManager::CommandManager | ( | ) |
The default constructor
void berry::CommandManager::AddCommandManagerListener | ( | ICommandManagerListener * | listener | ) |
Adds a listener to this command manager. The listener will be notified when the set of defined commands changes. This can be used to track the global appearance and disappearance of commands.
listener | The listener to attach; must not be null . |
void berry::CommandManager::AddExecutionListener | ( | IExecutionListener * | listener | ) |
Adds an execution listener to this manager. This listener will be notified if any of the commands controlled by this manager execute. This can be used to support macros and instrumentation of commands.
listener | The listener to attach; must not be null . |
void berry::CommandManager::DefineUncategorizedCategory | ( | const QString & | name, |
const QString & | description | ||
) |
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
.
name | The name of the category for uncategorized commands; must not be null . |
description | The description of the category for uncategorized commands; may be null . |
SmartPointer<ParameterizedCommand> berry::CommandManager::Deserialize | ( | const QString & | serializedParameterizedCommand | ) |
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 in this case the value of the parameter when the command is executed is unspecified.
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.
serializedParameterizedCommand | a string representing a command id and parameter ids and values; must not be null |
serializedParameterizedCommand
; never null
. NotDefinedException | if the command indicated in serializedParameterizedCommand is not defined |
SerializationException | if there is an error deserializing serializedParameterizedCommand |
void berry::CommandManager::FireNotDefined | ( | const QString & | commandId, |
const NotDefinedException * | exception | ||
) |
Fires the notDefined
event for executionListeners
.
Note: This supports bridging actions to the command framework, and should not be used outside the framework.
commandId | The command id of the command about to execute, never null . |
exception | The exception, never null . |
void berry::CommandManager::FireNotEnabled | ( | const QString & | commandId, |
const NotEnabledException * | exception | ||
) |
Fires the notEnabled
event for executionListeners
.
Note: This supports bridging actions to the command framework, and should not be used outside the framework.
commandId | The command id of the command about to execute, never null . |
exception | The exception, never null . |
void berry::CommandManager::FirePostExecuteFailure | ( | const QString & | commandId, |
const ExecutionException * | exception | ||
) |
Fires the postExecuteFailure
event for executionListeners
.
Note: This supports bridging actions to the command framework, and should not be used outside the framework.
commandId | The command id of the command executed, never null . |
exception | The exception, never null . |
void berry::CommandManager::FirePostExecuteSuccess | ( | const QString & | commandId, |
Object::Pointer | returnValue | ||
) |
Fires the postExecuteSuccess
event for executionListeners
.
Note: This supports bridging actions to the command framework, and should not be used outside the framework.
commandId | The command id of the command executed, never null . |
returnValue | The value returned from the command, may be null . |
void berry::CommandManager::FirePreExecute | ( | const QString & | commandId, |
const SmartPointer< const ExecutionEvent > | event | ||
) |
Fires the preExecute
event for executionListeners
.
Note: This supports bridging actions to the command framework, and should not be used outside the framework.
commandId | The command id of the command about to execute, never null . |
event | The event that triggered the command, may be null . |
QList<SmartPointer<Command> > berry::CommandManager::GetAllCommands | ( | ) | const |
Returns all of the commands known by this manager – defined and undefined.
null
. SmartPointer<CommandCategory> berry::CommandManager::GetCategory | ( | const QString & | categoryId | ) |
Gets the category with the given identifier. If no such category currently exists, then the category will be created (but be undefined).
categoryId | The identifier to find; must not be null . If the category is null , then a category suitable for uncategorized items is defined and returned. |
null
, but it might be undefined. SmartPointer<Command> berry::CommandManager::GetCommand | ( | const QString & | commandId | ) |
Gets the command with the given identifier. If no such command currently exists, then the command will be created (but will be undefined).
commandId | The identifier to find; must not be null and must not be zero-length. |
null
, but it might be undefined. QList<SmartPointer<CommandCategory> > berry::CommandManager::GetDefinedCategories | ( | ) |
Returns the categories that are defined.
null
. QSet<QString> berry::CommandManager::GetDefinedCategoryIds | ( | ) | const |
Returns the set of identifiers for those category that are defined.
null
. QSet<QString> berry::CommandManager::GetDefinedCommandIds | ( | ) | const |
Returns the set of identifiers for those commands that are defined.
null
. QList<SmartPointer<Command> > berry::CommandManager::GetDefinedCommands | ( | ) | const |
Returns the commands that are defined.
null
. QSet<QString> berry::CommandManager::GetDefinedParameterTypeIds | ( | ) | const |
Returns the set of identifiers for those parameter types that are defined.
null
. QList<SmartPointer<ParameterType> > berry::CommandManager::GetDefinedParameterTypes | ( | ) |
Returns the command parameter types that are defined.
null
. QString berry::CommandManager::GetHelpContextId | ( | const SmartPointer< const Command > | command | ) | const |
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.
command | The command for which the help context should be retrieved; must not be null . |
null
. NotDefinedException | If the given command is not defined. |
SmartPointer<ParameterType> berry::CommandManager::GetParameterType | ( | const QString & | parameterTypeId | ) |
Gets the command ParameterType with the given identifier. If no such command parameter type currently exists, then the command parameter type will be created (but will be undefined).
parameterTypeId | The identifier to find; must not be null and must not be zero-length. |
null
, but it might be undefined. void berry::CommandManager::RemoveCommandManagerListener | ( | ICommandManagerListener * | listener | ) |
Removes a listener from this command manager.
listener | The listener to be removed; must not be null . |
void berry::CommandManager::RemoveExecutionListener | ( | IExecutionListener * | listener | ) |
Removes an execution listener from this command manager.
listener | The listener to be removed; must not be null . |
void berry::CommandManager::SetHandlersByCommandId | ( | const QHash< QString, SmartPointer< IHandler > > & | handlersByCommandId | ) |
Block updates all of the handlers for all of the commands. If the handler is null
or the command id does not exist in the map, then the command becomes unhandled. Otherwise, the handler is set to the corresponding value in the map.
handlersByCommandId | A map of command identifiers (String ) to handlers (IHandler ). This map may be null if all handlers should be cleared. Similarly, if the map is empty, then all commands will become unhandled. |
void berry::CommandManager::SetHelpContextId | ( | const SmartPointer< IHandler > | handler, |
const QString & | helpContextId | ||
) |
Sets the help context identifier to associate with a particular handler.
handler | The handler with which to register a help context identifier; must not be null . |
helpContextId | The help context identifier to register; may be null if the help context identifier should be removed. |
|
static |
The identifier of the category in which all auto-generated commands will appear. This value must never be null
.
Definition at line 142 of file berryCommandManager.h.
|
staticprotected |
The escape character to use for serialization and deserialization of parameterized commands.
Definition at line 476 of file berryCommandManager.h.
|
staticprotected |
The character that separates a parameter id from its value.
Definition at line 481 of file berryCommandManager.h.
|
staticprotected |
The character that indicates the end of a list of parameters.
Definition at line 486 of file berryCommandManager.h.
|
staticprotected |
The character that separators parameters from each other.
Definition at line 491 of file berryCommandManager.h.
|
staticprotected |
The character that indicates the start of a list of parameters.
Definition at line 496 of file berryCommandManager.h.