ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
manager.connect(file.getFullPath(), LocationKind.IFILE, monitor);
ITextFileBuffer buffer= ITextFileBufferManager.DEFAULT.getTextFileBuffer(file.getFullPath(), LocationKind.IFILE);
buffer.getDocument().set(document.get());
buffer.commit(monitor, true);
manager.disconnect(file.getFullPath(), LocationKind.IFILE, monitor);
} finally {
monitor.done();
}
}