Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Please Help(Problem with Eugenia)
Please Help [message #1013415] Sat, 23 February 2013 15:59 Go to next message
Joshua Nwokeji is currently offline Joshua NwokejiFriend
Messages: 94
Registered: January 2013
Member
Dear All,

I have defined multiple sources and targets from and to one node in ecore, and annotated it in emfatic, but when I ran the configuration it only gave me one link. Please see the code below,

@gmf.link(target.decoration="arrow", source="fromc", target="toc", source="fromd", target="tod", source="FromO", target="ToO", incoming="true")
class Refinement extends KLink {
ref Requirement toc;
ref Goal fromc;
ref Goal fromd;
ref Expectation tod;
ref Obstacle[1] FromO;
ref Obstacle[1] ToO;
}

Thanks

Joshua
Re: Please Help [message #1013490 is a reply to message #1013415] Sat, 23 February 2013 19:42 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

I'm sorry, but that's not how Eugenia works Smile. The @gmf.link annotation will only have the last values for "source" and "target". By specifying them several times, you're only overriding their previous values.

Please remember that there are two ways to create links, as listed in the official docs:

  • You can have a link class with one "source" and one "target" attribute, as in:
    @gmf.link(source="source", target="target")
    class Link {
      ref Object source, target;
    }
    

    This is pretty much what you were doing in your case. You'll need one link class for each kind of relationship that you want to create.

  • Alternatively, you may apply @gmf.link to some of the EReference fields in a regular @gmf.node EClass:
    @gmf.node
    class Node {
      @gmf.link
      ref Requirement req;
    
      @gmf.link
      ref Goal goal;
    
      @gmf.link
      ref Expectation exp;
    }
    


In short: you may have multiple link classes for each kind of relationship, or you may use @gmf.link annotations on some of the reference attributes in your classes. You might want to try this example project:

http://eclipse.org/epsilon/examples/index.php?example=org.eclipse.epsilon.eugenia.examples.friends

[Updated on: Sat, 23 February 2013 19:44]

Report message to a moderator

Re: Please Help [message #1013510 is a reply to message #1013490] Sat, 23 February 2013 21:08 Go to previous messageGo to next message
Joshua Nwokeji is currently offline Joshua NwokejiFriend
Messages: 94
Registered: January 2013
Member
Dear Antonio,

Thanks for your help but I tried it, and it worked though it did not completely solve the problem, it creates additional link in the connection palette which does not fit into my project. Let me explain better:
In my ecore.diagram, I have a class called refinement (defined as gmf.link in emfatic) which has multiple sources and targets, e.g. refinement goes, from goal to requirement, from goal to sub-goal, from goal to expectation, from obstacle to obstacle, etc. Thus I need only one link/connector called refinement which can connect, goal to a sub-goal, goal to a requirement, goal to an expectation, obstacle to obstacle, etc.

Secondly, the emfatic file generated from ecore only gives me the E-Classes, how do I make it to show EReference?
Re: Please Help [message #1013831 is a reply to message #1013510] Sun, 24 February 2013 12:35 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

Dear Joshua,

If you want "refinement" to be a one-size-fits-all link type, you should make it link two instances of a common superclass of all your nodes. That should allow you to do all those links with one tool.

As for EReferences, these are the "ref" attributes that you declare inside a class. In the .ecore file, these will show up as structural features of your EClasses.

Would something like this work for you?

@gmf.diagram
class Model {
val Node[*] nodes;
val Refinement[*] refinements;
}

@gmf.node
abstract class Node {
}

@gmf.link(source="source", target="target")
class Refinement {
ref Node source, target;
}

class Goal extends Node {}
class Requirement extends Node {}
class Expectation extends Node {}
class Obstacle extends Node {}

That should allow you to have as many kinds of nodes as you want, and you should also be able to link them all with one tool.
Re: Please Help [message #1013856 is a reply to message #1013831] Sun, 24 February 2013 14:15 Go to previous messageGo to next message
Joshua Nwokeji is currently offline Joshua NwokejiFriend
Messages: 94
Registered: January 2013
Member
Dear Antonio,

This is great, it works, and I am so happy and excited. Thanks very much for your help. I know most of my questions are very basic, I am just new to programming, and GMF.

However, I will need another help from you. I want to use various figures and attributes for each nodes and link. I have been able to use rectangle, ellipse, and rounded (default). I tried couple of others but they are not supported. Please where can I get figures supported by java.lang? I need figures link, parallelogram, rounded rectangle, trapezium, polygon, etc. I came across SVG figures in the Eugenia website, but dont know how to use them. Can I also use customized figures like human, etc.

Thanks for your Help.

Regards

Joshua
Re: Please Help [message #1014379 is a reply to message #1013856] Mon, 25 February 2013 17:38 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

Dear Joshua,

I'm glad it worked for you Smile.

Indeed, Eugenia supports several custom figure types. For polygons, you can do something like this:

@gmf.node(figure="polygon", polygon.x="10 20 0", polygon.y="0 -10 -10")
class TriangleNode {
// ...
}

For SVG figures, you'll need to install the Experimental GMF SDK feature, place the my.svg SVG file (drawn with Inkscape, for example) into your plugin my.plugin (make sure it's included in your binary builds) and then refer to it like this:

@gmf.node(figure="svg", svg.uri="platform:/plugin/my.plugin/path/to/my.svg)
class NodeWithSVGFigure {
// ...
}

You can also implement your own Java classes for drawing the nodes as well. I suggest you have a look at these example projects:

http://eclipse.org/epsilon/doc/articles/eugenia-nodes-with-images/
http://eclipse.org/epsilon/doc/articles/eugenia-nodes-with-runtime-images/


Re: Please Help [message #1014391 is a reply to message #1014379] Mon, 25 February 2013 18:14 Go to previous messageGo to next message
Joshua Nwokeji is currently offline Joshua NwokejiFriend
Messages: 94
Registered: January 2013
Member
Dear Antonio,

Thanks a million times. You have been very helpful to me.

Regards

Joshua
Re: Please Help [message #1016061 is a reply to message #1014391] Mon, 04 March 2013 18:56 Go to previous message
Joshua Nwokeji is currently offline Joshua NwokejiFriend
Messages: 94
Registered: January 2013
Member
Dear Antonio,

I am trying to install "GMF Experimental SDK" in my ecllipse, and I did the following: Help->install new software->all available sites->GMF: But I only saw GMF Runtime SDK, and GMF notation SDK. are they the same with GMF Experimental SDK? If No how do I install GMF Experimental SDK?

I also need some help on how to place my.svg SVG file into my.plugin, so that I can refer it as "figure="svg", svg.uri="platform:/plugin/my.plugin/path/to/my.svg". Which steps should I follow to do these?

Regards

Joshua
Previous Topic:Converting OCL constraints on EVL constraints
Next Topic:Do the quickFixes work in tree-editor?
Goto Forum:
  


Current Time: Fri Mar 29 05:44:27 GMT 2024

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

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

Back to the top