Show action buttons only when valid

Having trouble installing Oxygen? Got a bug to report? Post it all here.
yann1806
Posts: 22
Joined: Fri Aug 09, 2013 11:03 am

Show action buttons only when valid

Post by yann1806 »

Hi guys,

I'm wondering if there is a way to make toolbar buttons active only when the action they represent is valid based on the XSD?

For example in Author mode, the completion menu that comes with an "Enter" keypress shows only the tags that are valid to be inserted at the current location. If my action is just inserting a tag, is there a simple way to make its toolbar button active/inactive the same way, i.e. based on the existing XSD only, without writing extra Xpath conditions?

Thanks!

Yann
alex_jitianu
Posts: 1016
Joined: Wed Nov 16, 2005 11:11 am

Re: Show action buttons only when valid

Post by alex_jitianu »

Hello Yann,

As you already discovered each action has some XPath conditions that control whether it's active or not in a given context. Right now the only solution for your use case is writing XPath expressions to identify each context where the action is active.

In the next version of Oxygen (15.1) which will be released in 1 or 2 months, you will be able to use in these XPath expressions a new function: oxy_allows-child-element(). This function basically checks the schema constraints so an action will only be active if an element is allowed in that context.

Best regards,
Alex
yann1806
Posts: 22
Joined: Fri Aug 09, 2013 11:03 am

Re: Show action buttons only when valid

Post by yann1806 »

Thanks for the clear response Alex, appreciated.

Yann
alex_jitianu wrote:Hello Yann,

As you already discovered each action has some XPath conditions that control whether it's active or not in a given context. Right now the only solution for your use case is writing XPath expressions to identify each context where the action is active.

In the next version of Oxygen (15.1) which will be released in 1 or 2 months, you will be able to use in these XPath expressions a new function: oxy_allows-child-element(). This function basically checks the schema constraints so an action will only be active if an element is allowed in that context.

Best regards,
Alex
Radu
Posts: 9449
Joined: Fri Jul 09, 2004 5:18 pm

Re: Show action buttons only when valid

Post by Radu »

Hi,

As Alex said we added in Oxygen 15.1 that extension XPath function:

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

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