gpt4 book ai didi

java - JEdi​​t 宏 - 打开和保存文件

转载 作者:行者123 更新时间:2023-11-29 06:48:11 25 4
gpt4 key购买 nike

我有一个 JEdit (BeanShell) 宏,它可以打开一个特定的文件,然后立即将该文件保存到我的 c:\temp 文件夹中(这样我就不会不小心更新真实文件)。

下面是 bean 壳代码:

logFilePath = "c:\\temp\\aj.txt";
jEdit.openFile( view , logFilePath );
_buffer = jEdit.getBuffer(logFilePath);
_buffer.save(view,"c:\\temp\\backup.txt",true);

这给了我以下错误:

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.

我尝试添加一个 while 循环来等待 buffer.isLoaded() 为真,但这只会进入无限循环。
似乎起作用的是弹出一个消息框 ( Macros.message )。但是,我真的不想有这种不必要的对话。

我不太了解 java,如果我犯了菜鸟错误,请告诉我。

更新:

添加了我自己的答案以显示从 Serhii's answer 指向的代码.

最佳答案

你可以试试this solution , 调用 VFSManager.waitForRequests();

关于java - JEdi​​t 宏 - 打开和保存文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/295956/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com