summaryrefslogtreecommitdiffstats
path: root/lib/interfaces/extensions/Mainpage.dox
blob: 175909c351ab378ac6c7de22b4c99b1e6eb51e51 (plain)
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
/**
@mainpage The TDevelop Extension Interfaces Library

This library contains extension interfaces used by TDevelop plugin architecture.

<b>Link with</b>: -ltdevelop

<b>Include path</b>: -I\$(kde_includes)/tdevelop/interfaces/extensions

\section whatisextension What is the TDevelop extension

Extension is a TDevelop plugin which implements one of extension interfaces.
Extension is usually not important enough to be returned by @ref KDevApi and @ref KDevPlugin
methods. Therefore extension instance can be obtained by @ref KDevPlugin::extension method.

Note: extension plugins can be either core, global and project plugins. They are loaded
in the same way other plugins are. But extensions differ from usual plugins.

Note: many plugins implementing extension interface can be created but only one of
those should be loaded at a time. This can be accomplished by:
- using a shell plugin profile (as done in current generic shell implementation) - define
  different X-TDevelop-Properties for different extension implementations;
- writing project manager which looks into the project file and loads the neccesary extension.

\section creatingextension Creating and using an extension
- Define a service, use following .desktop file:
  @code
  [Desktop Entry]
  Encoding=UTF-8
  Type=ServiceType
  X-TDE-ServiceType=TDevelop/MyExtension
  X-TDE-Derived=TDevelop/Plugin
  Name=My Extension Interface
  [PropertyDef::X-TDevelop-Version]
  Type=int
  @endcode
- Define an abstract base class for an extension like:
  @code
  class KDevMyExtension: public KDevPlugin {
  public:
      KDevMyExtension(const KDevPluginInfo *info, TQObject* parent, const char* name)
          :KDevPlugin(info, parent, name) {}
      
      virtual void doSomething() = 0;
  };
  @endcode  
- Create an usual plugin, but instead of setting service type to "TDevelop/Plugin", set:
  @code
  ServiceTypes=TDevelop/MyExtension
  @endcode
- Use your extension:
  @code
  KDevMyExtension *myext = extension<KDevMyExtension>("TDevelop/MyExtension");
  if (sf) {
      // do something
  } else {
      // fail
  }  
  @endcode
*/