void CRepositoryFilterNode::ItemExpanding() { CComPtr<IRepository> rep = m_owner->GetRepository(); IModuleVector modules; rep->GetAllModules(modules, false, true, true); for(IAttributeVector::iterator itr = m_results->begin(); itr != m_results->end(); ++itr) { std::_tstring module = itr->get()->GetModuleQualifiedLabel(); if (m_modules.find(module) == m_modules.end()) { IModule * found = Find(&modules, module); ATLASSERT(found); m_modules[module] = new CModuleFilterNode(m_owner, found); ATLASSERT(m_modules[module].get()); } m_modules[module]->AddAttribute(itr->get()); } for(IModuleVector::iterator itr = modules.begin(); itr != modules.end(); ++itr) { if (m_modules.find(itr->get()->GetQualifiedLabel()) != m_modules.end()) { m_modules[itr->get()->GetQualifiedLabel()]->InsertBelow(*GetTreeView(), *this); m_modules[itr->get()->GetQualifiedLabel()]->Expand(); } } }
unsigned GetModules(const std::_tstring & module, IModuleVector & modules, bool GetChecksum = false, bool noRefresh=false) const { IModuleVector allModules; GetAllModules(allModules, GetChecksum, noRefresh); for(IModuleVector::iterator itr = allModules.begin(); itr != allModules.end(); ++itr) { IModule * parent = itr->get()->GetParentModule(); if ((!parent && module.empty()) || (parent && boost::algorithm::equals(module, parent->GetQualifiedLabel()))) modules.push_back(itr->get()); } return 0; }
IModule * Rename(const TCHAR* label) { IModuleVector children; GetModules(children); for(IModuleVector::iterator itr = children.begin(); itr != children.end(); ++itr) { std::_tstring qualifiedLabel = label; qualifiedLabel += _T("."); qualifiedLabel += itr->get()->GetLabel(); itr->get()->Rename(qualifiedLabel.c_str()); } return m_repository->RenameModule(GetQualifiedLabel(), label); }
IModule * GetModule(const TCHAR* label, bool GetChecksum = false, bool noBroadcast = false) const { clib::recursive_mutex::scoped_lock proc(m_mutex); IModuleVector modules; GetAllModules(modules, GetChecksum, false, noBroadcast); for (IModuleVector::iterator itr = modules.begin(); itr != modules.end(); ++itr) { if (boost::algorithm::iequals(itr->get()->GetQualifiedLabel(), label)) { return itr->get(); } } return NULL; }
void CRepositoryNode::LoadModules(IModuleVector & modules, CLoadingNode * loading) { clib::recursive_mutex::scoped_lock lock(m_mutex); if (m_loading == loading) { m_loading->Delete(); m_loading = NULL; WTL::CLockWindowUpdate lock(*GetTreeView()); for (IModuleVector::iterator itr = modules.begin(); itr != modules.end(); ++itr) { CModuleNode * newNode = new CModuleNode(m_owner, itr->get()); newNode->InsertBelow(*GetTreeView(), m_bVirtualNode ? TVI_ROOT : *this); newNode->operator ()(itr->get()); } } }
void CModuleNode::ItemExpanding() { IModuleVector modules; IAttributeVector attributes; m_owner->OnLoading(); m_module->GetModules(modules); if (m_nextExpandShouldBeFast) { m_module->GetAttributes(attributes, true); m_nextExpandShouldBeFast = false; } else m_module->GetAttributes(attributes); m_owner->OnLoaded(m_module, attributes); WTL::CLockWindowUpdate lock(*GetTreeView()); for (IModuleVector::iterator itr = modules.begin(); itr != modules.end(); ++itr) { CModuleNode * newNode = new CModuleNode(m_owner, itr->get()); newNode->InsertBelow(*GetTreeView(), *this); newNode->operator ()(newNode->GetModule()); } for (IAttributeVector::iterator itr = attributes.begin(); itr != attributes.end(); ++itr) { CAttributeNode * newNode = new CAttributeNode(m_owner, itr->get()); newNode->InsertBelow(*GetTreeView(), *this); newNode->operator ()(newNode->GetAttribute(), false, NULL, false); } }
const TCHAR *GetChecksum() const { clib::recursive_mutex::scoped_lock proc(m_mutex); if (m_fullChecksum.GetLength() == 0) { m_fullChecksum = m_checksum; IModuleVector children; GetModules(children, true); for(IModuleVector::iterator itr = children.begin(); itr != children.end(); ++itr) m_fullChecksum += itr->get()->GetChecksum(); } return m_fullChecksum; }
bool Delete() { IModuleVector children; GetModules(children); for(IModuleVector::iterator itr = children.begin(); itr != children.end(); ++itr) itr->get()->Delete(); IAttributeVector childAttrs; GetAttributes(childAttrs, true); for(IAttributeVector::iterator itr = childAttrs.begin(); itr != childAttrs.end(); ++itr) itr->get()->Refresh(false, NULL, true); if (m_repository->DeleteModule(GetQualifiedLabel())) { DeleteModule(this); return true; } return false; }