Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » migrating from acceleo2 to acceleo 3(problem re-writing the java services for acceleo3)
migrating from acceleo2 to acceleo 3 [message #908559] Wed, 05 September 2012 15:04
ibrahim kara is currently offline ibrahim karaFriend
Messages: 10
Registered: May 2012
Junior Member
I am migrating a code generator plug-in that was written for acceleo2 to acceleo3. I have the following java service that I need to update for acceleo 3. I could not make it work for acceleo 3 by updating the ENode paramaters. Could you help me convert this java service in order to make it usable for acceleo 3? without the imports:
import fr.obeo.acceleo.gen.template.eval.ENode;
import fr.obeo.acceleo.gen.template.eval.ENodeCastException;
import fr.obeo.acceleo.gen.template.eval.ENodeIterator;
import fr.obeo.acceleo.gen.template.eval.ENodeList;

here is the java code:

public LinkedList<Region> sortRegion(ENode eNode)
throws ENodeCastException, ClassCastException {

Set<Region> unpriorizedSet = new LinkedHashSet<Region>();
TreeMap<Integer, Region> tm = new TreeMap<Integer, Region>(
new TransitionComparator());
ENodeList list = null;
UmlServices umlservice = new UmlServices();
LinkedList<Region> sortedList = new LinkedList<Region>();
Set<Entry<Integer, Region>> set = null;

if (eNode.getType().equals("EObject")) {
throw new IllegalArgumentException(
"Argument must be of type ENodeList, not EObject. Owner.filter(\"Region\").sortRegions() or container.filter(\"Region\").sortRegions() is not allowed.");
// sortedList.add((Region)eNode.getEObject());
// return sortedList;
} else if (eNode.getType().equals("ENodeList")) {
list = eNode.getList();
if (list == null) {
throw new NullPointerException(
"Argument (list) must be not null.");

} else {
throw new IllegalArgumentException(
"Argument must be of type ENodeList.");

for (ENodeIterator iterator = list.iterator(); iterator.hasNext()Wink {
Region region = (Region);
Stereotype stereotype = umlservice.getStereotype(region,
if (stereotype == null) {
} else {
Integer transitionPriority = (Integer) region.getValue(
stereotype, "priority");
if (transitionPriority != null) {
if (!tm.containsKey(transitionPriority)) {
tm.put(transitionPriority, region);
} else {
} else {


set = tm.entrySet();
for (Entry<Integer, Region> entry : set) {
for (Region entry : unpriorizedSet) {
return sortedList;

here is an example template that calls this java service:

<%script type="uml.StateMachine" name="stateMachineBehaviorCode" post="trim()"%>

<%for (ownedElement.filter("Region").sortRegions().filter("Region")){%>

Thanks in advance.
Previous Topic:[Acceleo] Capability Question
Next Topic:[Acceleo] Create Standalone application
Goto Forum:

Current Time: Wed Oct 28 12:30:53 GMT 2020

Powered by FUDForum. Page generated in 0.01500 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top