Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » gmf.label for EAttributes - use of pattern
gmf.label for EAttributes - use of pattern [message #1128456] Mon, 07 October 2013 18:11 Go to next message
Jessica Diaz is currently offline Jessica DiazFriend
Messages: 3
Registered: October 2013
Junior Member
Hello,

Please, I need help for the following issue. I want to model the metaclass "CEOLidership" which has a list of attributes (pairs of key/value), such as:
- Tolerance Of Ambiguity : value{yes/no/no evidence}
- Self confidence : value{yes/no/no evidence}
- ....

I used gmf.label and label.pattern.
Althoug label.pattern works for gmf.node (see labels v1 and v2), it seems that label.pattern does not work for gmf.label

Any suggestion to make a fixed list of attributes in the form "key : value"
Please find below the code for any suggetion.

Thanks in advance.

---------------------------------------------------------

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

@gmf.diagram
class InnoModel {
val Employee[*] employees;
val Determinant[*] determinants;
}

@gmf.node(figure="rectangel",
label.icon="false", label="name", label.placement="external")
class Employee {
attr String name;
@gmf.link(width="2", color="0,0,255", target.decoration="arrow", style="dash")
ref CEOLidership exercises;
}

abstract class Determinant {
attr String name;
}

@gmf.node(label="v1,v2", figure="rectangle", label.pattern="aa:{0}:{1}",
tool.small.bundle="InnoModelingTool", tool.small.path="icons/CEO.gif")
class CEOLidership extends Determinant{
attr String v1;
attr String v2;

@gmf.label(label="toleranceofamiguityvalue", label.icon="false", label.pattern="Tolerance Of Ambiguity : {0}")
attr CEOFactorValue toleranceofamiguityvalue;

@gmf.label(label="selfconfidencevalue", label.icon="false", label.pattern="Self Confidence : {0}")
attr CEOFactorValue selfconfidencevalue;
}

//ENUM
enum CEOFactorValue{
no = 0;
yes = 1;
noEvidence = 2;
}
Re: gmf.label for EAttributes - use of pattern [message #1128554 is a reply to message #1128456] Mon, 07 October 2013 20:26 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Jessica,

The problem seems to be that the type of your attributes is an enum. If you change your attributes to be strings instead (and remove the label="..." details as they are not supported by @gmf.label) everything works as expected:

@gmf.label(label.icon="false" , label.pattern="Tolerance Of Ambiguity : {0}")
attr String toleranceofamiguityvalue;

@gmf.label(label.icon="false", label.pattern="Self Confidence : {0}")
attr String selfconfidencevalue;

A minor typo I also had to fix to get this to run was figure="rectangel" -> figure="rectangle".

This looks like a GMF bug to me as Eugenia generates the expected .gmfmap model even when the @gmf.label attributes are of an enumeration type.

Cheers,
Dimitris
Re: gmf.label for EAttributes - use of pattern [message #1128575 is a reply to message #1128554] Mon, 07 October 2013 21:00 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

Hi everyone,

I also found the same issues (label="..." and "rectangel"). I did get it to work with enums, though, but I had to manually modify the parser in the GMFGen model. The problem is that when GMF sees the enum, it uses the default enum parser instead of the MessageFormat-based parser.

I'll write up a quick polishing transformation which should help you, and if it works we could integrate it into Eugenia later on Smile.

Cheers,
Antonio

Edit: We do tell GMF to use MESSAGE_FORMAT in the GMFGen model, but the "Edit/View Method" attributes are now deprecated in favor of the "Parser" attribute. I think this bug may have been introduced recently with a new version of GMF.

[Updated on: Mon, 07 October 2013 21:03]

Report message to a moderator

Re: gmf.label for EAttributes - use of pattern [message #1128594 is a reply to message #1128575] Mon, 07 October 2013 21:22 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

Here's a fixed .emf file and the polishing transformation that you'll need.

You'll notice that I'm using label.parser="MessageFormatParser" in order to force GMF to honor our label patterns instead of using the default Enum parser.

GMF doesn't like unused parsers, though, so it'd produce a validation error and stop the code generation process. That's what the FixGMFGen.eol is for: it removes the unused parsers so GMF doesn't complain.

You only have to replace your .emf file with this one, place the FixGMFGen.eol file in the same folder and regenerate the code with Eugenia. Give it a try and tell us if it works for you Smile.
  • Attachment: model.emf
    (Size: 1.04KB, Downloaded 174 times)
  • Attachment: FixGMFGen.eol
    (Size: 0.16KB, Downloaded 159 times)
Re: gmf.label for EAttributes - use of pattern [message #1128630 is a reply to message #1128594] Mon, 07 October 2013 22:11 Go to previous message
Jessica Diaz is currently offline Jessica DiazFriend
Messages: 3
Registered: October 2013
Junior Member
Thank you both. This forum is a great help.

I'd like alto to add that I had previously used eclipse-epsilon-1.0-win32-x86_64 and the proposed solution did not work, but it does work with eclipse-epsilon-1.1_SR1-win32-x86_64

Thanks again.
Previous Topic:Eugenia Annotation
Next Topic:Eugenia Compartment Layout
Goto Forum:
  


Current Time: Fri Apr 26 12:25:33 GMT 2024

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

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

Back to the top