SmartPointer<IHandlerActivation> HandlerService::ActivateHandler( const SmartPointer<IHandlerActivation>& childActivation) { const QString commandId = childActivation->GetCommandId(); const IHandler::Pointer handler = childActivation->GetHandler(); const Expression::Pointer expression = childActivation->GetExpression(); const int depth = childActivation->GetDepth() + 1; const IHandlerActivation::Pointer localActivation( new HandlerActivation(commandId, handler, expression, depth, this)); handlerAuthority->ActivateHandler(localActivation); return localActivation; }
std::string CommandManager::GetHelpContextId(const SmartPointer<const Command> command) const throw(NotDefinedException) { // Check if the command is defined. if (!command->IsDefined()) { throw NotDefinedException("The command is not defined. " //$NON-NLS-1$ + command->GetId()); } // Check the handler. const IHandler::Pointer handler(command->GetHandler()); if (handler) { const IHandler::WeakPtr weakHandler(handler); Poco::HashMap<WeakPointer<IHandler>, std::string, Object::Hash>::ConstIterator itr = helpContextIdsByHandler.find(weakHandler); if (itr != helpContextIdsByHandler.end() && !itr->second.empty()) { return itr->second; } } // Simply return whatever the command has as a help context identifier. return command->GetHelpContextId(); }
SmartPointer<IHandlerActivation> SlaveHandlerService::ActivateHandler(const SmartPointer<IHandlerActivation>& childActivation) { const QString commandId = childActivation->GetCommandId(); const IHandler::Pointer handler = childActivation->GetHandler(); const Expression::Pointer childExpression = childActivation->GetExpression(); Expression::Pointer expression = defaultExpression; if (childExpression.IsNotNull() && defaultExpression.IsNotNull()) { const AndExpression::Pointer andExpression(new AndExpression()); andExpression->Add(childExpression); andExpression->Add(defaultExpression); expression = andExpression; } else if (childExpression.IsNotNull()) { expression = childExpression; } const int depth = childActivation->GetDepth() + 1; const IHandlerActivation::Pointer localActivation( new HandlerActivation(commandId, handler, expression, depth, this)); return DoActivation(localActivation); }