Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
berry::IHandlerService Struct Referenceabstract

#include <berryIHandlerService.h>

Inheritance diagram for berry::IHandlerService:
Collaboration diagram for berry::IHandlerService:

Public Member Functions

 berryObjectMacro (berry::IHandlerService)
 
 ~IHandlerService () override
 
virtual SmartPointer< IHandlerActivationActivateHandler (const SmartPointer< IHandlerActivation > &activation)=0
 
virtual SmartPointer< IHandlerActivationActivateHandler (const QString &commandId, const SmartPointer< IHandler > &handler)=0
 
virtual SmartPointer< IHandlerActivationActivateHandler (const QString &commandId, const SmartPointer< IHandler > &handler, const SmartPointer< Expression > &expression)=0
 
virtual SmartPointer< IHandlerActivationActivateHandler (const QString &commandId, const SmartPointer< IHandler > &handler, const SmartPointer< Expression > &expression, bool global)=0
 
virtual SmartPointer< const ExecutionEventCreateExecutionEvent (const SmartPointer< const Command > &command, const SmartPointer< const UIElement > &uielement)=0
 
virtual SmartPointer< const ExecutionEventCreateExecutionEvent (const SmartPointer< const ParameterizedCommand > &command, const SmartPointer< const UIElement > &uielement)=0
 
virtual void DeactivateHandler (const SmartPointer< IHandlerActivation > &activation)=0
 
virtual void DeactivateHandlers (const QList< SmartPointer< IHandlerActivation > > &activations)=0
 
virtual Object::Pointer ExecuteCommand (const QString &commandId, const SmartPointer< const UIElement > &uielement)=0
 
virtual Object::Pointer ExecuteCommand (const SmartPointer< ParameterizedCommand > &command, const SmartPointer< const UIElement > &uielement)=0
 
virtual Object::Pointer ExecuteCommandInContext (const SmartPointer< ParameterizedCommand > &command, const SmartPointer< const UIElement > &uielement, const SmartPointer< IEvaluationContext > &context)=0
 
virtual SmartPointer< IEvaluationContextCreateContextSnapshot (bool includeSelection)=0
 
virtual SmartPointer< IEvaluationContextGetCurrentState () const =0
 
virtual void ReadRegistry ()=0
 
virtual void SetHelpContextId (const SmartPointer< IHandler > &handler, const QString &helpContextId)=0
 
- Public Member Functions inherited from berry::IServiceWithSources
 berryObjectMacro (berry::IServiceWithSources)
 
 ~IServiceWithSources () override
 
virtual void AddSourceProvider (const SmartPointer< ISourceProvider > &provider)=0
 
virtual void RemoveSourceProvider (const SmartPointer< ISourceProvider > &provider)=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
 

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

Provides services related to activating and deactivating handlers within the workbench.

This service can be acquired from your service locator:

 IHandlerService service = (IHandlerService) getSite().getService(IHandlerService.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.
Since
3.1

Definition at line 53 of file berryIHandlerService.h.

Constructor & Destructor Documentation

◆ ~IHandlerService()

berry::IHandlerService::~IHandlerService ( )
override

Member Function Documentation

◆ ActivateHandler() [1/4]

virtual SmartPointer<IHandlerActivation> berry::IHandlerService::ActivateHandler ( const QString &  commandId,
const SmartPointer< IHandler > &  handler 
)
pure virtual

Activates the given handler within the context of this service. If this service was retrieved from the workbench, then this handler will be active globally. If the service was retrieved from a nested component, then the handler will only be active within that component.

Also, it is guaranteed that the handlers submitted through a particular service will be cleaned up when that services is destroyed. So, for example, a service retrieved from a IWorkbenchPartSite would deactivate all of its handlers when the site is destroyed.

Parameters
commandIdThe identifier for the command which this handler handles; must not be null.
handlerThe handler to activate; must not be null.
Returns
A token which can be used to later cancel the activation. Only someone with access to this token can cancel the activation. The activation will automatically be cancelled if the context from which this service was retrieved is destroyed.

◆ ActivateHandler() [2/4]

virtual SmartPointer<IHandlerActivation> berry::IHandlerService::ActivateHandler ( const QString &  commandId,
const SmartPointer< IHandler > &  handler,
const SmartPointer< Expression > &  expression 
)
pure virtual

Activates the given handler within the context of this service. The handler becomes active when expression evaluates to true. This is the same as calling ActivateHandler with global==false .

Also, it is guaranteed that the handlers submitted through a particular service will be cleaned up when that service is destroyed. So, for example, a service retrieved from a IWorkbenchPartSite would deactivate all of its handlers when the site is destroyed.

Parameters
commandIdThe identifier for the command which this handler handles; must not be null.
handlerThe handler to activate; must not be null.
expressionThis expression must evaluate to true before this handler will really become active. The expression may be null if the handler should always be active.
Returns
A token which can be used to later cancel the activation. Only someone with access to this token can cancel the activation. The activation will automatically be cancelled if the context from which this service was retrieved is destroyed.
See also
org.eclipse.ui.ISources
Since
3.2

◆ ActivateHandler() [3/4]

virtual SmartPointer<IHandlerActivation> berry::IHandlerService::ActivateHandler ( const QString &  commandId,
const SmartPointer< IHandler > &  handler,
const SmartPointer< Expression > &  expression,
bool  global 
)
pure virtual

Activates the given handler within the context of this service. The handler becomes active when expression evaluates to true. if global==false, then this handler service must also be the active service to active the handler. For example, the handler service on a part is active when that part is active.

Also, it is guaranteed that the handlers submitted through a particular service will be cleaned up when that services is destroyed. So, for example, a service retrieved from a IWorkbenchPartSite would deactivate all of its handlers when the site is destroyed.

Parameters
commandIdThe identifier for the command which this handler handles; must not be null.
handlerThe handler to activate; must not be null.
expressionThis expression must evaluate to true before this handler will really become active. The expression may be null if the handler should always be active.
globalIndicates that the handler should be activated irrespectively of whether the corresponding workbench component (e.g., window, part, etc.) is active.
Returns
A token which can be used to later cancel the activation. Only someone with access to this token can cancel the activation. The activation will automatically be cancelled if the context from which this service was retrieved is destroyed.
See also
org.eclipse.ui.ISources
Since
3.2

◆ ActivateHandler() [4/4]

virtual SmartPointer<IHandlerActivation> berry::IHandlerService::ActivateHandler ( const SmartPointer< IHandlerActivation > &  activation)
pure virtual

Activates the given handler from a child service. This is used by slave and nested services to promote handler activations up to the root. By using this method, it is possible for handlers coming from a more nested component to override the nested component.

Parameters
activationThe activation that is local to the child service; must not be null.
Returns
A token which can be used to later cancel the activation. Only someone with access to this token can cancel the activation. The activation will automatically be cancelled if the service locator context from which this service was retrieved is destroyed. This activation is local to this service (i.e., it is not the activation that is passed as a parameter).
Since
3.2

◆ berryObjectMacro()

berry::IHandlerService::berryObjectMacro ( berry::IHandlerService  )

◆ CreateContextSnapshot()

virtual SmartPointer<IEvaluationContext> berry::IHandlerService::CreateContextSnapshot ( bool  includeSelection)
pure virtual

This method creates a copy of the application context returned by GetCurrentState.

Parameters
includeSelectionif true, include the default variable and selection variables
Returns
an context filled with the current set of variables. If selection is not included, the default variable is an empty collection

◆ CreateExecutionEvent() [1/2]

virtual SmartPointer<const ExecutionEvent> berry::IHandlerService::CreateExecutionEvent ( const SmartPointer< const Command > &  command,
const SmartPointer< const UIElement > &  uielement 
)
pure virtual

Creates an execution event based on an SWT event. This execution event can then be passed to a command for execution.

Parameters
commandThe command for which an execution event should be created; must not be null.
uielement
Returns
An execution event suitable for calling Command#ExecuteWithChecks.
Since
3.2
See also
Command::ExecuteWithChecks

◆ CreateExecutionEvent() [2/2]

virtual SmartPointer<const ExecutionEvent> berry::IHandlerService::CreateExecutionEvent ( const SmartPointer< const ParameterizedCommand > &  command,
const SmartPointer< const UIElement > &  uielement 
)
pure virtual

Creates a parameterized execution event based on an SWT event and a parameterized command. This execution event can then be passed to a command for execution.

Parameters
commandThe parameterized command for which an execution event should be created; must not be null.
uielement
Returns
An execution event suitable for calling Command#ExecuteWithChecks.
Since
3.2
See also
ParameterizedCommand::GetCommand
Command::ExecuteWithChecks

◆ DeactivateHandler()

virtual void berry::IHandlerService::DeactivateHandler ( const SmartPointer< IHandlerActivation > &  activation)
pure virtual

Deactivates the given handler within the context of this service. If the handler was activated with a different service, then it must be deactivated from that service instead. It is only possible to retract a handler activation with this method. That is, you must have the same IHandlerActivation used to activate the handler.

Parameters
activationThe token that was returned from a call to activateHandler; must not be null.

◆ DeactivateHandlers()

virtual void berry::IHandlerService::DeactivateHandlers ( const QList< SmartPointer< IHandlerActivation > > &  activations)
pure virtual

Deactivates the given handlers within the context of this service. If the handler was activated with a different service, then it must be deactivated from that service instead. It is only possible to retract a handler activation with this method. That is, you must have the same IHandlerActivation used to activate the handler.

Parameters
activationsThe tokens that were returned from a call to activateHandler. This collection must only contain instances of IHandlerActivation. The collection must not be null.

◆ ExecuteCommand() [1/2]

virtual Object::Pointer berry::IHandlerService::ExecuteCommand ( const QString &  commandId,
const SmartPointer< const UIElement > &  uielement 
)
pure virtual

Executes the command with the given identifier and no parameters.

Parameters
commandIdThe identifier of the command to execute; must not be null.
uielement
Returns
The return value from the execution; may be null.
Exceptions
ExecutionExceptionIf the handler has problems executing this command.
NotDefinedExceptionIf the command you are trying to execute is not defined.
NotEnabledExceptionIf the command you are trying to execute is not enabled.
NotHandledExceptionIf there is no handler.
Since
3.2
See also
Command::ExecuteWithChecks

◆ ExecuteCommand() [2/2]

virtual Object::Pointer berry::IHandlerService::ExecuteCommand ( const SmartPointer< ParameterizedCommand > &  command,
const SmartPointer< const UIElement > &  uielement 
)
pure virtual

Executes the given parameterized command.

Parameters
commandThe parameterized command to be executed; must not be null.
uielement
Returns
The return value from the execution; may be null.
Exceptions
ExecutionExceptionIf the handler has problems executing this command.
NotDefinedExceptionIf the command you are trying to execute is not defined.
NotEnabledExceptionIf the command you are trying to execute is not enabled.
NotHandledExceptionIf there is no handler.
Since
3.2
See also
Command::ExecuteWithChecks

◆ ExecuteCommandInContext()

virtual Object::Pointer berry::IHandlerService::ExecuteCommandInContext ( const SmartPointer< ParameterizedCommand > &  command,
const SmartPointer< const UIElement > &  uielement,
const SmartPointer< IEvaluationContext > &  context 
)
pure virtual

Executes the given parameterized command in the provided context. It takes care of finding the correct active handler given the context, calls IHandler2.setEnabled(Object) to update the enabled state if supported, and executes with that handler.

Parameters
commandThe parameterized command to be executed; must not be null.
uielement
contextthe evaluation context to run against. Must not be null
Returns
The return value from the execution; may be null.
Exceptions
ExecutionExceptionIf the handler has problems executing this command.
NotDefinedExceptionIf the command you are trying to execute is not defined.
NotEnabledExceptionIf the command you are trying to execute is not enabled.
NotHandledExceptionIf there is no handler.
Since
3.4
See also
Command::ExecuteWithChecks
CreateContextSnapshot

◆ GetCurrentState()

virtual SmartPointer<IEvaluationContext> berry::IHandlerService::GetCurrentState ( ) const
pure virtual

Returns an evaluation context representing the current state of the world. This is equivalent to the application context required by ExecutionEvent.

Returns
the current state of the application; never null.
See also
ParameterizedCommand::ExecuteWithChecks
ExecutionEvent::ExecutionEvent
IEvaluationService

◆ ReadRegistry()

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

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

◆ SetHelpContextId()

virtual void berry::IHandlerService::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.
Since
3.2

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