In this example we are going to reverse the full Xerces project
java code information and map it to the model .uml file.
We have decided for the purpose of this example to map all java
information with the model. If you prefer just to have a view of the
code and don't need need to save all Java code project in your model
then see the Create
View of your Project section
The example is composed by:
1. Import your Xerces
project inside Eclipse
- Import your
Xerces project inside Eclipse
- Save all
project information inside your model
- View Nested
Package View of your project
- Reverse of a package
inheritances of Classes and
from different packages
- Reverse Method and map
this information to the model
- Erase your java
code and still use the model to navigate
Create a Java project by selecting the Package Explorer > New > Java Project
Enter the name of your project in the Project name field and select the
Create separate folders as sources and class files option (e.g. create
src at the root of your project).
Click on the Finish button.
project structure has been created inside the Package Explorer.
Click on the src > Import...
> File System.
Browse your hard disk and select your
project source code.
Click on Xerces folder and select build-src.
Select build-src folder and click on the
Eclipse will immediately import your code inside your java project.
You can see the newly imported project
in the package explorer.
2. Save all project
information inside your model
3. Nested Package
View of your project.
save all your structural project (e.g. classifiers and connections
but not business rules) select in the Package Explorer src > Open / Revers UML > Deep
Reverse > XMI Backup.
This heavy refactoring process will take
few minutes to complete.
At the end of the process the Model has
been created including all Java information.
To visualize the model click on the Xerces_Reverse.uml
file > Open With > Omondo XMI 2.1 Editor.
is the newly created model.
To get a nested package diagram view of your project you need to
click on the src > Open / Reverse
UML > Nested Package Diagram
4. Reverse of
To select the level of depth click on
the top down arrow or write a number in the Deep field.
Here is the nested package giving
a structural view of the Xerces project.
You can reverse multiple packages classifiers by reversing a
package and adding classifiers from both the XMI Editor
or the Package
Explorer. To reverse a package you can either double click on a package
inside a package diagram or select a package in the package explorer.
You can decide two main options:
- either create a class diagram
with a name that you manually
Click for example on javax.xml.transform.dom package > New UML Diagram > UML Class Diagram
The My_inheritance_Interface class diagram has been created. Drag and
drop from the Package Explorer or Select in the Package Content
Selection Classifiers to be inserted inside your diagram.
- Or use a given name reverse
The following options are then available:
- Open/Reverse UML
- Class Diagram allows to
only see classifiers if you don't select any option. This is a nice
feature if you want to immediately get a diagram and then navigate
manually creating your connector links. The advantage of this option is
that the reverse is very fast.
5. See Classes and
Interfaces coming from a different package inheritances
- Class Diagram > Class
Inheritance Explorer > Fit Diagram to Screen or Full Diagram. This option allows to
immediately get a view of your diagram. You can select to see
compartments (e.g. Full Diagram)
or not (e.g. Fit Diagram to
Screen) in order to have a smaller diagram .
You can select a group of classifiers and drag and drop them
inside an existing diagram.
Select a group of classifiers with the mouse in the Package Explorer
and drop them inside the diagram.
The new interfaces will immediately be
added in your diagram.
Now click on the class diagram contextual menu > Inheritance > Show all Inheritance >
Here is the diagram you get after using
the class diagram contextual menu > Arrange
Diagram > Arrange All.
6. Reverse Method and map
this information into the model
You can reverse a method by selecting a method in:
- inside the operation compartment of a class
7. Erase your java
code manually and only use the model to navigate
Once the XMI Backup has been selected you can delete you all
java code and still be able to navigate inside your model.
For example let erase all Xerces code from the package explorer and
paste and copy your existing diagram at the src root.
You will have the following Package Explorer
You can now open any diagram previously
created if you double click in the Package Explorer.