{"id":249,"date":"2016-05-06T11:55:58","date_gmt":"2016-05-06T10:55:58","guid":{"rendered":"http:\/\/www.riedmann.it\/blog\/?p=249"},"modified":"2016-05-09T09:09:13","modified_gmt":"2016-05-09T08:09:13","slug":"xide-plugin-system","status":"publish","type":"post","link":"https:\/\/blog.riedmann.it\/?p=249","title":{"rendered":"XIDE: Plugin system"},"content":{"rendered":"<p>XIDE supports a plugin system.<\/p>\n<p>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.<br \/>\nAfter 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.<\/p>\n<p>And this is a sample code by Chris Pyrgas, the author of XIDE:<\/p>\n<p><code><br \/>\nusing Xide.PluginSystem<br \/>\nusing System.Windows.Forms<\/p>\n<p>class TestPlugin inherit Xide.PluginSystem.Plugin<br \/>\n\tprotect oService as PluginService<br \/>\n\tvirtual method Initialize(_oService as PluginService) as void<\/p>\n<p>\t\tself:oService := _oService<\/p>\n<p>\t\tlocal oMenuItem as MenuItem<\/p>\n<p>\t\toMenuItem := MenuItem{\"Add some custom text\" , PluginMenuItem_Edit_clicked }<br \/>\n\t\tself:oService:RegisterMenuItem(MainMenuItem.Edit , oMenuItem)<\/p>\n<p>\t\toMenuItem := MenuItem{\"My Plugin\" , PluginMenuItem_Window_clicked }<br \/>\n\t\tself:oService:RegisterMenuItem(MainMenuItem.Window , oMenuItem)<\/p>\n<p>\treturn<\/p>\n<p>\tmethod PluginMenuItem_Edit_clicked(o as object,e as EventArgs) as void<br \/>\n\t\tlocal oFilePad as FilePad<br \/>\n\t\tlocal oEditor as Editor<br \/>\n\t\toFilePad := self:oService:GetActiveFilePad()<br \/>\n\t\tif oFilePad == null<br \/>\n\t\t\treturn<br \/>\n\t\tend if<br \/>\n\t\toEditor := oFilePad:Editor<br \/>\n\t\toEditor:AddLine(\"\")<br \/>\n\t\toEditor:AddLine(\"\")<br \/>\n\t\toEditor:AddLine(\"\/\/ This is some test enetered from the plugin!\")<br \/>\n\t\toEditor:AddLine(\"\")<br \/>\n\treturn<\/p>\n<p>\tmethod PluginMenuItem_Window_clicked(o as object,e as EventArgs) as void<br \/>\n\t\tlocal oProject as Project<br \/>\n\t\toProject := self:oService:ActiveProject<br \/>\n\t\tif oProject == null<br \/>\n\t\t\treturn<br \/>\n\t\tend if<br \/>\n\t\tMessageBox.Show(\"Applications in project \" + oProject:Name + \" : \" + oProject:GetApplications():Length:ToString()   , \"Message from plugin!\")<br \/>\n\treturn<\/p>\n<p>\tvirtual property Name as string get \"A test plugin\"<\/p>\n<p>end class<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[],"class_list":["post-249","post","type-post","status-publish","format-standard","hentry","category-xide"],"_links":{"self":[{"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/posts\/249","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=249"}],"version-history":[{"count":3,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/posts\/249\/revisions"}],"predecessor-version":[{"id":259,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/posts\/249\/revisions\/259"}],"wp:attachment":[{"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=249"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=249"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=249"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}