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

Method LoadHandler

Plugins/org.blueberry.ui.qt/src/internal/berryHandlerProxy.cpp:318–361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

316}
317
318bool 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
363IHandlerListener* HandlerProxy::GetHandlerListener() const
364{

Callers

nothing calls this directly

Calls 8

SetEnabledMethod · 0.95
RefreshElementsMethod · 0.95
IsNotNullMethod · 0.80
AddHandlerListenerMethod · 0.80
IsNullMethod · 0.45
GetCurrentStateMethod · 0.45
GetAttributeMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected