}
if (createBaseAndSubclass) {
code = code.replaceFirst(
"(Ext.define\\([\"'].+?)([\"'],)", "$1Base$2");
FileObject fo = processingEnv.getFiler()
.createResource(StandardLocation.SOURCE_OUTPUT,
packageName, fileName + "Base.js");
OutputStream os = fo.openOutputStream();
os.write(code.getBytes(ModelGenerator.UTF8_CHARSET));
os.close();
try {
fo = processingEnv.getFiler().getResource(
StandardLocation.SOURCE_OUTPUT,
packageName, fileName + ".js");
InputStream is = fo.openInputStream();
is.close();
}
catch (FileNotFoundException e) {
String subClassCode = generateSubclassCode(
modelClass, outputConfig);
fo = processingEnv.getFiler().createResource(
StandardLocation.SOURCE_OUTPUT,
packageName, fileName + ".js");
os = fo.openOutputStream();
os.write(subClassCode
.getBytes(ModelGenerator.UTF8_CHARSET));
os.close();
}
}
else {
FileObject fo = processingEnv.getFiler()
.createResource(StandardLocation.SOURCE_OUTPUT,
packageName, fileName + ".js");
OutputStream os = fo.openOutputStream();
os.write(code.getBytes(ModelGenerator.UTF8_CHARSET));
os.close();
}
}