If I have handle to file how do I create a document and write to it? Right now, I am having to delete the file completely and recreate with new content as shown below :
IFile file = getFile();
file.delete();
file.create(input, false, null);
EDIT : This is in an eclipse plugin, not a regular java program.
Found the answer here : http://old.nabble.com/how-to-get-the-IDocument-of-an-ITextFileBuffer-created-from-an-IFile–td19222160.html
Had to modify a little to suit my need: