Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
berry::HandlerUtil Class Reference

#include <berryHandlerUtil.h>

Public Types

typedef ObjectList< ObjectString::PointerStringVectorType
 

Static Public Member Functions

static Object::ConstPointer GetVariable (const ExecutionEvent::ConstPointer &event, const QString &name)
 
static Object::ConstPointer GetVariableChecked (const ExecutionEvent::ConstPointer &event, const QString &name)
 
static Object::ConstPointer GetVariable (Object::Pointer context, const QString &name)
 
static StringVectorType::ConstPointer GetActiveContexts (const ExecutionEvent::ConstPointer &event)
 
static StringVectorType::ConstPointer GetActiveContextsChecked (const ExecutionEvent::ConstPointer &event)
 
static IWorkbenchWindow::Pointer GetActiveWorkbenchWindow (const ExecutionEvent::ConstPointer &event)
 
static IWorkbenchWindow::Pointer GetActiveWorkbenchWindowChecked (const ExecutionEvent::ConstPointer &event)
 
static ObjectString::ConstPointer GetActiveEditorId (const ExecutionEvent::ConstPointer &event)
 
static ObjectString::ConstPointer GetActiveEditorIdChecked (const ExecutionEvent::ConstPointer &event)
 
static IWorkbenchPart::Pointer GetActivePart (const ExecutionEvent::ConstPointer &event)
 
static IWorkbenchPart::Pointer GetActivePartChecked (const ExecutionEvent::ConstPointer &event)
 
static ObjectString::ConstPointer GetActivePartId (const ExecutionEvent::ConstPointer &event)
 
static ObjectString::ConstPointer GetActivePartIdChecked (const ExecutionEvent::ConstPointer &event)
 
static IWorkbenchPartSite::Pointer GetActiveSite (const ExecutionEvent::ConstPointer &event)
 
static IWorkbenchPartSite::Pointer GetActiveSiteChecked (const ExecutionEvent::ConstPointer &event)
 
static ISelection::ConstPointer GetCurrentSelection (const ExecutionEvent::ConstPointer &event)
 
static ISelection::ConstPointer GetCurrentSelectionChecked (const ExecutionEvent::ConstPointer &event)
 
static StringVectorType::ConstPointer GetActiveMenus (const ExecutionEvent::ConstPointer &event)
 
static StringVectorType::ConstPointer GetActiveMenusChecked (const ExecutionEvent::ConstPointer &event)
 
static ISelection::ConstPointer GetActiveMenuSelection (const ExecutionEvent::ConstPointer &event)
 
static ISelection::ConstPointer GetActiveMenuSelectionChecked (const ExecutionEvent::ConstPointer &event)
 
static ISelection::ConstPointer GetActiveMenuEditorInput (const ExecutionEvent::ConstPointer &event)
 
static ISelection::ConstPointer GetActiveMenuEditorInputChecked (const ExecutionEvent::ConstPointer &event)
 
static ISelection::ConstPointer GetShowInSelection (const ExecutionEvent::ConstPointer &event)
 
static ISelection::ConstPointer GetShowInSelectionChecked (const ExecutionEvent::ConstPointer &event)
 
static Object::ConstPointer GetShowInInput (const ExecutionEvent::ConstPointer &event)
 
static Object::ConstPointer GetShowInInputChecked (const ExecutionEvent::ConstPointer &event)
 
static bool ToggleCommandState (const SmartPointer< Command > &command)
 
static bool MatchesRadioState (const SmartPointer< ExecutionEvent > &event)
 
static void UpdateRadioState (const SmartPointer< Command > &command, const QString &newState)
 

Detailed Description

Some common utilities for working with handlers in Platform UI.

Note: this class should not be instantiated or extended by clients.

Since
3.3

Definition at line 40 of file berryHandlerUtil.h.

Member Typedef Documentation

◆ StringVectorType

Member Function Documentation

◆ GetActiveContexts()

HandlerUtil::StringVectorType::ConstPointer berry::HandlerUtil::GetActiveContexts ( const ExecutionEvent::ConstPointer event)
static

Return the active contexts.

Parameters
eventThe execution event that contains the application context
Returns
a collection of String contextIds, or null.

Definition at line 80 of file berryHandlerUtil.cpp.

References berry::ISources::ACTIVE_CONTEXT_NAME(), berry::SmartPointer< TObjectType >::Cast(), and GetVariable().

◆ GetActiveContextsChecked()

HandlerUtil::StringVectorType::ConstPointer berry::HandlerUtil::GetActiveContextsChecked ( const ExecutionEvent::ConstPointer event)
static

Return the active contexts.

Parameters
eventThe execution event that contains the application context
Returns
a collection of String contextIds. Will not return null.
Exceptions
ExecutionExceptionIf the context variable is not found.

Definition at line 87 of file berryHandlerUtil.cpp.

References berry::ISources::ACTIVE_CONTEXT_NAME(), berry::SmartPointer< TObjectType >::Cast(), and GetVariableChecked().

◆ GetActiveEditorId()

ObjectString::ConstPointer berry::HandlerUtil::GetActiveEditorId ( const ExecutionEvent::ConstPointer event)
static

Return the active editor.

Parameters
eventThe execution event that contains the application context
Returns
the active editor, or null. Return the active editor.
Parameters
eventThe execution event that contains the application context
Returns
the active editor. Will not return null.
Exceptions
ExecutionExceptionIf the active editor variable is not found. Return the part id of the active editor.
Parameters
eventThe execution event that contains the application context
Returns
the part id of the active editor, or null.

Definition at line 120 of file berryHandlerUtil.cpp.

References berry::ISources::ACTIVE_EDITOR_ID_NAME(), berry::SmartPointer< TObjectType >::Cast(), and GetVariable().

◆ GetActiveEditorIdChecked()

ObjectString::ConstPointer berry::HandlerUtil::GetActiveEditorIdChecked ( const ExecutionEvent::ConstPointer event)
static

Return the part id of the active editor.

Parameters
eventThe execution event that contains the application context
Returns
the part id of the active editor. Will not return null.
Exceptions
ExecutionExceptionIf the active editor id variable is not found.

Definition at line 127 of file berryHandlerUtil.cpp.

References berry::ISources::ACTIVE_EDITOR_ID_NAME(), berry::SmartPointer< TObjectType >::Cast(), and GetVariableChecked().

◆ GetActiveMenuEditorInput()

ISelection::ConstPointer berry::HandlerUtil::GetActiveMenuEditorInput ( const ExecutionEvent::ConstPointer event)
static

Return the active menu editor input, if available. The active menu is a registered context menu.

Parameters
eventThe execution event that contains the application context
Returns
the active menu editor, or null.

Definition at line 288 of file berryHandlerUtil.cpp.

References berry::ISources::ACTIVE_MENU_EDITOR_INPUT_NAME(), berry::SmartPointer< TObjectType >::Cast(), and GetVariable().

◆ GetActiveMenuEditorInputChecked()

ISelection::ConstPointer berry::HandlerUtil::GetActiveMenuEditorInputChecked ( const ExecutionEvent::ConstPointer event)
static

Return the active menu editor input. The active menu is a registered context menu. Some context menus do not include the editor input which will throw an exception.

Parameters
eventThe execution event that contains the application context
Returns
the active menu editor input. Will not return null.
Exceptions
ExecutionExceptionIf the active menu editor input variable is not found.

Definition at line 296 of file berryHandlerUtil.cpp.

References berry::ISources::ACTIVE_MENU_EDITOR_INPUT_NAME(), berry::SmartPointer< TObjectType >::Cast(), and GetVariableChecked().

◆ GetActiveMenus()

HandlerUtil::StringVectorType::ConstPointer berry::HandlerUtil::GetActiveMenus ( const ExecutionEvent::ConstPointer event)
static

Return the menu IDs that were applied to the registered context menu. For example, #CompilationUnitEditorContext.

Parameters
eventThe execution event that contains the application context
Returns
the menu IDs, or null.

Definition at line 223 of file berryHandlerUtil.cpp.

References berry::ISources::ACTIVE_MENU_NAME(), berry::SmartPointer< TObjectType >::Cast(), and GetVariable().

◆ GetActiveMenusChecked()

HandlerUtil::StringVectorType::ConstPointer berry::HandlerUtil::GetActiveMenusChecked ( const ExecutionEvent::ConstPointer event)
static

Return the menu IDs that were applied to the registered context menu. For example, #CompilationUnitEditorContext.

Parameters
eventThe execution event that contains the application context
Returns
the menu IDs. Will not return null.
Exceptions
ExecutionExceptionIf the active menus variable is not found.

Definition at line 231 of file berryHandlerUtil.cpp.

References berry::ISources::ACTIVE_MENU_NAME(), berry::SmartPointer< TObjectType >::Cast(), and GetVariableChecked().

◆ GetActiveMenuSelection()

ISelection::ConstPointer berry::HandlerUtil::GetActiveMenuSelection ( const ExecutionEvent::ConstPointer event)
static

Return the active menu selection. The active menu is a registered context menu.

Parameters
eventThe execution event that contains the application context
Returns
the active menu selection, or null.

Definition at line 244 of file berryHandlerUtil.cpp.

References berry::ISources::ACTIVE_MENU_SELECTION_NAME(), berry::SmartPointer< TObjectType >::Cast(), and GetVariable().

◆ GetActiveMenuSelectionChecked()

ISelection::ConstPointer berry::HandlerUtil::GetActiveMenuSelectionChecked ( const ExecutionEvent::ConstPointer event)
static

Return the active menu selection. The active menu is a registered context menu.

Parameters
eventThe execution event that contains the application context
Returns
the active menu selection. Will not return null.
Exceptions
ExecutionExceptionIf the active menu selection variable is not found.

Definition at line 252 of file berryHandlerUtil.cpp.

References berry::ISources::ACTIVE_MENU_SELECTION_NAME(), berry::SmartPointer< TObjectType >::Cast(), and GetVariableChecked().

◆ GetActivePart()

IWorkbenchPart::Pointer berry::HandlerUtil::GetActivePart ( const ExecutionEvent::ConstPointer event)
static

Return the active part.

Parameters
eventThe execution event that contains the application context
Returns
the active part, or null.

Definition at line 140 of file berryHandlerUtil.cpp.

References berry::ISources::ACTIVE_PART_NAME(), berry::SmartPointer< TObjectType >::GetPointer(), and GetVariable().

◆ GetActivePartChecked()

IWorkbenchPart::Pointer berry::HandlerUtil::GetActivePartChecked ( const ExecutionEvent::ConstPointer event)
static

Return the active part.

Parameters
eventThe execution event that contains the application context
Returns
the active part. Will not return null.
Exceptions
ExecutionExceptionIf the active part variable is not found.

Definition at line 147 of file berryHandlerUtil.cpp.

References berry::ISources::ACTIVE_PART_NAME(), berry::SmartPointer< TObjectType >::Cast(), berry::SmartPointer< TObjectType >::GetPointer(), and GetVariableChecked().

◆ GetActivePartId()

ObjectString::ConstPointer berry::HandlerUtil::GetActivePartId ( const ExecutionEvent::ConstPointer event)
static

Return the part id of the active part.

Parameters
eventThe execution event that contains the application context
Returns
the part id of the active part, or null.

Definition at line 160 of file berryHandlerUtil.cpp.

References berry::ISources::ACTIVE_PART_ID_NAME(), berry::SmartPointer< TObjectType >::Cast(), and GetVariable().

◆ GetActivePartIdChecked()

ObjectString::ConstPointer berry::HandlerUtil::GetActivePartIdChecked ( const ExecutionEvent::ConstPointer event)
static

Return the part id of the active part.

Parameters
eventThe execution event that contains the application context
Returns
the part id of the active part. Will not return null.
Exceptions
ExecutionExceptionIf the active part id variable is not found.

Definition at line 167 of file berryHandlerUtil.cpp.

References berry::ISources::ACTIVE_PART_ID_NAME(), berry::SmartPointer< TObjectType >::Cast(), and GetVariableChecked().

◆ GetActiveSite()

IWorkbenchPartSite::Pointer berry::HandlerUtil::GetActiveSite ( const ExecutionEvent::ConstPointer event)
static

Return the active part site.

Parameters
eventThe execution event that contains the application context
Returns
the active part site, or null.

Definition at line 180 of file berryHandlerUtil.cpp.

References berry::ISources::ACTIVE_SITE_NAME(), berry::SmartPointer< TObjectType >::GetPointer(), and GetVariable().

◆ GetActiveSiteChecked()

IWorkbenchPartSite::Pointer berry::HandlerUtil::GetActiveSiteChecked ( const ExecutionEvent::ConstPointer event)
static

Return the active part site.

Parameters
eventThe execution event that contains the application context
Returns
the active part site. Will not return null.
Exceptions
ExecutionExceptionIf the active part site variable is not found.

Definition at line 188 of file berryHandlerUtil.cpp.

References berry::ISources::ACTIVE_SITE_NAME(), berry::SmartPointer< TObjectType >::Cast(), berry::SmartPointer< TObjectType >::GetPointer(), and GetVariableChecked().

◆ GetActiveWorkbenchWindow()

IWorkbenchWindow::Pointer berry::HandlerUtil::GetActiveWorkbenchWindow ( const ExecutionEvent::ConstPointer event)
static

Return the active shell. Is not necessarily the active workbench window shell.

Parameters
eventThe execution event that contains the application context
Returns
the active shell, or null. Return the active shell. Is not necessarily the active workbench window shell.
Parameters
eventThe execution event that contains the application context
Returns
the active shell. Will not return null.
Exceptions
ExecutionExceptionIf the active shell variable is not found. Return the active workbench window.
Parameters
eventThe execution event that contains the application context
Returns
the active workbench window, or null.

Definition at line 266 of file berryHandlerUtil.cpp.

References berry::ISources::ACTIVE_WORKBENCH_WINDOW_NAME(), berry::SmartPointer< TObjectType >::GetPointer(), and GetVariable().

◆ GetActiveWorkbenchWindowChecked()

IWorkbenchWindow::Pointer berry::HandlerUtil::GetActiveWorkbenchWindowChecked ( const ExecutionEvent::ConstPointer event)
static

Return the active workbench window.

Parameters
eventThe execution event that contains the application context
Returns
the active workbench window. Will not return null.
Exceptions
ExecutionExceptionIf the active workbench window variable is not found.

Definition at line 274 of file berryHandlerUtil.cpp.

References berry::ISources::ACTIVE_WORKBENCH_WINDOW_NAME(), berry::SmartPointer< TObjectType >::Cast(), berry::SmartPointer< TObjectType >::GetPointer(), and GetVariableChecked().

◆ GetCurrentSelection()

ISelection::ConstPointer berry::HandlerUtil::GetCurrentSelection ( const ExecutionEvent::ConstPointer event)
static

Return the current selection.

Parameters
eventThe execution event that contains the application context
Returns
the current selection, or null.

Definition at line 201 of file berryHandlerUtil.cpp.

References berry::ISources::ACTIVE_CURRENT_SELECTION_NAME(), berry::SmartPointer< TObjectType >::Cast(), and GetVariable().

◆ GetCurrentSelectionChecked()

ISelection::ConstPointer berry::HandlerUtil::GetCurrentSelectionChecked ( const ExecutionEvent::ConstPointer event)
static

Return the current selection.

Parameters
eventThe execution event that contains the application context
Returns
the current selection. Will not return null.
Exceptions
ExecutionExceptionIf the current selection variable is not found.

Definition at line 209 of file berryHandlerUtil.cpp.

References berry::ISources::ACTIVE_CURRENT_SELECTION_NAME(), berry::SmartPointer< TObjectType >::Cast(), and GetVariableChecked().

◆ GetShowInInput()

Object::ConstPointer berry::HandlerUtil::GetShowInInput ( const ExecutionEvent::ConstPointer event)
static

Return the ShowInContext input.

Parameters
eventThe execution event that contains the application context
Returns
the show in input, or null.

Definition at line 331 of file berryHandlerUtil.cpp.

References GetVariable(), and berry::ISources::SHOW_IN_INPUT().

◆ GetShowInInputChecked()

Object::ConstPointer berry::HandlerUtil::GetShowInInputChecked ( const ExecutionEvent::ConstPointer event)
static

Return the ShowInContext input. Will not return null.

Parameters
eventThe execution event that contains the application context
Returns
the show in input, or null.
Exceptions
ExecutionExceptionIf the show in input variable is not found.

Definition at line 342 of file berryHandlerUtil.cpp.

References GetVariableChecked(), and berry::ISources::SHOW_IN_INPUT().

◆ GetShowInSelection()

ISelection::ConstPointer berry::HandlerUtil::GetShowInSelection ( const ExecutionEvent::ConstPointer event)
static

Return the ShowInContext selection.

Parameters
eventThe execution event that contains the application context
Returns
the show in selection, or null.

Definition at line 310 of file berryHandlerUtil.cpp.

References berry::SmartPointer< TObjectType >::Cast(), GetVariable(), and berry::ISources::SHOW_IN_SELECTION().

◆ GetShowInSelectionChecked()

ISelection::ConstPointer berry::HandlerUtil::GetShowInSelectionChecked ( const ExecutionEvent::ConstPointer event)
static

Return the ShowInContext selection. Will not return null.

Parameters
eventThe execution event that contains the application context
Returns
the show in selection, or null.
Exceptions
ExecutionExceptionIf the show in selection variable is not found.

Definition at line 318 of file berryHandlerUtil.cpp.

References berry::SmartPointer< TObjectType >::Cast(), GetVariableChecked(), and berry::ISources::SHOW_IN_SELECTION().

◆ GetVariable() [1/2]

Object::ConstPointer berry::HandlerUtil::GetVariable ( const ExecutionEvent::ConstPointer event,
const QString &  name 
)
static

Extract the variable.

Parameters
eventThe execution event that contains the application context
nameThe variable name to extract.
Returns
The object from the application context, or null if it could not be found.

Definition at line 46 of file berryHandlerUtil.cpp.

References berry::SmartPointer< TObjectType >::Cast(), and berry::IEvaluationContext::UNDEFINED_VARIABLE.

Referenced by GetActiveContexts(), GetActiveEditorId(), GetActiveMenuEditorInput(), GetActiveMenus(), GetActiveMenuSelection(), GetActivePart(), GetActivePartId(), GetActiveSite(), GetActiveWorkbenchWindow(), GetCurrentSelection(), GetShowInInput(), GetShowInSelection(), and GetVariableChecked().

◆ GetVariable() [2/2]

Object::ConstPointer berry::HandlerUtil::GetVariable ( Object::Pointer  context,
const QString &  name 
)
static

Extract the variable.

Parameters
contextThe IEvaluationContext or null
nameThe variable name to extract.
Returns
The object from the application context, or null if it could not be found.

Definition at line 68 of file berryHandlerUtil.cpp.

References berry::SmartPointer< TObjectType >::Cast(), berry::SmartPointer< TObjectType >::IsNotNull(), and berry::IEvaluationContext::UNDEFINED_VARIABLE.

◆ GetVariableChecked()

Object::ConstPointer berry::HandlerUtil::GetVariableChecked ( const ExecutionEvent::ConstPointer event,
const QString &  name 
)
static

Extract the variable.

Parameters
eventThe execution event that contains the application context
nameThe variable name to extract.
Returns
The object from the application context. Will not return null.
Exceptions
ExecutionExceptionif the variable is not found.

Definition at line 57 of file berryHandlerUtil.cpp.

References GetVariable(), and berry::SmartPointer< TObjectType >::IsNull().

Referenced by GetActiveContextsChecked(), GetActiveEditorIdChecked(), GetActiveMenuEditorInputChecked(), GetActiveMenusChecked(), GetActiveMenuSelectionChecked(), GetActivePartChecked(), GetActivePartIdChecked(), GetActiveSiteChecked(), GetActiveWorkbenchWindowChecked(), GetCurrentSelectionChecked(), GetShowInInputChecked(), and GetShowInSelectionChecked().

◆ MatchesRadioState()

bool berry::HandlerUtil::MatchesRadioState ( const SmartPointer< ExecutionEvent > &  event)
static

Checks whether the radio state of the command is same as the radio state parameter's value

Parameters
eventThe execution event that contains the application context
Returns
true whe the values are same, false otherwise
Exceptions
ExecutionExceptionWhen the command doesn't have the radio state or the event doesn't have the radio state parameter

Definition at line 374 of file berryHandlerUtil.cpp.

References berry::SmartPointer< TObjectType >::Cast(), berry::SmartPointer< TObjectType >::IsNull(), berry::RadioState::PARAMETER_ID, and berry::RadioState::STATE_ID.

◆ ToggleCommandState()

bool berry::HandlerUtil::ToggleCommandState ( const SmartPointer< Command > &  command)
static

Toggles the command's state.

Parameters
commandThe command whose state needs to be toggled
Returns
the original value before toggling
Exceptions
ExecutionExceptionWhen the command doesn't contain the toggle state or when the state doesn't contain a boolean value

Definition at line 354 of file berryHandlerUtil.cpp.

References berry::SmartPointer< TObjectType >::Cast(), berry::SmartPointer< TObjectType >::IsNull(), and berry::RegistryToggleState::STATE_ID.

◆ UpdateRadioState()

void berry::HandlerUtil::UpdateRadioState ( const SmartPointer< Command > &  command,
const QString &  newState 
)
static

Updates the radio state of the command to the given value

Parameters
commandthe command whose state should be updated
newStatethe new state
Exceptions
ExecutionExceptionWhen the command doesn't have a radio state

Definition at line 398 of file berryHandlerUtil.cpp.

References berry::SmartPointer< TObjectType >::IsNull(), and berry::RadioState::STATE_ID.


The documentation for this class was generated from the following files: