I have a JEdit (BeanShell) macro which opens a specific file then immediately saves the file to my c:\temp folder (so that I don't accidentally update the real file).
Here is the bean shell code:
logFilePath = "c:\\temp\\aj.txt";
jEdit.openFile( view , logFilePath );
_buffer = jEdit.getBuffer(logFilePath);
_buffer.save(view,"c:\\temp\\backup.txt",true);
This gives me the following error:
I/O Error
Each buffer can only execute one input/output operation at a time.
Please wait until the current operation finishes
(or abort it in the I/O progress monitor) before starting another one.
I have tried adding a while loop to wait until buffer.isLoaded()
is true, but that just goes into an infinite loop.
What does seem to work is popping up a message box ( Macros.message
). However, I really don't want to have this unnecessary dialogue.
I don't know much java, so please tell me if I'm making a rookie mistake.
Update:
Added my own answer to show the code pointed to from Serhii's answer.