DefaultMutableTreeNode (@NotNull PackageChooserDialog.PackageUpdate pkgUpdate) { PsiPackage aPackage = pkgUpdate.getPkg(); String qualifiedPackageName = aPackage.getQualifiedName(); if (pkgUpdate.getParentUpdate() == null) { DefaultMutableTreeNode rootNode = (DefaultMutableTreeNode)myModel.getRoot(); if (qualifiedPackageName.isEmpty()) { rootNode.setUserObject(aPackage); return rootNode; } else { DefaultMutableTreeNode packageNode = findPackageNode(rootNode, qualifiedPackageName); if (packageNode != null) return packageNode; packageNode = new DefaultMutableTreeNode(aPackage); rootNode.add(packageNode); return packageNode; } } else { DefaultMutableTreeNode parentNode = addPackage(pkgUpdate.getParentUpdate()); DefaultMutableTreeNode packageNode = findPackageNode(parentNode, qualifiedPackageName); if (packageNode != null) return packageNode; packageNode = new DefaultMutableTreeNode(aPackage); parentNode.add(packageNode); return packageNode; } }