Basically, all you need is to get the Player's currently-piloted ship via getPlayerShip() then get the target; if not null, then <do something>.
It's not that this is hard to do (re-targetting is an inherent part of the AI, of course), I think it's just too much advantage to give to the player, since that gets around the Command Point system to a large extent.
It would also have unintended consequences sometimes (for example, those fighters that were guarding a Nav Point have now abandoned their task, which also masked a nearby Carrier, which kept the fighters alive...), which, given that there isn't any way to customize fighters to ignore such things, might be a Bad Thing. I feel that the Command system is really where that kind of thing should be done; the Target system is a pretty crude tool.