Home > Diagrams > Class Diagram


This section describes how to add new Java or model elements to your Class Diagram.
It is possible to create Java or only UML Superstructure model elements (e.g. no Java code generation).

  1. New Java Elements
  2. New UML Metamodel Elements

The New menu can immediately for example create from the UML Editor new:

The New menu is available at:

1. New Java Elements
  1. Create New Classifiers (e.g. Class, Interface and Enum)
  2. Add a metamodel method (no Java Code generation for the method) to a Java Class

1. 1 Create a new Java classifier

Java elements can be added to the Class Diagram using the Package Explorer drag and drop or using contextual menus.
You can add new classifiers using the class diagram contextual menu.
Click on the diagram background
(be sure that the mouse is not selecting any other element) > New …

Please note that the Jee elements will automatically be shown in the class diagram New menu, after you have selected the Class Diagram PSM /Model Driven Development menu.

1.2 Add a metamodel method (no Java Code generation for the method) to a Java Class

UML Property and Operation can be added in the metamodel and not created in the Java code using the drag and drop XMI Editor option.
This is useful feature if you want to create the skeleton of your application and not the body.

Select a Java Class in your XMI Editor > New Child > Owned Operation > Operation

A method has been created in your Class Diagram.
Note that this method has no name.
You can add a name using the Property view in order to keep it as a metamodel Operation, or click on the method in the class diagram and add a name using the Property menu in order to transform it to a Java Class.

2. New UML Metamodel Elements

You can create metamodel elements which are not related to Java using the XMI 2.1 Editor drag and drop to the Class Diagram or the Class Diagram contextual menu.

From the Model Editor
you can drag and drop the following UML (just a metamodel element not related to Java) elements:
To create a new Metamodel Class in your XMI Editor you need to:
Click on the package > New Child > Packaged Element > Class

A none named class will be created in your XMI Editor representing your metamodel instance.

You need to drag and drop this Class to your UML Editor to create the metamodel class. No Java Code will be created.
Note that the automatic Class diagram naming will add a modeling name to your class. when you have decided which name should be given, ,then you can change the name directly in the Property View. All previous diagram including this renamed Class will be automatically renamed inside the full project. It means that if you have 10 diagram s having the same elements, all 10 diagrams will be updated once you have change your Property View name.