Package com.intellij.packageDependencies.ui

Examples of com.intellij.packageDependencies.ui.PackageDependenciesNode


    public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf,
      int row, boolean hasFocus)
    {
      if (value instanceof PackageDependenciesNode)
      {
        PackageDependenciesNode node = (PackageDependenciesNode) value;
        try
        {
            setIcon(node.getIcon());
        }
        catch (IndexNotReadyException ignored)
        {
        }

        final SimpleTextAttributes regularAttributes = SimpleTextAttributes.REGULAR_ATTRIBUTES;
        TextAttributes textAttributes = regularAttributes.toTextAttributes();
        if (node instanceof BasePsiNode && ((BasePsiNode) node).isDeprecated())
        {
          textAttributes =
            EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.DEPRECATED_ATTRIBUTES)
              .clone();
        }

        PsiElement psiElement = node.getPsiElement();
        VirtualFile vFile = (psiElement == null)
          ? null
            : ((psiElement instanceof PsiDirectory)
              ? ((PsiDirectory) psiElement).getVirtualFile()
                : (psiElement.getContainingFile() == null) ? null : psiElement.getContainingFile().getVirtualFile());

        String reviewName = scopeTreeViewPanel.getCurrentScopeName();
        if (reviewName == null)
        {
          return;
        }

        Review review = project.getComponent(ReviewManager.class).getReviewByName(reviewName);
        if (review != null)
        {
          FileStatus fileStatus = retrieveFileStatus(review, vFile);
          textAttributes.setForegroundColor(fileStatus.getColor());
        }

        append(node.toString(), SimpleTextAttributes.fromTextAttributes(textAttributes));

        String oldToString = toString();
        for (ProjectViewNodeDecorator decorator : Extensions.getExtensions(ProjectViewNodeDecorator.EP_NAME, myProject))
        {
          decorator.decorate(node, this);
        }

        if (review != null)
        {
          int issueCount = retrieveIssueCount(review, vFile);
          if (issueCount > 0)
          {
            append(" [" + RevuBundle.message("projectView.issueCount.text", issueCount) + "]",
              SimpleTextAttributes.GRAY_ATTRIBUTES);
          }
        }

        if (toString().equals(oldToString))
        {   // nothing was decorated
          final String locationString = node.getComment();
          if (locationString != null && locationString.length() > 0)
          {
            append(" (" + locationString + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
          }
        }
View Full Code Here


    public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf,
      int row, boolean hasFocus)
    {
      if (value instanceof PackageDependenciesNode)
      {
        PackageDependenciesNode node = (PackageDependenciesNode) value;
        try
        {
          setIcon(expanded ? node.getOpenIcon() : node.getClosedIcon());
        }
        catch (IndexNotReadyException ignore)
        {
        }
        final SimpleTextAttributes regularAttributes = SimpleTextAttributes.REGULAR_ATTRIBUTES;
        TextAttributes textAttributes = regularAttributes.toTextAttributes();
        if (node instanceof BasePsiNode && ((BasePsiNode) node).isDeprecated())
        {
          textAttributes =
            EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.DEPRECATED_ATTRIBUTES)
              .clone();
        }

        PsiElement psiElement = node.getPsiElement();
        VirtualFile vFile = (psiElement == null)
          ? null
            : ((psiElement instanceof PsiDirectory)
              ? ((PsiDirectory) psiElement).getVirtualFile()
                : (psiElement.getContainingFile() == null) ? null : psiElement.getContainingFile().getVirtualFile());

        String reviewName = scopeTreeViewPanel.CURRENT_SCOPE_NAME;
        if (reviewName == null)
        {
          return;
        }

        Review review = project.getComponent(ReviewManager.class).getReviewByName(reviewName);
        if (review != null)
        {
          FileStatus fileStatus = retrieveFileStatus(review, vFile);
          textAttributes.setForegroundColor(fileStatus.getColor());
        }

        append(node.toString(), SimpleTextAttributes.fromTextAttributes(textAttributes));

        String oldToString = toString();
        for (ProjectViewNodeDecorator decorator : Extensions.getExtensions(ProjectViewNodeDecorator.EP_NAME, myProject))
        {
          decorator.decorate(node, this);
        }

        if (review != null)
        {
          int issueCount = retrieveIssueCount(review, vFile);
          if (issueCount > 0)
          {
            append(" [" + RevuBundle.message("projectView.issueCount.text", issueCount) + "]",
              SimpleTextAttributes.GRAY_ATTRIBUTES);
          }
        }

        if (toString().equals(oldToString))
        {   // nothing was decorated
          final String locationString = node.getComment();
          if (locationString != null && locationString.length() > 0)
          {
            append(" (" + locationString + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
          }
        }
View Full Code Here

TOP

Related Classes of com.intellij.packageDependencies.ui.PackageDependenciesNode

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.