if (document == null || document.getText() == null) {
return null;
}
try {
final TempFileSystem tempFileSystem = TempFileSystem.getInstance();
VirtualFile rootFile = tempFileSystem.findFileByPath("/junitGenerator");
if (rootFile == null || !rootFile.exists()) {
rootFile = tempFileSystem.findFileByPath("/").createChildDirectory(this, "junitGenerator");
}
VirtualFile theFile = rootFile.createChildData(this, UUID.randomUUID().toString() + ".vm");
theFile.setBinaryContent(this.document.getText().getBytes());
theFile = tempFileSystem.refreshAndFindFileByPath(theFile.getPath());
return theFile;
} catch (IOException e) {
Logger.getInstance(EditorCreator.class).warn(e);
}
return null;