Esempio n. 1
0
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();
		}
	}
}
 //  Attribute short cuts  ---
 IAttribute * GetAttribute(const TCHAR* module, const TCHAR* label, IAttributeType * type, int version, bool sandbox, bool text, bool placeholder) const
 {
     clib::recursive_mutex::scoped_lock proc(m_mutex);
     IAttributeVector attributes;
     GetAttributes(module, attributes);
     for (IAttributeVector::iterator itr = attributes.begin(); itr != attributes.end(); ++itr)
     {
         if (boost::algorithm::iequals(itr->get()->GetLabel(), label))
         {
             return itr->get();
         }
     }
     return NULL;
 }
Esempio n. 3
0
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);
	}
}
Esempio n. 4
0
void CModuleFilterNode::ItemExpanding()
{
	for(IAttributeVector::iterator itr = m_attrs.begin(); itr != m_attrs.end(); ++itr)
	{
		CAttributeNode * newNode = new CAttributeNode(m_owner, itr->get());
		newNode->InsertBelow(*GetTreeView(), *this);
		newNode->operator ()(newNode->GetAttribute(), false, NULL, false);
	}
}
Esempio n. 5
0
void CAttributeVectorView::Refresh()
{
    WTL::CLockWindowUpdate lock(m_hWnd);
    m_Tree.DeleteAllItems();
    for(IAttributeVector::iterator itr = m_attrs.begin(); itr != m_attrs.end(); ++itr)
    {
        CComPtr<CAttributeNode> item = new CAttributeNode(m_Owner, itr->get(), true);
        item->InsertBelow(m_Tree, TVI_ROOT);
        item->operator ()(item->GetAttribute(), false, NULL, false);
    }
}
    bool Save(IAttributeVector & attributes, bool noBroadcast = false)
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        for(IAttributeVector::iterator itr = attributes.begin(); itr != attributes.end(); ++itr)
        {
            std::_tstring newModFile;
            bool inCurrentAttr = false;
            bool alreadyExisted = false;

            typedef std::vector<std::_tstring> split_vector_type;
            split_vector_type SplitVec; 
            boost::algorithm::split(SplitVec, m_modFile, boost::algorithm::is_any_of("\r\n"), boost::algorithm::token_compress_on);

            for (split_vector_type::const_iterator itr2 = SplitVec.begin(); itr2 != SplitVec.end(); ++itr2)
            {
                std::_tstring line = *itr2;
                std::_tstring origline = line;
                if (boost::algorithm::istarts_with(line, IMPORT_MARKER))
                {
                    boost::algorithm::ireplace_first(line, IMPORT_MARKER, _T(""));
                    boost::algorithm::trim(line);
                    inCurrentAttr = boost::algorithm::iequals(line, itr->get()->GetQualifiedLabel());
                    if (inCurrentAttr)
                    {
                        newModFile += (boost::_tformat(_T("%1%%2%\r\n%3%\r\n")) % IMPORT_MARKER % itr->get()->GetQualifiedLabel() % itr->get()->GetText(true, noBroadcast)).str();
                        alreadyExisted = true;
                        continue;
                    }
                }
                if (!inCurrentAttr)
                {
                    newModFile += origline + _T("\r\n");
                }
            }
            if (!alreadyExisted)
                newModFile += (boost::_tformat(_T("%1%%2%\r\n%3%\r\n")) % IMPORT_MARKER % itr->get()->GetQualifiedLabel() % itr->get()->GetText(true, noBroadcast)).str();
            m_modFile = newModFile.c_str();
        }

        CUnicodeFile file;
        if (file.Create(pathToWString(m_path).c_str()))
        {
            file.Write(m_modFile);
            file.Close();
        }

        return true;
    }
Esempio n. 7
0
    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;
    }