void (@NotNull AnActionEvent e) { Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); if (focusOwner == null || !focusOwner.getClass().getName().contains("JBCefOsrComponent")) { throw new IllegalStateException("No JCEF OSR browser is in focus"); } Notification notification = JBCefApp.getNotificationGroup(). createNotification(IdeBundle.message("notification.title.jcef.measureFPS"), IdeBundle.message("notification.content.jcef.measureFPS"), NotificationType.INFORMATION); notification.notify(null); final JBCefFpsMeter fpsMeter = JBCefFpsMeter.get(FPS_METER_ID); if (fpsMeter == null) return; focusOwner.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e1) { focusOwner.removeKeyListener(this); fpsMeter.setActive(false); } }); focusOwner.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e1) { focusOwner.removeFocusListener(this); fpsMeter.setActive(false); } }); ApplicationManager.getApplication().executeOnPooledThread(() -> { Robot robot; try { robot = new Robot(); } catch (AWTException ex) { //noinspection CallToPrintStackTrace ex.printStackTrace(); return; } fpsMeter.setActive(true); boolean scroll = RegistryManager.getInstance().is("ide.browser.jcef.osr.measureFPS.scroll"); // if (scroll) [tav] todo: check the browser is under mouse while (fpsMeter.isActive()) { if (scroll) robot.mouseWheel(SystemInfo.isMac ? -1 : 1); robot.delay(scroll ? 15 : 1000); } }); }