This tutorial refers to Netbeans IDE 5.5.
Getting Started with Netbeans UML modelling Tools
Call it Reverse Engineering. Netbeans 5.5 Unified Modelling Language (UML) tools enables you to generate UML Diagrams - class diagrams, sequence diagrams, activity diagrams et. al automatically from your source code. Yes,you heard it right! There is no need to manually draw the UML diagrams any more for your Java source code.
If you are wondering why should we use UML, check out The Importance of Using the Unified Modelling Language.
It is always a good practice to first get a feel of what we are trying to accomplish in this tutorial. As a primary goal, I shall give you a hands-on approach to create UML class diagrams for your project. We shall not bother ourselves with other UML diagrams - sequence diagrams, activity diagrams, etc. For the purpose of this tutorial the java project that I am going to use is NOT a dummy project, it is the ODF Toolkit for Java project and I am a mentee in that project. So the class diagrams that is shown here are highly detailed and contain many classes, packages. My suggestion is that before getting started with this document, create a simple "Hello World" java project for yourself to test the steps given here.
Netbeans UML modelling tools
Before you can start using the UML modelling tools, you will have to install them using the Netbeans update center. Go to Tools -> Update Center. After all the module lists have been retrieved select the UML Modelling Pack.
For more detailed instructions on installation you may refer this page
Generating UML Class Diagrams
- Open the project for which you want to genearate the class diagram
- On the package view on the left hand side in Netbeans, Right-click on the project Name. On the menu that appears, select Reverse Engineer. You will get the following dialog box
- The project window should now look like this:
- Now click on the UML project you just created and hence click on Model. This gives a view of all the packages in your project.
- Now, Right-click on the package for which you want to generate the class diagram and from the menu, select Diagram. This brings you to the following screen:
- The class diagram is generated and reproduced below:
- You can now export and save the class diagram as a PNG, JPEG image
Future To Do's
- Explore Sequence diagrsms, activity diagrams
- Generate Code from UML diagrams
Comments / Suggestions awaited! Amit Kumar Saha