void (final Runnable runnable) { CommandProcessor.getInstance().runUndoTransparentAction(new Runnable() { public void run() { CommandProcessor.getInstance().executeCommand(myProject, new Runnable() { public void run() { ApplicationManager.getApplication().runWriteAction(runnable); } }, "", null); } }); }