Adding Types to Diagrams

Adding Types by Dragging

Types (classes, interfaces, enums or annotations) may be added to a diagram by dragging them in from the Package Explorer, Project Explorer, Type Hierarchy or the Navigator in the Resource Perspective.

If the type you want to add to your diagram is open in a source editor, and you have the Link with Editor button pressed, Eclipse will switch to the source editor before you have chance to drop the type on the diagram. To avoid this being a problem you can:

As a type is dragged over a diagram the mouse cursor will indicate if it is suitable for dropping. The reasons why a drop would be disallowed are:

A multiple selection of types can be added to a diagram, or a parent (for example a package) of types can be added. The cursor will indicate a valid drop state if there is at least one suitable type among the selection.

After the drop the types will be placed on the diagram cascading downwards and rightwards. You may wish to make use of the Improve Layout action after adding more types.

Adding Types by Context Menu

Right clicking on a node in the Eclipse Package Explorer tree reveals a menu option with the label Add to Diagram situated off the AgileJ StructureViews menu. This action works in exactly the same way as a drag, adding types to the active diagram.

Adding Related Classes

A right click on a type in a diagram (in this case called Customer) reveals options to add related types. Selecting any of these options scans the Eclipse JDT model for qualifying types and adds them to the diagram.

A right-click on the type label of a field reveals the option to add the field's type to the diagram.

A right-click on the return type label of a method reveals the option to add the method's return type to the diagram.

Controlling Bulk Addition of Types

You are warned when, for any reason, you add a large number of types to a diagram. For example: a drag from the Package Explorer or the Add Supertypes context menu. Whenenever an action would cause the addition of a large number of types to your diagram, the dialog below offers you an opportunity to apply a filter to thin down the number of types.

Removing Types

Select any collection of types on a diagram then press the delete key to remove them.

Notes: