CodeBlockNode fix and some code refactoring

What was wrong with code block node:
Empty code block node should be deleted when it loose the focus - the same behavior is implemented in the Dynamo. So it had been done a code block gets the focus right after its creating. But it doesn't take into account the case when a code block node is being loaded with other nodes. In this case code block shouldn't get the focus - this fix is in this PR.
Also this PR contains some code refactoring

for no undefined fails of code block