1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
23 #include <ParametersPlugin_Plugin.h>
24 #include <ParametersPlugin_Parameter.h>
25 #include <ParametersPlugin_ParametersMgr.h>
26 #include <ParametersPlugin_Validators.h>
27 #include <ParametersPlugin_WidgetCreator.h>
29 #include <ModuleBase_WidgetCreatorFactory.h>
31 #include <ModelAPI_Session.h>
32 #include <ModelAPI_Validator.h>
36 // the only created instance of this plugin
37 static ParametersPlugin_Plugin* MY_PARAMETERSPLUGIN_INSTANCE = new ParametersPlugin_Plugin();
39 ParametersPlugin_Plugin::ParametersPlugin_Plugin()
41 // register this plugin
42 WidgetCreatorFactoryPtr aWidgetCreatorFactory = ModuleBase_WidgetCreatorFactory::get();
43 aWidgetCreatorFactory->registerCreator(
44 std::shared_ptr<ParametersPlugin_WidgetCreator>(new ParametersPlugin_WidgetCreator()));
46 SessionPtr aSession = ModelAPI_Session::get();
47 aSession->registerPlugin(this);
49 ModelAPI_ValidatorsFactory* aFactory = aSession->validators();
50 aFactory->registerValidator("Parameters_VariableValidator",
51 new ParametersPlugin_VariableValidator);
52 aFactory->registerValidator("Parameters_ExpressionValidator",
53 new ParametersPlugin_ExpressionValidator);
56 std::shared_ptr<ParametersPlugin_EvalListener>(new ParametersPlugin_EvalListener());
59 FeaturePtr ParametersPlugin_Plugin::createFeature(std::string theFeatureID)
61 // TODO: register some features
62 if (theFeatureID == ParametersPlugin_Parameter::ID()) {
63 return FeaturePtr(new ParametersPlugin_Parameter);
65 if (theFeatureID == ParametersPlugin_ParametersMgr::ID()) {
66 return FeaturePtr(new ParametersPlugin_ParametersMgr);