code: private void processExternalTasks(List<Task> externalTasks)
     {
        //
        // Sort the list of tasks into ID order
        //
        Collections.sort(externalTasks);
  
        //
        // Find any external tasks which don't have a sub project
        // object, and set this attribute using the most recent
        // value.
        //
        SubProject currentSubProject = null;
  
        for (Task currentTask : externalTasks)
        {
           SubProject sp = currentTask.getSubProject();
           if (sp == null)
           {
              currentTask.setSubProject(currentSubProject);
  
              //we need to set the external task project path now that we have
              //the subproject for this task (was skipped while processing the task earlier)
              if (currentSubProject != null)
              {
                 currentTask.setExternalTaskProject(currentSubProject.getFullPath());
              }
  
           }
           else
           {
              currentSubProject = sp;
           }
  
           if (currentSubProject != null)
           {
              //System.out.println ("Task: " +currentTask.getUniqueID() + " " + currentTask.getName() + " File=" + currentSubProject.getFullPath() + " ID=" + currentTask.getExternalTaskID());
              currentTask.setProject(currentSubProject.getFullPath());
           }
        }
     }
docs: The project files to which external tasks relate appear not to be
  held against each task, instead there appears to be the concept
  of the "current" external task file, i.e. the last one used.
  This method iterates through the list of tasks marked as external
  and attempts to ensure that the correct external project data (in the
  form of a SubProject object) is linked to the task.
  
  @param externalTasks list of tasks marked as external