X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_Session.cpp;h=d264be4d34519940d9dd5cda5dbc55886f388248;hb=4cc670477fa518dd1e90c709d28711ffdbc90085;hp=d8e5166986f5a7cfb9329ccf7747ba2e0993dfde;hpb=9e869ede4d8c56262bb20534543c2bf56cd6a91b;p=modules%2Fshaper.git diff --git a/src/Model/Model_Session.cpp b/src/Model/Model_Session.cpp index d8e516698..d264be4d3 100644 --- a/src/Model/Model_Session.cpp +++ b/src/Model/Model_Session.cpp @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: Model_Session.cxx // Created: 20 Mar 2014 // Author: Mikhail PONIKAROV @@ -61,9 +63,15 @@ void Model_Session::finishOperation() void Model_Session::abortOperation() { ROOT_DOC->abortOperation(); + // here the update mechanism may work after abort, so, supress the warnings about + // modifications outside of the transactions + bool aWasCheck = myCheckTransactions; + myCheckTransactions = false; static std::shared_ptr anAbortMsg (new Events_Message(Events_Loop::eventByName("AbortOperation"))); Events_Loop::loop()->send(anAbortMsg); + myCheckTransactions = true; + myCheckTransactions = aWasCheck; } bool Model_Session::isOperation() @@ -141,6 +149,12 @@ std::shared_ptr Model_Session::moduleDocument() Model_Application::getApplication()->getDocument("root")); } +std::shared_ptr Model_Session::document(std::string theDocID) +{ + return std::shared_ptr( + Model_Application::getApplication()->getDocument(theDocID)); +} + bool Model_Session::hasModuleDocument() { return Model_Application::getApplication()->hasDocument("root"); @@ -283,6 +297,14 @@ void Model_Session::registerPlugin(ModelAPI_Plugin* thePlugin) static Events_ID EVENT_LOAD = Events_Loop::loop()->eventByName(EVENT_PLUGIN_LOADED); ModelAPI_EventCreator::get()->sendUpdated(ObjectPtr(), EVENT_LOAD); Events_Loop::loop()->flush(EVENT_LOAD); + // If the plugin has an ability to process GUI events, register it + Events_Listener* aListener = dynamic_cast(thePlugin); + if (aListener) { + Events_Loop* aLoop = Events_Loop::loop(); + static Events_ID aStateRequestEventId = + Events_Loop::loop()->eventByName(EVENT_FEATURE_STATE_REQUEST); + aLoop->registerListener(aListener, aStateRequestEventId); + } } ModelAPI_ValidatorsFactory* Model_Session::validators()