Output

XML output element describe the behaviour of the Finish button of the Wizard page. With output you can :

  • manage files with file element, on other words generate or update files with Eclipse wizard page.
  • launch command with command element to build project (WEB,Struts,...). For instance, with this element you can launch Ant target Eclipse wizard page.

Those behaviours are defined inside ouput element :

<component>
    ...
  <!-- Output page -->
  <output>
    ...
  </output>
</component>

output element support sequence of file and command. With sequence of file, you can generate, update sseveral files with same Eclipse wizard page. For more information, go at Multiple output section.

file

file elements must be included into ouput element.

<component>
    ...
  <!-- Output page -->
  <output>
    <file>
      ...
    </file>  
    ...
  </output>
</component>

With file element you can :

  • generate file. Generated file content is the result of the merge of template with input parameters of component.
  • update properties file. This case is able to update values of properties file.
  • update XML file. This case is able to add XML fragment into XML file. This XML fragment is the the result of the merge of template with input parameters of component. XPath is used to locate the position where XML fragment must be added.

file Attributes

Attribute nameDescriptionRequired ?
keyrefer to key model. This attribute is used when file must be updated.No
conditionCall javascript fonction which return true if code generation must be done and false otherwise.No
outputBaseDirXUL contrĂ´le ID which define output directory (used into code generation). By default this attribute has outputBaseDir value.No
outputFileNameXUL contrĂ´le ID which define output file name (used into code generation). By default this attribute has outputFileName value.No
appendThis attribute works if key is filled. true if generated content by template must be appended into file (filled with key).No

command

command elements must be included into ouput element.

<component>
    ...
  <!-- Output page -->
  <output>
    <command>
      ...
    </command>  
    ...
  </output>
</component>

For more information about command, go at Command section.

Multiple output

output element can contain several file and command. It's possible to generate several files with same Eclipse wizard page.

Mutltiple file generation

In the case of multiple file generation, output directory and file name to generate must be distinct. To do that you must use outputBaseDir and outputFileName attribute to distinguish output directory and file name to generate between file :

<output>
  <file>
    <template uri="/ftl/Xul/Textbox.ftl" />
  </file>
  <file outputBaseDir="outputBaseDir2" 
        outputFileName="outputFileName2">
      <template uri="/ftl/Xul/Textbox.ftl" />
  </file>               
</output>  

In the below sample, output directory and first file name to generate will be use values of texboxes with outputBaseDir and outputFileName ID's. Output directory and second file name to generate will be use values of texboxes outputBaseDir2 and outputFileName2 ID's.

Output with condition

It's possible to set condition to launch code generation. This condition can be managed with script.

For instance it's possible to display checkbox to check if code generation must be done or not :

To do that, before defining checkox with checkoxParam ID :

<checkbox id="checkoxParam" flex="1" 
          checked="true" label="must launch file generation?" />  

You must se condition on file element :

<output>
  <file condition="javascript:mustLaunchFileGeneration();">
    <template uri="/ftl/Xul/Textbox.ftl" />
  </file>
</output> 

condition attrinute call mustLaunchFileGeneration javascript function :

<script type="text/javascript" >
  function mustLaunchFileGeneration() {
    var /* checkbox */ checkoxParam = document.getElementById('checkoxParam');
    return checkoxParam.checked;
  }
</script>

This javascript function return true if checkbox with checkoxParam ID is checked (code generation must be done) and false otherwise (code generation must not be done).