Core Java

Eclipse class diagram example

In this tutorial we are going to see how you can generate UML class diagrams from your source code, using Eclipse. Class diagrams are an extremely helpful tool, visualizing the structure of the code of your project. It is a very good companion for your documentation.

There are many Eclipse plugins that do class diagrams and most of them are quite good. In this example we are going to use the most classic one, class ObjectAid UML Explorer.

 
 
 

1. ObjectAid UML Explorer Eclipse plugin installation

In this tutorial we are going to use Eclipse Kepler 4.3. We are going to show you how to install ObjectAid UML Explorer in Eclipse, and a glimpse of how you can use it.

1. In order to install ObjectAid UML Explorer in Eclipse, go to Help -> Install New Software…

Figure 1: Install New Software
Figure 1 : Install New Software

2. Paste this URL : http://www.objectaid.net/update in the Work with text field.

Figure 2 : Add URL
Figure 2 : Add URL

3. Click Add and put ObjectAid in the Name field and click OK.

Figure 3 : Add Resource
Figure 3 : Add Resource

4. Select all the plugins you want to install and click Next.

Figure 4 : Select plugins
Figure 4 : Select plugins

5. You will see an overview of your installation.

Figure 6 : Installation Overview
Figure 5 : Installation Overview

6. Accept the Licence Agreement and click Finish.

Figure 5 : Accept the Licence Aggreement
Figure 6 : Accept the Licence Agreement

7. Give it some time to install the new Software.

Figure 7 : installing...
Figure 7 : installing…

It is likely the a Warning will pop up during installation. Click OK to ignore it.

Figure 8 : Ingore Warning
Figure 8 : Ingore Warning

8. When the installation finishes, you will be prompt to restart your Eclipse IDE. Click Yes.

Figure 9 : Restart Eclipse IDE
Figure 9 : Restart Eclipse IDE

2. Create a Simple class Diagram

When your Eclipse IDE restarts, this is how you can create a Class diagram for one of your projects.

1. On the Project Explorer, Right Click on the Project’s name -> New -> Other. On the pop up box, start typing Class Diagram in the Wizards text field. Click on the Class Diagram and then click Next.

Figure 10 : Add new Class Diagram
Figure 10 : Add new Class Diagram

2. Type in a name for the diagram file, and select the several details and options.

Figure 11 : Diagram Name and Options
Figure 11 : Diagram Name and Options

3. After that the blanc page of the Class Diagram editor will open. From then you can Drag and Drop a class from Project Explorer in order to create it’s UML node in the Diagram. Here is a simple Class Diagram that I’ve constructed.

Figure 12 : A simple Class Diagram
Figure 12 : A simple Class Diagram

Download the Eclipse Project

This was an example on how to create Class Diagrams with Eclipse.

Download
You can download the full source code of this example here : ClassDiagramExample.zip

Nikos Maravitsas

Nikos has graduated from the Department of Informatics and Telecommunications of The National and Kapodistrian University of Athens. During his studies he discovered his interests about software development and he has successfully completed numerous assignments in a variety of fields. Currently, his main interests are system’s security, parallel systems, artificial intelligence, operating systems, system programming, telecommunications, web applications, human – machine interaction and mobile development.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Jonathan De La Marche
Jonathan De La Marche
5 years ago

The url in Step 2 is no longer valid. Use this one instead: http://www.objectaid.com/update/current
(Source: http://www.objectaid.com/installation)

Back to top button