當前位置: 首頁>>代碼示例>>Java>>正文


Java DirectoryNode類代碼示例

本文整理匯總了Java中com.intellij.packageDependencies.ui.DirectoryNode的典型用法代碼示例。如果您正苦於以下問題:Java DirectoryNode類的具體用法?Java DirectoryNode怎麽用?Java DirectoryNode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DirectoryNode類屬於com.intellij.packageDependencies.ui包,在下文中一共展示了DirectoryNode類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: treeWillCollapse

import com.intellij.packageDependencies.ui.DirectoryNode; //導入依賴的package包/類
public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
  final TreePath path = event.getPath();
  if (path == null) return;
  final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
  if (node instanceof DirectoryNode) {
    Set<FileNode> fileNodes = null;
    for (int i = node.getChildCount() - 1; i >= 0; i--) {
      final TreeNode childNode = node.getChildAt(i);
      if (childNode instanceof ClassNode) {
        final ClassNode classNode = (ClassNode)childNode;
        final PsiFile containingFile = classNode.getContainingFile();
        if (containingFile != null && containingFile.isValid()) {
          if (fileNodes == null) {
            fileNodes = new HashSet<FileNode>();
          }
          fileNodes.add(new FileNode(containingFile.getVirtualFile(), myProject, true));
        }
        node.remove(classNode);
      }
    }
    if (fileNodes != null) {
      for (FileNode fileNode : fileNodes) {
        node.add(fileNode);
      }
    }
    TreeUtil.sort(node, getNodeComparator());
    final Object source = event.getSource();
    if (source instanceof JTree) {
      ((DefaultTreeModel)((JTree)source).getModel()).reload(node);
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:33,代碼來源:ClassesScopeTreeStructureExpander.java

示例2: treeWillCollapse

import com.intellij.packageDependencies.ui.DirectoryNode; //導入依賴的package包/類
public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
  final TreePath path = event.getPath();
  if (path == null) return;
  final DefaultMutableTreeNode node = (PackageDependenciesNode)path.getLastPathComponent();
  if (node instanceof DirectoryNode) {
    Set<FileNode> fileNodes = null;
    for (int i = node.getChildCount() - 1; i >= 0; i--) {
      final TreeNode childNode = node.getChildAt(i);
      if (childNode instanceof ClassNode) {
        final ClassNode classNode = (ClassNode)childNode;
        final PsiFile containingFile = classNode.getContainingFile();
        if (containingFile != null && containingFile.isValid()) {
          if (fileNodes == null) {
            fileNodes = new HashSet<FileNode>();
          }
          fileNodes.add(new FileNode(containingFile.getVirtualFile(), myProject, true));
        }
        node.remove(classNode);
      }
    }
    if (fileNodes != null) {
      for (FileNode fileNode : fileNodes) {
        node.add(fileNode);
      }
    }
    TreeUtil.sort(node, getNodeComparator());
    final Object source = event.getSource();
    if (source instanceof JTree) {
      ((DefaultTreeModel)((JTree)source).getModel()).reload(node);
    }
  }
}
 
開發者ID:consulo,項目名稱:consulo-java,代碼行數:33,代碼來源:ClassesScopeTreeStructureExpander.java


注:本文中的com.intellij.packageDependencies.ui.DirectoryNode類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。