Reverting Deletion of a binary file.

Answered

I used

IdeaGateway ideaGateway = LocalHistoryImpl.getInstanceImpl().getGateway();
UndoChangeRevertingVisitor vi = new UndoChangeRevertingVisitor(ga, id, null);
vi.visit(change);
vi.finished();

for reverting the deletion of a file or directory.

1) Can you pls explain the parameter meanings of UndoChangeRevertingVisitor constructor.

2)  It's working fine for all files except for binary files like .jar and .apk etc. The file deletion is reverted
but the size of the file became 0.
Is there any mechanism for making revert work (update with old binary content) with such files.


3) Also the above code is not working for if parameter 'change' is ContentChange. Should I use any other API's?

Thanks,

 

0
3 comments

To undo some operation, you can use com.intellij.history.LocalHistory#put*Label/com.intellij.history.Label#revert API.

Though Local History doesn't support binary files, I'm afraid: IDEA-99788

0
Avatar
Permanently deleted user

Thanks.

Is there any reason why the above method (using UndoChangeRevertingVisitor ) is not working with ContentChange only?

 

0

Yes, the ContentChanges are handled separately by DocumentUndoProvider

0

Please sign in to leave a comment.