The fact that many believe that profits should be taxed where they are economically earned is a pink mackerel so far as this ruling is concerned. The issue here is that Apple had a sweetheart deal with the Irish revenue (government) that most of its profits could be internally allocated to its "head office" which apparently resides nowhere. Imagine if every company could have a piece of that.
There is no question but the illegal state aid should be returned to Ireland, the argument that it was economically earned elsewhere is yet to be thrashed out and will surely not be retrospective, and it is of course a much more important matter so far as FDI is concerned.