Home > Diagrams > Class Diagram

New

This section describes how to add:

  1. New Java Elements
  2. New UML Metamodel Elements

Note that you can not create metamodel elements which are not related to Java if you don't use the XMI 2.1 Editor.
To activate the XMI Editor, click on the Class Diagram Bacground > XMI Editor > Open XMI 2.1 Editor



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. Create a new Java classifier


The Java elements can be added using the package explorer drag and drop and the Class diagram toolbar or contextual menu.


You can add new elements using the class diagram contextual menu.
Click on the diagram background (be sure that the mouse is not selecting any element) > New …

 

Please ote that the Jee elements, will automaticly be show in the class diagram new menu, after you have validate the PSM Preferences

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 usefull 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 methode 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 transfomr it to a Java Class.



2. New UML Metamodel Elements

You can not create metamodel elements which are not related to Java if you don't use the XMI 2.1 Editor.

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 deceided 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 automaticly renamed inside the full project. It means that if you have 10 diagram s ahving the same elements, all 10 diagrams will be updated once you have change your Property View name.