UML diagrams compliment inline documentation (
javadoc ) and allow to better explore/understand a design. Moreover, you can print and bring them to table to discuss a design.
In this post, we will install and use the ObjectAid plugin for Eclipse to produce jUnit lib class diagrams. Then, we will be able to generate UML diagrams by simply dragging and dropping classes into the editor. We can further manipulate the diagram by selecting which references, operations or attributes to display.
Open Eclipse and go to Help > Install New Software
Click on add to add a new repository
Enter name ObjectAid UML Explorer
Enter Location http://www.objectaid.net/update
Next, select the ObjectAid Class Diagram plugin –
it is free – and click Next. The Sequence Diagram one requires a paid license.
Click
Finish to confirm your choices and start the instalation process.
Click Ok on the security warningSelect Restart Now after the installation completes to restart Eclipse.
To create a new UML diagram we start the ObjectAid wizard with
File >
New >
Other… and start typing in the textbox
Class Diagram
to filter the desired wizard. Click
Next, and enter a directory and name for the diagram.
Drop java source or compiled class files into the visual UML editor to start populating the diagram. Right click on a generated class to bring up a context menu and adjust visibility, operations attributes, etc as you like.
Below, we see the
Assert
class from the jUnit library with all operations and fileds hidden.
From the context menu, we can add implementations and associations for a selected class. In the following screen, we add the interface
Test
implemented by the
TestCase
class.
This is how part of the jUnit UML class diagram look after adding some more classes.
To auto layout the diagram right click anywhere within the editor and select
Layout Diagram. From the same menu, you can export the diagram to an image (
gif png jpeg ) by clicking the Save As Image… menu item
Have fun with the plugin, leave a comment if you like 🙂
Read More:
- How to generate main () method in java graphical interface
- Solution to garbled code problem after importing project in eclipse
- After eclipse eclipse eclipse imports the correct project, an error is reported in XML and other files
- How to generate and view SSH keys in Ubuntu 16.04
- IntelliJ idea / eclipse automatically generate author annotation signature
- The solution to “polling news feeds” appeared in Eclipse in Java
- Set code indent to space indent in eclipse
- Hot code replace failed in eclipse compilation
- How to solve the problem of “version 11 or greater is required” in eclipse 2020
- Hot code replace failed error in eclipse
- Wechat third party authorization to generate QR code API
- @How to solve eclipse error after setter and @ getter (@ data) annotation
- Eclipse port occupied( java.net.BindException : address already in use: bind) solution
- Tomcat memory overflow in Eclipse: Java. Lang. outofmemoryerror: permgen space solution:
- To solve the problem, start eclipse and return exit code = 13
- The solution of a Java exception has occurred. And error exception in thread when eclipse runs
- The solution of eclipse code automatic prompt function
- Eclipse: unable to open editor: no ID org.eclipse.jdt . ui.CompilationUnitEditor Editor descriptor for
- Eclipse startup error: a Java runtime environment (JRE) or Java Development Kit (JDK) must be available
- How to generate PDF by C #