Medical Imaging Interaction Toolkit
2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
|
#include <berryParameterizedCommand.h>
Public Member Functions | |
berryObjectMacro (ParameterizedCommand) | |
ParameterizedCommand (const SmartPointer< Command > &command, const QList< Parameterization > ¶meterizations) | |
bool | operator< (const Object *object) const override |
bool | operator== (const Object *object) const override |
Object::Pointer | ExecuteWithChecks (const Object::ConstPointer &trigger, const Object::Pointer &applicationContext) |
SmartPointer< Command > | GetCommand () const |
QString | GetId () const |
QString | GetName () const |
QHash< QString, QString > | GetParameterMap () const |
uint | HashCode () const override |
QString | Serialize () |
QString | ToString () const override |
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 |
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 |
Static Public Member Functions | |
static QList< ParameterizedCommand::Pointer > | GenerateCombinations (const SmartPointer< Command > command) |
static ParameterizedCommand::Pointer | GenerateCommand (const SmartPointer< Command > command, const QHash< QString, Object::Pointer > ¶meters) |
Static Public Member Functions inherited from berry::Object | |
static const char * | GetStaticClassName () |
static Reflection::TypeInfo | GetStaticTypeInfo () |
static QList< Reflection::TypeInfo > | GetStaticSuperclasses () |
Static Public Attributes | |
static const int | INDEX_PARAMETER_ID |
static const int | INDEX_PARAMETER_NAME |
static const int | INDEX_PARAMETER_VALUE_NAME |
static const int | INDEX_PARAMETER_VALUE_VALUE |
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 |
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 |
A command that has had one or more of its parameters specified. This class serves as a utility class for developers that need to manipulate commands with parameters. It handles the behaviour of generating a parameter map and a human-readable name.
Definition at line 40 of file berryParameterizedCommand.h.
berry::ParameterizedCommand::ParameterizedCommand | ( | const SmartPointer< Command > & | command, |
const QList< Parameterization > & | parameterizations | ||
) |
Constructs a new instance of ParameterizedCommand
with specific values for zero or more of its parameters.
command | The command that is parameterized; must not be null . |
parameterizations | An array of parameterizations binding parameters to values for the command. This value may be null . |
berry::ParameterizedCommand::berryObjectMacro | ( | ParameterizedCommand | ) |
Object::Pointer berry::ParameterizedCommand::ExecuteWithChecks | ( | const Object::ConstPointer & | trigger, |
const Object::Pointer & | applicationContext | ||
) |
Executes this command with its parameters. This does extra checking to see if the command is enabled and defined. If it is not both enabled and defined, then the execution listeners will be notified and an exception thrown.
trigger | The object that triggered the execution; may be null . |
applicationContext | The state of the application at the time the execution was triggered; may be null . |
null
. ExecutionException | If the handler has problems executing this command. |
NotDefinedException | If the command you are trying to execute is not defined. |
NotEnabledException | If the command you are trying to execute is not enabled. |
NotHandledException | If there is no handler. |
|
static |
Generates all the possible combinations of command parameterizations for the given command. If the command has no parameters, then this is simply a parameterized version of that command. If a parameter is optional, both the included and not included cases are considered.
If one of the parameters cannot be loaded due to a ParameterValuesException
, then it is simply ignored.
command | The command for which the parameter combinations should be generated; must not be null . |
ParameterizedCommand
instances representing all of the possible combinations. This value is never empty and it is never null
. NotDefinedException | If the command is not defined. |
|
static |
Take a command and a map of parameter IDs to values, and generate the appropriate parameterized command.
command | The command object. Must not be null . |
parameters | A map of String parameter ids to objects. May be null . |
null
if it could not be generated SmartPointer<Command> berry::ParameterizedCommand::GetCommand | ( | ) | const |
Returns the base command. It is possible for more than one parameterized command to have the same identifier.
null
, but may be undefined. QString berry::ParameterizedCommand::GetId | ( | ) | const |
Returns the command's base identifier. It is possible for more than one parameterized command to have the same identifier.
null
. QString berry::ParameterizedCommand::GetName | ( | ) | const |
Returns a human-readable representation of this command with all of its parameterizations.
null
. NotDefinedException | If the underlying command is not defined. |
QHash<QString, QString> berry::ParameterizedCommand::GetParameterMap | ( | ) | const |
Returns the parameter map, as can be used to construct an ExecutionEvent
.
String
) to parameter values (String
). This map is never null
, but may be empty.
|
overridevirtual |
Returns a hash code value for the object.
Reimplemented from berry::Object.
|
overridevirtual |
Override this method to implement a specific "less than" operator for associative STL containers.
Reimplemented from berry::Object.
|
overridevirtual |
A generic comparison method. Override this method in subclasses and cast to your derived class to provide a more detailed comparison.
Reimplemented from berry::Object.
QString berry::ParameterizedCommand::Serialize | ( | ) |
Returns a String
containing the command id, parameter ids and parameter values for this ParameterizedCommand
. The returned String
can be stored by a client and later used to reconstruct an equivalent ParameterizedCommand using the CommandManager.deserialize(String)
method.
The syntax of the returned String
is as follows:
serialization = commandId [ '(' parameters ')' ]
parameters = parameter [ ',' parameters ]
parameter = parameterId [ '=' parameterValue ]
In the syntax above, sections inside square-brackets are optional. The characters in single quotes ((
, )
, ,
and =
) indicate literal characters.
commandId
represents the command id encoded with separator characters escaped. parameterId
and parameterValue
represent the parameter ids and values encoded with separator characters escaped. The separator characters (
, )
, ,
and =
are escaped by prepending a %
. This requires %
to be escaped, which is also done by prepending a %
.
The order of the parameters is not defined (and not important). A missing parameterValue
indicates that the value of the parameter is null
.
For example, the string shown below represents a serialized parameterized command that can be used to show the Resource perspective:
org.eclipse.ui.perspectives.showPerspective(org.eclipse.ui.perspectives.showPerspective.perspectiveId=org.eclipse.ui.resourcePerspective)
This example shows the more general form with multiple parameters, null
value parameters, and escaped =
in the third parameter value.
command.id(param1.id=value1,param2.id,param3.id=esc%=val3)
null
.
|
overridevirtual |
Returns a string representation of this object. The default implementation returns an empty string.
Reimplemented from berry::Object.
|
static |
The index of the parameter id in the parameter values.
Definition at line 52 of file berryParameterizedCommand.h.
|
static |
The index of the human-readable name of the parameter itself, in the parameter values.
Definition at line 60 of file berryParameterizedCommand.h.
|
static |
The index of the human-readable name of the value of the parameter for this command.
Definition at line 68 of file berryParameterizedCommand.h.
|
static |
The index of the value of the parameter that the command can understand.
Definition at line 75 of file berryParameterizedCommand.h.