private static void collectTables(
     DBRProgressMonitor monitor, DBSObjectContainer container, Set<DBSEntity> tables)
     throws DBException {
   if (monitor.isCanceled()) {
     return;
   }
   container.cacheStructure(monitor, DBSObjectContainer.STRUCT_ALL);
   final Collection<? extends DBSObject> children = container.getChildren(monitor);
   if (!CommonUtils.isEmpty(children)) {
     Class<? extends DBSObject> childType = container.getChildType(monitor);
     DBSObjectFilter objectFilter =
         container.getDataSource().getContainer().getObjectFilter(childType, container, true);
     for (DBSObject entity : children) {
       if (monitor.isCanceled()) {
         break;
       }
       if (objectFilter != null && !objectFilter.matches(entity.getName())) {
         continue;
       }
       if (entity instanceof DBSEntity) {
         tables.add((DBSEntity) entity);
       } else if (entity instanceof DBSObjectContainer) {
         collectTables(monitor, (DBSObjectContainer) entity, tables);
       }
     }
   }
 }