RSS

Search Engine

Monday, October 11, 2010

Eclipse UML2 Tools

3.1. Creating UML Diagrams

The following example will create a class diagram with the UML2 tools.

Create a new java project "sawan.modi.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.

In my example I will create a class diagram.

Define the name of you diagram as "myclasses.umlclass".

Press finish.

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 mouse 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.

Tip

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.

Save your UML diagram.

Tip

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 mouse click and by selecting the "Initialize * class diagram" entry in the menu.

3.2. Multiplicity

You can maintain the relationship multiplicity between two classes by clicking on the association and via the properties lower / upper in the property view.

3.3. Interfaces

UML2 Tool let you choose if you want to use the ball-and-socket notation (interface is displayed as a circle) or UML stereotype <> for the representation of an interface. Simple right click on the interface and select "Show as class" of "Collapse to circle".

3.4. Viewing the .uml file

Investigate the *.uml file. The *.uml file is EMF based. Eclipse UML provides an editor for it. Alternative you can view the file directly in a text editor.

1 comments:

manali said...

how can i color a class diagram?
Is there any way to color a class diagramby reading .uml file of that class diagram?

Post a Comment