if (psiElement instanceof BasePsiElement) {
BasePsiElement basePsiElement = (BasePsiElement) psiElement;
BasePsiElement scope = basePsiElement.lookupEnclosingNamedPsiElement();
DBObjectType objectType = aliasElement.getObjectType();
ObjectLookupAdapter lookupInput = new ObjectLookupAdapter(aliasElement, objectType);
BasePsiElement objectPsiElement = lookupInput.findInScope(scope);
if (objectPsiElement == null) {
scope = scope.lookupEnclosingSequencePsiElement();
if (scope != null)
objectPsiElement = lookupInput.findInScope(scope);
}
if (objectPsiElement != null) {
Set<BasePsiElement> virtualObjectPsiElements = new THashSet<BasePsiElement>();
scope.collectVirtualObjectPsiElements(virtualObjectPsiElements, objectType);
for (BasePsiElement virtualObjectPsiElement : virtualObjectPsiElements) {