User's Guide
Introduction
Only class diagrams for existing Java classes are supported.
They are based on the OMG's UML 1.5 specification
(see http://www.omg.org/uml/).
Class diagrams can contain existing classes, interfaces, enumerations,
annotations (called \classifiers henceforth in accordance with UML 1.5)
as well as packages and package roots (i.e. JARs and source folders).
A diagram only reflects the existing source code, which cannot be
manipulated through the diagram.
Class diagrams are created with a wizard. Simply select the package
(or folder) where the diagram should be stored and either press Ctrl+N or
right-click and select 'New', then 'Other...'; in the 'New' wizard dialog
select 'UML Diagram' and 'Class Diagram'.
Class diagrams are XML files with the extension '.ucls' and are excluded
from the Java resource copy process, i.e. they are not copied into the
output folder by the Java builder.
All user interaction with the class diagram is either graphical
(clicking, dragging, drag and drop) or with context menus. Exceptions:
- A toolbar combobox allows the selection of zoom factors.
- Accelerators are available for Delete (DEL), Open Source
(double-click or F3), Open Type Hierarchy (F4) and some other
common actions (Undo, Redo, Select All, Save, Save As).
Eclipse refactoring is fully supported. Refactoring updates all diagrams
in the workspace appropriately. The only exception are deletions affecting
diagrams that are not open in an editor; those are handled when diagram is
opened.
Integration with Views
The Outline View shows all nodes in a diagram, along with their fields and
methods. Selecting a node in the outline also selects it in the diagram
(and scrolls the diagram to its position if necessary) and vice verse.
Below the outline is a thumbnail of the entire diagram, which allows easy
navigation in large diagrams.
The Javadoc View shows the documentation of the selected classfier.
Similarly, the Declaration View shows the source code of the currently
selected classifier.
The Console View contains a log of problems that occurred when a diagram
was opened. This can be due to an invalid or outdated diagram, or simply
because some Java elements or relationships don't exist any more and had
to be deleted. The diagram's name is a hyperlink and clicking on it opens
the diagram.
The References context menu of a classifier displays search results as
usual in the Search View, from which classifiers can be dragged onto the
diagram.
The Open Type Hierarchy context menu of a classifier shows its inheritance
hierarchy as usual, from which classifiers can be dragged onto the
diagram.
Classifiers
In the context of this document, a classifier is a Java type. Java classes,
interfaces, enumerations and annotations are the supported classifiers.
Source and binary classifiers can be added to the diagram in various
ways (as long as they are not there already):
- Classifiers can be dragged from the Package Explorer, the Type
Hierarchy View and the Search View. Note that when you drag a file from
the Package Explorer, all classifiers in that file are added to the
diagram.
- Classifiers can be added directly by opening a
selection dialog from the class diagram's context menu.
- Classifiers with a particular relationship to the currently
selected classifer can be added from the context menu. The supported
relationships are: generalization (parents only), realization,
association.
- When an attribute is selected whose type is a classifier, that
classifier can be added directly to the class diagram by selecting
it from the context menu.
- Java elements can be copied and pasted from one diagram to another.
They appear in the same location as the previous diagram. All
relationships between the elements are are copied as well, relationships
to other classifiers are reverse engineered as usual.
Packages and package roots (i.e. JARs and source folders) can be
dragged from the Package Explorer
Various display options are available for classifiers:
- Automatic Resize - determines if a classifier is automatically or
manually sized. Automatic Resize is turned off when you change the
classifier's size.
- Show Package Name - shows or hides the package name of classifiers
that are not within the same package as the class diagram. The package
name of classifiers within the same package as the diagram is never
shown.
- Show Visibility - shows or hides the visibility (public '+',
package '~', protected '#', private '-') of attributes and
operations.
- Show Attributes - shows or hides the attribute (field) compartment.
- Show Operations - shows or hides the operation (method) compartment.
- Show Attribute Default - shows or hides the default (initial) values
of all attributes. If the initial value is an anonymous inner class,
the actual code is shown as '{...}'.
- Show Operation Signature - shows or hides the operation (method)
signatures.
Layout options for classifiers include:
- Vertical and horizontal alignment along the middle and the edges.
- Automatic layout for the entire class diagram.
Relationships
The following relationship types are supported:
Generalization, Realization, Association, Dependency, Nesting.
When a classifier is added to a diagram, relationships to other
classifiers in the diagram are reverse engineered. They can be deleted
from the diagram and reverse engineered again later.
- The reverse engineering of relationships is configurable in the
'New UML Class Diagram' wizard and the class diagram context menu.
- The reverse engineering of associations knows generics: generic
collections and maps with type parameters are reverse engineered
as associations to the classifier of the type parameter if that
classifier is in the diagram.
- A non-generic collection or map can be converted into an
association by selecting it and clicking the target classifier.
- Two unidirectional associations between two classifiers can be
merged into a single bidirectional association. The unidirectional
associations have to point in opposite directions, but they can
be on the same classifier.
- Relationships can be reverse engineered by type for the selected
classifer with a context menu.
- Relationships can be routed automatically or manually. Moving a
bend point in a relationship turns off automatic routing. A context
menu option or moving the relationship back to a straight line turn
it on again.
- Attributes that participate in an association are not displayed
on their classifier.
The attribute and multiplicity labels of associations are auto-located by
default, but can also be moved manually. The display options for
association labels are:
- Show Labels - shows or hides the names of the attributes upon which
the association is based.
- Show Multiplicity - shows or hides the reverse engineered multiplicity.
It is 0..1 for normal attributes and 0..* for collections and maps.
Known Issues and Limitations
- The source code cannot be manipulated through the diagram.
This means that changing or deleting a classifier or relationship
within a diagram has no effect on the source code.
This is intentional.
- Opening a class diagram with many classifiers or dropping a classifer
onto a freshly opened class diagram with many other classifiers can take
a little longer. This is because the reverse engineering of relationships
requires the complete parsing of every classifier. The second time a
classifier is dropped on the diagram, it should be nearly instantaneous.
- Drag and drop does not work from the Navigator in the Resource perspective.
- Binary classifiers from JARs do not have default/initial values because
those are parsed from the source code.
- Currently the Eclipse refactoring extension points do not support
everything you can actually do in the Java IDE. For example, the move of
inner classes or non-static class members via drag and drop does not
trigger the refactoring extension points. Such operation therefore cause
the deletion of the affected classifiers and associations from class
diagrams.
- When you rename a type and select the option 'Update similarly named
variables and methods', any associations related to renamed variables are
lost since Eclipse doesn't provide a notification.