XIDE plugin?

This forum is meant for questions and discussions about the X# language and tools
User avatar
SHirsch
Posts: 286
Joined: Tue Jan 30, 2018 8:23 am
Location: Germany

XIDE plugin?

Post by SHirsch »

Hi Chris,

is it possible to write PlugIns for XIDE? In VO I had an build counter that was incremented at every compile run. Also the export file name was changed with build number in file name. I would like to implement something similar to XIDE.

Regards,
Stefan
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

XIDE plugin?

Post by wriedmann »

Hi Stefan,

I have written a plugin for XIDE, you can download the sources here:

https://www.riedmann.it/download/XIDE_WR_Plugin.zip

This plugin has some useful functions, but not what you need.

The currently implemented functions are:
xide_plugin_functions.png
xide_plugin_functions.png (3.73 KiB) Viewed 699 times
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 4903
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

XIDE plugin?

Post by Chris »

Hi Stefan,

Please see Wolfgang's sample plugin to get you started with it. But in order to implement the features you want, I need to add support for them in the plugin system (fortunately it's easy).

So you need a callback that will be called in your plugin every time an app/library is compiled and another one when exporting. Do you mean when you export viaef/vipef files? Do you prefer to put a new command to do the export the way you like, or do you want to just intervene when exporting from the current procedure and modify the filename in the save dialog?

Chris
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
SHirsch
Posts: 286
Joined: Tue Jan 30, 2018 8:23 am
Location: Germany

XIDE plugin?

Post by SHirsch »

Hi Chris,

that sounds good.
A callback before compiling and one before exporting as viaef/vipef. At export I would like to change filename before SaveDialog.

Regards,
Stefan
User avatar
SHirsch
Posts: 286
Joined: Tue Jan 30, 2018 8:23 am
Location: Germany

XIDE plugin?

Post by SHirsch »

Hi Chris,

your methods are working, thanks.
After implementing my first ideas more ideas appear:
- I would like to zip the exported files. So a callback after export (also auto export) would be nice. Or maybe this could be implemented as option in Xide with file extension vipefx/viaefx.
- I would like to add menu items to context menu in project tree. I have not found any method how to do that although some methods names sound like it could be done. Maybe you can help out.
- I hacked a bit through the controls to get the currently selected app (Xide.PluginSystem.Application). From ProjectTreeView I get Xide.AppClass and then call Xide.PluginSystem.Application.__InternalCreate(app, TRUE) to create the Application object. It's working but looks not elegant. Maybe I missed something?

I will populate the plugin in chit-chat.

Regards,
Stefan
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

XIDE plugin?

Post by wriedmann »

Hi Stefan,

the appetite comes while eating <g>.

The request to add an option to the context menu in the project browser is not new, but unfortunately it is not that easy because it depends on the context, or better, if you are on a project, a folder, an application or on a simple item.

And yes, Chris had forgotten to hide the XIDE internals from a plugin, so you can access also XIDEs internals from a plugin (fortunately this opens a lot of possibilities, and I needed some of them also in my own plugin).

I have a lot of other ideas for plugins, and what I will make when I have a bit of time: a sort of Export Explorer for viaef and vipef files.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 4903
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

XIDE plugin?

Post by Chris »

Stefan Hirsch wrote: your methods are working, thanks.
After implementing my first ideas more ideas appear:
Very glad it worked ok!
Stefan Hirsch wrote: - I would like to zip the exported files. So a callback after export (also auto export) would be nice. Or maybe this could be implemented as option in Xide with file extension vipefx/viaefx.
That's a bit more complicated. And it gets even more complicated, because there are more commands that have to do with app and project export files, like Project|Compare All Files which compares the contents of all your files with their version included in a previous .vipef or .viaef file. Probably it will be easier if I implement this myself, but this will require a hard dependancy on a zip library (btw, which one would you suggest to use?). Will also give it some thought on providing plugin interface for that, but I don't think I can do this quickly. I assume it's not highest priority for you either, am I right?
Stefan Hirsch wrote: - I would like to add menu items to context menu in project tree. I have not found any method how to do that although some methods names sound like it could be done. Maybe you can help out.
Ah, yeah, there's a callback method OnProjectContextMenuPopup(), and I see I have actually written code in the main IDE that calls it, but this code is commented out. Can't remember why, I think as Wolfgang said it was not ready. I will have a look again and will try to enable it soon. Just to get an idea, what kind of command do you want to put there?
Stefan Hirsch wrote: - I hacked a bit through the controls to get the currently selected app (Xide.PluginSystem.Application). From ProjectTreeView I get Xide.AppClass and then call Xide.PluginSystem.Application.__InternalCreate(app, TRUE) to create the Application object. It's working but looks not elegant. Maybe I missed something?
Amazing, I had a look at your code, that was quite some reverse engineering, you are using classes of the IDE that even I do not remember how they work! :) Regarding getting the active app, this is missing by mistake, there's already a GetActiveProject(), a GetActiveFilePad(), I will also add a GetActiveApp(), it is very easy to do, so you do not need to go through the internals to get it.

Chris
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
Chris
Posts: 4903
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

XIDE plugin?

Post by Chris »

Hi Wolfgang,
Wolfgang Riedmann wrote:The request to add an option to the context menu in the project browser is not new, but unfortunately it is not that easy because it depends on the context, or better, if you are on a project, a folder, an application or on a simple item.
Yeah, I think it's you that had requested this first, so I had started working on it? I will look into it again. Like I asked Stefan, what kind of commands do you want to put there? Just to implement your needs first.

Wolfgang Riedmann wrote: And yes, Chris had forgotten to hide the XIDE internals from a plugin, so you can access also XIDEs internals from a plugin (fortunately this opens a lot of possibilities, and I needed some of them also in my own plugin).
I think this had started by accident, but then realized it's a good idea to give you full access to the IDE classes, so you can use stuff even if I haven't exposed them to the plugin system yet.

There's a "Ide" property of the PluginService class which gives you access to the main IDE object, and in addition almost no (or very little) code in XIDE is marked as internal/protected/private, so you can use practically everything. Of course this is not the suggested way, but then again I have no plans for a major refactoring of the code, so you're 99% safe using even the XIDE internals.
Wolfgang Riedmann wrote: I have a lot of other ideas for plugins, and what I will make when I have a bit of time: a sort of Export Explorer for viaef and vipef files.
Sounds very nice! Actually it's one of the things I have on my list, but if you do it yourself, it's a lot better for me :)

Chris
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

XIDE plugin?

Post by wriedmann »

Hi Chris,

currently my session preparation for Cologne has the highest priority... But after then I will look at it.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
SHirsch
Posts: 286
Joined: Tue Jan 30, 2018 8:23 am
Location: Germany

XIDE plugin?

Post by SHirsch »

Hi Chris,

the most import plugin function build count is now implemented. Everything else is nice to have.
As zip lib I use ZipStorer from 'Jaime Olivares' (https://github.com/jaime-olivares/zipstorer).

In context menu I would insert the same menu items as now in the Plugins menu. It would be easier to use because one does not have to control if one is in the correct app.

Some classes I walked over are internal so that I could not access them. Maybe you can change the protection level to pulbic. So that 100% of the classes are accessable due to your statement that you have no plans to refactor. Plugin developers would have even more possibilities and you do not have to write plugin classes or callbacks for every request.

Regards,
Stefan
Post Reply