X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_PluginManager.cpp;h=05f1586e678f1c1b5ba1df48cd2b668ee71926d8;hb=10afa56c18322075c75ff2616ac23853bd0c87ca;hp=7a0a20d0a009958e1b4e4b1073aaefdbe5d00bf8;hpb=d19f9bb678f86dd6aa27528a8b51084f5417d027;p=modules%2Fshaper.git diff --git a/src/Model/Model_PluginManager.cpp b/src/Model/Model_PluginManager.cpp index 7a0a20d0a..05f1586e6 100644 --- a/src/Model/Model_PluginManager.cpp +++ b/src/Model/Model_PluginManager.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -97,27 +98,34 @@ boost::shared_ptr Model_PluginManager::copy( Model_PluginManager::Model_PluginManager() { myPluginsInfoLoaded = false; - //TODO(sbh): Implement static method to extract event id [SEID] - static Events_ID aFeatureEvent = Events_Loop::eventByName("FeatureRegisterEvent"); - ModelAPI_PluginManager::SetPluginManager(boost::shared_ptr(this)); // register the configuration reading listener Events_Loop* aLoop = Events_Loop::loop(); - aLoop->registerListener(this, aFeatureEvent); + static Events_ID FeatureEvent = Events_Loop::eventByName("FeatureRegisterEvent"); + aLoop->registerListener(this, FeatureEvent); + aLoop->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_CREATED)); + aLoop->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_UPDATED)); + aLoop->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_DELETED)); } void Model_PluginManager::processEvent(const Events_Message* theMessage) { - const Config_FeatureMessage* aMsg = - dynamic_cast(theMessage); - if (aMsg) { - // proccess the plugin info, load plugin - if (myPlugins.find(aMsg->id()) == myPlugins.end()) { - myPlugins[aMsg->id()] = aMsg->pluginLibrary(); + static Events_ID FeatureEvent = Events_Loop::eventByName("FeatureRegisterEvent"); + if (theMessage->eventID() == FeatureEvent) { + const Config_FeatureMessage* aMsg = + dynamic_cast(theMessage); + if (aMsg) { + // proccess the plugin info, load plugin + if (myPlugins.find(aMsg->id()) == myPlugins.end()) { + myPlugins[aMsg->id()] = aMsg->pluginLibrary(); + } } + // plugins information was started to load, so, it will be loaded + myPluginsInfoLoaded = true; + } else { // create/update/delete + if (!rootDocument()->isOperation()) + Events_Error::send("Modification of data structure outside of the transaction"); } - // plugins information was started to load, so, it will be loaded - myPluginsInfoLoaded = true; } void Model_PluginManager::LoadPluginsInfo()