~ubuntu-branches/ubuntu/quantal/mysql-workbench/quantal

« back to all changes in this revision

Viewing changes to plugins/wb.model.tagging/backend/register_plugin.cpp

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2012-03-01 21:57:30 UTC
  • Revision ID: package-import@ubuntu.com-20120301215730-o7y8av8y38n162ro
Tags: upstream-5.2.38+dfsg
ImportĀ upstreamĀ versionĀ 5.2.38+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#include "stdafx.h"
 
3
 
 
4
#include "grtpp.h"
 
5
#include "interfaces/plugin.h"
 
6
 
 
7
#include "grts/structs.workbench.model.h"
 
8
#include "grts/structs.meta.h"
 
9
 
 
10
#define MODULE_VERSION "1.0.0"
 
11
 
 
12
 
 
13
#ifdef _WIN32
 
14
# define FRONTEND_LIBNAME(obj, windows_dll, linux_so, osx_dylib)\
 
15
obj->moduleName(windows_dll)
 
16
#elif defined(__APPLE__)
 
17
# define FRONTEND_LIBNAME(obj, windows_dll, linux_so, osx_dylib)\
 
18
obj->moduleName(osx_dylib)
 
19
#else
 
20
# define FRONTEND_LIBNAME(obj, windows_dll, linux_so, osx_dylib)\
 
21
obj->moduleName(linux_so)
 
22
#endif
 
23
 
 
24
 
 
25
 
 
26
static grt::ListRef<app_Plugin> get_plugins_info(grt::GRT *grt);
 
27
 
 
28
 
 
29
class WbTaggingModuleImpl : public grt::ModuleImplBase, public PluginInterfaceImpl
 
30
{
 
31
public:
 
32
  WbTaggingModuleImpl(grt::CPPModuleLoader *ldr)
 
33
  : grt::ModuleImplBase(ldr)
 
34
  {
 
35
  }
 
36
  
 
37
  DEFINE_INIT_MODULE(MODULE_VERSION, "Sun Microsystems Inc", grt::ModuleImplBase,
 
38
                     DECLARE_MODULE_FUNCTION(WbTaggingModuleImpl::getPluginInfo), NULL);
 
39
  
 
40
  virtual grt::ListRef<app_Plugin> getPluginInfo()
 
41
  {
 
42
    return get_plugins_info(get_grt());
 
43
  }
 
44
};
 
45
 
 
46
 
 
47
 
 
48
static void set_object_argument(app_PluginRef &plugin, const std::string &struct_name)
 
49
{
 
50
  app_PluginObjectInputRef pdef(plugin.get_grt());
 
51
  
 
52
  pdef->objectStructName(struct_name);
 
53
  pdef->owner(plugin);
 
54
  
 
55
  plugin->inputValues().insert(pdef);
 
56
}
 
57
 
 
58
 
 
59
 
 
60
static grt::ListRef<app_Plugin> get_plugins_info(grt::GRT *grt)
 
61
{
 
62
  grt::ListRef<app_Plugin> editors(grt);
 
63
  
 
64
  app_PluginRef tag_editor(grt);
 
65
  
 
66
  FRONTEND_LIBNAME(tag_editor,
 
67
                   ".\\wb.model.tagging.wbp.fe.dll",
 
68
                   "wb.model.tagging.wbp.so",
 
69
                   "wb.model.tagging.mwbplugin");
 
70
  tag_editor->pluginType("gui");
 
71
  tag_editor->moduleFunctionName("WbTagEditor");
 
72
  set_object_argument(tag_editor, "workbench.physical.Model");
 
73
  tag_editor->caption("Edit Object Tags");
 
74
  tag_editor->rating(10);
 
75
  tag_editor->name("wb.plugin.edit.tags");
 
76
  tag_editor->groups().insert("model/Editors");
 
77
  editors.insert(tag_editor);
 
78
  
 
79
  return editors;
 
80
}
 
81
 
 
82
 
 
83
GRT_MODULE_ENTRY_POINT(WbTaggingModuleImpl);