MyEclipse Logo

MyEclipse UML Tutorial

Outline

  1. Preface
  2. Requirements
  3. Introduction
  4. Creating a UML Model Repository
  5. Creating and Editing UML Diagrams
  6. Forward Engineering - UML Class Diagrams to Java Code
  7. Reverse Engineering - Java Code to UML Class Diagrams
  8. Drawing Tools
  9. Compatibility with Argo UML
  10. FAQ
  11. References
  12. User Feedback

Notice

The contents of this document refer to the UML1-based feature set in MyEclipse. As of MyEclipse 7.0 M2, there are both UML1 () and UML2 () tooling available in the IDE and this document covers the UML1 () tooling.

1. Preface

This document was written using MyEclipse 6.0. All screenshots are based upon the default user interface settings for MyEclipse, and Windows XP. If you experience difficulty with the instruction of this document, please see the User Feedback section for how to provide feedback to the MyEclipse documentation team.

2. Requirements

MyEclipse UML Tools are supported in the following enviornments:

  • MyEclipse UML requires a Professional level, MyEclipse Subscription
  • MyEclipse 4.1 - 6.0 supported on Windows Vista, XP and 2000 and Linux with Java 5 only
  • Macintosh OS/X is not available at this time due to Eclipse bug (see Eclipse bug #145890)

3. Introduction

MyEclipse UML provides developers the MyEclipse developers with the following UML features:

  • UML Diagrams: Use-case, Class, Sequence, Collaboration, State, Activity, Deployment
  • Integrated Diagram Editor, Outline View, and Properties View
  • UML Perspective
  • Free-form figure drawing tools
  • Direct edit of Node and Connection details via Hot-Zones
  • Diagrams stored in UML Model Repository File (e.g., cardemo.umr)
  • No restriction on location or project type that may contain UML Model Repository files
  • Generate Java code from models
  • Export models as XMI 1.0 format
  • Export diagrams in image format: GIF, PNG, PS, EPS, SVG
  • Reverse-engineer class diagrams from any MyEclipse J2EE project or Eclipse Java project
    • Batch process reverse-engineer any combination of project, source-folder, Java package or individual class
    • Drag-n-drop any Java class or interface from the Eclipse PackageExplorer view onto any UML class diagram
    • Customizable reverse-engineering preferences
  • Drag-n-drop any UML artifact from the Outline view onto any compatible UML diagram
  • Auto-layout option for class diagram

UML Perspective

The MyEclipse UML Perspective provides a workbench organization tailored to activities of the modeling process. Default views include the UML Diagram Editor, Outline View, and custom Properties View. Toolbar actions are contributed to make new diagram creation quick and simple. An annotated class diagram example is shown below.

UML Perspective Figure 3.1. UML Perspective

4. Creating a UML Model Repository

MyEclipse UML stores all UML diagrams and model elements in a special file known as a UML Model Repository (UMR). A UMR has a file extension of " .umr" and is depicted with the  icon in the PackageExplorer and Navigation views. You may create any number of UMR files in any type of Eclipse project. 

The 1st step in working with new MyEclipse UML diagrams is to create a UML model repository using the New UMR Wizard.

  1. Launch the New UMR Wizard (see figure below)  from the menu  File > New > Other... > MyEclipse > UML > UML Model Repository, or from the MyEclipse UML Perspective at FiIe > New... > UML Model Repository.
  2. Complete the wizard by navigating to workspace folder that will contain the new UMR file and by specifying the name of the UML model repository.


Figure 4.1. Create a new UMR

  1. Select Finish to create the repository at the location you specified and to open MyEclipse UML Diagram Editor as shown below. Note that a new UMR file is created with an empty class diagram.


Figure 4.2. Editing UMR using the Diagram Editor

That concludes creating the steps necessary to create a UML repository. In the next section adding diagrams to the model is discussed.

5. Creating and Editing UML Diagrams

5.1 Creating UML Diagrams

A model repository can contain any number of diagrams of any type. To add a new diagram to a model repository, open the UML repository file in the editor and then click on the appropriate new UML Diagram action from the dropdown menu on the Diagram Editor's toolbar, as shown below.  


Figure 5.1. New Diagram action from Editor toolbar

Use-case diagram

Class diagram

Sequence diagram

Collaboration diagram

State diagram

Activity diagram

Deployment diagram

Diagrams can also be created from the UML Outline View, as shown below

0
Figure 5.2. New Diagram action from Outline View

To edit or view a UML diagram select it from either the dropdown diagram list on the Diagram Editor's local toolbar or from the MyEclipse UML outline view. The Diagram Editor toolbar is shown below.


Figure 5.3. View/Edit UML diagrams

While editing UML diagrams, you can enter "mass add" mode which allows you to continually click in the diagram area adding the same type of element, click after click. To enter mass-add mode you simply double-click the type of element you want to add to your diagram, and then begin clicking in the diagram area:

To exit mass-add mode, simply click back on the arrow icon and continue editing the diagram.

5.2 Adding Model Elements to Diagrams

Model elements can be added to the current diagram from the UML editor's toolbar simply by clicking on the appropriate element button and then selecting the location on the diagram where the new element should reside. Please note that the toolbar is "diagram-specific", so its contents changes based on the active diagram's type. Below is a sequence of screenshots  that show how a class can be added to a class diagram. Any element can be added to other diagrams in a similar way.

Figure 5.4. Add a new class to a ClassDiagram

5.3 Editing Diagram Elements

The Diagram Editor enables you to directly modify nodes and connections through a concept known as a hot-zone. There are two type of hot-zones: text and connection. 

Text hot-zone is an editable region within a node or at the center and end-points of a connection, e.g., association, that is activated by double-clicking within its region. When activated, a hot-zone presents a rectangular editable type-in field. The type-in field accepts direct text entry and delete/cut/copy/paste operations. To commit the changes of a text hot-zone, select anywhere outside of the hot-zone edit region. The type-in region will disappear and be replaced with its content.


Figure 5.5. Text hot-zone

Quick Connects are a type of hot-zone that provides fly-over short-cut association and generalization connections on a node. The user can quickly choose the connection type, e.g., association, generalization, self association, and drag the connection to another node to complete the connection.


Figure 5.6. Quick Connects

Properties editing allows any change to an element to be entered through a form-based UI called the Properties View. The Properties View has several pages for easy entry or edit of any attribute associated with an element. Some of the editable fields overlap with changes that can be made in a hot-zone, and others are only available in the Properties view.

0
Figure 5.7. Editing Properties

6. Forward Engineering - UML Class Diagrams to Java Code

MyEclipse UML enables you to generate Java code directly from the class diagrams of your UML model. 

  1. Open the UML repository with the class diagrams you wish to generate Java code
  2. Launch the Forward-Engineering Wizard from the menubar, UML > Generate Java...

UML Forward Menu
Figure 6.1. Select "Generate Java.."

  1. Select the source folder of the MyEclipse J2EE Project or any Eclipse Java project into which the new UML->Java classes will be created. 
  2. Select 1 or more UML classes to translate to Java code
  3. Select Finish to initiate the code generation process

UML Forward Select
Figure 6.2. UML Forward-Engineering

After generation is complete, the newly generated Java classes will appear in the specified source folder.

UML Forward Results
Figure 6.3. Generated classes

7. Reverse Engineering - Java Code to UML Class Diagrams

Reverse engineering from Java code to UML can be done in two different ways, through batch processing or through drag-and-drop.  Both options will be described in this section.

7.1 Batch Mode - Reverse-Engineering

The MyEclipse UML Reverse-Engineering tools enable you to import the Java classes and interfaces from any Java project, source folder, Java package or source file. 

  1. Open the UMR file 
  2. Launch the MyEclipse UML Reverse-Engineering Wizard.  From the Eclipse menubar select UML > Reverse Engineer UML from Java... .

UML Batch Reverse Engineering
Figure 7.1. Select "Reverse Engineering"

  1. Navigate to and select the Java source files to reverse-engineer.

UML Reverse Engineering Dialog
Figure 7.2. UML Reverse Engineering - Select packages

  1. Specify your processing preferences. 
  2. Select Finish to initiate reverse-engineering process.

UML Reverse Wizard 2
Figure 7.3. UML Reverse Engineering- Select diagram attributes

7.2 Drag-and-Drop - Reverse-Engineering

You can seamlessly add Java classes and interfaces to any UML class diagram using drag-n-drop operations. 

  1. From the Java PackageExplorer View, select one or more classes or interfaces
  2. Drag and drop the selected classes onto the active UML class diagram in the UML Diagram Editor.

UML Drag Start
Figure 7.4. Drag and drop

  1. After dropping the Java classes, the following dialog will allow customization of the generated content.  The default settings are highly recommended.
  2. Select Finish to initiate reverse-engineering of the selected Java classes.

UML Reverse Configuration
Figure 7.5. UML Reverse Engineering

Upon completion, the class diagram will reflect the new additions, including any associations between them, as shown below.

UML Drag End
Figure 7.6. Reverse Engineered diagram

8. Drawing Tools

Since it's often useful to annotate diagrams with some amount of free-form drawing or text, MyEclipse UML includes a set of drawing tools for simple shapes and text which can be used on any type of diagram.  The drawing tool selection menu is in the main diagram toolbar and is used to select the element type.

UML Drawing Tools
Figure 8.1. Drawing Tools drop down menu

UML Drawing Example
Figure 8.2. Drawing Tools usage

9. Compatibility with Argo UML

MyEclipse UML is backward compatible with the.zargo file format of Argo UML (ver. 0.17 or earlier). To use an existing Argo model file with MyEclipse UML do the following:

  1. Copy the Argo file into an Eclipse project.
  2. Open the .zargo file in the Diagram Editor to begin browsing and editing diagrams.

10. FAQ

Q1: When I open the MyEclipse workbench I don't see how to get started using UML features.
A1: You need to create a UMR file and open it in the UML diagram editor. Do the following:

  1. Open the MyEclipse UML perspective, Windows>Open Perspective>Other>MyEclipse UML
  2. Create a new UMR file, File>New>MyEclipse>UML>UML Model Repository. This will create a UMR file and open the UML Diagram Editor.

11. References

To learn more about UML visit the UML Resource Center.

12. User Feedback

If you have comments or suggestions regarding this document please submit them to the If you have comments or suggestions regarding this document please submit them to the MyEclipse Documentation Forum.