It is important to be able to refactor your Java code & model at any stage of the development cycle.
EclipseUML 2008 allows many advanced options when modeling Java or UML classes.
The following options are possible:
  1. Refactoring Java Code using the Class Diagram
  2. Refactor Java Code when EclipseUML is switched off and update the model
  3. Move UML diagram into a new package
  4. Reverse Java code and refactor the model with no code generation
  5. Refactor the UML project
1. Refactor Java code using the Class Diagram

You can refactor your java code using the Class Diagram contextual menu  > Refactor.
You can Rename, Move etc.... this information will immediately be updated in the Java code (e.g. Package Explorer) in the Properties View and in the UML Superstructure of your model.
Please note that you can not give the name "java" to a package because we use this name for EMOF synchronization.
Giving  the package name "java" to a package will break the UML Superstructure synchronization.

2. Refactor Java Code when EclipseUML is switched off and update the model

You can refactor Java code even if EclipseUML is closed and not loose you code and model synchronization. We recommend to always refactor using the Package Explorer because EclipseUML has a listener in this view which will immediately update any change from the Java code to the UML superstructure of your model (e.g. the model is at the root of the Project in the Package Explorer and have the name of your project with a .uml extension). Note that the UML Superstructure of the model should always be at the root of your project. If you use CVS/SVN and get a modified code from a non registered EclipseUML user then you need to merge your model in order to update all classifiers which have been added, deleted, changed or moved in your project.

Note that we have disabled the Java Editor listener in order not to slow the speed of manual java code typing.

You need therefore to refactor using the Package Explorer and if not please don't forget to use the model merge feature in order to update your model.
In the Package Explorer click on the src > Open / Reverse UML > Merge Model

3. Move UML diagrams into a new package

UML Diagrams can only be saved in a java/jee nature project at the root of src or a package.
You can create you model structure just using the UML superstructure of your model but not save any diagram inside your XMI.
Graphical and model information are always saved into two different files. Model information is saved in the UML Superstructure of your model which is available at the root of your project and graphical UML Editor files are saved on the hard disk inside the project.

For example if you create a new package inside your Package Explorer named myDiagrams and then move your diagrams using the mouse (the paste and copy feature is also possible) inside this package then there will be a path problem to be solved in order to keep traceability. The related .ucd file in the UML Superstructure of your model is only available for traceability purposes and is representing a link to your already saved graphical file. If you move your graphical diagrams after its creation then the path is incorrect.It means that you need to manually update pathes using for example the find and replace feature of a text or xml editor. Note that myDiagrams package is still not in the model because it has been just created and not merged with the model. To merge it with the model you need either drag and drop the new created package inside a diagram or use the Merge Model feature.

4. Reverse Java code and refactor the project with no code generation

If you a reverse a Java project then your model and your UML Superstructure model remain synchronized. You can not therefore refactor your reversed project without refactoring your Java Code.
The work around to be able to refactor your project (e.g. work at model abstract level) and not start the implementation Java code is to:
  1. Paste and copy your project.uml UML Superstructure model into another project (create a new project having a java, jpa, webservices nature and use it for modeling purposes)
  2. Open your reversed project.uml model (e.g. the one which has been copied) by selecting the .uml file > Open With > Omondo XMI Editor
  3. Create a new class diagram in the new project and drag and drop one classifier inside the newly created diagram
  4. Wait for the automatic merge to be completed (e.g. the merge of your model coming from your reversed java project with this new UML Superstructure Model project).

Please note that you can drag and drop as many java project as you want and consolidate all models inside the UML Superstructure of the newly created model. This model would therefore be a kind of "Superstructure multiple models" composed by small models which represents one to many java projects. This is an important feature when you need to model a large project which is composed by more than one project.
Once the merge has been completed you can erase the other model because all the model information has been already extracted to the UML Superstructure of the newly created project model.

5. Refactor UML project elements

You can only refactor UML elements (e.g. not related to java) with the Properties View or the contextual menu.
Classifiers related to Java should only be refactored using the Java refactoring feature.
The Properties View allows you to rename UML classes and change properties as well as the contextual menu. The Properties View is not an Omondo view and could be used with any other plugin sharing the UML Superstructure model such as the UML Model Editor. You can move classes inside a package by drag and drop inside the UML Editor. Do not use any other manipulation because EclipseUML has added all model synchronization cycle inside the diagram.

Note that UML diagrams are for Omondo viewers of the UML Superstructure model. You can therefore refactor your model directly with the UML editor (e.g. no need to use xml editors). We don't recommend to refactor your model using the Eclipse Model Editor (e.g. only use the UML Editor or the Properties View) because this editor don't have the Omondo Java Classifier logic. EclipseUML allows the use of other plugins therefore it is easy to erase, change or had wrong information in the UML Superstructure of the model. If using any trick to manipulate your model then Omondo will not be responsible for any model information looses. btw, if you loose your model you can restore your previous model by selecting the .uml file in the project explorer.