How to add a menu item to the window's right side pop-up?

As you can see on the screenshot, the standard Console window has some additional menu items set for the right-side window header menu: Open Editor Log and Stack Trace Logging. I wonder how custom editor windows can add additional menu items to this menu next to already existing Maximize, Close/Add Tab items.

67154-2016-04-02-15-28-28-unity-personal-64bit-untitled.png

Found the solution, thanks to Dean Lackey’s blog post. You just have to implement the IHasCustomMenu interface in your editor.