Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Uffe on July 19, 2007, 04:09:57 pm
-
Hey people!
I'm creating UML profiles and code generation templates for various nefarious purposes. There's a couple of things I don't get, or just can't do properly:
1) Packages. It seems the %packagePath% always comes out the same as the %packageName%, even if the class being generated is three levels into a hierarchy. It seems that only the View level package is actually translated into a %packageName%. What am I missing?
2) Multi-class files. I'd like to generate all classes in a package into one and the same file, but when I specify the same file name for the classes they end up overwriting each other. Ideally, I'd like to be able to generate a whole hierarchy of packages into one file. Considering that there's no %package% template hook, is this possible? Are there any plans to incorporate a %package% hook in a future version?
All help appreciated.
Cheers,
/Uffe
-
1) You're not listing over the namespaces so the current package is always the top level package.
2) Use the package generation dialog. This will generate all classes to any file in one go.
-
Hi again,
Thanks for that, works like a charm.
However, I noticed that part of the problem was the fact that some of my packages only contain other packages, no classes.
These classless packages seem to be ignored in the generation process; the Namespace template only produces output for packages with classes (although a subpackage of a childless package is processed).
Any hints?
Cheers,
/Uffe
-
EA transforms and code generation work on a set of elements and the packages that contain them. You can't get packages into a transform without them containing at least one element.