Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 08:06 Go to next message
mona gupta is currently offline mona guptaFriend
Messages: 5
Registered: May 2014
Junior Member
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] Mon, 09 June 2014 02:53 Go to previous messageGo to next message
Benjamin NoOnesBusiness is currently offline Benjamin NoOnesBusinessFriend
Messages: 3
Registered: June 2014
Junior Member
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] Tue, 10 June 2014 03:04 Go to previous messageGo to next message
mona gupta is currently offline mona guptaFriend
Messages: 5
Registered: May 2014
Junior Member
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 18:22 Go to previous message
Nikos Margaritis is currently offline Nikos MargaritisFriend
Messages: 65
Registered: September 2014
Member

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: Sun Nov 18 07:36:55 GMT 2018

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

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

Back to the top