In 4.1 you have support for alignment out of the box on paragraph|table|td|th|custom|embed tags, so you will not need the above code to accomplish alignment(but it will work there as well, just not inside editor unless you define that css in editor .css file).
I answered this in another forum post, the buttons are there, just not enabled by default in OE 5.0.0, this is fixed in next version of OE witch will be bundled with eZ Publish 4.1.1.
If you use 4.1.0, look in ezoe.ini for how to enable them yourself.