void (@NotNull Project project, PsiFile file, @Nullable Editor editor) { VirtualFile vFile = file.getVirtualFile(); Object oldValue = getOption(project, vFile); setOption(project, vFile, myValue); if (oldValue != null) { UndoManager.getInstance(project).undoableActionPerformed(new BasicUndoableAction(vFile) { @Override public void undo() { setOption(project, vFile, oldValue); } @Override public void redo() { setOption(project, vFile, myValue); } }); } }