private static Pair<String, AnAction> createAction(String shortcut, Consumer<? super CefFrame> action) {
    return Pair.create(shortcut, LightEditActionFactory.create(event -> {
      Component component = event.getData(PlatformCoreDataKeys.CONTEXT_COMPONENT);
      if (component == null) return;

      if (component instanceof JComponent && ((JComponent)component).getClientProperty(JBCEFBROWSER_INSTANCE_PROP) != null) {
        Object browser = ((JComponent)component).getClientProperty(JBCEFBROWSER_INSTANCE_PROP);
        action.accept(((JBCefBrowserBase)browser).getCefBrowser().getFocusedFrame());
        return;
      }

      Component parentComponent = component.getParent();
      if (!(parentComponent instanceof JComponent)) {
        return;
      }
      Object browser = ((JComponent)parentComponent).getClientProperty(JBCEFBROWSER_INSTANCE_PROP);
      if (!(browser instanceof JBCefBrowserBase)) {
        return;
      }
      action.accept(((JBCefBrowserBase)browser).getCefBrowser().getFocusedFrame());
    }));
  }
private static Pair<String, AnAction> createAction(String shortcut, Consumer<? super CefFrame> action)