public static void splitText(OutlinerCellRendererImpl textArea, JoeTree tree, OutlineLayoutManager layout) {
		Node currentNode = textArea.node;

		// Get Text for nodes.
		String oldText = currentNode.getValue();
		String oldNodeText = currentNode.getValue().substring(0,textArea.getCaretPosition());
		String newNodeText = currentNode.getValue().substring(textArea.getCaretPosition(), currentNode.getValue().length());
		currentNode.setValue(oldNodeText);
		
		// Create a new node and insert it as a sibling immediatly after this node, unless
		// the current node is expanded and has children. Then, we should insert it as the first child of the
		// current node.
		Node newNode = new NodeImpl(currentNode.getTree(),newNodeText);
		
		if ((!currentNode.isLeaf()) && (currentNode.isExpanded())) {
			newNode.setDepth(currentNode.getDepth() + 1);
			currentNode.insertChild(newNode,0);				
		} else {
			newNode.setDepth(currentNode.getDepth());
			currentNode.getParent().insertChild(newNode,currentNode.currentIndex() + 1);
		}
		
		tree.insertNode(newNode);

		// Record the EditingNode and CursorPosition
		tree.setEditingNode(newNode);
		tree.setCursorPosition(0);

		// Update Preferred Caret Position
		tree.getDocument().setPreferredCaretPosition(0);

		// Put the Undoable onto the UndoQueue
		CompoundUndoableEdit undoableEdit = new CompoundUndoableEdit(tree);
		undoableEdit.addPrimitive(new PrimitiveUndoableEdit(currentNode, oldText, oldNodeText));
		
		CompoundUndoableInsert undoableInsert = new CompoundUndoableInsert(newNode.getParent());
		undoableInsert.addPrimitive(new PrimitiveUndoableInsert(newNode.getParent(),newNode,newNode.currentIndex()));
		
		CompoundUndoableImpl undoable = new CompoundUndoableImpl(true);
		undoable.setName("Split Text and Insert Below");
		undoable.addPrimitive(undoableEdit);
		undoable.addPrimitive(undoableInsert);
		
		tree.getDocument().getUndoQueue().add(undoable);

		// Redraw and Set Focus
		layout.draw(newNode,OutlineLayoutManager.TEXT);
	}