[EuGENia] [message #498724] |
Wed, 18 November 2009 06:55  |
Eclipse User |
|
|
|
Originally posted by: arendt.mathematik.uni-marburg.de
Hi,
Using EuGENia two questions arose when specifying source and target of a
link:
1. How can I specify elements in an EList?
2. How can I navigate to other related EClasses?
Consider the following example:
class Classifier{}
@gmf.node
class Class extends Classifier{}
class Property extends Classifier{
ref Classifier type;
}
If I want to specify Associations like in UML, I think of this solution:
@gmf.link(source=X, target=Y)
class Association {
val Property[2] ownedEnds;
}
where X had to be set to "ownedEnds.get(0).getType()" or something like
this. Who can help to specify X and Y???
Regards,
Thorsten
|
|
|
|
Re: [EuGENia] [message #498733 is a reply to message #498725] |
Wed, 18 November 2009 07:54  |
Eclipse User |
|
|
|
Originally posted by: arendt.mathematik.uni-marburg.de
Hi Dimitris,
Thanks a lot, it works!
I specified in the model:
@gmf.link(source="source", target="target")
class Association {
val Property[2] ownedEnds;
derived ref Classifier source;
derived ref Classifier target;
}
.... and implemented in AssociationImpl.java:
public Classifier getSource(){
return getOwnedEnd().get(0).getType();
}
public Classifier getTarget(){
return getOwnedEnd().get(1).getType();
}
Best regards,
Thorsten
Dimitris Kolovos schrieb:
> Hi Thorsten,
>
> It seems that setting both the source and target to "ownedEnds" doesn't
> work. I'd recommend trying to create two derived features and setting
> them as the source and target of the link respectively:
>
> @gmf.link(source="source", target="target", label="name")
> class Association {
> ref Property[2] ownedEnds;
> derived ref Property source;
> derived ref Property target;
> }
>
> You'll then need to implement the logic in which the features are
> derived from ownedEnds by customizing the generated EMF code - don't
> forget to set @generated NOT in the methods you change. I must admit I
> haven't tried it but it should work. Please let me know if it doesn't
> and I'll have a closer look.
>
> Cheers,
> Dimitris
>
> Thorsten Arendt wrote:
>> Hi,
>>
>> Using EuGENia two questions arose when specifying source and target of a
>> link:
>> 1. How can I specify elements in an EList?
>> 2. How can I navigate to other related EClasses?
>>
>> Consider the following example:
>>
>> class Classifier{}
>>
>> @gmf.node
>> class Class extends Classifier{}
>>
>> class Property extends Classifier{
>> ref Classifier type;
>> }
>>
>> If I want to specify Associations like in UML, I think of this solution:
>>
>> @gmf.link(source=X, target=Y)
>> class Association {
>> val Property[2] ownedEnds;
>> }
>>
>> where X had to be set to "ownedEnds.get(0).getType()" or something like
>> this. Who can help to specify X and Y???
>>
>> Regards,
>> Thorsten
>
>
|
|
|
Re: [EuGENia] [message #582980 is a reply to message #498724] |
Wed, 18 November 2009 07:14  |
Eclipse User |
|
|
|
Hi Thorsten,
It seems that setting both the source and target to "ownedEnds" doesn't
work. I'd recommend trying to create two derived features and setting
them as the source and target of the link respectively:
@gmf.link(source="source", target="target", label="name")
class Association {
ref Property[2] ownedEnds;
derived ref Property source;
derived ref Property target;
}
You'll then need to implement the logic in which the features are
derived from ownedEnds by customizing the generated EMF code - don't
forget to set @generated NOT in the methods you change. I must admit I
haven't tried it but it should work. Please let me know if it doesn't
and I'll have a closer look.
Cheers,
Dimitris
Thorsten Arendt wrote:
> Hi,
>
> Using EuGENia two questions arose when specifying source and target of a
> link:
> 1. How can I specify elements in an EList?
> 2. How can I navigate to other related EClasses?
>
> Consider the following example:
>
> class Classifier{}
>
> @gmf.node
> class Class extends Classifier{}
>
> class Property extends Classifier{
> ref Classifier type;
> }
>
> If I want to specify Associations like in UML, I think of this solution:
>
> @gmf.link(source=X, target=Y)
> class Association {
> val Property[2] ownedEnds;
> }
>
> where X had to be set to "ownedEnds.get(0).getType()" or something like
> this. Who can help to specify X and Y???
>
> Regards,
> Thorsten
--
Spread the word: http://www.eclipse.org/gmt/epsilon/spreadtheword
Follow Epsilon on Twitter: http://twitter.com/epsilonews
|
|
|
Re: [EuGENia] [message #582998 is a reply to message #498725] |
Wed, 18 November 2009 07:54  |
Eclipse User |
|
|
|
Originally posted by: arendt.mathematik.uni-marburg.de
Hi Dimitris,
Thanks a lot, it works!
I specified in the model:
@gmf.link(source="source", target="target")
class Association {
val Property[2] ownedEnds;
derived ref Classifier source;
derived ref Classifier target;
}
.... and implemented in AssociationImpl.java:
public Classifier getSource(){
return getOwnedEnd().get(0).getType();
}
public Classifier getTarget(){
return getOwnedEnd().get(1).getType();
}
Best regards,
Thorsten
Dimitris Kolovos schrieb:
> Hi Thorsten,
>
> It seems that setting both the source and target to "ownedEnds" doesn't
> work. I'd recommend trying to create two derived features and setting
> them as the source and target of the link respectively:
>
> @gmf.link(source="source", target="target", label="name")
> class Association {
> ref Property[2] ownedEnds;
> derived ref Property source;
> derived ref Property target;
> }
>
> You'll then need to implement the logic in which the features are
> derived from ownedEnds by customizing the generated EMF code - don't
> forget to set @generated NOT in the methods you change. I must admit I
> haven't tried it but it should work. Please let me know if it doesn't
> and I'll have a closer look.
>
> Cheers,
> Dimitris
>
> Thorsten Arendt wrote:
>> Hi,
>>
>> Using EuGENia two questions arose when specifying source and target of a
>> link:
>> 1. How can I specify elements in an EList?
>> 2. How can I navigate to other related EClasses?
>>
>> Consider the following example:
>>
>> class Classifier{}
>>
>> @gmf.node
>> class Class extends Classifier{}
>>
>> class Property extends Classifier{
>> ref Classifier type;
>> }
>>
>> If I want to specify Associations like in UML, I think of this solution:
>>
>> @gmf.link(source=X, target=Y)
>> class Association {
>> val Property[2] ownedEnds;
>> }
>>
>> where X had to be set to "ownedEnds.get(0).getType()" or something like
>> this. Who can help to specify X and Y???
>>
>> Regards,
>> Thorsten
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.06026 seconds