Community
Participate
Working Groups
If we do not clear the previous one, for JavaGen, there will be two copies of Java Files which the same name. We probably should delete the previous directory and anything inside it. The other option might be to exclude the previous directory from Java Source folder. However, I could not think of a good reason to keep the files in the previous directory.
Should we warn the user about this? A dialog could tell them what's about to happen, and ask if they want to continue.
Is this going to only delete the generated files? What if I generated into a source folder that contained some hand-written code?
Is there a way to know if a file (say .java) is generated by our JavaGenerator or is written by user?
There's no way to know by looking at a file if it was generated or hand-written. You could check what the generators for the files they would have created (IGenerator.getOutputFiles()). Right now our own generators only return a single file for this method, we'd have to update the Java generator to also return the *.eglsmap file. You'd have to be smart about this, in that you only check for generated artifacts corresponding to resources that have had their generation directory changed. So if I change the generator at the project level, and one of the packages overrides the generation directory, that package's files do not get deleted. Also, if we decide to do anything in 0.7.0, I agree with Matt that a yes/no dialog should be used.
Based on the discussions, I think we should defer this work until we have a better solution and have good answers to the listed questions. For now, user will have to manually clean directories and files if they change output directory in compiler setting. Questions to be answered: 1. There's not a good way to tell which files are generated by EDT and which are written by user (target java code of an externalType for example). Our generators know 2. Since each resource can override generator setting. To determine if a directory is really not used as gen output directory, we have to scan configuration of all resources. And if we are changing the workspace default, we will have to scan all projects in the workspace. 3. RBD & EDT don't delete generated files if the EGL source is deleted, I think we should make the rationale consistent in terms of cleaning generated artifacts which (we think) are not needed any more. 4. Bottom line is that user should be aware of, and have an choice when something is going to be deleted.