Adding to the code completion pop-up via a plugin

Oxygen general issues.
kevd
Posts: 3
Joined: Sun Mar 24, 2013 9:33 pm

Adding to the code completion pop-up via a plugin

Post by kevd »

Hi

I am tying to add my own custom code-completion pop-up suggestions (the ones that show up via ctrl+space) via a plugin on the standalone version of Oxygen. I know this can be done through an XSD, but I would like to do it programmatically through a plugin. Is this possible?

I have seen some references to a pop-up customizer but this only seems to be for the Author view, and I want to be in Text view.
Please advise on if this is possible and if so which APIs i should be looking at.

Thanks
Radu
Posts: 9445
Joined: Fri Jul 09, 2004 5:18 pm

Re: Adding to the code completion pop-up via a plugin

Post by Radu »

Hi,
I am tying to add my own custom code-completion pop-up suggestions (the ones that show up via ctrl+space) via a plugin on the standalone version of Oxygen. I know this can be done through an XSD, but I would like to do it programmatically through a plugin. Is this possible?
Let me see if I understand. You want to add additional entries to the usual content completion window which appears when Ctrl-Space is pressed.
This is possible only in the Author mode (you can define custom actions and add them to the content completion window).
Could you elaborate a little bit? If you add to the content completion window elements which are not defined in the schema, the XML will not be valid after they are inserted.
I have seen some references to a pop-up customizer but this only seems to be for the Author view, and I want to be in Text view.
The pop-up customizer is used in the Author mode for the pop-up menu which appears when you right click in the Author page.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
kevd
Posts: 3
Joined: Sun Mar 24, 2013 9:33 pm

Re: Adding to the code completion pop-up via a plugin

Post by kevd »

Hi Radu.
Yes you understood correctly. This code completion suggestions would mainly be used for providing attribute names, based on other attributes in the document.(Not adding new invalid elements)
For example when specifying a reference to an elements 'id' attribute, the auto-complete would suggest the id's of previously defined elements. Ideally the plugin would then be extended to give suggestions based on other documents not open in the editor.

However it seems this is not possible, so I will see what can be done through XSD's.

Thanks
Radu
Posts: 9445
Joined: Fri Jul 09, 2004 5:18 pm

Re: Adding to the code completion pop-up via a plugin

Post by Radu »

Hi,

So you have an attribute let's say called idref for which you want to propose values from other editors as well, right?
This can be done if you have a custom Document Type Association for your type of XML documents (and you probably have done this already).

http://www.oxygenxml.com/doc/ug-oxygen/ ... orial.html

In the Oxygen Preferences->"Document Type Association" if you edit the document type association, in the Extensions tab you can see a Content completion handler extension.
Such an implementation needs to be an extension of ro.sync.contentcompletion.xml.SchemaManagerFilter.
Such a filter can add to the list of possible values that will be presented for a certain attribute name.
Our Author SDK should have an example of this:

http://www.oxygenxml.com/oxygen_sdk.htm ... horing_SDK


Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
kevd
Posts: 3
Joined: Sun Mar 24, 2013 9:33 pm

Re: Adding to the code completion pop-up via a plugin

Post by kevd »

Radu
Thanks for your help, this looks to be exactly what I was looking for.

Cheers
Kev
Post Reply