MSCFOSS/DIF122/Software Development Practices/UML with Eclipse
UML with Eclipse and the UM2Tools
This article gives a short overview of UML2 and explains the usage of the Eclipse UML2 Tools for modeling UML 2 diagrams.
This article is based on Eclipse 3.5.
Eclipse supports the creation of UML2 diagrams via UML2 Tools project. UML2 Tools is a set of GMF-based editors for viewing and editing UML models.
The Unified Modeling Language (UML) is a visual language for capturing software designs and patterns. The first version of UML was defined 1994 and released by the Object Management Group (OMG) in 1997 as UML v.1.1. The syntax and a semantic of UML is defined by the OMG.
The basic building block for UML is a diagram. UML divides diagrams into structural diagrams and behavioral diagrams
The latest version UML 2 has the target to add the ability for modelers to capture more system behavior. UML 2 has the target to support model driving architectures (MDA). MDA has the target to create automatically a software program from several models.
UML is intended to be extended. The formal way to extending a UML model is via a UML profile. A UML profile a collection of UML stereotypes and constraints on elements that map the generic UML to a specific problem domain or implementation. For example a UML profile can be used to support the modeling of J2EE software components.
Installation of Eclipse UML2 Tools
Install the following plug-in
- UML2 Tools SDK
The UML2 Tools can be found under "Modeling" in the update manager.
Install the plugins via the update manager of eclipse.
Eclipse UML2 Tools
Creating UML Diagrams
The following example will create a class diagram with the UML2 tools.
Create a new java project "de.vogella.uml2.first" and a new folder "uml2". Right-click on the folder "uml2", select New-> Other. Select UML 2.1 Diagrams and then the "class diagram" as the type.
We will create a class diagram.
Define the name of you diagram as "myclasses.umlclass".
From the "Palette" you can now select the type of element you would like to create. For example Select "Class" and click in the whitespace to create the UML representation of a class.
The result should look like the following.
The properties view allow you to change the attributes of the elements. To open the properties view select a class, right-click and select "Show Properties View". You can then for example set the "Is Abstract" flag to true to create a abstract class.
If you select your element a menu will be displayed which allows you to add property (fields) and operations (methods).
If you select your UML diagram and click on the outgoing arrow you can create associations.
Save your UML diagram.
- You can edit the properties and the operations names directly in the diagram. According to the UML specification the name of an operation should be followed by round brackets, e.g. you can type foo() but not foo for a operation.
- Note that your UML diagram updates the *.uml file. In case you deleted your diagram you can re-create the diagram from the .uml file, via the right-click and by selecting the "Initialize * class diagram" entry in the menu.