MCPcopy Create free account
hub / github.com/MITK/MITK / ToggleCommandState

Method ToggleCommandState

Plugins/org.blueberry.ui.qt/src/handlers/berryHandlerUtil.cpp:354–372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

352}
353
354bool HandlerUtil::ToggleCommandState(const SmartPointer<Command>& command)
355{
356 State::Pointer state = command->GetState(RegistryToggleState::STATE_ID);
357 if(state.IsNull())
358 {
359 throw ExecutionException("The command does not have a toggle state");
360 }
361 if(ObjectBool::Pointer boolObj = state->GetValue().Cast<ObjectBool>())
362 {
363 bool oldValue = boolObj->GetValue();
364 Object::Pointer newValue(new ObjectBool(!oldValue));
365 state->SetValue(newValue);
366 return oldValue;
367 }
368 else
369 {
370 throw ExecutionException("The command's toggle state doesn't contain a boolean value");
371 }
372}
373
374bool HandlerUtil::MatchesRadioState(const SmartPointer<ExecutionEvent>& event)
375{

Callers

nothing calls this directly

Calls 4

GetStateMethod · 0.45
IsNullMethod · 0.45
GetValueMethod · 0.45
SetValueMethod · 0.45

Tested by

no test coverage detected