File: register_plugin.cpp

package info (click to toggle)
mysql-workbench 6.2.3%2Bdfsg-7
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 102,612 kB
  • ctags: 84,593
  • sloc: ansic: 804,682; cpp: 438,759; yacc: 59,129; python: 54,293; xml: 48,851; sql: 5,512; objc: 1,414; makefile: 505; sh: 455; java: 237; ruby: 6; perl: 5; php: 1
file content (97 lines) | stat: -rw-r--r-- 2,689 bytes parent folder | download | duplicates (2)
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
96
97
/*
* Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; version 2 of the
* License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301  USA
*/

#include "grtpp.h"
#include "interfaces/plugin.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 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);