Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
berry::IContextService Struct Referenceabstract

#include <berryIContextService.h>

Inheritance diagram for berry::IContextService:
Collaboration diagram for berry::IContextService:

Public Types

enum  ShellType { TYPE_DIALOG, TYPE_NONE, TYPE_WINDOW }
 
- 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
 

Public Member Functions

virtual SmartPointer< IContextActivation > ActivateContext (const QString &contextId)=0
 
virtual SmartPointer< IContextActivation > ActivateContext (const QString &contextId, const SmartPointer< Expression > &expression)=0
 
virtual SmartPointer< IContextActivation > ActivateContext (const QString &contextId, const SmartPointer< Expression > &expression, bool global)=0
 
virtual void AddContextManagerListener (IContextManagerListener *listener)=0
 
virtual void DeactivateContext (const SmartPointer< IContextActivation > &activation)=0
 
virtual void DeactivateContexts (const QList< SmartPointer< IContextActivation > > &activations)=0
 
virtual QList< QString > GetActiveContextIds () const =0
 
virtual SmartPointer< Context > GetContext (const QString &contextId) const =0
 
virtual QList< SmartPointer< Context > > GetDefinedContexts () const =0
 
virtual QList< QString > GetDefinedContextIds () const =0
 
virtual ShellType GetShellType (const SmartPointer< Shell > &shell) const =0
 
virtual ShellType GetShellType (QWidget *widget) const =0
 
virtual void ReadRegistry ()=0
 
virtual bool RegisterShell (const SmartPointer< Shell > &shell, ShellType type)=0
 
virtual void RemoveContextManagerListener (IContextManagerListener *listener)=0
 
virtual bool UnregisterShell (const SmartPointer< Shell > &shell)=0
 
virtual void DeferUpdates (bool defer)=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
 

Static Public Attributes

static const QString CONTEXT_ID_WORKBENCH_MENU
 
static const QString CONTEXT_ID_DIALOG
 
static const QString CONTEXT_ID_DIALOG_AND_WINDOW
 
static const QString CONTEXT_ID_WINDOW
 

Additional Inherited Members

- 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 contexts in the blueberry workbench. This provides access to contexts.

This service can be acquired from your service locator:

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

Definition at line 45 of file berryIContextService.h.

Member Enumeration Documentation

◆ ShellType

Enumerator
TYPE_DIALOG 

The type used for registration indicating that the shell should be treated as a dialog. When the given shell is active, the "In Dialogs" context should also be active.

TYPE_NONE 

The type used for registration indicating that the shell should not receive any key bindings be default. When the given shell is active, we should not provide any EnabledSubmission instances for the "In Dialogs" or "In Windows" contexts.

TYPE_WINDOW 

The type used for registration indicating that the shell should be treated as a window. When the given shell is active, the "In Windows" context should also be active.

Definition at line 71 of file berryIContextService.h.

Member Function Documentation

◆ ActivateContext() [1/3]

virtual SmartPointer<IContextActivation> berry::IContextService::ActivateContext ( const QString &  contextId)
pure virtual

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

Also, it is guaranteed that the contexts 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 contexts when the site is destroyed.

Parameters
contextIdThe identifier for the context which should be activated; 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.

◆ ActivateContext() [2/3]

virtual SmartPointer<IContextActivation> berry::IContextService::ActivateContext ( const QString &  contextId,
const SmartPointer< Expression > &  expression 
)
pure virtual

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

Also, it is guaranteed that the context 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
contextIdThe identifier for the context which should be activated; must not be null.
expressionThis expression must evaluate to true before this context will really become active. The expression may be null if the context 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
ISources

◆ ActivateContext() [3/3]

virtual SmartPointer<IContextActivation> berry::IContextService::ActivateContext ( const QString &  contextId,
const SmartPointer< Expression > &  expression,
bool  global 
)
pure virtual

Activates the given context within the context of this service. The context becomes active when expression evaluates to true. If global==false then this service must also be the active service to activate the context.

Also, it is guaranteed that the context 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
contextIdThe identifier for the context which should be activated; must not be null.
expressionThis expression must evaluate to true before this context will really become active. The expression may be null if the context 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
ISources

◆ AddContextManagerListener()

virtual void berry::IContextService::AddContextManagerListener ( IContextManagerListener *  listener)
pure virtual

Adds a listener to this context service. The listener will be notified when the set of defined contexts changes. This can be used to track the global appearance and disappearance of contexts.

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 attach; must not be null.
See also
RemoveContextManagerListener(IContextManagerListener*)

◆ DeactivateContext()

virtual void berry::IContextService::DeactivateContext ( const SmartPointer< IContextActivation > &  activation)
pure virtual

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

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

◆ DeactivateContexts()

virtual void berry::IContextService::DeactivateContexts ( const QList< SmartPointer< IContextActivation > > &  activations)
pure virtual

Deactivates the given contexts within the context of this service. If the contexts were activated with a different service, then they must be deactivated from that service instead. It is only possible to retract context activations with this method. That is, you must have the same IContextActivation instances used to activate the contexts.

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

◆ DeferUpdates()

virtual void berry::IContextService::DeferUpdates ( bool  defer)
pure virtual

Informs the service that a batch operation has started.

Note: You must insure that if you call deferUpdates(true) that nothing in your batched operation will prevent the matching call to deferUpdates(false).

Parameters
defertrue when starting a batch operation false when ending the operation

◆ GetActiveContextIds()

virtual QList<QString> berry::IContextService::GetActiveContextIds ( ) const
pure virtual

Returns the set of active context identifiers.

Returns
The set of active context identifiers; this value may be null if no active contexts have been set yet. If the set is not null, then it contains only instances of String.

◆ GetContext()

virtual SmartPointer<Context> berry::IContextService::GetContext ( const QString &  contextId) const
pure virtual

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

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

◆ GetDefinedContextIds()

virtual QList<QString> berry::IContextService::GetDefinedContextIds ( ) const
pure virtual

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

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

◆ GetDefinedContexts()

virtual QList<SmartPointer<Context> > berry::IContextService::GetDefinedContexts ( ) const
pure virtual

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

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

◆ GetShellType() [1/2]

virtual ShellType berry::IContextService::GetShellType ( const SmartPointer< Shell > &  shell) const
pure virtual

Returns the shell type for the given shell.

Parameters
shellThe shell for which the type should be determined. If this value is null, then IContextService.TYPE_NONE is returned.
Returns
IContextService.TYPE_WINDOW, IContextService.TYPE_DIALOG, or IContextService.TYPE_NONE.

◆ GetShellType() [2/2]

virtual ShellType berry::IContextService::GetShellType ( QWidget *  widget) const
pure virtual

◆ ReadRegistry()

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

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

◆ RegisterShell()

virtual bool berry::IContextService::RegisterShell ( const SmartPointer< Shell > &  shell,
ShellType  type 
)
pure virtual

Registers a shell to automatically promote or demote some basic types of contexts. The "In Dialogs" and "In Windows" contexts are provided by the system. This a convenience method to ensure that these contexts are promoted when the given is shell is active.

If a shell is registered as a window, then the "In Windows" context is enabled when that shell is active. If a shell is registered as a dialog – or is not registered, but has a parent shell – then the "In Dialogs" context is enabled when that shell is active. If the shell is registered as none – or is not registered, but has no parent shell – then the neither of the contexts will be enabled (by us – someone else can always enabled them).

If the provided shell has already been registered, then this method will change the registration.

Parameters
shellThe shell to register for key bindings; must not be null.
typeThe type of shell being registered. This value must be one of the constants given in this interface.
Returns
true if the shell had already been registered (i.e., the registration has changed); false otherwise.

◆ RemoveContextManagerListener()

virtual void berry::IContextService::RemoveContextManagerListener ( IContextManagerListener *  listener)
pure virtual

Removes a listener from this context service.

Parameters
listenerThe listener to be removed; must not be null.

◆ UnregisterShell()

virtual bool berry::IContextService::UnregisterShell ( const SmartPointer< Shell > &  shell)
pure virtual

Unregisters a shell that was previously registered. After this method completes, the shell will be treated as if it had never been registered at all. If you have registered a shell, you should ensure that this method is called when the shell is disposed. Otherwise, a potential memory leak will exist.

If the shell was never registered, or if the shell is null, then this method returns false and does nothing.

Parameters
shellThe shell to be unregistered; does nothing if this value is null.
Returns
true if the shell had been registered; false otherwise.

Member Data Documentation

◆ CONTEXT_ID_DIALOG

const QString berry::IContextService::CONTEXT_ID_DIALOG
static

The identifier for the context that is active when a shell registered as a dialog.

Definition at line 57 of file berryIContextService.h.

◆ CONTEXT_ID_DIALOG_AND_WINDOW

const QString berry::IContextService::CONTEXT_ID_DIALOG_AND_WINDOW
static

The identifier for the context that is active when a shell is registered as either a window or a dialog.

Definition at line 63 of file berryIContextService.h.

◆ CONTEXT_ID_WINDOW

const QString berry::IContextService::CONTEXT_ID_WINDOW
static

The identifier for the context that is active when a shell is registered as a window.

Definition at line 69 of file berryIContextService.h.

◆ CONTEXT_ID_WORKBENCH_MENU

const QString berry::IContextService::CONTEXT_ID_WORKBENCH_MENU
static

The identifier for the context that is active when a workbench is active.

Definition at line 51 of file berryIContextService.h.


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