3D viewer: attach listeners after initialization

The CLOSE and RESIZE listeners are now attached to the 3D viewer window
after the window and the 3d canvas have been initialized. This prevents
a call to the 3D viewers init() method by the resize handler which
doesn't know and pass the 3D viewer's canvas ID to initialization
method. Moreover, it caused the 3D viewer to be initialized twice. So
maybe this also fixes the 3D viewer destruction issues. Due to the
first initialization before, the canvas element was added to a more or
less random position (the canvas' ID wasn't passed!) so it ended up
in the first project menu entry (because it was the first match).
3D viewer: cancel resize if not initialized

This return replaces the call to init() in case of a missing
initialization. The call to init() wasn't correct, because the
canvas ID was missing. Since this is not known in the resizeView()
method before init() was called with the proper ID, a call to
init() isn't possible in resizeView(). Therefore, this commit
makes the method abort if not initialized---this case shouldn't
happen in the first place.
3D viewer: prevent double initialization

The commits before fixed a problem that caused a double initialization.
This commit makes sure it won't happen again by having a member variable
that indicates whether the viewer object has been initialized already.
Initialization will abort if this variable is already set to true.