public Set < ComponentDescription > getComponents ( final String componentName , final VirtualFile deploymentRoot ) { if ( componentName . contains ( "#" ) ) { final String [ ] parts = componentName . split ( "#" ) ; String path = parts [ 0 ] ; if ( ! path . startsWith ( "../" ) ) { path = "../" + path ; } final VirtualFile virtualPath = deploymentRoot . getChild ( path ) ; final String name = parts [ 1 ] ; final List < Description > info = componentsByName . get ( name ) ; if ( info == null ) { return Collections . emptySet ( ) ; } final Set < ComponentDescription > ret = new HashSet < ComponentDescription > ( ) ; for ( Description i : info ) { //now we need to check the path if ( virtualPath . equals ( i . deploymentRoot ) ) { ret . add ( i . componentDescription ) ; } } return ret ; } else { final List < Description > info = componentsByName . get ( componentName ) ; if ( info == null ) { return Collections . emptySet ( ) ; } final Set < ComponentDescription > all = new HashSet < ComponentDescription > ( ) ; final Set < ComponentDescription > thisDeployment = new HashSet < ComponentDescription > ( ) ; for ( Description i : info ) { all . add ( i . componentDescription ) ; if ( i . deploymentRoot . equals ( deploymentRoot ) ) { thisDeployment . add ( i . componentDescription ) ; } } //if there are multiple e if ( all . size ( ) > 1 ) { return thisDeployment ; } return all ; } }
Get all components in the application that have the given name