public void rebuildTreeChildren() { if (isLoaded()) { for (DBObject object : getObjects()) { object.rebuildTreeChildren(); } } }
/** * ******************************************************* LoadableContent * * ******************************************************* */ public String getContentDescription() { if (getTreeParent() instanceof DBObject) { DBObject object = (DBObject) getTreeParent(); return getName() + " of " + object.getQualifiedNameWithType(); } ConnectionHandler connectionHandler = getConnectionHandler(); return connectionHandler == null ? getName() : getName() + " from " + connectionHandler.getName(); }
public static Set<DBObject> identifyPotentialParentObjects( DBObjectType objectType, @Nullable ObjectTypeFilter filter, BasePsiElement sourceScope, LeafPsiElement lookupIssuer) { ConnectionHandler connectionHandler = sourceScope.getActiveConnection(); Set<DBObject> parentObjects = null; Set<DBObjectType> parentTypes = objectType.getGenericParents(); if (parentTypes.size() > 0) { if (objectType.isSchemaObject() && connectionHandler != null && !connectionHandler.isVirtual()) { DBObjectBundle objectBundle = connectionHandler.getObjectBundle(); if (filter == null || filter.acceptsCurrentSchemaObject(objectType)) { DBSchema currentSchema = sourceScope.getCurrentSchema(); parentObjects = addObjectToSet(parentObjects, currentSchema); } if (filter == null || filter.acceptsPublicSchemaObject(objectType)) { DBSchema publicSchema = objectBundle.getPublicSchema(); parentObjects = addObjectToSet(parentObjects, publicSchema); } } Set<BasePsiElement> parentObjectPsiElements = null; for (DBObjectType parentObjectType : parentTypes) { PsiLookupAdapter lookupAdapter = new ObjectDefinitionLookupAdapter(lookupIssuer, parentObjectType, null); parentObjectPsiElements = !objectType.isSchemaObject() && parentObjectType.isSchemaObject() ? lookupAdapter.collectInScope(sourceScope, parentObjectPsiElements) : lookupAdapter.collectInParentScopeOf(sourceScope, parentObjectPsiElements); } if (parentObjectPsiElements != null) { for (BasePsiElement parentObjectPsiElement : parentObjectPsiElements) { if (!parentObjectPsiElement.containsPsiElement(sourceScope)) { DBObject parentObject = parentObjectPsiElement.resolveUnderlyingObject(); parentObjects = addObjectToSet(parentObjects, parentObject); } } } } DBObject fileObject = sourceScope.getFile().getUnderlyingObject(); if (fileObject != null && fileObject.getObjectType().isParentOf(objectType)) { parentObjects = addObjectToSet(parentObjects, fileObject); } return parentObjects; }
private static Set<DBObject> addObjectToSet(Set<DBObject> objects, DBObject object) { if (object != null && !object.isDisposed()) { if (objects == null) objects = new THashSet<DBObject>(); objects.add(object); } return objects; }