Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [EuGENia] Reorder nodes in ECore2GMF.eol
[EuGENia] Reorder nodes in ECore2GMF.eol [message #519236] Mon, 08 March 2010 08:50 Go to next message
Ralf is currently offline RalfFriend
Messages: 25
Registered: March 2010
Junior Member
Moin, moin,

I'm trying to reorder the Tool Nodes in my Eugenia generated gmftool-file with ECore2GMF.eol. By now I have no idea how to access the child nodes and alter the order of the nodes. The tree example in the EpsilonBook shows a children attribute but these lines do not work:

var toolGroupObjects = GmfTool!ToolGroup.all.selectOne(r|r.title = 'Objects');
var fooNode = toolGroupObjects.children.all.selectOne(t|t.title = 'Foo');


How can I access the children of a specific node in the GmfTool tree ?
Re: [EuGENia] Reorder nodes in ECore2GMF.eol [message #519267 is a reply to message #519236] Mon, 08 March 2010 10:27 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Ralf,

I've scribbled the following ECore2GMF.eol that does this:

var objectsToolGroup = GmfTool!ToolGroup.all.selectOne(g|g.title="Objects");
objectsToolGroup.reorder(Sequence{"D", "C", "B", "A"});

operation GmfTool!ToolGroup reorder(order : Sequence(String)) {
var reordered = new Sequence;
for (item in order) {
var tool = self.tools.selectOne(t|t.title = item);
if (tool.isDefined()) {
reordered.add(tool);
}
}
self.tools = reordered;
}

for the following exemplar metamodel:

@namespace(uri="reordertools", prefix="reordertools")
package reordertools;

@gmf.diagram(foo="bar")
class Model {
val ModelElement[*] contents;
}

@gmf.node(label="name")
abstract class ModelElement {
attr String name;
}

class A extends ModelElement {

}

class B extends ModelElement {

}

class C extends ModelElement {

}

class D extends ModelElement {

}

If you need to inspect an existing model/built-in metamodel, Exeed and
the EPackage registry view can be very useful:

http://epsilonblog.wordpress.com/2008/07/17/inspecting-emf-m odels-with-exeed/
http://www.eclipse.org/gmt/epsilon/doc/articles/epackage-reg istry-view/

Cheers,
Dimitris

Ralf wrote:
> Moin, moin,
>
> I'm trying to reorder the Tool Nodes in my Eugenia generated
> gmftool-file with ECore2GMF.eol. By now I have no idea how to access the
> child nodes and alter the order of the nodes. The tree example in the
> EpsilonBook shows a children attribute but these lines do not work:
>
> var toolGroupObjects = GmfTool!ToolGroup.all.selectOne(r|r.title =
> 'Objects');
> var fooNode = toolGroupObjects.children.all.selectOne(t|t.title = 'Foo');
>
> How can I access the children of a specific node in the GmfTool tree ?
>


--
Spread the word: http://www.eclipse.org/gmt/epsilon/spreadtheword
Follow Epsilon on Twitter: http://twitter.com/epsilonews
Re: [EuGENia] Reorder nodes in ECore2GMF.eol [message #519300 is a reply to message #519236] Mon, 08 March 2010 12:55 Go to previous message
Ralf is currently offline RalfFriend
Messages: 25
Registered: March 2010
Junior Member
Works great, Thanks! Smile
Previous Topic:Problem reproducing EOL Tool Simmetrics Example
Next Topic:[EuGENia] Reorder nodes in ECore2GMF.eol
Goto Forum:
  


Current Time: Sat Nov 29 09:00:50 GMT 2014

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

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