How to modify files in plugin
已回答
Hello,
I want to create a plugin for file read/write operations. The plugin will read the opened file, make changes then save it.
I have an issue with the write process. Whenever I write changes to the file, it directly changes the file system making the undo option unavailable.
Currently, I'm doing it like this:
VirtualFile file = event.getData(PlatformDataKeys.VIRTUAL_FILE);
try {
file.setWritable(true);
byte[] newContent = changeContent(file.contentsToByteArray());
file.setBinaryContent(newContent);
} catch (Exception e) {
}
How can I fix it?
请先登录再写评论。
I found the solution in the documentation. Here is how to do it, if someone got interested: