Package org.twodividedbyzero.idea.findbugs.gui.tree.model

Examples of org.twodividedbyzero.idea.findbugs.gui.tree.model.BugInstanceNode


    if (treeNode == null) {
      return null;
    }
    if (treeNode instanceof BugInstanceNode) {
      final BugInstanceNode node = (BugInstanceNode) treeNode;
      if (node.getPsiFile() != null) {
        return node.getPsiFile();
      } else {
        final PsiClass psiClass = IdeaUtilImpl.findJavaPsiClass(_project, node.getSourcePath());
        LOGGER.debug("BugTreeHelper#getSeletedElement(" + _project + ", " + node.getSourcePath() + ')');
        if (psiClass != null) {
          LOGGER.debug("Found: psiClass (" + psiClass.getName() + ')');
          psiElement = IdeaUtilImpl.getPsiFile(psiClass);
          if (psiElement != null) {
            LOGGER.debug("BugTreeHelper - IdeaUtilImpl.getPsiFile(psiClass) - found - psiElement: [" + psiElement.getText() + ']');
            node.setPsiFile((PsiFile) psiElement);
          } else {
            LOGGER.debug("BugTreeHelper - IdeaUtilImpl.getPsiFile(psiClass) - found - psiClass: [" + psiClass + ']');
          }
        }
      }
View Full Code Here


    if (treeNode == null) {
      return null;
    } else {
      if (treeNode instanceof BugInstanceNode) {
        final BugInstanceNode node = (BugInstanceNode) treeNode;
        if (node.getPsiFile() != null) {
          return node.getPsiFile();
        } else {
          final PsiClass psiClass = IdeaUtilImpl.findJavaPsiClass(_project, node.getSourcePath());
          LOGGER.debug("BugTreeHelper#getSelectedFile(" + _project + ", " + node.getSourcePath() + ')');
          if (psiClass != null) {
            LOGGER.debug("Found: psiClass (" + psiClass.getName() + ')');
            final PsiFile psiFile = IdeaUtilImpl.getPsiFile(psiClass);
            if (psiFile != null) {
              LOGGER.debug("BugTreeHelper - IdeaUtilImpl.getPsiFile(psiClass) - found - psiFile: " + psiFile.getName());
              node.setPsiFile(psiFile);
            } else {
              LOGGER.debug("BugTreeHelper - IdeaUtilImpl.getPsiFile(psiClass) - NOT found - psiClass: " + psiClass);
            }
            return psiFile;
          } else {
View Full Code Here

    @SuppressWarnings({"unchecked"})
    final AbstractTreeNode<VisitableTreeNode> treeNode = (AbstractTreeNode<VisitableTreeNode>) treepath.getLastPathComponent();


    final BugInstanceNode bugInstanceNode = getPreviousBugInstanceLeafNode(treeNode);

    if (bugInstanceNode != null) {
      final TreePath path = getPath(bugInstanceNode);
      _tree.expandPath(path);
      _tree.setExpandsSelectedPaths(true);
View Full Code Here

    final TreePath path = _tree.getPathForRow(_tree.getRowForPath(treepath) + 1);

    //noinspection unchecked
    final AbstractTreeNode<VisitableTreeNode> lastPathComponent = (AbstractTreeNode<VisitableTreeNode>) path.getLastPathComponent();
    final BugInstanceNode nextBugInstanceLeafNode = getNextBugInstanceLeafNode(lastPathComponent);
    if (nextBugInstanceLeafNode == null) {
      return null;
    }
    final TreePath treePath = getPath(nextBugInstanceLeafNode);
View Full Code Here

      return (BugInstanceNode) node;
    }
    final List<VisitableTreeNode> childList = node.getChildsList();
    for (final VisitableTreeNode childNode : childList) {
      //noinspection unchecked
      final BugInstanceNode result = childNode instanceof BugInstanceNode ? (BugInstanceNode) childNode : getNextBugInstanceLeafNode((AbstractTreeNode<VisitableTreeNode>) childNode);
      if (result != null) {
        return result;
      }
    }
    return null;
View Full Code Here

  }


  public void setPreview(final TreePath treePath) {
    if (treePath != null && treePath.getLastPathComponent() instanceof BugInstanceNode) {
      final BugInstanceNode bugInstanceNode = (BugInstanceNode) getTreeNodeFromPath(treePath);
      if (bugInstanceNode == null) {
        return;
      }

      if (bugInstanceNode.getPsiFile() == null) {
        return; // no problem here
      }

      final PsiFile psiFile = bugInstanceNode.getPsiFile();
      if (psiFile != null) {
        final Document document = PsiDocumentManager.getInstance(_project).getDocument(psiFile);
        if (document != null) {
          final Editor editor = createEditor(bugInstanceNode, document);
          _parent.setPreviewEditor(editor, psiFile);
View Full Code Here

  public void setDetailHtml(final TreePath treePath) {
    final TreeNode treeNode = getTreeNodeFromPath(treePath);

    if (treeNode instanceof BugInstanceNode) {
      final BugInstanceNode bugNode = (BugInstanceNode) treeNode;
      final BugInstance bugInstance = bugNode.getBugInstance();

      if (_parent != null) {
        _parent.getBugDetailsComponents().setBugExplanation(_bugCollection, bugInstance);
      }
    }
View Full Code Here

  public void setDetailText(final TreePath treePath) {
    final TreeNode treeNode = getTreeNodeFromPath(treePath);

    if (treeNode instanceof BugInstanceNode) {
      final BugInstanceNode bugNode = (BugInstanceNode) treeNode;

      if (_parent != null) {
        _parent.getBugDetailsComponents().setBugsDetails(bugNode, treePath);
      }
    }
View Full Code Here

    @SuppressWarnings({"unchecked"})
    final AbstractTreeNode<VisitableTreeNode> treeNode = (AbstractTreeNode<VisitableTreeNode>) treepath.getLastPathComponent();
    if (!(treeNode instanceof BugInstanceNode)) {
      return null;
    }
    final BugInstanceNode node = (BugInstanceNode) treeNode;

    if ("virtualFile".equals(s)) {
      final PsiFile psiFile = _treeHelper.getSelectedFile();
      return psiFile == null ? null : psiFile.getVirtualFile();
    }
    if ("Navigatable".equals(s)) {
      final PsiFile psiFile = _treeHelper.getSelectedFile();
      if (psiFile != null) {
        final VirtualFile virtualFile = psiFile.getVirtualFile();
        //LOGGER.debug("PsiFile: " + psiFile + " VirtualFile: " + virtualFile.getName() + " - Line: " + node.getSourceLines()[0]);
        final int[] lines = node.getSourceLines();
        if (lines[0] == -1 && lines[1] == -1) {  // find anonymous classes
          final PsiElement psiElement = IdeaUtilImpl.findAnonymousClassPsiElement(psiFile, node, _project);
          if (psiElement != null) {
            return psiElement;
          }
        } else if (virtualFile != null) {
          return new OpenFileDescriptor(_project, virtualFile, node.getSourceLines()[0] - 1, 0);
        } else {
          return null;
        }
      } else {
        return null;
      }
    }
    if ("psi.Element".equals(s)) {
      final int[] lines = node.getSourceLines();
      if (lines[0] == -1 && lines[1] == -1) {  // find anonymous classes
        final PsiFile psiFile = _treeHelper.getSelectedFile();
        final PsiElement psiElement = IdeaUtilImpl.findAnonymousClassPsiElement(psiFile, node, _project);
        if (psiElement != null) {
          return psiElement;
View Full Code Here

    }

    if (value != null) {
      setLinkHtml("");
      if (value instanceof BugInstanceNode) {
        final BugInstanceNode bugInstanceNode = (BugInstanceNode) value;

        if (expanded) {
          final Icon expandedIcon = bugInstanceNode.getExpandedIcon();
          ((MaskIcon) expandedIcon).setColorPainted(selected);
          setIcon(expandedIcon);
        } else {
          final Icon collapsedIcon = bugInstanceNode.getCollapsedIcon();
          ((MaskIcon) collapsedIcon).setColorPainted(selected);
          setIcon(collapsedIcon);
        }

        setToolTipText(bugInstanceNode.getTooltip());
        setTitle(bugInstanceNode.getSimpleName());
        setHits("");

      } else if (value instanceof RootNode) {
        final RootNode rootNode = (RootNode) value;
View Full Code Here

TOP

Related Classes of org.twodividedbyzero.idea.findbugs.gui.tree.model.BugInstanceNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.