private IPath getAbsoluteLocation ( IPath location ) { if ( location . isAbsolute ( ) ) return location ; IWorkspaceRoot root = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ; if ( location . segmentCount ( ) >= 2 && ! ".." . equals ( location . segment ( 0 ) ) ) { //$NON-NLS-1$ IFile file = root . getFile ( location ) ; IPath absolutePath = file . getLocation ( ) ; if ( absolutePath != null ) { return absolutePath ; } } // The path does not exist in the workspace (e.g. because there's no such project). // Fallback is to just append the path to the workspace root. return root . getLocation ( ) . append ( location ) ; }
Gets the absolute location relative to the workspace .