}
}
private void resolveWithScopeParentLookup(DBObjectType objectType, IdentifierElementType substitutionCandidate) {
if (substitutionCandidate.isObject()) {
ConnectionHandler activeConnection = ref.getActiveConnection();
if (!substitutionCandidate.isLocalReference() && activeConnection != null && !activeConnection.isVirtual()) {
Set<DBObject> parentObjects = identifyPotentialParentObjects(objectType, null, this, this);
if (parentObjects != null && parentObjects.size() > 0) {
for (DBObject parentObject : parentObjects) {
/*BasePsiElement probableParentObjectElement = null;
if (parentObject instanceof IdentifierPsiElement) {
IdentifierPsiElement identifierPsiElement = (IdentifierPsiElement) parentObject;
probableParentObjectElement =
identifierPsiElement.isObject() ?
identifierPsiElement :
PsiUtil.resolveAliasedEntityElement(identifierPsiElement);
parentObject = identifierPsiElement.resolveUnderlyingObject();
} */
PsiElement referencedElement = parentObject.getChildObject(objectType, ref.getText().toString(), false);
if (isValidReference(referencedElement)) {
ref.setParent(null);
ref.setReferencedElement(referencedElement);
setElementType(substitutionCandidate);
return;
}
}
}
DBObjectBundle objectBundle = activeConnection.getObjectBundle();
PsiElement referencedElement = objectBundle.getObject(objectType, ref.getText().toString());
if (isValidReference(referencedElement)) {
ref.setParent(null);
ref.setReferencedElement(referencedElement);
setElementType(substitutionCandidate);