public void removeElementsThatAreUnreachableFrom ( Element element ) { if ( element != null ) { Set < Element > elementsToShow = new HashSet <> ( ) ; Set < Element > elementsVisited = new HashSet <> ( ) ; findElementsToShow ( element , element , elementsToShow , elementsVisited ) ; for ( ElementView elementView : getElements ( ) ) { if ( ! elementsToShow . contains ( elementView . getElement ( ) ) && canBeRemoved ( elementView . getElement ( ) ) ) { removeElement ( elementView . getElement ( ) ) ; } } } }
Removes all elements that cannot be reached by traversing the graph of relationships starting with the specified element .