00001 #include "stdafx.h" 00002 #include "MetaGMEVisitor.h" 00003 #include "NmspSpec.h" 00004 00005 namespace MetaBON 00006 { 00007 00008 MetaGMEVisitor::MetaGMEVisitor() { } 00009 00010 MetaGMEVisitor::~MetaGMEVisitor() { } 00011 00012 // virtual 00013 void MetaGMEVisitor::visitFolderImpl( const BON::Folder& folder) // rootfolder's accept will call this 00014 { 00015 if( folder->getFolderMeta().name() == "RootFolder") 00016 { 00017 std::string nmsp = ""; 00018 BON::RegistryNode rn = folder->getRegistry()->getChild( "Namespace"); 00019 if( rn) nmsp = rn->getValue(); 00020 else nmsp = ""; 00021 00022 m_data.push_back( std::make_pair( folder, nmsp)); 00023 00024 //folder->getProject()->consoleMsg( folder->getName(), MSG_INFO); 00025 } 00026 } 00027 00028 void MetaGMEVisitor::showOptions() 00029 { 00030 std::string msg; 00031 for( VectorOfPairs::const_iterator it = m_data.begin() 00032 ; it != m_data.end() 00033 ; ++it) 00034 { 00035 msg += it->first->getName() + " : " + it->second + "<br>"; 00036 } 00037 00038 if( !msg.empty()) 00039 { 00040 //m_data.begin()->first->getProject()->consoleMsg( msg, MSG_INFO); 00041 } 00042 00043 NmspSpec dlg; 00044 dlg.setData( m_data); 00045 if( dlg.DoModal() == IDOK) 00046 { 00047 dlg.getData( m_data); 00048 00049 // write back the data 00050 for( VectorOfPairs::const_iterator it = m_data.begin() 00051 ; it != m_data.end() 00052 ; ++it) 00053 { 00054 if( !it->first->isInLibrary()) // libraries nested in libraries can't be written 00055 it->first->getRegistry()->getChild( "Namespace")->setValue( it->second); 00056 } 00057 } 00058 } 00059 00060 } // namespace 00061