static boolean isValidEditor(@NotNull Editor editor) {
    Project editorProject = editor.getProject();
    return editorProject != null && !editorProject.isDisposed() && !editor.isDisposed() &&
           UIUtil.isShowing(editor.getContentComponent());
  }
static boolean isValidEditor(@NotNull Editor editor)