Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [eugenia] is there a way?(@gmf.node annotations)
[eugenia] is there a way? [message #897740] Wed, 25 July 2012 07:55 Go to next message
Akira Tanaka is currently offline Akira Tanaka
Messages: 33
Registered: March 2010
Member
Hello,

I am wondering if it is possible to add something like UML's stereotype (e.g. <<xxx>>) to nodes (classes) using @gmf.node annotations.

For instance, by adding something to annotation part:

@gmf.node(label="name")
class ABC {
  attr String name
}


is it possible to get graphic element similar to UML's Class with stereotype?

+---------------+
+<ABC> name + 
+++++++++++
+                        +
+---------------+


Or, do I need to work at GMF level?

Thank you very much for your help in advance.
Akira
Re: [eugenia] is there a way? [message #897999 is a reply to message #897740] Wed, 25 July 2012 15:16 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-Dominguez
Messages: 309
Registered: January 2010
Senior Member
Hi Akira,

You should be able to use something like this, I believe:

@gmf.node(label="name", label.pattern="<<xxx>> {0}")


This comprehensive reference has more information on "label.pattern":

http://www.eclipse.org/epsilon/doc/articles/eugenia-gmf-tutorial/

Cheers,
Antonio
Re: [eugenia] is there a way? [message #898691 is a reply to message #897999] Fri, 27 July 2012 08:30 Go to previous messageGo to next message
Akira Tanaka is currently offline Akira Tanaka
Messages: 33
Registered: March 2010
Member
Thank you very much for the response.

I tried the suggested annotation and found the following.

1) if I use "«" and "»", the character seems to be transformed into "<" and ">" (in .gmfgen) for @gmf.node.
2) if I apply the same to @gmf.link, it seems they are removed (in .gmfgen) at the end.

Above may be because of my eclipse set up e.g. character encoding (I use utf-8 for workspace).

So my solution was to just use "<" and ">" in the label.pattern, or to do manual replacement in .gmfgen file.

Thanks again for your help.
Akira
Re: [eugenia] is there a way? [message #898793 is a reply to message #898691] Fri, 27 July 2012 15:21 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-Dominguez
Messages: 309
Registered: January 2010
Senior Member
Hi Akira,

Akira Tanaka wrote on Fri, 27 July 2012 04:30
Thank you very much for the response.


Why, thank you very much for your feedback! Smile

Akira Tanaka wrote on Fri, 27 July 2012 04:30

I tried the suggested annotation and found the following.

1) if I use "«" and "»", the character seems to be transformed into "<" and ">" (in .gmfgen) for @gmf.node.


I've tried it on a few models of my own (also using UTF-8) and it works for me. I've had a look at the code and we don't really parse the value of "label.pattern" at all, so this is a bit puzzling :-/. We just pass it over to the GMF models.

Akira Tanaka wrote on Fri, 27 July 2012 04:30

2) if I apply the same to @gmf.link, it seems they are removed (in .gmfgen) at the end.


The problem is in the documentation, actually: "label.pattern" is not supported for @gmf.link. For the time being, I've fixed the documentation on the Epsilon website. If you need this feature, could you please file a bug report for it, citing this thread?

Best regards,
Antonio

[Updated on: Sun, 29 July 2012 13:21]

Report message to a moderator

Re: [eugenia] is there a way? [message #898900 is a reply to message #898793] Sun, 29 July 2012 01:01 Go to previous messageGo to next message
Akira Tanaka is currently offline Akira Tanaka
Messages: 33
Registered: March 2010
Member
Hello Antonio,

Thank you for the response. I tried use of french quotations in label.pattern again, and found that the emf file was not actually processed by "Generate Ecore Model" under my eclipse setting. That is, if I had something like

@gmf.node(label="name", label.pattern="«Node» {0}")


Then, no ecore file was generated by the command. And, if I changed this to

@gmf.node(label="name", label.pattern="<<Node>> {0}")
[


Correct ecore file was generated. So the issue may be around handling of special characters in "Generate Ecore Model," or in Emfatic or ... (?). I checked this with new UTF-8 workspace and ISO-8859-1 workspace (it was the same). Probably I am missing something.

Best regards,
Akira
Re: [eugenia] is there a way? [message #898960 is a reply to message #898900] Sun, 29 July 2012 15:16 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-Dominguez
Messages: 309
Registered: January 2010
Senior Member
Hi Akira,

That's odd. I have tried it again, this time with the simplest .emf I could think of, and it still works fine for me.

I have attached to this message the .emf file I have used. You only need to place it inside a project and launch Eugenia by right-clicking on it and selecting "Eugenia > Generate GMF Editor". It should produce all the ECore and GMF models, and all the required code.

In any case, it seems we will need more information to track down this problem. Could you describe your environment a bit more? Here's mine:

  • Latest Epsilon from SVN (revision 1917)
  • Eclipse Juno 4.2.0, build ID I20120608-1400
  • 64-bit Server Sun JDK 6 update 33, running on GNU/Linux (Arch Linux)
  • System-wide encoding: UTF-8 (the system property "file.encoding" is "UTF-8")
  • Workspace encoding: UTF-8


If I recall correctly, Japanese operating systems tend to use Shift-JIS or EUC-JP as system-wide default encodings, instead of UTF-8 or the ISO-8859 variants. I'm not sure if Emfatic is honoring the workspace encoding when producing the .ecore file from the .emf file.

Could you please check the value of "file.encoding" in "Help > About Eclipse Platform > Installation Details > Configuration"? If it's not UTF-8, you might want to change its value following these instructions:

http://stackoverflow.com/questions/361975/setting-the-default-java-character-encoding

You're welcome!
Antonio
  • Attachment: example.emf
    (Size: 0.37KB, Downloaded 66 times)
Re: [eugenia] is there a way? [message #899076 is a reply to message #898960] Mon, 30 July 2012 13:40 Go to previous messageGo to next message
Akira Tanaka is currently offline Akira Tanaka
Messages: 33
Registered: March 2010
Member
Hello Antonio,

Thank you for the file. You are right. The root cause was my "file.encoding," which was set to SJIS for eclipse. I will find a way to change this and try your file again (I just applied JAVA_TOOL_OPTIONS).

My settings:
o epsilon: 0.9.1.201107251201
o Juno: 4.2.0, build ID I20120608-1400 (same as yours)
o Java: 1.6.0_33 (MacOSX 64bit)
o "file.encoding": UTF-8 (Command level), SJIS (eclipse's config info) <= will work on this.
o workspace: UTF-8

I will repot the result when I succeed.

Best,
Akira
Re: [eugenia] is there a way? [message #899196 is a reply to message #899076] Tue, 31 July 2012 02:02 Go to previous message
Akira Tanaka is currently offline Akira Tanaka
Messages: 33
Registered: March 2010
Member
Hello Antonio,

I was able to change file.encoding to UTF8 in eclipse config and your file was beautifully processed!

Just in case for other people who may face the same issue, here are what I did to change the character encoding setting on Mac OSX (Lion).

From Terminal:

1) JAVA_TOOL_OPTIONS='-Dfile.encoding=UTF8'

2) Did "cd" to "/your eclipse installation folder/Eclipse.app/Contents/MacOS," and edited "eclipse.ini" there to include "-Dfile.encoding=UTF8."

Thank you for your help. This tool is great.
Best regards,
Akira
Previous Topic:XMI to HUTN bridge
Next Topic:Epsilon csv model loader
Goto Forum:
  


Current Time: Thu Oct 30 13:17:10 GMT 2014

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

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