[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.modeling.gmt.amw] Re: attributes wLink

Hello!

The second part of the code has the good structure: you should first get the structural feature, then call an eGet() over the object passing the structural feature as parameter.

However, the "left" or "right" references are defined in the following way (in KM3):

	class Link extends WLink {
		
		-- @subsets end
		reference left container : WLinkEnd;
		
		-- @subsets end
		reference right container : WLinkEnd;
	}
	
	class LinkEnd extends WLinkEnd {
	}		


These references "subsets" reference "end", but we do not define an opposite. Thus the "link" property is null, as you did.


To be able to access the parent link, you can use for example

wRightLinkEnd.eContainer();

This is an EMF method that returns the containing class.


Regards,

Marcos.


Kelly Garcés wrote:
Hello!

I use mw_base_ext metamodel.

I'm extending DefaultWeavingPanel, in createWLinkEndActions method i have a wLinkRightEnd, i can to access its attribute (link ...), i need link attributes too (left, right), i use this statements:

EObject sWLink = wLinkRightEnd.eClass().getEStructuralFeature("link");
sWlink is ok, but

EObject sRight = wLink.eClass().getEStructuralFeature("right");

sRight is null... :(

i tried this too, but it didn´t works

EStructuralFeature sWLink = wLinkRightEnd.eClass().getEStructuralFeature("link");

EObject wLink = (EObject) wLinkRightEnd.eGet(sWLink);

but wLink is null.

Sincerely thanks.

Kelly.