Installing EA
- Open Microsoft Store. Install Company Portal
- Open Company Portal. Search for Enterprise Architect
- Hit Install. Wait for the install to reach 100%. Wait a few more minutes for the reinstall button to appear, indicating the install is complete
- Open Enterprise Architect by searching for it in the Start menu/search bar
Creating classes and relationships in EA
Creating a class diagram in EA
- On the welcome screen, in the main window, below Open and Personal Project, click Create New. In the process, you choose where you will save it
- In the Browser on the left, right-click Model. Select Add View. Keep the default option Create Diagram. Click the OK button. Keep the default option of a UML Structural Class diagram. Click the OK button
- In the central pane of the document, above the great blanks space where you want to draw, right above where it says “Start Page” with a small blue logo, click on the » symbol to open the toolbox
Note that the little three boxes icon represents a diagram. As you create objects, they will sit beside the diagram, not in it. If you find yourself deleting extra stuff after trying the next few steps, be careful not to delete your diagram at the same time. If you do, you can recreate it by right-clicking on the view and selecting Add Diagram
Creating a solution-level HAS-A relationship in EA
Don’t miss the last step above about the tiny » symbol!
- Drag a class onto the digram. Give it a name. Hit Enter
- Drag another class onto the diagram. Give it a name. Hit Enter
- Click on the class you will start from
- Click and hold on the open arrow pointing upward in the top right corner of the class
- Drag the cursor over the class you want to connect to. Let go
- Select Association. This produces an undirected assocation - a simple, straight, solid line between the two classes
- Right-click on the end of the line where you want an arrow-head
- Select Advanced -> Change Direction -> “Source -> Destination”
Doing the same thing but creating a new class in the process
Don’t miss the last step in the first section about the tiny » symbol!
- Drag a class onto the digram. Give it a name. Hit Enter
- Click and hold on the open arrow pointing upward in the top right corner of the class
- Drag the cursor to where you want the new class to be. Let go.
- Select Class -> Association
- Right-click on the end of the line where you want an arrow-head
- Select Advanced -> Change Direction -> “Source -> Destination”
- Give the class a name
If you find an easier way, please tell me!
Creating a solution-level IS-A relationship in EA
Don’t miss the last step in the first section about the tiny » symbol!
- Drag a class onto the digram. Give it a name. Hit Enter
- Click and hold on the open arrow pointing upward in the top right corner of the class
- Drag the cursor to where you want the new class to be. Let go
- a. If you want the arrow to point to the new class, select Class -> Generalization b. If you want the arrow to point to your existing class, select Class -> Specialization (at the very bottom)
- Give the class a name
Copy a child class in EA
To copy a child class to create a second child class with the same relationship
- Press and hold the control key on your keyboard
- Click and drag the class you want to copy
- In the dialog, under New Element Name, give your class a new name
- Hit Paste
Create a multiplicity in EA
Create two classes with a HAS-A relationship as described above.
- Right-click on the end of the line where you want the star.
- Select Multiplicity -> *
Create a rolename in EA
Create two classes with a HAS-A relationship as described above.
- Right-click on either end of the line where you want the rolename. Note whether it says “source” or “target”.
- Click into the field matching the SOURCE or TARGET depending on what you saw in the previous step.
- Type your rolename.
- By Access, change Public to Private or anything else.
(Some instructors do not like public rolenames in diagrams because they suggest public instance variables – common coupling!)
Creating methods and fields in EA
Add an instance variable (field) in EA
- Click on the class
- Press Ctl-Shift-F9. Edit the field. Press Enter
A disadvantage of this approach is that if you get the syntax wrong, it silently rejects your edit. You can always mess around with some of the dialogs to get a sense for what syntax is allowed.
Edit an instance variable in EA
- Click on the class
- Click on the field
- Click on the field again. This is NOT a double-click. It needs to be slower
Add an instance method (behavior) in EA
- Click on the class
- Press Ctl-Shift-F10. Edit the field. Press the Enter key
Again, the disadvantage is that if you don’t follow the exact syntax, your edit is silently rejected.
Reverse-engineering code in EA
Please consult with your instructor on whether reverse-engineering code is permitted for a diagram unless the instructions make it perfectly clear that you should use this feature.
- Create a new project as you normally would. Create a new view, too. Avoid creating a diagram by hitting cancel where you would normally select to create a class diagram.
- Set up the import.
- Go to the Develop tab of the ribbon, under Files, click the down arrow. Select Import Source Directory…. Paste the full path to your src folder here. (One way to do this is to right-click on the src folder within IntelliJ, select Open in -> Explorer, then hit enter to enter the src folder. Finally, copy the path from the top of your explorer browser, ensuring it includes the src at the end. Then paste it into the EA window.)
- Select Java for the Source Type.
- Hit OK.
- You should now see all your classes and packages represented in a tree structure, with a diagram for each package automatically generated.
- You will usually need to edit these diagrams. See your instructor’s UML requirements for details.
Random little things
Creating an inner class relationship
- Create an assication as described above, drawing the line from the inner class to the outer class.
- Right click anywhere on the association line, select Advanced -> Change Type. In the Connector Type dropdown, select Nesting.
- The circle with a plus in it should appear by the outer class.