{"id":94,"date":"2018-03-31T03:02:29","date_gmt":"2018-03-31T00:02:29","guid":{"rendered":"http:\/\/siteblog.tuc.gr\/nispanoudakis\/?p=94"},"modified":"2018-03-31T03:02:29","modified_gmt":"2018-03-31T00:02:29","slug":"complex-graphical-models-using-eclipse-gmf-technology","status":"publish","type":"post","link":"https:\/\/siteblog.tuc.gr\/nispanoudakis\/2018\/03\/31\/complex-graphical-models-using-eclipse-gmf-technology\/","title":{"rendered":"Complex Graphical Models using Eclipse GMF technology"},"content":{"rendered":"<p>Today I am going to discuss about two features of Eclipse GMF that are not well covered by the documentation and that are difficult to locate in forums. For this article I used the\u00a0<a href=\"https:\/\/www.eclipse.org\/downloads\/packages\/eclipse-modeling-tools\/mars2\" target=\"_blank\">Eclipse Modeling Tools<\/a>\u00a0Mars 2 Package. After installing the package you must go to Help -&gt; Install Modeling Components and select and install the <em>Graphical Modeling Framework Tooling<\/em>.<\/p>\n<p>The <em><strong>first feature<\/strong><\/em> is to have<em><strong> text areas that can span multiple lines of text<\/strong><\/em>.<\/p>\n<p>The <em><strong>second feature<\/strong><\/em>\u00a0is to be able to <em><strong>print my model<\/strong> <\/em>(as I may want to have it is xps or pdf format). By default GMF allows only for printing your models in png (picture) format.<\/p>\n<p>I will take you step by step to these features definition using a simple example. Assume you have a newspaper and you want to publish articles. The page of the newspaper has one or more articles. Articles have a title, a teaser and text.<\/p>\n<p><strong>1. Create the project and the metamodel<\/strong><\/p>\n<p>You first need to create a new Modeling project. File-&gt; New-&gt; Project..-&gt;Ecore Modeling Project (see the next figure).<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/ModelingProject.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-96\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/ModelingProject-300x286.png\" alt=\"ModelingProject\" width=\"300\" height=\"286\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/ModelingProject-300x286.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/ModelingProject.png 525w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Now define the model as a collection of pages, and the pages are collections of articles.\u00a0 To do that right click on the newspaper.ecore file and click on &#8220;Initialize ecore_diagram diagram file&#8221;. Use the aggregation (or composition if you use the <em>aird<\/em> file) relationship from the toolbox and click and drag from the <em>Newspaper EClass<\/em> to the <em>Page<\/em> <em>EClass<\/em> and for <em>Page<\/em> to <em>Article<\/em>. Define the\u00a0relationships\u00a0and properties shown in the following diagram.<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/ecore_model.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-121\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/ecore_model-300x156.png\" alt=\"ecore_model\" width=\"300\" height=\"156\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/ecore_model-300x156.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/ecore_model.png 418w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>It is interesting to take a look at the properties of the aggregation.\u00a0Right click on\u00a0the line of the<em> articles<\/em> relationship and <em>select<\/em>\u00a0the properties view (see figure below). To indicate that the articles can be from one to many you\u00a0assign to the property &#8220;Lower Bound&#8221;\u00a0the value 1 and to the &#8220;Upper Bound&#8221;\u00a0the value -1.<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/open_properties-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-101\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/open_properties-1-272x300.png\" alt=\"open_properties\" width=\"272\" height=\"300\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/open_properties-1-272x300.png 272w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/open_properties-1.png 602w\" sizes=\"auto, (max-width: 272px) 100vw, 272px\" \/><\/a><\/p>\n<p>Now assume that you want the\u00a0<em>teaser<\/em> and\u00a0<em>text<\/em> properties of the\u00a0<em>Article\u00a0<\/em>to be able to have multiple lines of text (the first deature we discuss in this article). In order to do that you need first to open the <em>genmodel<\/em> file.\u00a0Then you will select the <em>teaser\u00a0<\/em>attribute and you set its &#8220;Property Multi-line&#8221; to the value <em>true<\/em>. By default it is false, so make sure to do that.<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/multi-line.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-104\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/multi-line-191x300.png\" alt=\"multi-line\" width=\"191\" height=\"300\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/multi-line-191x300.png 191w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/multi-line.png 287w\" sizes=\"auto, (max-width: 191px) 100vw, 191px\" \/><\/a><\/p>\n<p>Finally select the top level node in the genmodel diagram and check its properties. Set the <em>Compliance Level<\/em> to 6.0 (if you do not do this then when building the gmfgen file you will get an error):<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/genmodel-complianceLevel.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-122\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/genmodel-complianceLevel-300x201.png\" alt=\"genmodel-complianceLevel\" width=\"300\" height=\"201\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/genmodel-complianceLevel-300x201.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/genmodel-complianceLevel.png 304w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Now you are ready to initialize the code for editing the model&#8217;s elements. Right click on the Newspaper element of the <em>genmodel<\/em> and select &#8220;Generate All&#8221;. This will create the ecore <em>Model\u00a0Code<\/em> in this project and generate the <em>Edit Code<\/em>\u00a0project that you need.<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/generate_all.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-105\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/generate_all.png\" alt=\"generate_all\" width=\"268\" height=\"156\" \/><\/a><\/p>\n<p><strong>2. Generating the Graphical Model<\/strong><\/p>\n<p>Now you are ready to start working with GMF. Open the GMF Dashboard. Select Window-&gt;Show View-&gt;Other and type GMF and immediately you will see the GMF Dashboard appear. Select it and you will see it in your eclipse window.<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMFDashboard.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-107\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMFDashboard-300x300.png\" alt=\"GMFDashboard\" width=\"300\" height=\"300\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMFDashboard-300x300.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMFDashboard-150x150.png 150w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMFDashboard.png 311w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>The first task is to <em>select<\/em> the <em>ecore<\/em>\u00a0(Domain Model) and <em>genmodel<\/em>\u00a0(Domain Gen Model) files:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMFDashboard1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-108\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMFDashboard1-300x128.png\" alt=\"GMFDashboard1\" width=\"300\" height=\"128\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMFDashboard1-300x128.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMFDashboard1.png 664w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Next you derive the <em>gmfgraph<\/em> model by clicking <em>Derive<\/em> from the <em>Domain Model<\/em> towards the <em>Graphical Def Model<\/em>. I named it <em>newspaper1.gmfgraph<\/em> (see first figure below, in your machine you can give it the name newspaper.gmfgraph, I cannot because I already have one graph file). Then I selected the newspaper element in the Next step of the dialog (see second figure below), and in the final step of the dialog (see third figure) I selected that I want graphical representations for the <em>Page<\/em> (with the <em>number<\/em> attribute) and <em>Article<\/em> (with all its attributes, i.e., <em>name<\/em>, <em>teaser<\/em> and <em>text<\/em>).<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Graph-dialog-2.png\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-110\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Graph-dialog-2-300x260.png\" alt=\"GMF-Gen-Graph-dialog-2\" width=\"300\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Graph-dialog-2-300x260.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Graph-dialog-2.png 482w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Graph-dialog-1.png\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-111\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Graph-dialog-1-300x260.png\" alt=\"GMF-Gen-Graph-dialog-1\" width=\"300\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Graph-dialog-1-300x260.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Graph-dialog-1.png 482w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Graph-dialog-3.png\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-109\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Graph-dialog-3-300x270.png\" alt=\"GMF-Gen-Graph-dialog-3\" width=\"300\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Graph-dialog-3-300x270.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Graph-dialog-3.png 500w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Now if everything is OK you can see the following <em>newspaper1.gmfgraph<\/em>\u00a0file on eclipse:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-initial.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-113\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-initial-263x300.png\" alt=\"GMF-Graph-initial\" width=\"263\" height=\"300\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-initial-263x300.png 263w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-initial.png 417w\" sizes=\"auto, (max-width: 263px) 100vw, 263px\" \/><\/a><\/p>\n<p>All elements are in the <em>Canvas<\/em>. The Canvas has a <em>Figure Gallery<\/em>\u00a0(we will see it in detail later), the <em>Node<\/em> elements that refer to the objects that will be displayed and the <em>Diagram Label<\/em> elements that refer to the text boxes that will display attributes (bottom part of the figure). Now, in the <em>Figure Gallery<\/em> we have two main <em>Figure Descriptors<\/em>, one for the Page (<em>PageFigure<\/em>) and one for the Article (<em>ArticleFigure<\/em>). Each of these has a <em>Rectangle<\/em> with the default <em>Flow Layout<\/em>\u00a0and as many <em>Child Access<\/em> elements as its text boxes (attributes). Note that this is not enough, there are also the relevant <em>Label<\/em>s defined in the <em>Rectangle<\/em>. The\u00a0<em>Diagram Label<\/em> elements refer to the <em>Child Access<\/em> elements and the latter refer to the <em>Label<\/em> elements. In the <em>Label<\/em> element you can add children like <em>Insets<\/em> (to space the text from the limits of the rectangle) and\u00a0\u00a0a <em>Basic Font<\/em> to define text size and style &#8211; regular, bold or italics:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-add-properties-to-label.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-115\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-add-properties-to-label-274x300.png\" alt=\"GMF-Graph-add-properties-to-label\" width=\"274\" height=\"300\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-add-properties-to-label-274x300.png 274w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-add-properties-to-label-768x841.png 768w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-add-properties-to-label.png 822w\" sizes=\"auto, (max-width: 274px) 100vw, 274px\" \/><\/a><\/p>\n<p>Now we need to define a new <em>Rectangle<\/em> in <em>Page<\/em> where we will be inserting <em>Article<\/em> objects. Right click on the Rectangle PageFigure and select New Child -&gt; Rectangle:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-add-rectangle.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-116\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-add-rectangle-277x300.png\" alt=\"GMF-Graph-add-rectangle\" width=\"277\" height=\"300\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-add-rectangle-277x300.png 277w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-add-rectangle-768x832.png 768w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-add-rectangle.png 830w\" sizes=\"auto, (max-width: 277px) 100vw, 277px\" \/><\/a><\/p>\n<p>Name the <em>Rectangle<\/em> element\u00a0<em>PageCompartmentFigure<\/em>. See its properties:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-name-rectangle.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-117\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-name-rectangle-259x300.png\" alt=\"GMF-Graph-name-rectangle\" width=\"259\" height=\"300\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-name-rectangle-259x300.png 259w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-name-rectangle.png 382w\" sizes=\"auto, (max-width: 259px) 100vw, 259px\" \/><\/a><\/p>\n<p>Now you need to add a <em>Border Layout Data<\/em>\u00a0child to the <em>PageCompartmentFigure<\/em>\u00a0and add to the Rectangle\u00a0PageFigure a Child Access element with properties:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-Child-Access-Compartment.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-119\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-Child-Access-Compartment-300x287.png\" alt=\"GMF-Graph-Child-Access-Compartment\" width=\"300\" height=\"287\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-Child-Access-Compartment-300x287.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-Child-Access-Compartment.png 384w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Now go to Canvas -&gt; New Child -&gt; Compartment, name it\u00a0<em>PageCompartment<\/em>\u00a0with the following properties:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-Compartment-properties.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-120\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-Compartment-properties-207x300.png\" alt=\"GMF-Graph-Compartment-properties\" width=\"207\" height=\"300\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-Compartment-properties-207x300.png 207w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Graph-Compartment-properties.png 404w\" sizes=\"auto, (max-width: 207px) 100vw, 207px\" \/><\/a><\/p>\n<p>Save it and for now you are finished with the <em>gmfgraph<\/em> file. The next step is to go to the GMF Dashboard and\u00a0<em>Derive\u00a0<\/em>the <em>gmftool<\/em> model. First you select its name, then you select the newspaper element and finally, the two objects that you are going to be using to draw the model, i.e. the <em>Page<\/em> and the <em>Article<\/em>. See these three steps of the wizard:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Tool-dialog-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-123\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Tool-dialog-1-300x249.png\" alt=\"GMF-Gen-Tool-dialog-1\" width=\"300\" height=\"249\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Tool-dialog-1-300x249.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Tool-dialog-1.png 525w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Tool-dialog-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-124\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Tool-dialog-2-300x207.png\" alt=\"GMF-Gen-Tool-dialog-2\" width=\"300\" height=\"207\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Tool-dialog-2-300x207.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Tool-dialog-2.png 525w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Tool-dialog-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-125\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Tool-dialog-3-300x207.png\" alt=\"GMF-Gen-Tool-dialog-3\" width=\"300\" height=\"207\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Tool-dialog-3-300x207.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Tool-dialog-3.png 525w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Now you are ready to <em>Combine<\/em> all these models (using again the GMF Dashboard) to get the <em>gmfmap<\/em> model. Follow again the steps of the wizard. Take care to remove Article from the Links compartment in the fifth step. It must look as in the fifth figure below:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-127\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-1-300x274.png\" alt=\"GMF-Gen-Map-dialog-1\" width=\"300\" height=\"274\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-1-300x274.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-1.png 509w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-128\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-2-300x274.png\" alt=\"GMF-Gen-Map-dialog-2\" width=\"300\" height=\"274\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-2-300x274.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-2.png 509w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-129\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-3-300x274.png\" alt=\"GMF-Gen-Map-dialog-3\" width=\"300\" height=\"274\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-3-300x274.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-3.png 509w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-130\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-4-300x274.png\" alt=\"GMF-Gen-Map-dialog-4\" width=\"300\" height=\"274\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-4-300x274.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-4.png 509w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-131\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-5-300x274.png\" alt=\"GMF-Gen-Map-dialog-5\" width=\"300\" height=\"274\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-5-300x274.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-5.png 509w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Then you have to take care of the Nodes Page and Article because they need a final touch. Select <em>Article<\/em> and then click the button <em>Change<\/em>. Add the first <em>EReference articles<\/em> to the <em>Children Feature<\/em>:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-5-Article.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-132\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-5-Article-300x194.png\" alt=\"GMF-Gen-Map-dialog-5-Article\" width=\"300\" height=\"194\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-5-Article-300x194.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-5-Article-768x497.png 768w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-5-Article.png 779w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-5-Page.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-133\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-5-Page-300x193.png\" alt=\"GMF-Gen-Map-dialog-5-Page\" width=\"300\" height=\"193\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-5-Page-300x193.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-5-Page-768x495.png 768w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-Map-dialog-5-Page.png 779w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Now you have to edit the <em>newspaper.gmfmap<\/em> file. It is shown below. See that it contains the <em>ecore<\/em>, <em>gmfgraph<\/em> and <em>gmftool<\/em> models. We are going to focus on the <em>gmfmap<\/em> part. The <em>Mapping<\/em> has two elements of type<em> Top Node Reference<\/em> (one for articles and one for nodes) and a <em>Canvas Mapping<\/em>. Verify that the<\/p>\n<p>Each <em>Top Node Reference<\/em> has a <em>Node Mapping<\/em>. The <em>Node Mapping<\/em>\u00a0of <em>Article<\/em> has a <em>Feature Label Mapping<\/em> whose properties are displayed in the figure below:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Map-FeatureLabelMapping.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-134\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Map-FeatureLabelMapping-230x300.png\" alt=\"GMF-Map-FeatureLabelMapping\" width=\"230\" height=\"300\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Map-FeatureLabelMapping-230x300.png 230w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Map-FeatureLabelMapping.png 410w\" sizes=\"auto, (max-width: 230px) 100vw, 230px\" \/><\/a><\/p>\n<p>Now you have to add the\u00a0<em>Feature Label Mapping<\/em> that are missing with similar properties. Note that the one for Page (number) is not of type EString but of type EInt. I have its properties shown below:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Map-FeatureLabelMappings.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-135\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Map-FeatureLabelMappings-208x300.png\" alt=\"GMF-Map-FeatureLabelMappings\" width=\"208\" height=\"300\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Map-FeatureLabelMappings-208x300.png 208w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Map-FeatureLabelMappings.png 412w\" sizes=\"auto, (max-width: 208px) 100vw, 208px\" \/><\/a><\/p>\n<p>The final part in mapping is to add the compartment of the page.Right click to Node Mapping &lt;Page\/Page&gt; -&gt; New Child -&gt; Child Reference and then again right\u00a0\u00a0click to Node Mapping &lt;Page\/Page&gt; -&gt; New Child -&gt; Compartment Mapping. You do not have to type anything in their properties, just select the right items. See both their properties in the figures below:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Map-ChildReference-Properties.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-137\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Map-ChildReference-Properties-300x275.png\" alt=\"GMF-Map-ChildReference-Properties\" width=\"300\" height=\"275\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Map-ChildReference-Properties-300x275.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Map-ChildReference-Properties.png 489w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Map-CompartmentMapping-Properties.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-138\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Map-CompartmentMapping-Properties-300x261.png\" alt=\"GMF-Map-CompartmentMapping-Properties\" width=\"300\" height=\"261\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Map-CompartmentMapping-Properties-300x261.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Map-CompartmentMapping-Properties.png 502w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Now save it, if all has gone well you are ready to\u00a0press transform from the gmfmap model to the gmfgen model in GMF Dashboard. You finished the process:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Dashboard-100.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-140\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Dashboard-100-300x132.png\" alt=\"GMF-Dashboard-100\" width=\"300\" height=\"132\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Dashboard-100-300x132.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Dashboard-100.png 668w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><strong>Insert Printing Capability<\/strong><\/p>\n<p>Double click the newspaper.gmfgen file to open it. Now you click its\u00a0<em>Gen Editor Generator <\/em>top\u00a0element. Its properties <em>Diagram File Extention<\/em> and\u00a0<em>Domain File Extention<\/em> show the extentions of the files related to newspaper. The models will have the extention <em>.mewspaper<\/em> and the graphical models <em>.newspaper_diagram<\/em>. See also all the files in the models folder of our projet on the left:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-GMFGen-model.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-142\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-GMFGen-model-300x220.png\" alt=\"GMF-GMFGen-model\" width=\"300\" height=\"220\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-GMFGen-model-300x220.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-GMFGen-model-768x563.png 768w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-GMFGen-model.png 823w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Now select the\u00a0<em>Gen Plugin Newspaper Plugin\u00a0<\/em>element and set its property\u00a0<em>Printing Enabled\u00a0<\/em>to\u00a0<em>true<\/em>:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-GMFGen-print.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-141\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-GMFGen-print-300x270.png\" alt=\"GMF-GMFGen-print\" width=\"300\" height=\"270\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-GMFGen-print-300x270.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-GMFGen-print.png 522w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Now your models will have the printing capability! Now save and right click on the newspaper.gmfgen file and select to generate the diagram code:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-generate_code.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-143\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-generate_code-219x300.png\" alt=\"GMF-Gen-generate_code\" width=\"219\" height=\"300\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-generate_code-219x300.png 219w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-Gen-generate_code.png 658w\" sizes=\"auto, (max-width: 219px) 100vw, 219px\" \/><\/a><\/p>\n<p><strong>Add Text Multi-line capability<\/strong><\/p>\n<p>Normally the\u00a0<em>Newspaper.diagram<\/em> project has been created successfully and you can see it in the following figure. It is ready to work with it. However, we want the teaser and the text elements of the articles to be able to span multiple lines of text. To achieve that you need to edit a number (six actually) java files in package <em>newspaper.diagram.edit.parts<\/em>. The first two files that you need to edit are the\u00a0<em>ArticleEditPart.java<\/em> and\u00a0<em>Article2EditPart.java<\/em>. You need to find their\u00a0<em>createContents()<\/em> method. Initially it is like in the figure:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_edit_initial.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-145\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_edit_initial-300x216.png\" alt=\"GMF-diagram_code_edit_initial\" width=\"300\" height=\"216\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_edit_initial-300x216.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_edit_initial-768x553.png 768w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_edit_initial-1024x738.png 1024w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_edit_initial.png 1249w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>You need to locate the lines where the\u00a0<em>fFigureArticleTeaserFigure.setText(&#8220;&lt;&#8230;&gt;&#8221;)<\/em> method is called and add the code:<\/p>\n<p><em>fFigureArticleTeaserFigure.setTextWrap(true);<\/em><\/p>\n<p>Do the same for the\u00a0<em>fFigureArticleTextFigure<\/em>. Do not forget to set the method\u00a0to not be automatically generated from now on (<em>generated NOT<\/em>). You must do that because if for any reason\u00a0 &#8211; e.g. you want to change the fonts of the labels &#8211; you re-generate the diagram code you will lose your changes. See the final outcome in the following figure:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_edit_refined.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-146\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_edit_refined-300x216.png\" alt=\"GMF-diagram_code_edit_refined\" width=\"300\" height=\"216\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_edit_refined-300x216.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_edit_refined-768x553.png 768w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_edit_refined-1024x738.png 1024w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_edit_refined.png 1249w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>You have to repeat the above process for file\u00a0<em>Article2EditPart.java<\/em>.<\/p>\n<p>Now you get the <em>ArticleTeaserEditPart.java<\/em>, <em>ArticleTeaser2EditPart.java<\/em>, <em>ArticleTextEditPart.java<\/em>,\u00a0<em>ArticleText2EditPart.java<\/em>, and make another change. Take for example the first of them, i.e., <em>ArticleTeaserEditPart.java<\/em>, and locate its\u00a0<em>getManager()<\/em> method:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_text_edit_initial.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-148\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_text_edit_initial-300x126.png\" alt=\"GMF-diagram_code_text_edit_initial\" width=\"300\" height=\"126\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_text_edit_initial-300x126.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_text_edit_initial-768x322.png 768w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_text_edit_initial-1024x429.png 1024w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_text_edit_initial.png 1344w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Now you have to\u00a0locate the line with code:<\/p>\n<p><em>setManager(new TextDirectEditManager(this, null, NewspaperEditPartFactory.getTextCellEditorLocator(this)));<\/em><\/p>\n<p>and replace <em>null<\/em> with <em>WrapTextCellEditor.class<\/em>. This classhas not been imported yet, so hover your mouse over it and select to import <em>org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager<\/em>:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_text_edit_edit_line.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-149\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_text_edit_edit_line-300x127.png\" alt=\"GMF-diagram_code_text_edit_edit_line\" width=\"300\" height=\"127\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_text_edit_edit_line-300x127.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_text_edit_edit_line-768x325.png 768w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_text_edit_edit_line-1024x433.png 1024w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_text_edit_edit_line.png 1344w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Then remember to add <em>generated NOT<\/em> and save it:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_text_edit_final.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-150\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_text_edit_final-300x119.png\" alt=\"GMF-diagram_code_text_edit_final\" width=\"300\" height=\"119\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_text_edit_final-300x119.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_text_edit_final-768x303.png 768w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_text_edit_final-1024x405.png 1024w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_code_text_edit_final.png 1425w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Do not worry about the deprecated warning, it is just a warning \ud83d\ude42<\/p>\n<p>Now you have to do the same for the other three files. After that you are ready to test your model! To do that right click on your Newspaper.diagram project and select Run as -&gt; Eclipse Application.<\/p>\n<p>Create my first newspaper<\/p>\n<p>Create a new project and name it MyNewspaper. Then right click on the project and select New -&gt; Example -&gt; Newspaper Diagram<\/p>\n<p>Let it have the default name and add pages and then articles. To add an element click on it at the palette on the right hand side of the following figure. Then if it is a <em>Page<\/em> click anywhere in the canvas to insert a page. If it is an <em>Article<\/em> click inside a page to insert it there. Then add your text:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_newspaper.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-152\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_newspaper-300x163.png\" alt=\"GMF-diagram_newspaper\" width=\"300\" height=\"163\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_newspaper-300x163.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_newspaper-768x418.png 768w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_newspaper.png 927w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Now do you want to print your model? Just right click on the canvas and select File -&gt; Print:<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_print.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-154\" src=\"http:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_print-300x283.png\" alt=\"GMF-diagram_print\" width=\"300\" height=\"283\" srcset=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_print-300x283.png 300w, https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-content\/uploads\/sites\/58\/2018\/03\/GMF-diagram_print.png 519w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today I am going to discuss about two features of Eclipse GMF that are not well covered by the documentation and that are difficult to locate in forums. For this article I used the\u00a0Eclipse Modeling Tools\u00a0Mars 2 Package. After installing the package you must go to Help -&gt; Install Modeling Components and select and install &hellip; <a href=\"https:\/\/siteblog.tuc.gr\/nispanoudakis\/2018\/03\/31\/complex-graphical-models-using-eclipse-gmf-technology\/\" class=\"more-link\">\u03a3\u03c5\u03bd\u03ad\u03c7\u03b5\u03b9\u03b1 \u03b1\u03bd\u03ac\u03b3\u03bd\u03c9\u03c3\u03b7\u03c2 <span class=\"screen-reader-text\">Complex Graphical Models using Eclipse GMF technology<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":77,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,22,23,24,25,2,26,27],"tags":[],"class_list":["post-94","post","type-post","status-publish","format-standard","hentry","category-eclipse","category-ecore","category-emf","category-gmf","category-graphical-modeling-framework","category-java","category-multi-line-property","category-print"],"_links":{"self":[{"href":"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-json\/wp\/v2\/posts\/94","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-json\/wp\/v2\/users\/77"}],"replies":[{"embeddable":true,"href":"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-json\/wp\/v2\/comments?post=94"}],"version-history":[{"count":10,"href":"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-json\/wp\/v2\/posts\/94\/revisions"}],"predecessor-version":[{"id":155,"href":"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-json\/wp\/v2\/posts\/94\/revisions\/155"}],"wp:attachment":[{"href":"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-json\/wp\/v2\/media?parent=94"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-json\/wp\/v2\/categories?post=94"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/siteblog.tuc.gr\/nispanoudakis\/wp-json\/wp\/v2\/tags?post=94"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}