private static boolean isEnabled(@NotNull AnActionEvent e) {
    Object component = e.getData(PlatformCoreDataKeys.CONTEXT_COMPONENT);
    if (!(component instanceof JComponent)) return false;
    Editor editor = e.getData(CommonDataKeys.EDITOR);
    if (editor != null) return !editor.isViewer();
    Action pasteAction = ((JComponent)component).getActionMap().get(DefaultEditorKit.pasteAction);
    return pasteAction != null;
  }
private static boolean isEnabled(@NotNull AnActionEvent e)