@Override
  public void update(@NotNull AnActionEvent e) {
    Project project = e.getData(CommonDataKeys.PROJECT);

    ClientAppSession appSession = ClientSessionsManager.getAppSession();
    // In a remote development case we cannot receive clipboard content immediately (we need to fetch it from client),
    // so we make the action enabled unconditionally.
    String text = (appSession != null && appSession.isRemote()) ? "" : ClipboardUtil.getTextInClipboard();

    // allow to apply from clipboard even if we do not detect it as a patch, because during applying we parse content more precisely
    e.getPresentation().setEnabled(project != null && text != null && ChangeListManager.getInstance(project).isFreezed() == null);
  }
@Override
  public void update(@NotNull AnActionEvent e)