MDT-UML2Tools How To Regenerate Diagrams (Alternative)

From Eclipsepedia

Jump to: navigation, search



Because I couldn't get regeneration of diagrams working according to the existing How-To I decided to describe the way I did get it working finally.

Prerequisites and Target Platform

First I downloaded all build dependencies for the latest U2T biuld. The dependencies can be found here. I downloaded them all as ZIP-files. I didn't install anything via the Eclipse Update Manager. May you need another Eclipse 3.6 SDK for your OS. Feel free to use the Eclipse 3.6 SDK which you need. After downloading everything I unzipped all dependencies into the dropins folder of the Eclipse 3.6 SDK. So the Eclipse SDK you are using to regenerate U2T is your target platform too.

Checkout needed source code

First you'll need the U2T sources. These can be found in the CVS at "org.eclipse.mdt/org.eclipse.uml2tools". If you want to have the GMF source code available for debugging you also have to checkout the GMF sources at "org.eclipse.gmp/org.eclipse.gmf.tooling" and "org.eclipse.gmp/org.eclipse.gmf.runtime". If you check out the GMF sources, be sure to have the identical code to the GMF release you use (build dependencies). E.g. if you have downloaded the GMF SDK from 2010-06-15 10:00 (2.3.0 release build) checkout with this timestamp.

Setting up the development platform

Start Eclipse and add the following two U2T projects to the workspace:

  • org.eclipse.uml2.diagram.codegen
  • org.eclipse.uml2.diagram.codegen.edit

If you want to have GMF sources available you also have to import the according GMF projects here. I added all GMF-Tooling projects here. GMF-Runtime projects are only necessary if you have a particular case where you need the sources for debugging. Some GMF-T projects are marked with problem markers. As long as these problems are concerning only tempalte-files you can ignore them. Now create a new Eclipse Run Configuration, to which you add all plugins you previously had added (the projects you have imported currently). This new Run Configuration is your development platform. Here you have to import the following U2T projects:

  • org.eclipse.uml2.diagram.common
  • org.eclipse.uml2.diagram.common.notation
  • org.eclipse.uml2.diagram.def

These three projects are mandatory because the def-projects contains all GMF-model-files. The other two projects contain commonly use code. Then you have to import the diagrams you want to work on.

Regenerate the diagrams

After having made your changes you have to create a new GMF generator model. Therefore right-click on the gmfmap-file and select "Create generator model...". Follow the wizard. You can ignore validation errors in the gmfmap file. These normally are caused by some cases where GMF is insufficient for the UML. At the last wizard page enter the following for GMFGrap dynamic templates: "platform:/resource/org.eclipse.uml2.diagram.def/dynamic-templates/gmf-graph/". Now you have a new GMF generator model for your diagram. Now right-click on the gmfgen-file an select "Generate UML2Tools Diagram". Proceed (ignore validation errors).

Test your changes

Start a new Run Configuration, with contains all uml2tools you currently have imported in your development workspace (except the def-project. This isn't needed at runtime, only at creation time of the diagrams). Create a diagam and test your changes.