Let's go step by step. I apparently tried to drag an application off the dock while dragging a file onto another application at the same time (the computer slowed down and I went on doing it anyway before the action was performed). Here's the turnout:
Now, what would you do if you had accidentally deleted TextEdit and didn't feel like getting out your install disk because you'll be wiping your system anyway in a few days? Xcode is the answer! It works fine as a rich text editor (and a plain text editor, I'm also assuming).