void (@NotNull AnActionEvent e) { final MyModuleNode node = (MyModuleNode)myTree.getSelectionPath().getLastPathComponent(); final TreePath[] selectedNodes = myTree.getSelectionPaths(); final ProcessorConfigProfile nodeProfile = ((ProfileNode)node.getParent()).myProfile; final List<ProcessorConfigProfile> profiles = new ArrayList<>(); profiles.add(myDefaultProfile); profiles.addAll(myModuleProfiles); profiles.remove(nodeProfile); final JBPopup popup = JBPopupFactory.getInstance() .createPopupChooserBuilder(profiles) .setTitle(JavaCompilerBundle.message("action.text.move.to")) .setItemChosenCallback((chosenProfile) -> { final Module toSelect = node.getModule(); if (selectedNodes != null) { for (TreePath selectedNode : selectedNodes) { final Object node1 = selectedNode.getLastPathComponent(); if (node1 instanceof MyModuleNode) { final Module module = ((MyModuleNode)node1).getModule(); if (nodeProfile != myDefaultProfile) { nodeProfile.removeModuleName(module.getName()); } if (chosenProfile != myDefaultProfile) { chosenProfile.addModuleName(module.getName()); } } } } final RootNode root = (RootNode)myTree.getModel().getRoot(); root.sync(); final DefaultMutableTreeNode node1 = TreeUtil.findNodeWithObject(root, toSelect); if (node1 != null) { TreeUtil.selectNode(myTree, node1); } }).createPopup(); RelativePoint point = e.getInputEvent() instanceof MouseEvent ? getPreferredPopupPoint() : TreeUtil.getPointForSelection(myTree); popup.show(point); }