I have a plugin with which I would like to 'edit' a file, retrieve the contents, then destroy the file. I realize to get full editor functionality (like code reformatting, renaming, etc, etc,) I need the editor bound to a PSI document. It appears that this might be difficult to do. I have created Document and attempted to stream to TemporaryFileSystem, read it back, etc. but this seems quite complex.
The really tricky part is that the read, write activities need to be done with runWrite... and runRead... methods. As the plugin is not always on the UI thread, care must be taken to use runlater() when required.
Does someone have a good example and/or some things to try to make this a little easier? Is there a 'Manager' I can use that is already setup to create, say, a .java file on the fly?