|
|
|
Re: need figures to appear on canvas when application launched [message #1431459 is a reply to message #1385611] |
Thu, 25 September 2014 18:22 |
|
Hello mona,
I dont know if you still need this but I am pointing out a solution for any other interested party
I assume that what you like to achieve is basically create a parent node s.s School and add children nodes into it s.s Classrooms whenever the diagram is created.
In order to do that, you need to go under YourProjectsName.diagram --> src --> yourname.diagram.part --> YournameDiagramEditorUtil.java
Then you will need to locate the createInitialModel() method and there you will need to call the Factory of this project and create the elements.
private static Diagram createInitialModel() {
Diagram diagram = SchoolFactory.eINSTANCE.createDiagram();
// note that you need to pay attention to the hierarchy that you execute the commands. For example, if you wanted to add students too, you would have first to append the students into the classroom list and then add this classroom to the school.
School school = SchoolFactory.eINSTANCE.createSchool();
Classroom room1 = SchoolFactory.eINSTANCE.createClassroom();
Classroom room2 = SchoolFactory.eINSTANCE.createClassroom();
school.addClassroom(room1); //or whatever name is used for the method that adds a classroom to the school classroom list
school.addClassroom(room2);
diagram.setSchool(school);
return diagram;
}
This will result into a school with 2 classes being created whenever you create a new diagram.
|
|
|
Powered by
FUDForum. Page generated in 0.02882 seconds