JComponent (@NotNull Editor editor) { JComponent externalComponent = editor.getComponent(); JRootPane rootPane = externalComponent.getRootPane(); if (rootPane == null) return externalComponent; JLayeredPane layeredPane = rootPane.getLayeredPane(); return layeredPane != null ? layeredPane : rootPane; }