Bug 109513 Project Specific Code Templates are not persisted across sessions
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.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/viewsupport/ProjectTemplateStore.java
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.Assert;
import org.eclipse.jface.text.templates.Template;
import org.eclipse.jface.text.templates.persistence.TemplatePersistenceData;
import org.eclipse.jface.text.templates.persistence.TemplateReaderWriter;
import org.eclipse.jface.text.templates.persistence.TemplateStore;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jdt.internal.ui.JavaPlugin;
/**
 * @since 3.1
 */
public final class ProjectTemplateStore {
	
	private static final String KEY= "org.eclipse.jdt.ui.text.custom_code_templates"; 
	private final TemplateStore fInstanceStore;
	private final TemplateStore fProjectStore;
	
	public ProjectTemplateStore(IProject project) {
		fInstanceStore= JavaPlugin.getDefault().getCodeTemplateStore();
		if (project == null) {
			fProjectStore= null;
		} else {
			final IPreferenceStore projectSettings= new ScopedPreferenceStore(new ProjectScope(project), JavaUI.ID_PLUGIN);
			fProjectStore= new TemplateStore(projectSettings, KEY) {
				/*
				 * Make sure we keep the id of added code templates - add removes
				 * it in the usual add() method
				 */