What might the editor do if my supervisor contacts a journal to claim authorship of a paper? When I was doing my PhD project, I got an idea to solve a different but related problem. However, my supervisor said neither the motivation nor the initial result were interesting, and so he refused to offer me help on this topic. Then, I did a paper on my own with a lot of work afterwards, and submitted it to a high standard journal, and it was accepted. 

My supervisor knew this, and he commanded me to add his name to the paper, otherwise he would write to the editor. I asked him what his contribution was. He had nothing to say, but insisted he had spent time to discuss the result with me. 

So, if he writes to the editor, what would happen? Or if the paper has been published, then he has nothing to do with it? I am pretty much sure he can almost show nothing about the evidence of the contribution.
The short answer is that the editor will likely ask for more information from you and the adviser in response to a letter such as your adviser apparently plan to write. I doubt any action will be taken immediately and without some research if the editor is taking the task seriously.

As an editor, I would find this sort of case very difficult since I would (most likely) receive two conflicting pictures of the story. Editors have the power to take whatever action they find appropriate. Their decisions may of course be disputed and the story could go on. In a case that is relatively similar in parts (case link), an editor has turned to the Committee on Publication ethics to get support in a decision. Their case portfolio can also be of help to editors.

Obviously, following the linked case, an editor will try to have you and your adviser fix the problem yourself, it is after all primarily your problem. Hopefully the editor will come up with a plan for further actions, perhaps, as in the case, bring in a mediator and finally, if all fails, make a decision based on the existing facts that will be final. Some similar line of action seems appropriate and was also deemed appropriate by COPE. What route an editor will take may of course differ depending on the case but the aim will be to try to resolve what is right or wrong will be the aim and if all fails a suggestion on how the journal will proceed will follow.