Community
Participate
Eclipse IDE
I tried changing the Code templates for a project. I enabled "Project Specific Settings" and changed the method template. It worked for that session, but if I closed Eclipse and opened it again the settings were restored to Workspace settings. I would of expected the project specific settings to be stored in the .settings directory of the project so that they can be persisted and sent to CVS. This is important to us because we do combined open source and commercial development based upon the opensource in the same workspace. The two different types of plugins require different license/copyrights at the head of new java files. We were going to use this capability of project specific template to prevent accidentally having the wrong copyright on the wrong class.
Richard, this works for me. I tested the following setup: - new workspace - change method comment template to: /** * Custom comment * ${tags} */ - change method code template to: // ${todo} Auto-generated method stub; custom comment ${body_statement} - added class package p; public class A { public void foo(String s) { } } - shutdown Eclipse - restarted Eclipse - create class package p; public class B extends A { } - execute "Override/Implements method" - checked foo and generate comments (if you want to have that checked you have to enable the preference Java->Code Style->Autmoatically add comments for ... - pressing OK results in /* (non-Javadoc) * @see p.A#foo(java.lang.String) */ public void foo(String s) { // TODO Auto-generated method stub; custom comment super.foo(s); } - which is expected - typing in public void bar() { } - executing "Add comment" results in /** * Custom comment */ public void bar() { } Both results are correct IMO. Can you please provide steps to reproduce the problem.
Actually, I was able to reproduce. It depends on whether there are other setting changed to be local to the project. Steps to reproduce: - new workspace - new Java project - deselect .* filter - change code templates to be project specific and change the file comment - press OK observe: no .setting directory is created. I think it worked for me in the first test since if you make the Java code style setting local all setting are saved correctly. Martin, can you please investigate. We might want to fix this for 3.1.1 depending on the impact of the fix.
Created attachment 27158 [details] patch on ProjectTemplateStore
This is really Tom's land. For consistency it would be good if the TemplateStore also ssaves the preference store, but I realize that it you could also argue that this is not the job of the TemplateStore. Tom, can you give your opinion to both patches. So far nothing is released.
Created attachment 27159 [details] patch for TemplateStore
Hm, I would think that persistence management is not the job of TemplateStore. Currently the preference page saves the plug-ins preferences when pressing OK, but even without that, I think that the preferences should be saved to disk when a plug-in is shutdown (no?). I don't see why this does not work when changing project's properties - shouldn't the property dialog flush the preference on OK? Why are project preference not flushed automatically on shutdown? -- On the other hand, the patch is minimally intrusive and I could live with the patch in comment 5.
CC Dani. What's your opinion regarding 3.1.1.
Already reviewed yesterady and released to HEAD (will be in 3.2 M2). Now also backported to 3.1.1.
Verified for 3.2 M2 using I20050921-0010.
Verified in M20050923-1430.