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 11:04
ibrahim kara is currently offline ibrahim kara
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: Fri Apr 18 06:51:31 EDT 2014

Powered by FUDForum. Page generated in 0.06557 seconds