I missed diskstream versus stream.
I propose starting with something like
Inputstream cppTemplateStream=null;
Inputstream hTemplateStream=null;
String Include = "WProgram.h";
if (ArduinoInstancePreferences.isArduinoIdeOne()) // Arduino v1.0+
{
Include = "Arduino.h";
}
if (ArduinoInstancePreferences.getLastUsedDefaultSketchSelection() == true) {
String folderName = ArduinoInstancePreferences.getLastTemplateFolderName();
cppTemplateStream=DiskStream.openContentStream(project.getName(), "", folderName + "\\sketch.cpp");
hTemplateStream=DiskStream.openContentStream(project.getName(), "", folderName + "\\sketch.h");
}
else
{
cppTemplateStream=Stream.openContentStream(project.getName(), Include, "templates/sketch.cpp");
hTemplateStream=Stream.openContentStream(project.getName(), Include, "templates/sketch.h");
}

I really do not know how to redo a pull request. As you got this far so fast I guess you'll find out in not time :-)
Jantje