コード例 #1
0
 private void traverseToLeaves(
     final PackageDependenciesNode treeNode,
     final StringBuffer denyRules,
     final StringBuffer allowRules) {
   final Enumeration enumeration = treeNode.breadthFirstEnumeration();
   while (enumeration.hasMoreElements()) {
     PsiElement childPsiElement =
         ((PackageDependenciesNode) enumeration.nextElement()).getPsiElement();
     if (myIllegalDependencies.containsKey(childPsiElement)) {
       final Map<DependencyRule, Set<PsiFile>> illegalDeps =
           myIllegalDependencies.get(childPsiElement);
       for (final DependencyRule rule : illegalDeps.keySet()) {
         if (rule.isDenyRule()) {
           if (denyRules.indexOf(rule.getDisplayText()) == -1) {
             denyRules.append(rule.getDisplayText());
             denyRules.append("\n");
           }
         } else {
           if (allowRules.indexOf(rule.getDisplayText()) == -1) {
             allowRules.append(rule.getDisplayText());
             allowRules.append("\n");
           }
         }
       }
     }
   }
 }
コード例 #2
0
  private void selectElementInLeftTree(PsiElement elt) {
    PsiManager manager = PsiManager.getInstance(myProject);

    PackageDependenciesNode root = (PackageDependenciesNode) myLeftTree.getModel().getRoot();
    Enumeration enumeration = root.breadthFirstEnumeration();
    while (enumeration.hasMoreElements()) {
      PackageDependenciesNode child = (PackageDependenciesNode) enumeration.nextElement();
      if (manager.areElementsEquivalent(child.getPsiElement(), elt)) {
        myLeftTree.setSelectionPath(
            new TreePath(((DefaultTreeModel) myLeftTree.getModel()).getPathToRoot(child)));
        break;
      }
    }
  }