boolean (@NotNull JComponent rootComponent) { Container parent = rootComponent.getParent(); JComponent thisPanel = getPanel(); while (parent != null && !(parent instanceof NewCodeStyleSettingsPanel)) { if (parent == thisPanel) { return true; } parent = parent.getParent(); } return false; }