Search in sources :

Example 11 with UsageInfo2UsageAdapter

use of com.intellij.usages.UsageInfo2UsageAdapter in project intellij-community by JetBrains.

the class UsageSerializable method serializeMe.

@Override
public void serializeMe(UsageInfo info, StringBuilder os) throws IOException {
    //final SmartPsiElementPointer<?> pointer = info.getSmartPointer();
    final GenericElementSignatureProvider provider = new GenericElementSignatureProvider();
    final String signature = provider.getSignature(info.getElement());
    append(os, info.getFile().getVirtualFile().getPath());
    os.append(separator);
    append(os, signature);
    os.append(separator);
    final ProperTextRange rangeInElement = info.getRangeInElement();
    if (rangeInElement == null) {
        append(os, "-1");
        os.append(separator);
        append(os, "-1");
        os.append(separator);
    } else {
        append(os, String.valueOf(rangeInElement.getStartOffset()));
        os.append(separator);
        append(os, String.valueOf(rangeInElement.getEndOffset()));
        os.append(separator);
    }
    append(os, String.valueOf(info.isNonCodeUsage()));
    os.append(separator);
    append(os, String.valueOf(info.isDynamicUsage()));
    os.append(separator);
    final String text = new UsageInfo2UsageAdapter(info).getPlainText();
    append(os, text);
    os.append(separator);
}
Also used : ProperTextRange(com.intellij.openapi.util.ProperTextRange) UsageInfo2UsageAdapter(com.intellij.usages.UsageInfo2UsageAdapter) GenericElementSignatureProvider(com.intellij.codeInsight.folding.impl.GenericElementSignatureProvider)

Aggregations

UsageInfo2UsageAdapter (com.intellij.usages.UsageInfo2UsageAdapter)11 UsageInfo (com.intellij.usageView.UsageInfo)7 PsiFile (com.intellij.psi.PsiFile)5 JavaAnalysisScope (com.intellij.analysis.JavaAnalysisScope)4 BackwardDependenciesBuilder (com.intellij.packageDependencies.BackwardDependenciesBuilder)4 DependenciesBuilder (com.intellij.packageDependencies.DependenciesBuilder)4 ForwardDependenciesBuilder (com.intellij.packageDependencies.ForwardDependenciesBuilder)4 PsiClass (com.intellij.psi.PsiClass)4 Usage (com.intellij.usages.Usage)4 HashSet (java.util.HashSet)4 AnalysisScope (com.intellij.analysis.AnalysisScope)2 Project (com.intellij.openapi.project.Project)2 PsiPackage (com.intellij.psi.PsiPackage)2 NotNull (org.jetbrains.annotations.NotNull)2 CommonBundle (com.intellij.CommonBundle)1 GenericElementSignatureProvider (com.intellij.codeInsight.folding.impl.GenericElementSignatureProvider)1 com.intellij.find (com.intellij.find)1 ShowUsagesAction (com.intellij.find.actions.ShowUsagesAction)1 AllIcons (com.intellij.icons.AllIcons)1 UISettings (com.intellij.ide.ui.UISettings)1