Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 402042

Summary: [Project explorer - Refactoring] Renaming a Papyrus model has many critical side-effects
Product: [Modeling] Papyrus Reporter: Camille Letavernier <cletavernier>
Component: CoreAssignee: Project Inbox <mdt-papyrus-inbox>
Status: RESOLVED FIXED QA Contact: Camille Letavernier <cletavernier>
Severity: critical    
Priority: P3 CC: benoit.maggi, papyrus-bugs, rschnekenburger
Version: 1.0.0   
Target Milestone: M7   
Hardware: All   
OS: All   
Whiteboard: dx stable
Bug Depends on:    
Bug Blocks: 402036    
Attachments:
Description Flags
Test model none

Description Camille Letavernier CLA 2013-02-28 12:51:55 EST
The issues is basically the same as described in Bug 396878: [Project Explorer] Renaming a *.uml file corrupts files, except that the scope has been reduced to refactoring Papyrus models (di files).

Depending on the scope of the refactoring, all Project or Workspace files are opened and saved, even when they are not related to the refactored model. This sometimes simply lead to re-formatting the models, but it can sometime corrupt these files (e.g. result in an empty xmi file)

It seems to affect all files with an xmi content type (e.g. a text file with the .uml extension will be transformed into an empty xmi model)

Two workarounds exist: 
	- Select "Scope: None" when renaming a Papyrus model
	- Use the Eclipse local history to revert the unwished changes
	
We need to improve the impact analysis to:

	- Skip non-xmi files (Including non-xmi files with an xmi content type, e.g. a text file with an xmi extension)
	- Skip models which are unrelated to the current Papyrus model
Comment 1 Camille Letavernier CLA 2014-05-06 08:05:36 EDT
Still valid in 1.0.0 M7

Non-xmi files which have the same name prefix as a DI file being renamed, are deleted

For XMI files, they seem to be deleted as well under some (unidentified) circumstances
Comment 2 Camille Letavernier CLA 2014-05-16 13:48:33 EDT
Created attachment 243196 [details]
Test model

Contains a set of files to test the "Rename" action, with various kinds of files and models

It contains:

- Papyrus model (di, notation, uml)
- Pure XML file (HTML)
- Standard text file (txt)
- XText/EMF model (CSS)
- Empty xmi model (xmi)
- XML/EMF model (XWT)

It currently crashes during the rename operation

Expected result: the contents of the files should remain the same
Comment 3 Camille Letavernier CLA 2014-05-16 13:53:53 EDT
The test model from Comment 2 should also be used as a Copy/Paste test case (It currently fails as well). Especially, the html file is converted to an empty EMF resource.

Moreover, copying the set of SubResources should make a file copy (not a model copy), and should leave the file contents 100% unchanged (This shouldn't update the URIs nor anything else). It currently does the same thing as a PapyrusFile copy
Comment 4 Camille Letavernier CLA 2014-05-16 13:54:16 EDT
Gerrit review: https://git.eclipse.org/r/#/c/26686/
Comment 5 Camille Letavernier CLA 2014-07-07 11:27:14 EDT
The contribution has been merged to master

I close the task