public static IPath toFilterPath ( String filePath , IProject project ) { IPath path = new Path ( filePath ) ; IPath commonPath ; if ( project != null ) { commonPath = project . getLocation ( ) ; IPath relativePath = getRelativePath ( path , commonPath ) ; if ( ! relativePath . equals ( path ) ) { return relativePath ; } } commonPath = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getLocation ( ) ; return getRelativePath ( path , commonPath ) ; }
Checks the given absolute path and convert it to relative path if it is relative to the given project or workspace . This representation can be used to store filter paths in user preferences file