private IProject getProjectFromPath ( IPath path ) { IWorkspace workspace = ResourcesPlugin . getWorkspace ( ) ; IProject project = null ; if ( path != null ) { if ( workspace . validatePath ( path . toString ( ) , IResource . PROJECT ) . isOK ( ) ) { project = workspace . getRoot ( ) . getProject ( path . toString ( ) ) ; } else { project = workspace . getRoot ( ) . getFile ( path ) . getProject ( ) ; } } return project ; }
Returns the project that contains the specified path