public static boolean isReadOnly(@NotNull final Editor editor) {
    if (editor.isViewer()) {
      return true;
    }
    Document document = editor.getDocument();
    return !document.isWritable();
  }
public static boolean isReadOnly(@NotNull final Editor editor)