Store portable scenario association in xpr file

Having trouble installing Oxygen? Got a bug to report? Post it all here.
martindholmes
Posts: 190
Joined: Wed Apr 20, 2005 5:43 pm
Location: Victoria, BC, Canada

Store portable scenario association in xpr file

Post by martindholmes »

Hi there,

I've trying to figure out how to do the following:

We have an ant file ("build-dist.xml") which is part of an ant scenario. I'd like to associate the ant build file itself with the scenario, so that when I have that file open, the scenario runs when I click on the red triangle button.

I can easily do this in the editor, with the result that the association is stored in the oxyOptionsSa16.0.xml file in my Oxygen directory:

Code: Select all

<scenarioAssociation>
<field name="url">
<String>file:/home/mholmes/DiskStation/mholmes/WorkData/tei/jtei/issue_repo/trunk/oxygen/oxygen_aux_files/ant/build-dist.xml</String>
</field>
<field name="scenarioIds">
<list>
<String>2/internal/jTEI (internal)/jtei-distro</String>
</list>
</field>
<field name="scenarioTypes">
<list>
<String>ANT</String>
</list>
</field>
</scenarioAssociation>
However, I'd like to store this in the project's .xpr file, in such a way that it uses a path to the build file which is relative to the location of the .xpr file, making it portable.

There must be a straightforward way to do this, but I can't figure it out.

All help appreciated,
Martin
Ron Van den Branden
Posts: 65
Joined: Fri Jan 18, 2008 5:54 pm

Re: Store portable scenario association in xpr file

Post by Ron Van den Branden »

Hi Martin,

I've managed to set this association via Oxygen's "Configure Transformation Scenario(s)" wizard. When looking at the generated .xpr file, I noticed that the "url" field apparently just expects relative paths (with the .xpr project file as context):

Code: Select all


<scenarioAssociation>
<field name="url">
<String>oxygen_aux_files/ant/build-dist.xml</String>
</field>
<field name="scenarioIds">
<list>
<String>jtei-distro</String>
</list>
</field>
<field name="scenarioTypes">
<list>
<String>ANT</String>
</list>
</field>
</scenarioAssociation>
This does the trick; in fact, adding explicit editor variables like ${pd} in the "url" field made the transformation association fail, so that doesn't work. Also, the "scenarioIds" field seems to just expect an ID for this scenario, so it doesn't have to point anywhere.

Best,

Ron
adrian
Posts: 2879
Joined: Tue May 17, 2005 4:01 pm

Re: Store portable scenario association in xpr file

Post by adrian »

Hi,

The associations are stored together with the scenario. So, if the scenario is global, the associations are also global (stored in the oxyOptionsSa16.0.xml file). If you want the association(s) in the project file, you have to copy or move the scenario in the project options. In the "Configure Transformation Scenario(s)" dialog right click on the scenario name and pick "Change storage".
If the file is relative to the project file, the references in the associations will automatically be made relative.

Regarding ${pd}, the reason it doesn't work in the 'url' field is that it is expanded to a directory path, but you need a URL. So, instead, you should use the editor variable ${pdu} to refer to the project directory URL. Note that this is generally not necessary to do manually, Oxygen will do this automatically for you (at least in recent versions of Oxygen) after you browse and pick the file.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply