DefaultMutableTreeNode (DefaultMutableTreeNode rootNode, String qualifiedName) { for (int i = 0; i < rootNode.getChildCount(); i++) { DefaultMutableTreeNode child = (DefaultMutableTreeNode)rootNode.getChildAt(i); PsiPackage nodePackage = (PsiPackage)child.getUserObject(); if (nodePackage != null) { if (Objects.equals(nodePackage.getQualifiedName(), qualifiedName)) return child; } } return null; }