If warship building were governed by purely business considerations, we would be buying all our ships from yards in the far East and Portsmouth would have shut down years ago. Politics is the only reason there are any shipbuilding jobs left to lose in Portsmouth. If you live by the sword, you die by the sword.
The politics of it are, that said, slightly more complex than the simplistic claim that it's about trying to influence the referendum, and let's not forget that BAe did have a say in this, so there are business considerations in there somewhere. BBC Scotland's Brian Taylor is worth a read on this:
http://www.bbc.co.uk/news/uk-scotland-24839564