public void runWriteAction(@NotNull final Runnable action) { final AccessToken token = acquireWriteActionLock(action.getClass()); try { action.run(); } finally { token.finish(); } }
public <T> T getCurrentWriteAction(@Nullable Class<T> actionClass) { assertCanRunWriteAction(); for (int i = myWriteActionsStack.size() - 1; i >= 0; i--) { Runnable action = myWriteActionsStack.get(i); if (actionClass == null || ReflectionCache.isAssignable(actionClass, action.getClass())) return (T) action; } return null; }