use of com.intellij.extapi.psi.MetadataPsiElementBase in project intellij-community by JetBrains.
the class PsiProximityComparator method getProximity.
@Nullable
public static WeighingComparable<PsiElement, ProximityLocation> getProximity(final Computable<PsiElement> elementComputable, final PsiElement context, ProcessingContext processingContext) {
PsiElement element = elementComputable.compute();
if (element == null)
return null;
if (element instanceof MetadataPsiElementBase)
return null;
if (context == null)
return null;
Module contextModule = processingContext.get(MODULE_BY_LOCATION);
if (contextModule == null) {
contextModule = ModuleUtilCore.findModuleForPsiElement(context);
processingContext.put(MODULE_BY_LOCATION, contextModule);
}
if (contextModule == null)
return null;
return new WeighingComparable<>(elementComputable, new ProximityLocation(context, contextModule, processingContext), PROXIMITY_WEIGHERS);
}
Aggregations