function CodeEditor(parent, closeable, container, index)
{
	TabComponent.call(this, parent, closeable, container, index, Locale.codeEditor, Global.FILE_PATH + "icons/misc/code.png");

	var self = this;

	/**
	 * CodeMirror editor instance should be used to access any codemirror functionality.
	 * 
	 * @property code
	 * @type {CodeMirror}
	 */
	this.code = new CodeMirror(this.element,
		{
			value: "",
			hintOptions:
		{
			hint: CodeMirror.hint.anyword,
			completeSingle: false
		},
			gutters: ["CodeMirror-lint-markers"]
		});
	
	this.element.oncontextmenu = function(event)
	{
		var context = new ContextMenu(DocumentBody);
		context.size.set(130, 20);
		context.position.set(event.clientX, event.clientY);
		
		var refactor = context.addMenu(Locale.refactor);
		refactor.addOption(Locale.rename, function()
		{
			self.server.rename(self.code);
		});

		refactor.addOption(Locale.select, function()
		{
			self.server.selectName(self.code);
		});

		context.addOption(Locale.search, function()
		{
			self.code.execCommand("find");
		});

		context.addOption(Locale.replace, function()
		{
			self.code.execCommand("replace");
		});

		context.addOption(Locale.replaceAll, function()
		{
			self.code.execCommand("replaceAll");
		});

		context.addOption(Locale.documentation, function()
		{
			self.server.jumpToDef(self.code);
		});

		context.addOption(Locale.copy, function()
		{
			var text = self.code.getSelection();
			if (text !== "")
			{
				Editor.clipboard.set(text, "text");
			}
		});
		context.addOption(Locale.cut, function()
		{
			var text = self.code.getSelection();
			if (text !== "")
			{
				Editor.clipboard.set(text, "text");
				self.code.replaceSelection("");
			}
		});
		context.addOption(Locale.paste, function()
		{
			self.code.replaceSelection(Editor.clipboard.get("text"));
		});
		context.addOption(Locale.autoIndent, function()
		{
			self.code.execCommand("indentAuto");
		});
		context.addOption(Locale.selectAll, function()
		{
			self.code.execCommand("selectAll");
		});
		context.addOption(Locale.undo, function()
		{
			self.code.execCommand("undo");
		});
		context.addOption(Locale.redo, function()
		{
			self.code.execCommand("redo");
		});
		context.updateInterface();
	};

	/**
	 * Event manager to for the resize scroll event.
	 *
	 * @property manager
	 * @type {EventManager}
	 */
	this.manager = new EventManager();
	this.manager.addScrollEvent(this.element, function(event)
	{
		if (event.ctrlKey && event.deltaY !== 0)
		{
			event.preventDefault();
			self.setFontSize(Editor.settings.code.fontSize - event.deltaY / 100);
		}
	});
	this.manager.create();
}
Code editor tab element based on the codemirror code editor library.

@class CodeEditor
@extends {TabComponent}