[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.modeling.gmf] Re: How to simulate a label of a link when link and label are of different EClasses?
|
- From: alessanderbotti@xxxxxxxxx (Alessander Botti Benevides)
- Date: Tue, 9 Jun 2009 20:58:41 +0000 (UTC)
- Newsgroups: eclipse.modeling.gmf
- Organization: Eclipse
- User-agent: NewsPortal/0.36 (http://florian-amrhein.de/newsportal)
Hi Alex,
I finally managed to make it work! Thank you very much for your help, I
would not have succeeded without it.
I'll describe how I did it in the steps shown below. As you can see, some
steps of my previous message are unnecessary (I'll try to make a GMF
Recipe):
(i) make sure that both derivedCAttribute and BAttribute have the property
"Notify" set to true in the genmodel file. Also, derivedCAttribute should
have the properties "derived" and "volatile" set to true in the ecore file;
(ii) implement the method getDerivedCAttribute() in CImpl.java:
public String getDerivedCAttribute() {
if (getCtoB() != null) {
return getCtoB().getBAttribute();
else
return "";
}
(iii) implement the method setDerivedCAttribute(String newCAttribute) in
CImpl.java, making a call to eNotify: public void
setDerivedCAttribute(String newCAttribute) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
???Package.C__DERIVEDCATTRIBUTE, getDerivedCAttribute(), newCAttribute));
}
(iv) modify setBAttribute(String newBAttribute) in BImpl.java in order to
call the implementation of the method setDerivedCAttribute:
public void setBAttribute(String newBAttribute) {
if (getBtoC() != null)
getBtoC().setDerivedCAttribute(newBAttribute);
String oldBAttribute = BAttribute;
BAttribute = newBAttribute;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
???Package.B__BATTRIBUTE, oldBAttribute, BAttribute));
}
Thank you very much for your help!
Best regards,
Alessander Botti Benevides