|
|
|
Re: [ACCELEO] Null return in using pointer [message #957456 is a reply to message #956510] |
Thu, 25 October 2012 08:34 |
|
Hi Nicolas, Saadia,
As Ed pointed out, you will have to make sure you load your UML models correctly for Acceleo. In short, you cannot just load the 'model.uml' file and expect it to work. The generated java launcher has a number of comments on how to properly initialize and load UML models, please look at them and make sure to follow the instructions.
Most of these instructions are simply copied from the UML wiki.
You might also want to check "how" you are launching the Acceleo transformation. If you are using a run configuration, check whether you are launching the generation as "Acceleo Application" (standalone, needs all UML initialization to be done manually in the launcher) or "Acceleo plug-in Application" (runs as an Eclipse plugin, should be able to load UML models without you adding more initialization code).
Laurent Goubet
Obeo
|
|
|
|
|
Re: [ACCELEO] Null return in using pointer [message #975981 is a reply to message #963018] |
Thu, 08 November 2012 08:18 |
|
Hi,
So you can retrieve the value of some stereotypes... but not others. Do you have the proper initialization for the "other" stereotypes? "Algorithm" in saadia's above example is what cannot be resolved. Where is this stereotype located?
When you load the initial model from the generated Acceleo launcher, you can try and see if there are any unresolvable proxies through a method such as this called just before the acceleo engine in doGenerate (costly, but can be effective to debug) :
private void checkForUnresolvedProxies(Resource res) {
TreeIterator<EObject> allContent = EcoreUtil.getAllContent(res, true);
while (allContent.hasNext()) {
EObject next = allContent.next();
if (next.eIsProxy()) {
throw new RuntimeException("Unresolved proxy : " + ((InternalEObject)next).eProxyURI());
}
for (EObject crossReference : next.eCrossReferences()) {
if (crossReference.eIsProxy()) {
throw new RuntimeException("Unresolved proxy : " + ((InternalEObject)crossReference).eProxyURI());
}
}
}
}
This is a little "brute force"... but it should allow you to determine if there are any unresolveable proxies referenced by your model, even for UML. If this code cannot resolve a proxy, Acceleo won't either. This will throw exceptions for each proxy encountered, giving you the URI that could not be resolved. This URI is what your are missing initialization code for.
Laurent Goubet
Obeo
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04725 seconds