File: register_plugin.cpp

package info (click to toggle)
mysql-workbench 5.2.40%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 53,880 kB
  • sloc: cpp: 419,850; yacc: 74,784; xml: 54,510; python: 31,455; sh: 9,423; ansic: 4,736; makefile: 2,442; php: 529; java: 237
file content (95 lines) | stat: -rw-r--r-- 2,275 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include "stdafx.h"

#include "wb_config.h"

#include "grtpp.h"
#include "interfaces/plugin.h"
//#include "interfaces/rdbms_info.h"

#include "grtui/grt_wizard_plugin.h"

#include "grts/structs.db.mgmt.h"


#define MODULE_VERSION "1.0.0"



static grt::ListRef<app_Plugin> get_mysql_plugins_info(grt::GRT *grt);


class MySQLDbDiffReportingModuleImpl : public grt::ModuleImplBase, public PluginInterfaceImpl
{
public:
  MySQLDbDiffReportingModuleImpl(grt::CPPModuleLoader *ldr)
  : grt::ModuleImplBase(ldr)
  {
  }

  DEFINE_INIT_MODULE(MODULE_VERSION, "MySQL AB", grt::ModuleImplBase,
                     DECLARE_MODULE_FUNCTION(MySQLDbDiffReportingModuleImpl::getPluginInfo), 
                     DECLARE_MODULE_FUNCTION(MySQLDbDiffReportingModuleImpl::runWizard),
                     NULL);

  int runWizard()
  {
    extern grtui::WizardPlugin *createWbPluginDiffReport(grt::Module *module);
    
    grtui::WizardPlugin *wizard= createWbPluginDiffReport(this);
    int rc= wizard->run_wizard();
    delete wizard;
    
    return rc;
  }
  
  virtual grt::ListRef<app_Plugin> getPluginInfo()
  {
    return get_mysql_plugins_info(get_grt());
  }
};



static void set_object_argument(app_PluginRef &plugin, const std::string &struct_name)
{
  app_PluginObjectInputRef pdef(plugin.get_grt());

  pdef->objectStructName(struct_name);
  pdef->owner(plugin);

  plugin->inputValues().insert(pdef);
}



static grt::ListRef<app_Plugin> get_mysql_plugins_info(grt::GRT *grt)
{
  grt::ListRef<app_Plugin> plugins(grt);
  app_PluginRef diff_sql_generator(grt);

  {
    app_PluginRef plugin(grt);

    plugin->pluginType("standalone");
    plugin->moduleName("MySQLDbDiffReportingModule");
    plugin->moduleFunctionName("runWizard");
    plugin->name("db.mysql.plugin.diff_report.catalog");
    plugin->caption("Generate Catalog Diff Report");
    plugin->groups().insert("database/Database");

    grt::StringListRef document_types(grt);
    document_types.insert("workbench.Document");
    //plugin->documentStructNames(document_types);

    app_PluginObjectInputRef pdef(grt);
    pdef->objectStructName("db.Catalog");
    plugin->inputValues().insert(pdef);

    plugins.insert(plugin);
  }

  return plugins;
}


GRT_MODULE_ENTRY_POINT(MySQLDbDiffReportingModuleImpl);