void (Project project, Runnable r) { Label label = LocalHistory.getInstance().putUserLabel(project, "changeAndRevert"); boolean failed = false; try { r.run(); } catch (Throwable e) { failed = true; throw e; } finally { restoreEverything(label, failed, project); } }