Skip to content

Anatomy of the plugin

Pavel Anisko edited this page Mar 24, 2018 · 2 revisions

This article gives a quick overview of the plug-in structure, main exported functions and some of their nuances.

"PL/SQL Developer Plug-In interface Documentation" lists lots of functions, which plug-in can export in order to be called by PL/SQL Developer. But only a small subset is of great importance to the plug-in and are used often.

IdentifyPlugIn and RegisterCallback — the plug-in cann't exist without these exported functions. IdentifyPlugIn is used by PL/SQL Developer to recognize a DLL file as a plug-in. Thus it is mandatory for export. If you don't see your plug-in in the Plug-In Manager, check if IdentifyPlugIn is exported. It is called first of all, thus is a nice place to create an instance of your plug-in class or put other code for the plug-in initialisation.

RegisterCallback is another must to export function. This function allows your plug-in to get the pointer of PL/SQL Developer function (a callback) in order to call it later. Without RegisterCallback calling PL/SQL Developer API from plug-in is impossible (OK, it should be possible by directly accessing API from DLLs using DllImport, but in this case it is rather a hack). It is important to mention, that RegisterCallback is not called once, but many times — as many as the total number of callbacks PL/SQL Developer has got. Thus you must filter out only those which you need. See callback usage Concepts for details.

CreateMenuItem allows your plug-in to create menu items in PL/SQL Developer menu bar. If your plug-in creates any menu items in the PL/SQL Developer menu bar, this function is mandatory for export. Otherwise it is not. It is important to know, that CreateMenuItem is called 99 times allowing your plug-in to create 99 distinct menu items overall. In order to limit the number of menu items:

  1. assign your menu item an index in range [1; 99], and
  2. use if statement to check, whether CreateMenuItem has been called for your index.

OnMenuClick is a click event handler for the menu item previously created with CreateMenuItem. If your plug-in created any menu items, the function is mandatory for export. If no menu items have been created, plug-in don't need to export this function. See Using menu items for details.

CommandLine, PlugInName, PlugInShortName exported functions and IDE_CommandFeedback callback are also worth mentioning. If your plug-in is able to accept commands from the command window, you definitely need these ones. See Accepting commands in the command window for usage details. PlugInName is also used for online updates, as the official documentation states.

Clone this wiki locally