Material Preview into Node-editor window: it almost works!

PS perhaps i can ask you something, im looking for the anwser how the icons in the material ui list are generated and where they come from.

The only thing i can catch is an id number. It updates the icon instantly and also adjusts the look of it when changing mat specs like diffuse, spec, and many more.

I cant see to tackle how this is done.
I did see that povray still is able to preview this icon. However the addon i use doesnt show anthing

This is what i mean
Cycles engine

My addon engine