Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » need figures to appear on canvas when application launched(formatting the canvas)
need figures to appear on canvas when application launched [message #1384931] Tue, 03 June 2014 04:06 Go to next message
Eclipse UserFriend
I need to make a model using GMF in eclipse such that when the model is launched a rectangle appears automatically on the screen.... i.e. I do not have to draw it using tools from the palette but it appears by default when the application is launched.
Please tell me the changes I need to make in my Ecore diagram or .gmfgraph or any other file
Re: need figures to appear on canvas when application launched [message #1385535 is a reply to message #1384931] Sun, 08 June 2014 22:53 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
have a look at this tutorial.
gmfsamples .tuxfamily .org/wiki/doku.php?id=gmf_tutorial7
In here he adds a school node from code.
Hope that helps you

Best regards

Sorry for the bad link format, but I was not allowed to post it directly
Re: need figures to appear on canvas when application launched [message #1385611 is a reply to message #1385535] Mon, 09 June 2014 23:04 Go to previous messageGo to next message
Eclipse UserFriend
Thank you so much...it helped a lot.......
I have to further change my model to make nested rectangles appear on the canvas when launched. When i try to make the changes which were done for the node "School"
also to node "Classroom" , still only node "School" appears on the canvas.Is there any other way to make nested figures appear on the canvas when launched.
Re: need figures to appear on canvas when application launched [message #1431459 is a reply to message #1385611] Thu, 25 September 2014 14:22 Go to previous message
Eclipse UserFriend
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.
Previous Topic:Trigger another node's edit part from current node's edit part
Next Topic:gmfgen diagram model- different generated java classes structure
Goto Forum:
  


Current Time: Wed Jul 23 23:35:57 EDT 2025

Powered by FUDForum. Page generated in 0.80423 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top