Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Java reverse engineering"

m (Minor style & grammatical edits.)
Line 1: Line 1:
Until Eclipse mars, the Java Reverse Engineering have been available in the extra plugins of Papyrus. Since Eclipse neon, they are now in a separate Papyrus component, called Papyrus software designer.
+
Through Eclipse Mars, the Java Reverse Engineering was available in the Papyrus extra plugins. Since Eclipse Neon, they are now in a separate Papyrus component, called Papyrus software designer.
The Java reverse tools allows Java files or packages to be reverse-engineered into a Papyrus class diagram.
+
The Java reverse tools allow Java files or packages to be reverse-engineered into a Papyrus class diagram.
  
 
== Installation Instructions==
 
== Installation Instructions==
Line 6: Line 6:
  
 
You can install it by using the Papyrus update site corresponding to your Papyrus version.
 
You can install it by using the Papyrus update site corresponding to your Papyrus version.
Current Papyrus update site can be found in the following page :
+
The current Papyrus update site can be found at the following page :
 
*http://www.eclipse.org/papyrus/download.html
 
*http://www.eclipse.org/papyrus/download.html
Take the update site corresponding to your Eclipse version.
+
Use the update site corresponding to your Eclipse version.
  
 
Example :  
 
Example :  
*For latest mars version, use:
+
*For the latest Mars version, use:
 
**http://download.eclipse.org/modeling/mdt/papyrus/updates/releases/mars
 
**http://download.eclipse.org/modeling/mdt/papyrus/updates/releases/mars
  
*For neon use:
+
*For the Neon version, use:
 
**http://download.eclipse.org/modeling/mdt/papyrus/updates/nightly/neon or
 
**http://download.eclipse.org/modeling/mdt/papyrus/updates/nightly/neon or
 
**http://download.eclipse.org/modeling/mdt/papyrus/updates/releases/neon
 
**http://download.eclipse.org/modeling/mdt/papyrus/updates/releases/neon
 
**with the additional designer update-site: http://download.eclipse.org/modeling/mdt/papyrus/components/designer/
 
**with the additional designer update-site: http://download.eclipse.org/modeling/mdt/papyrus/components/designer/
  
Please note that the JavaReverse feature is currently not available for neon, it can only be found in the designer git (https://git.eclipse.org/r/papyrus/org.eclipse.papyrus-designer)
+
Please note that the JavaReverse feature is currently not available for Neon, it can only be found in the designer git source (https://git.eclipse.org/r/papyrus/org.eclipse.papyrus-designer)
  
 
Then :
 
Then :
Line 51: Line 51:
 
[[Image:JavaReverseOptionsMenu.jpg]]   
 
[[Image:JavaReverseOptionsMenu.jpg]]   
  
This options menu allows to:
+
This option menu allows one to:
 
* change the default package of the reverse-engineering,
 
* change the default package of the reverse-engineering,
 
* add or remove search path. The reverse generator search existing UML classes and regenerate them.
 
* add or remove search path. The reverse generator search existing UML classes and regenerate them.
Line 64: Line 64:
  
 
A settings dialog is opened. You can modify settings (please see Reverse settings).
 
A settings dialog is opened. You can modify settings (please see Reverse settings).
When you're reverse-engineering via the drag & drop method, you can also choose to display model, packages, and classes / interfaces / enumerations into the Papyrus diagram. To enable display, just click into the check-boxes:   
+
When you're reverse-engineering via the drag & drop method, you can also choose to display model, packages, and classes / interfaces / enumerations in the Papyrus diagram. To enable display, just click the check-boxes:   
  
 
[[Image:JavaReverseDnDPopUp.png]]
 
[[Image:JavaReverseDnDPopUp.png]]
  
When you click on the ''OK'' button, your components are displayed in the Papyrus diagram. Note: while all selected components are reversed-engineered, only components which are in selection, but not in the Papyrus diagram are displayed.   
+
When you click on the ''OK'' button, your components are displayed in the Papyrus diagram. Note: while all selected components are reversed-engineered, only components which are selected, but not in the Papyrus diagram are displayed.   
  
 
[[Image:JavaReverseDnDResult.png]]
 
[[Image:JavaReverseDnDResult.png]]

Revision as of 19:58, 4 October 2016

Through Eclipse Mars, the Java Reverse Engineering was available in the Papyrus extra plugins. Since Eclipse Neon, they are now in a separate Papyrus component, called Papyrus software designer. The Java reverse tools allow Java files or packages to be reverse-engineered into a Papyrus class diagram.

Installation Instructions

Java Reverse Engineering is available as a Papyrus extra plugin.

You can install it by using the Papyrus update site corresponding to your Papyrus version. The current Papyrus update site can be found at the following page :

Use the update site corresponding to your Eclipse version.

Example :

Please note that the JavaReverse feature is currently not available for Neon, it can only be found in the designer git source (https://git.eclipse.org/r/papyrus/org.eclipse.papyrus-designer)

Then :

  • Unselect 'Group item by category'
  • Select ' Papyrus Java Reverse (Incubation)'
  • Finish

How to use Reverse

Using Command

Reverse-engineer a Java class

A Java class can be reverse-engineered into a Papyrus class diagram:

  • open the class diagram,
  • select a Java package from a project
  • click the Reverse button ReverseButton.jpg

A UML class is created in Model Explorer. You can now add it into your diagram. Note that all associated classes have also been added to the model.

Reverse-engineer a package

A Java package (and all classes included) can be reverse-engineered into a Papyrus class diagram:

  • open the class diagram,
  • select a Java package from a project,
  • click the Reverse button ReverseButton.jpg

Packages and classes have been created in Model Explorer. Your can now add them to your diagram. Note that all associated classes have also been added to the model.

Reverse-engineering settings

By default, a package named "generated" is created for reverse-engineering. You can choose another package name on the options menu.

JavaReverseOptionsMenu.jpg

This option menu allows one to:

  • change the default package of the reverse-engineering,
  • add or remove search path. The reverse generator search existing UML classes and regenerate them.
  • add or remove creation path. The reverse generator search on existing Java classes to generate a UML class. Useful for creating Java imports (e.g.: String, Integer).

Using Drag & Drop

You can reverse-engineer a class or a package by just dragging & dropping it on a Papyrus diagram:

  • Drag one or more classes and/or packages,
  • Drop the selection into an open diagram.

JavaReverseDragAndDrop.png

A settings dialog is opened. You can modify settings (please see Reverse settings). When you're reverse-engineering via the drag & drop method, you can also choose to display model, packages, and classes / interfaces / enumerations in the Papyrus diagram. To enable display, just click the check-boxes:

JavaReverseDnDPopUp.png

When you click on the OK button, your components are displayed in the Papyrus diagram. Note: while all selected components are reversed-engineered, only components which are selected, but not in the Papyrus diagram are displayed.

JavaReverseDnDResult.png

Change default reverse-engineering settings

The Java code reverse-engineering plugin allows you to change default settings on eclipse preferences:

  • Open Eclipse Preferences,
  • Search for the Papyrus section,
  • Choose Java Code Reverse sub-section

In this preferences page, you can change:

  • default search path values,
  • default creation path values.

Note that there are default values; if you have changed these values for a project, your changes are saved, and default values are not used.

JavaCodeReversePreferences.png

Back to the top