<commit_before>package com.intellij.psi.impl;

import com.intellij.compiler.CompilerConfiguration;
import com.intellij.execution.junit.JUnitUtil;
import com.intellij.ide.IconUtilEx;
import com.intellij.lang.ant.PsiAntElement;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.Iconable;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.UserDataHolderBase;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.jsp.jspJava.JspClass;
import com.intellij.psi.jsp.WebDirectoryElement;
import com.intellij.psi.util.CachedValue;
import com.intellij.psi.util.CachedValueProvider;
import com.intellij.psi.util.InheritanceUtil;
import com.intellij.psi.xml.XmlTag;
import com.intellij.ui.RowIcon;
import com.intellij.util.IconUtil;
import com.intellij.util.Icons;
import gnu.trove.TIntObjectHashMap;

import javax.swing.*;

public abstract class ElementBase extends UserDataHolderBase implements Iconable {
  public Icon getIcon(int flags) {
    if (!(this instanceof PsiElement)) return null;

    final PsiElement element = (PsiElement)this;

    final Icon providersIcon = IconUtil.getProvidersIcon(element, flags);
    if(providersIcon != null) return providersIcon;

    RowIcon baseIcon;
    final boolean isLocked = (flags & ICON_FLAG_READ_STATUS) != 0 && !element.isWritable();
    int elementFlags = isLocked ? FLAGS_LOCKED : 0;
    if (element instanceof PsiDirectory) {
      Icon symbolIcon;
      final PsiDirectory psiDirectory = (PsiDirectory)element;
      if (psiDirectory.getPackage() != null) {
        symbolIcon = Icons.PACKAGE_ICON;
      }
      else {
        symbolIcon = Icons.DIRECTORY_CLOSED_ICON;
      }
      final VirtualFile vFile = psiDirectory.getVirtualFile();
      final Project project = psiDirectory.getProject();
      boolean isExcluded = isExcluded(vFile, project);
      baseIcon = RowIcon.createLayeredIcon(symbolIcon, elementFlags | (isExcluded ? FLAGS_EXCLUDED : 0));
    }
    else if (element instanceof PsiPackage) {
      baseIcon = RowIcon.createLayeredIcon(Icons.PACKAGE_ICON, elementFlags);
    }
    else if (element instanceof PsiFile) {
      PsiFile file = (PsiFile)element;

      VirtualFile virtualFile = file.getVirtualFile();
      final Icon fileTypeIcon;
      if (virtualFile == null) {
        fileTypeIcon = file.getFileType().getIcon();
      }
      else {
        fileTypeIcon = IconUtil.getIcon(virtualFile, flags & ~ICON_FLAG_READ_STATUS, file.getProject());
      }
      baseIcon = RowIcon.createLayeredIcon(fileTypeIcon, elementFlags);
    }
    else if (element instanceof PsiClass) {
      final PsiClass aClass = (PsiClass)element;
      Icon symbolIcon = getClassBaseIcon(aClass);
      baseIcon = RowIcon.createLayeredIcon(symbolIcon, getFlags(aClass, isLocked));
    }
    else if (element instanceof PsiMethod) {
      final PsiMethod method = (PsiMethod)element;
      Icon methodIcon = method.hasModifierProperty(PsiModifier.ABSTRACT) ? Icons.ABSTRACT_METHOD_ICON : Icons.METHOD_ICON;
      baseIcon = RowIcon.createLayeredIcon(methodIcon, getFlags(method, false));
    }
    else if (element instanceof PsiField) {
      baseIcon = RowIcon.createLayeredIcon(Icons.FIELD_ICON, getFlags((PsiField)element, false));
    }
    else if (element instanceof PsiParameter) {
      baseIcon = RowIcon.createLayeredIcon(Icons.PARAMETER_ICON, 0);
    }
    else if (element instanceof PsiVariable) {
      baseIcon = RowIcon.createLayeredIcon(Icons.VARIABLE_ICON, getFlags((PsiVariable)element, false));
    }
    else if (element instanceof XmlTag) {
      return Icons.XML_TAG_ICON;
    }
    else if (element instanceof PsiAntElement) {
      return ((PsiAntElement)element).getRole().getIcon();
    }
    else if (element instanceof WebDirectoryElement) {
      return Icons.DIRECTORY_CLOSED_ICON;
    }
    else if (element instanceof PsiClassObjectAccessExpression) {
      return RowIcon.createLayeredIcon(Icons.FIELD_ICON, 0);
    }
    else {
      return null;
    }
    if ((flags & ICON_FLAG_VISIBILITY) != 0) {
      PsiModifierList modifierList = element instanceof PsiModifierListOwner ? ((PsiModifierListOwner)element).getModifierList() : null;
      IconUtilEx.setVisibilityIcon(modifierList, baseIcon);<commit_msg>cleanup presentation<commit_after>package com.intellij.psi.impl;

import com.intellij.compiler.CompilerConfiguration;
import com.intellij.execution.junit.JUnitUtil;
import com.intellij.ide.IconUtilEx;
import com.intellij.lang.ant.PsiAntElement;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.Iconable;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.UserDataHolderBase;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.jsp.jspJava.JspClass;
import com.intellij.psi.jsp.WebDirectoryElement;
import com.intellij.psi.util.CachedValue;
import com.intellij.psi.util.CachedValueProvider;
import com.intellij.psi.util.InheritanceUtil;
import com.intellij.psi.xml.XmlTag;
import com.intellij.ui.RowIcon;
import com.intellij.util.IconUtil;
import com.intellij.util.Icons;
import gnu.trove.TIntObjectHashMap;

import javax.swing.*;

public abstract class ElementBase extends UserDataHolderBase implements Iconable {
  public Icon getIcon(int flags) {
    if (!(this instanceof PsiElement)) return null;

    final PsiElement element = (PsiElement)this;

    final Icon providersIcon = IconUtil.getProvidersIcon(element, flags);
    if(providersIcon != null) return providersIcon;

    RowIcon baseIcon;
    final boolean isLocked = (flags & ICON_FLAG_READ_STATUS) != 0 && !element.isWritable();
    int elementFlags = isLocked ? FLAGS_LOCKED : 0;
    if (element instanceof PsiDirectory) {
      Icon symbolIcon;
      final PsiDirectory psiDirectory = (PsiDirectory)element;
      if (psiDirectory.getPackage() != null) {
        symbolIcon = Icons.PACKAGE_ICON;
      }
      else {
        symbolIcon = Icons.DIRECTORY_CLOSED_ICON;
      }
      final VirtualFile vFile = psiDirectory.getVirtualFile();
      final Project project = psiDirectory.getProject();
      boolean isExcluded = isExcluded(vFile, project);
      baseIcon = RowIcon.createLayeredIcon(symbolIcon, elementFlags | (isExcluded ? FLAGS_EXCLUDED : 0));
    }
    else if (element instanceof PsiPackage) {
      baseIcon = RowIcon.createLayeredIcon(Icons.PACKAGE_ICON, elementFlags);
    }
    else if (element instanceof PsiFile) {
      PsiFile file = (PsiFile)element;

      VirtualFile virtualFile = file.getVirtualFile();
      final Icon fileTypeIcon;
      if (virtualFile == null) {
        fileTypeIcon = file.getFileType().getIcon();
      }
      else {
        fileTypeIcon = IconUtil.getIcon(virtualFile, flags & ~ICON_FLAG_READ_STATUS, file.getProject());
      }
      baseIcon = RowIcon.createLayeredIcon(fileTypeIcon, elementFlags);
    }
    else if (element instanceof PsiClass) {
      final PsiClass aClass = (PsiClass)element;
      Icon symbolIcon = getClassBaseIcon(aClass);
      baseIcon = RowIcon.createLayeredIcon(symbolIcon, getFlags(aClass, isLocked));
    }
    else if (element instanceof PsiMethod) {
      final PsiMethod method = (PsiMethod)element;
      Icon methodIcon = method.hasModifierProperty(PsiModifier.ABSTRACT) ? Icons.ABSTRACT_METHOD_ICON : Icons.METHOD_ICON;
      baseIcon = RowIcon.createLayeredIcon(methodIcon, getFlags(method, false));
    }
    else if (element instanceof PsiField) {
      baseIcon = RowIcon.createLayeredIcon(Icons.FIELD_ICON, getFlags((PsiField)element, false));
    }
    else if (element instanceof PsiParameter) {
      baseIcon = RowIcon.createLayeredIcon(Icons.PARAMETER_ICON, 0);
    }
    else if (element instanceof PsiVariable) {
      baseIcon = RowIcon.createLayeredIcon(Icons.VARIABLE_ICON, getFlags((PsiVariable)element, false));
    }
    else if (element instanceof XmlTag) {
      return Icons.XML_TAG_ICON;
    }
    else if (element instanceof PsiAntElement) {
      return ((PsiAntElement)element).getRole().getIcon();
    }
    else if (element instanceof WebDirectoryElement) {
      return Icons.DIRECTORY_CLOSED_ICON;
    }
    else if (element instanceof PsiClassObjectAccessExpression) {
      final RowIcon rowIcon = RowIcon.createLayeredIcon(Icons.FIELD_ICON, 0);
      rowIcon.setIcon(Icons.PUBLIC_ICON, 1);
      return rowIcon;
    }
    else {
      return null;
    }
    if ((flags & ICON_FLAG_VISIBILITY) != 0) {
      PsiModifierList modifierList = element instanceof PsiModifierListOwner ? ((PsiModifierListOwner)element).getModifierList() : null;
      IconUtilEx.setVisibilityIcon(modifierList, baseIcon);
{'fraction_non_alphanumeric': 0.096748790640117, 'fraction_numerical': 0.0014624817189785129, 'mean_word_length': 4.088723526044648, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5822111', 'n_tokens_mistral': 2792, 'n_tokens_neox': 2773, 'n_words': 546}