package org.asciidoc.intellij.psi;

import com.intellij.ide.actions.SearchEverywhereClassifier;
import com.intellij.ide.util.DefaultPsiElementCellRenderer;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import icons.AsciiDocIcons;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;

/**
 * @author Alexander Schwartz 2017
 */
public class AsciiDocSearchEverywhereClassifier extends DefaultPsiElementCellRenderer implements SearchEverywhereClassifier {

  @Override
  public boolean isClass(@Nullable Object o) {
    return false;
  }

  @Override
  protected Icon getIcon(PsiElement element) {
    return AsciiDocIcons.Asciidoc_Icon;
  }

  @Override
  public boolean isSymbol(@Nullable Object o) {
    return false;
  }

  @Nullable
  @Override
  public VirtualFile getVirtualFile(@NotNull Object o) {
    return null;
  }

}

@@ -365,16 +365,35 @@
 swing.*;
+%0Aimport java.awt.*;
 %0A%0A/**%0A *
@@ -825,16 +825,324 @@
 e;%0A  %7D%0A%0A
+  @Override%0A  public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) %7B%0A    if (value instanceof AsciiDocSection) %7B%0A      return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);%0A    %7D%0A    return null;%0A  %7D%0A%0A
   @Nulla

apply this classifier only for AsciidocSections