Example #1
0
 /**
  * Returns the source element corresponding to the given object or <code>null</code> if none, in
  * the context of the given launch.
  *
  * @param launch provides source locator
  * @param object object to resolve source element for
  * @return corresponding source element or <code>null</code>
  * @throws CoreException
  */
 public static Object resolveSourceElement(Object object, ILaunch launch) throws CoreException {
   ISourceLocator sourceLocator = launch.getSourceLocator();
   if (sourceLocator instanceof ISourceLookupDirector) {
     ISourceLookupDirector director = (ISourceLookupDirector) sourceLocator;
     Object[] objects = director.findSourceElements(object);
     if (objects.length > 0) {
       return objects[0];
     }
   }
   return null;
 }