Skip to content
Ábel Hegedüs edited this page Jan 11, 2016 · 10 revisions

IMPORTANT: THIS IS A PROTOTYPE AND MAY DELETE FILES IN THE WORKSPACE!!!

DO NOT IMPORT ANY CODE INTO THE DEMO WORKSPACE THAT IS NOT BACKED UP TO VERSION CONTROL OR TO ANOTHER LOCATION

Installation

  1. Install with Oomph as described in the README

Initial setup

  1. Start a runtime workspace
  2. Create a new Java Project or import the provided sample (select Copy to workspace).
  • Once again, you should run the transformation on your existing code only if it is a copy and not the single original (in any case, you should use version control even if you don't play with this tool)!
  1. Create a new UML model in the same project

Migrate existing Java code to UML model

  1. Open the created UML model
  • Since the Model Explorer shows the model only when the Papyrus editor is visible, you should move the editor from the central editor area to another part of the workbench (e.g. next to the Outline or Properties)
  1. Right click on the root Model element in the Model Explorer and select Start code synchronization
  • The transformation will read the source directories in the project and create the package hierarchy and classes in the UML model.
  • Limitations (see details on Feature support):
    • If you start the synchronization on a non-empty model, then the parts that are not also in Java are not deleted (the transformation ensures that the Java source files are created or updated).
    • Empty package fragments (packages that do not contain classes directly or in any of their subpackages transitively) are not created in the initial model

Make changes in Java code

  1. Once you have started the synchronization, any changes in the Java code in the same project will be incrementally synchronized to the UML model.
  • Note that changes made in a Java editor will only appear in the UML model after you save the file.
  • You can create new packages, delete existing ones, and rename packages or package hierarchies.
  • You can create new classes in existing packages, add fields and methods, add method parameters and return types
  • You can move classes between packages.
  • Built-in types (int, boolean) and java.lang.String are supported as types of fields, method parameters and return types.
  • Limitations (see details on Feature support):
    • External imports are not supported, all fields, parameters and return types should be classes defined in the same project.
      • This also means no generics, collections
    • Enums are not supported

Make changes in the UML model

  1. Any changes you make in the UML model will not be synchronized back the the Java code by default
  2. Right click on the root Model element in the Model Explorer and select Switch to UML2Java
  3. After this, changes in the UML model are synchronized to the Java code, but changes in the Java code are ignored
  • You can create new packages, new classes in existing packages and delete existing classes or packages.
  • Limitations (see details on Feature support):
    • Renaming a package that has subpackages may lead to inconsistencies as some renamings may not synchronize correctly

Switching synchronization directions

  1. You can switch back to the Java to UML direction by right clicking on the root Model element in the Model Explorer and select Switch to Java2UML

Cleaning up

  1. Closing the Papyrus editor will stop the transformation and should not delete any Java files.
  2. If you run into any issues with multiple synchronizations running on the same model, exceptions flying around or other problems, click on Reset All Synchronizations (red icon) in the Model Explorer toolbar.
  3. If all else fails, restart Eclipse to reset all synchronizations.
  4. Deleting the UML model and creating a new, empty one can also help in reaching a consistent state.