@@ -0,0 +1,2971 @@
+package com.intellij.usages;%0A%0Aimport com.intellij.navigation.NavigationItem;%0Aimport com.intellij.openapi.actionSystem.DataKey;%0Aimport com.intellij.openapi.actionSystem.DataSink;%0Aimport com.intellij.openapi.actionSystem.LangDataKeys;%0Aimport com.intellij.openapi.util.Comparing;%0Aimport com.intellij.openapi.vcs.FileStatus;%0Aimport com.intellij.psi.PsiNamedElement;%0Aimport com.intellij.psi.SmartPointerManager;%0Aimport com.intellij.psi.SmartPsiElementPointer;%0Aimport com.intellij.usageView.UsageInfo;%0Aimport com.intellij.usages.UsageGroup;%0Aimport com.intellij.usages.UsageView;%0Aimport org.jetbrains.annotations.NotNull;%0A%0Aimport javax.swing.*;%0A%0A/**%0A * @author Maxim.Mossienko%0A */%0Apublic abstract class PsiNamedElementUsageGroupBase%3CT extends PsiNamedElement & NavigationItem%3E implements UsageGroup %7B%0A  private final SmartPsiElementPointer myElementPointer;%0A  private final String myName;%0A  private final Icon myIcon;%0A%0A  public PsiNamedElementUsageGroupBase(@NotNull T element, Icon icon) %7B%0A    myIcon = icon;%0A%0A    String myName = element.getName();%0A    if (myName == null) myName = %22%3Canonymous%3E%22;%0A    this.myName = myName;%0A    myElementPointer = SmartPointerManager.getInstance(element.getProject()).createLazyPointer(element);%0A  %7D%0A%0A  public Icon getIcon(boolean isOpen) %7B%0A    return myIcon;%0A  %7D%0A%0A  public T getElement() %7B%0A    return (T)myElementPointer.getElement();%0A  %7D%0A%0A  @NotNull%0A  public String getText(UsageView view) %7B%0A    return myName;%0A  %7D%0A%0A  public FileStatus getFileStatus() %7B%0A    return isValid() ? getElement().getFileStatus() : null;%0A  %7D%0A%0A  public boolean isValid() %7B%0A    final T element = getElement();%0A    return element != null && element.isValid();%0A  %7D%0A%0A  public void navigate(boolean focus) throws UnsupportedOperationException %7B%0A    if (canNavigate()) %7B%0A      getElement().navigate(focus);%0A    %7D%0A  %7D%0A%0A  public boolean canNavigate() %7B%0A    return isValid();%0A  %7D%0A%0A  public boolean canNavigateToSource() %7B%0A    return canNavigate();%0A  %7D%0A%0A  public void update() %7B%0A  %7D%0A%0A  public int compareTo(final UsageGroup o) %7B%0A    return myName.compareTo(((PsiNamedElementUsageGroupBase)o).myName);%0A  %7D%0A%0A  public boolean equals(final Object obj) %7B%0A    if (!(obj instanceof PsiNamedElementUsageGroupBase)) return false;%0A    PsiNamedElementUsageGroupBase group = (PsiNamedElementUsageGroupBase)obj;%0A    if (isValid() && group.isValid()) %7B%0A      return getElement().getManager().areElementsEquivalent(getElement(), group.getElement());%0A    %7D%0A    return Comparing.equal(myName, ((PsiNamedElementUsageGroupBase)obj).myName);%0A  %7D%0A%0A  public int hashCode() %7B%0A    return myName.hashCode();%0A  %7D%0A%0A  public void calcData(final DataKey key, final DataSink sink) %7B%0A    if (!isValid()) return;%0A    if (LangDataKeys.PSI_ELEMENT == key) %7B%0A      sink.put(LangDataKeys.PSI_ELEMENT, getElement());%0A    %7D%0A    if (UsageView.USAGE_INFO_KEY == key) %7B%0A      T element = getElement();%0A      if (element != null) %7B%0A        sink.put(UsageView.USAGE_INFO_KEY, new UsageInfo(element));%0A      %7D%0A    %7D%0A  %7D%0A%7D%0A

move common UsageGroup base class to platform