Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: tathata on June 16, 2004, 02:56:46 pm
-
I am working on a code generation template for ActionScript 2.0. Most of my template is working just fine with the exception of the %packagePath%
The packagePath should be outputing "net.test" but instead is only outputting "net"
Here is a snippet of my AS2 file that was generated from my template.
---------------------------------------
class net.MyASClazz
{
public function MyASClazz()
{
};
}; //end MyASClazz
----------------------------------------
The line "class net.MyASClazz" should read "class net.test.MyASClazz"!!
If I try outputting C# code file it outputs the name space just fine!!
Here is the section from my template that should generate the proper name space path (note most of the code was barrowed from the C# template code).
************************
$name = %packagePath%
%if packageIsFirstNonEmpty != "T"%
$name = %packageName%
%endIf%
%if elemType == "Interface"%
%PI=""%
$name = "interface "+$name+"."+%className%
%endTemplate%
%PI=""%
$name = "class "+$name+"."+%className%
$name
***************************
I have been reading documentation and looking at other code generation templates but I just can't get it figured out! No matter what I have tried %packagePath% only gives me the first package name and drops everything in the middle!
Can someone give me a hand sorting this problem out??
Thanks!!
-
Hi,
Here's your problem. The package is only being set at the first level after the root namespace. This is setting the package to "net". It is never set after that.
To set the package you need to actually call the Namespace template. So, instead of having
%list="Class" @separator="\n\n"%
in your file level template use
%list="Namespace" @separator="\n\n"%
Then use
%list="Namespace" @separator="\n\n"%
%list="Class" @separator="\n\n"%
as your namespace template.
That should fix your problem.
Simon
-
That fixed it, Thanks!