Page 1 of 1
Adding to the code completion pop-up via a plugin
Posted: Sun Mar 24, 2013 9:50 pm
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
Re: Adding to the code completion pop-up via a plugin
Posted: Mon Mar 25, 2013 11:50 am
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
Re: Adding to the code completion pop-up via a plugin
Posted: Mon Mar 25, 2013 2:52 pm
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
Re: Adding to the code completion pop-up via a plugin
Posted: Mon Mar 25, 2013 3:18 pm
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
Re: Adding to the code completion pop-up via a plugin
Posted: Mon Mar 25, 2013 4:47 pm
by kevd
Radu
Thanks for your help, this looks to be exactly what I was looking for.
Cheers
Kev