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); } } } }
private static void collectTables( DBRProgressMonitor monitor, Collection<? extends DBSObject> roots, Set<DBSEntity> tables) throws DBException { for (DBSObject root : roots) { if (monitor.isCanceled()) { break; } if (root instanceof DBSFolder) { collectTables(monitor, ((DBSFolder) root).getChildrenObjects(monitor), tables); } else if (root instanceof DBSEntity) { tables.add((DBSEntity) root); } if (root instanceof DBSObjectContainer) { collectTables(monitor, (DBSObjectContainer) root, tables); } } }