[Acceleo] How to get attributes from this meta-model [message #1272264] |
Mon, 17 March 2014 14:00 |
|
Dear all,
I got a meta-model like the picture that I've attached
I want to get the "value" from that meta-model with this code
[for (it : Feature | aFeatureModel.eAllContents(Feature))]
[if (it.attributes->notEmpty())]
[i/]. [it.name/] with attributes [it.attributes.name/] and value [it.attributes/]
[else]
[i/]. [it.name/]
[/if]
[/for]
I hope the output will be like this
1. [Feature_name] with attributes [name of feature's attribute] and value [value of attribute]
but instead of that result, I got
1. [Feature_name] with attributes [name of feature's attribute] and value org.hyperflex.featuremodels.impl.SimpleAttributeImpl@6e486976 (name: amount) (type: Int, value: in [0..5])
I think my problem is I can not get the contained items in second round bracket (type: Int, value: in [0..5]). So, I change the code to but I got an error message "Unrecognized variable: (value)"
I hope someone can help me solve this problem
Thank you
Regards,
Irfan
|
|
|
|
Re: [Acceleo] How to get attributes from this meta-model [message #1272483 is a reply to message #1272378] |
Tue, 18 March 2014 02:30 |
|
Ed Willink wrote on Tue, 18 March 2014 02:53attributes is a Collection so you should probably iterate over it, but
if really want just one attributes->any(true).value should work.
Regards
Ed Willink
Hello Ed,
thank you for your reply. Yes it's true that attributes is a collection.
I've tried your code but I still get the error message "Unrecognized variable: (value)"
I think I cannot do direct access to value since it's in the second round bracket in this result (I make it red) -> org.hyperflex.featuremodels.impl.SimpleAttributeImpl@6e486976 (name: amount) (type: Int, value: in [0..5])
I can do a direct access like attributes->any(true).name and I get "amount" as a result since it's in first round bracket.
Regards,
Irfan
|
|
|
|
Re: [Acceleo] How to get attributes from this meta-model [message #1272630 is a reply to message #1272576] |
Tue, 18 March 2014 11:20 |
|
I am sorry if I made you a little bit confused.
I just want to get the value of my model's attribute. I have provided the meta-model and I think I can get that value just by using this code
I have put your code and I get an error message like in the picture I've attached in this reply
Hope it helps you see my problem
Thank you
Regards,
Irfan
-
Attachment: error.png
(Size: 4.48KB, Downloaded 201 times)
|
|
|
|
|
|
|
Re: [Acceleo] How to get attributes from this meta-model [message #1273023 is a reply to message #1272985] |
Wed, 19 March 2014 10:29 |
|
Hello,
Okay, I am trying to make a better explanation. So, I hope everyone can see a better perspective.
In my project, there is a folder called "model".
This folder contains my feature diagram named "account.featuremodel_diagram" and the model of that feature diagram called "account.featuremodel"
I made that diagram using HyperFlex Feature Diagram editor that I found in its update site http://lucagherardi.it/projects/HyperFlex/UpdateSite
So, if you do not mind please install new software in eclipse using that link first.
and if no plugins are showed try to unflagged "Groups item by category" like this picture
The meta-model is included in that tools.
I have no idea how to extract just the meta-model from that tools,
that's why I did not provide the meta model.
And the for the launch configuration I made it this way
My problem is I want to get the value in feature diagram that I've made.
I do not know how to get that value like my first post.
Thank you
Best regards,
Irfan
|
|
|
Re: [Acceleo] How to get attributes from this meta-model [message #1273030 is a reply to message #1273023] |
Wed, 19 March 2014 10:48 |
Ed Willink Messages: 7681 Registered: July 2009 |
Senior Member |
|
|
Hi
If you want help you should expect to make the job easy, not give a list
of special non-Eclipse installs.
If you cannot provide a sensible repro, I am sorry, but you will have to
hope that someone else on this newsgroup can help.
Regards
Ed Willink
On 19/03/2014 10:29, Irfan Fadhillah wrote:
> Hello,
>
> Okay, I am trying to make a better explanation. So, I hope everyone
> can see a better perspective.
>
> In my project, there is a folder called "model".
> This folder contains my feature diagram named
> "account.featuremodel_diagram" and the model of that feature diagram
> called "account.featuremodel"
> I made that diagram using HyperFlex Feature Diagram editor that I
> found in its update site
> http://lucagherardi.it/projects/HyperFlex/UpdateSite
> So, if you do not mind please install new software in eclipse using
> that link first.
> and if no plugins are showed try to unflagged "Groups item by
> category" like this picture
>
>
>
> The meta-model is included in that tools. I have no idea how to
> extract just the meta-model from that tools, that's why I did not
> provide the meta model.
> And the for the launch configuration I made it this way
>
>
>
> My problem is I want to get the value in feature diagram that I've made.
> I do not know how to get that value like my first post.
>
>
> Thank you
>
> Best regards,
> Irfan
|
|
|
Powered by
FUDForum. Page generated in 0.04560 seconds