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

Bug 380772

Summary: Adding xtext nature to a groovy-project deletes groovy files on save
Product: [Modeling] TMF Reporter: Thomas Schindl <tom.schindl>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3 CC: sebastian.zarnekow, sven.efftinge
Version: 2.3.0Flags: sven.efftinge: juno+
Target Milestone: RC2   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
patch none

Description Thomas Schindl CLA 2012-05-27 11:41:29 EDT
How to reproduce:
* install the groovyfx plugin (http://groovy.codehaus.org/Eclipse+Plugin)
* create a groovy project (New > Project ... > Groovy Project)
* create a Groovy-Class (New > Other ... > Groovy Class)
* add the xtext nature to the project
* modify the groovy file and save the changes

=> The groovy file is deleted!
Comment 1 Thomas Schindl CLA 2012-05-27 13:08:43 EDT
Created attachment 216337 [details]
patch

I found the cause of the deletion - the SmapInstallingCompilationParticipant is assuming all compilation units are .java-Files and does a simple replace which is not a good idea (e.g. of it is a groovy class the Compilation units filename is MyGroovyClass.groovy), the smap replace fails and my groovy file is deleted by xtext.
Comment 2 Thomas Schindl CLA 2012-05-27 13:46:26 EDT
Would be nice if you could consider this for Juno.
Comment 3 Sebastian Zarnekow CLA 2012-05-29 05:13:08 EDT
I used IPath.removeFileExtension and .addFileExtension instead of the string replace.

Pushed to master.
Comment 4 Eclipse Webmaster CLA 2017-10-31 11:30:38 EDT
Requested via bug 522520.

-M.