| 316 | } |
| 317 | |
| 318 | bool HandlerProxy::LoadHandler() const |
| 319 | { |
| 320 | if (handler.IsNull()) |
| 321 | { |
| 322 | HandlerProxy* self = const_cast<HandlerProxy*>(this); |
| 323 | // Load the handler. |
| 324 | try |
| 325 | { |
| 326 | if (configurationElement.IsNotNull()) |
| 327 | { |
| 328 | handler = configurationElement->CreateExecutableExtension<IHandler>(handlerAttributeName); |
| 329 | if (handler.IsNotNull()) |
| 330 | { |
| 331 | handler->AddHandlerListener(GetHandlerListener()); |
| 332 | self->SetEnabled(evaluationService == nullptr ? IEvaluationContext::Pointer(nullptr) : evaluationService->GetCurrentState()); |
| 333 | self->RefreshElements(); |
| 334 | return true; |
| 335 | } |
| 336 | else |
| 337 | { |
| 338 | const QString message = "The proxied handler was the wrong class"; |
| 339 | IStatus::Pointer status( |
| 340 | new Status(IStatus::ERROR_TYPE, PlatformUI::PLUGIN_ID(), 0, message, BERRY_STATUS_LOC)); |
| 341 | WorkbenchPlugin::Log(message, status); |
| 342 | configurationElement = nullptr; |
| 343 | loadException = new ctkException("Class cast exception"); |
| 344 | } |
| 345 | } |
| 346 | } |
| 347 | catch (const CoreException& e) |
| 348 | { |
| 349 | const QString message = "The proxied handler for '" + configurationElement->GetAttribute(handlerAttributeName) |
| 350 | + "' could not be loaded"; |
| 351 | IStatus::Pointer status( |
| 352 | new Status(IStatus::ERROR_TYPE, PlatformUI::PLUGIN_ID(), 0, message, e, BERRY_STATUS_LOC)); |
| 353 | WorkbenchPlugin::Log(message, status); |
| 354 | configurationElement = nullptr; |
| 355 | loadException = e.clone(); |
| 356 | } |
| 357 | return false; |
| 358 | } |
| 359 | |
| 360 | return true; |
| 361 | } |
| 362 | |
| 363 | IHandlerListener* HandlerProxy::GetHandlerListener() const |
| 364 | { |
nothing calls this directly
no test coverage detected