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
a
View of your Project section.
The example is composed by:
- Import your
Xerces project inside Eclipse
- Save all
project information inside your model
- View Nested
Package View of your project
- Reverse of a package
- Reverse
inheritances of Classes and
Interfaces coming
from different packages
- Reverse Method and map
this information to the model
- Erase your java
code and still use the model to navigate
1. Import your Xerces
project inside Eclipse
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
a
src at the root of your project).
Click on the Finish button.

Your
project structure has been created inside the Package Explorer.
Click on the src > Import...
Select General
> 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
Finish button.
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
To
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.

Here
is the newly created model.
3. Nested Package
View of your project.
To get a nested package diagram view of your project you need to
click on the
src > Open / Reverse
UML > Nested Package Diagram.
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.
4. Reverse of
a package.
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
enter.
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
class diagram.
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.

- 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 .
5. See Classes and
Interfaces coming from a different package inheritances.
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 >
Manual.
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.