XIDE: Plugin system

May 06
2016

XIDE supports a plugin system.

The core of a plugin is to define a class that inherits from Xide.PluginSystem.Plugin and implements the METHOD Initialize() and PROPERTY Name. Initialize() passes you a PluginService object, with which you can communicate with XIDE. Type self:oService: in the sample to get a list of available methods of this class.
After you have built your plugin dll, simply copy it in the plugin subdirectory of the XIDE directory, and it will be loaded on the next start of XIDE.

And this is a sample code by Chris Pyrgas, the author of XIDE:


using Xide.PluginSystem
using System.Windows.Forms

class TestPlugin inherit Xide.PluginSystem.Plugin
protect oService as PluginService
virtual method Initialize(_oService as PluginService) as void

self:oService := _oService

local oMenuItem as MenuItem

oMenuItem := MenuItem{"Add some custom text" , PluginMenuItem_Edit_clicked }
self:oService:RegisterMenuItem(MainMenuItem.Edit , oMenuItem)

oMenuItem := MenuItem{"My Plugin" , PluginMenuItem_Window_clicked }
self:oService:RegisterMenuItem(MainMenuItem.Window , oMenuItem)

return

method PluginMenuItem_Edit_clicked(o as object,e as EventArgs) as void
local oFilePad as FilePad
local oEditor as Editor
oFilePad := self:oService:GetActiveFilePad()
if oFilePad == null
return
end if
oEditor := oFilePad:Editor
oEditor:AddLine("")
oEditor:AddLine("")
oEditor:AddLine("// This is some test enetered from the plugin!")
oEditor:AddLine("")
return

method PluginMenuItem_Window_clicked(o as object,e as EventArgs) as void
local oProject as Project
oProject := self:oService:ActiveProject
if oProject == null
return
end if
MessageBox.Show("Applications in project " + oProject:Name + " : " + oProject:GetApplications():Length:ToString() , "Message from plugin!")
return

virtual property Name as string get "A test plugin"

end class

Comments are closed.