if (connectionHandler != null && !connectionHandler.isVirtual()) {
FileConnectionMapping mapping = lookupMapping(virtualFile);
if (mapping != null) {
String schemaName = mapping.getCurrentSchema();
if (StringUtil.isEmptyOrSpaces(schemaName)) {
DBSchema userSchema = connectionHandler.getUserSchema();
currentSchemaRef = userSchema == null ? null : userSchema.getRef();
schemaName = currentSchemaRef == null ? null : currentSchemaRef.getName();
} else {
DBSchema schema = connectionHandler.getObjectBundle().getSchema(schemaName);
currentSchemaRef = schema == null ? null : schema.getRef();
}
mapping.setCurrentSchema(schemaName);
virtualFile.putUserData(CURRENT_SCHEMA_KEY, currentSchemaRef);
}
}