Content Assist Extension - Mixing Element Values and Elements

Oxygen general issues.
DanielH
Posts: 14
Joined: Tue Sep 27, 2011 11:29 am

Content Assist Extension - Mixing Element Values and Elements

Post by DanielH »

Hi,

Currently, the content assist extension allows developers to add more entries like elements, element values and attributes. Is there a way of inserting an entry that is mixed? Like an element value and an element in one entry.

For example, if I had the following XML:

<paragraph>The black cat sat on the |</paragraph>

And the user pressed content complete (where | is), is there a way of having an entry on the content complete that allows entry of: '<color>brown</color> mat' so the result would be:

<paragraph>The black cat sat on the <color>brown</color> mat</paragraph>

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

Re: Content Assist Extension - Mixing Element Values and Elements

Post by Radu »

Hi Daniel,

There is a way but not by using the SchemaManagerFilter.
If you edit the document type in the Document Type Association Preferences page in the Author tab there is a Content Completion tab.
This tab actually allows you to add user defined actions to the content completion window or to the Elements view.
So you can create a custom action in the Actions tab which invokes an already defined operation like:
ro.sync.ecss.extensions.commons.operations.InsertFragmentOperation

For the defined action you should define an XPath context which defines the places in the document where the action can be called.
Based on that XPath context the action will appear or not in the content completion window.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
DanielH
Posts: 14
Joined: Tue Sep 27, 2011 11:29 am

Re: Content Assist Extension - Mixing Element Values and Elements

Post by DanielH »

Excellent, thank you - I'll give that a go and get back to you.
DanielH
Posts: 14
Joined: Tue Sep 27, 2011 11:29 am

Re: Content Assist Extension - Mixing Element Values and Elements

Post by DanielH »

OK, I have the Author Operation method working now, but I have another question. I can get my new actions to appear in the content completion window when the caret is inside an element and not selecting a block of text. However, my action does not appear when the caret has selected a block of text. For example:

<paragraph>The cat sat |</paragraph> <- works OK
<paragraph>The cat sat </paragraph> <- doesn't work (where 'The cat sat' has been selected/highlighted).

Is there a bit of config that I am missing or is this functionality not available?

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

Re: Content Assist Extension - Mixing Element Values and Elements

Post by Radu »

Hi Daniel,

You are right.
We deliberately removed them when the CC Window is shown in order to surround a certain selection. But we probably made the wrong decision, I see that there can be use cases in which you want the author operations to appear even in this case.
I added an improvement request for this and I'll update the post when a fix for this becomes available (maybe in Oxygen 14 in about 2-3 months).

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Content Assist Extension - Mixing Element Values and Elements

Post by Radu »

Hi Daniel,

The fix will be available in Oxygen 14 (in a couple of weeks).
Beta kits are already available for tests here:

http://www.oxygenxml.com/pipermail/oxyg ... 04129.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply