public static IPath getSourceBundlePath ( Bundle bundle , IPath bundleLocation ) { IPath sourcesPath = null ; // Not an essential functionality, make it robust try { final IPath srcFolderPath = getSourceRootProjectFolderPath ( bundle ) ; if ( srcFolderPath == null ) { //common case, jar file. final IPath bundlesParentFolder = bundleLocation . removeLastSegments ( 1 ) ; final String binaryJarName = bundleLocation . lastSegment ( ) ; final String symbolicName = bundle . getSymbolicName ( ) ; final String sourceJarName = binaryJarName . replace ( symbolicName , symbolicName . concat ( SOURCE_SUFIX ) ) ; final IPath potentialSourceJar = bundlesParentFolder . append ( sourceJarName ) ; if ( potentialSourceJar . toFile ( ) . exists ( ) ) { sourcesPath = potentialSourceJar ; } } else { sourcesPath = srcFolderPath ; } } catch ( Throwable t ) { throw new RuntimeException ( t ) ; } return sourcesPath ; }
Replies the source location for the given bundle .