boolean (Component component) { if (component instanceof JBPopupMenu menu) { Component invoker = menu.getInvoker(); if (invoker instanceof ActionMenu actionMenu) { return actionMenu.isMainMenuPlace(); } } return false; }