void (@NotNull AnActionEvent e) { Project project = e.getData(CommonDataKeys.PROJECT); Editor editor = e.getData(CommonDataKeys.EDITOR); if (editor == null) { myNotificationGroup .createNotification("No active editor", MessageType.ERROR) .notify(project); return; } myNotificationGroup .createNotification(String.format("Benchmarking the editor for %s seconds...", PERIOD), MessageType.INFO) .notify(project); ApplicationManager.getApplication().invokeLater(() -> { JComponent component = editor.getComponent(); Rectangle r = component.getVisibleRect(); long threshold = System.currentTimeMillis() + PERIOD * 1000; int n = 0; component.setOpaque(false); while (true) { component.paintImmediately(r); n++; if (System.currentTimeMillis() >= threshold) { break; } } double fps = (double)n / PERIOD; myNotificationGroup .createNotification(String.format("Benchmark results: %.1f FPS (%d x %d)", fps, r.width, r.height), MessageType.INFO) .notify(project); }); }