Accessing References inside model element [message #1080752] |
Tue, 06 August 2013 06:43  |
Eclipse User |
|
|
|
Hello ,
I have a question, Not sure if its the right forum to post.I have a Metamodel like this,
1.
Report1:
Element ----> EObject
0..*
Now I can create a model element of this.
- I need to access this element and store it inside another model element (2) which is displayed at bottom.
2.
Report2:
newElement --> EObject
1
anotherElement : EString
Currently I am trying to do the following way in the code :
List<Report2> parse(Report1 r1) {
List<Report2> rep2elements = new ArrayList<Report2>();
List<EObject> parsedElement;
pE = r1.Element();
Report2 rep2element;
for (i=0; i<pE.size();i++){
rep2element = reportFactoryImpl.eINSTANCE.createReport2();
// I can get the values contained inside report1 as a string
rep2element.setAnotherElement(pE.get(i).getClass().toString());
rep2elements.add(rep2element);
}
return rep2elements;
}
Now i need to get the element inside report1 as a reference inside my report2 :
i tried something like this but it does not work.
rep2element.setnewElement((EObject)affectedElements.get(i));
Any suggestions.
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05885 seconds