Bug 380772 - Adding xtext nature to a groovy-project deletes groovy files on save
Summary: Adding xtext nature to a groovy-project deletes groovy files on save
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.3.0   Edit
Hardware: PC All
: P3 major (vote)
Target Milestone: RC2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-27 11:41 EDT by Thomas Schindl CLA
Modified: 2017-10-31 11:30 EDT (History)
2 users (show)

See Also:
sven.efftinge: juno+


Attachments
patch (1.02 KB, patch)
2012-05-27 13:08 EDT, Thomas Schindl CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.