Bug 365968 - Improve how the editor is using requirejs
diff --git a/bundles/org.eclipse.orion.client.editor/web/examples/textview/textStyler.js b/bundles/org.eclipse.orion.client.editor/web/examples/textview/textStyler.js
index 79cc102..5bf10ea 100644
--- a/bundles/org.eclipse.orion.client.editor/web/examples/textview/textStyler.js
+++ b/bundles/org.eclipse.orion.client.editor/web/examples/textview/textStyler.js
@@ -11,7 +11,7 @@
 
 /*global document window navigator define */
 
-define(['orion/textview/annotations'], function(mAnnotations) {
+define("examples/textview/textStyler", ['orion/textview/annotations'], function(mAnnotations) {
 
 	var JS_KEYWORDS =
 		["break",
@@ -1073,4 +1073,4 @@
 	};
 	
 	return {TextStyler: TextStyler};
-}, "examples/textview");
+});
diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/editor/asyncStyler.js b/bundles/org.eclipse.orion.client.editor/web/orion/editor/asyncStyler.js
index 5b3422d..f8d2977 100644
--- a/bundles/org.eclipse.orion.client.editor/web/orion/editor/asyncStyler.js
+++ b/bundles/org.eclipse.orion.client.editor/web/orion/editor/asyncStyler.js
@@ -10,7 +10,7 @@
  ******************************************************************************/
 /*jslint browser:true regexp:true*/
 /*global define console*/
-define([], function() {
+define("orion/editor/asyncStyler", [], function() {
 	var HIGHLIGHT_ERROR_ANNOTATION = "orion.annotation.highlightError";
 	
 	/**
@@ -157,4 +157,4 @@
 	};
 	
 	return { AsyncStyler: AsyncStyler };
-}, "orion/editor");
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/editor/contentAssist.js b/bundles/org.eclipse.orion.client.editor/web/orion/editor/contentAssist.js
index 3bd13bd..b9f1c77 100644
--- a/bundles/org.eclipse.orion.client.editor/web/orion/editor/contentAssist.js
+++ b/bundles/org.eclipse.orion.client.editor/web/orion/editor/contentAssist.js
@@ -12,7 +12,7 @@
 /*global define */

 /*jslint maxerr:150 browser:true devel:true */

 

-define(['orion/textview/keyBinding', 'orion/textview/eventTarget'], function(mKeyBinding, mEventTarget) {

+define("orion/editor/contentAssist", ['orion/textview/keyBinding', 'orion/textview/eventTarget'], function(mKeyBinding, mEventTarget) {

 

 	/**

 	 * @name orion.editor.ContentAssist

@@ -392,4 +392,4 @@
 	mEventTarget.EventTarget.addMixin(ContentAssist.prototype);

 	

 	return {ContentAssist: ContentAssist};

-}, "orion/editor");

+});

diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js b/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js
index 20e5571..e167545e 100644
--- a/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js
+++ b/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js
@@ -12,7 +12,7 @@
  /*global define window */
  /*jslint maxerr:150 browser:true devel:true laxbreak:true regexp:false*/
 
-define(['orion/textview/keyBinding', 'orion/textview/eventTarget', 'orion/textview/tooltip'], function(mKeyBinding, mEventTarget, mTooltip) {
+define("orion/editor/editor", ['orion/textview/keyBinding', 'orion/textview/eventTarget', 'orion/textview/tooltip'], function(mKeyBinding, mEventTarget, mTooltip) {
 
 	/**
 	 * @name orion.editor.util
@@ -871,4 +871,4 @@
 		Editor: Editor,
 		util: util
 	};
-}, "orion/editor");
+});
diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/editor/editorFeatures.js b/bundles/org.eclipse.orion.client.editor/web/orion/editor/editorFeatures.js
index 780ec9b..5a8cedf 100644
--- a/bundles/org.eclipse.orion.client.editor/web/orion/editor/editorFeatures.js
+++ b/bundles/org.eclipse.orion.client.editor/web/orion/editor/editorFeatures.js
@@ -12,7 +12,7 @@
 /*global define */
 /*jslint maxerr:150 browser:true devel:true */
 
-define(['orion/textview/undoStack', 'orion/textview/keyBinding', 'orion/textview/rulers', 'orion/textview/annotations', 'orion/textview/textDND',
+define("orion/editor/editorFeatures", ['orion/textview/undoStack', 'orion/textview/keyBinding', 'orion/textview/rulers', 'orion/textview/annotations', 'orion/textview/textDND',
 	'orion/editor/regex'],
 function(mUndoStack, mKeyBinding, mRulers, mAnnotations, mTextDND, mRegex) {
 
@@ -960,4 +960,4 @@
 		SourceCodeActions: SourceCodeActions,
 		LinkedMode: LinkedMode
 	};
-}, "orion/editor");
+});
diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/editor/htmlGrammar.js b/bundles/org.eclipse.orion.client.editor/web/orion/editor/htmlGrammar.js
index 959fd18..74c9bbc 100644
--- a/bundles/org.eclipse.orion.client.editor/web/orion/editor/htmlGrammar.js
+++ b/bundles/org.eclipse.orion.client.editor/web/orion/editor/htmlGrammar.js
@@ -12,7 +12,7 @@
 /*jslint */
 /*global define */
 
-define([], function() {
+define("orion/editor/htmlGrammar", [], function() {
 
 	/**
 	 * Provides a grammar that can do some very rough syntax highlighting for HTML.
@@ -101,4 +101,4 @@
 	}
 
 	return {HtmlGrammar: HtmlGrammar};
-}, "orion/editor");
+});
diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/editor/regex.js b/bundles/org.eclipse.orion.client.editor/web/orion/editor/regex.js
index 98fc1a3..c47c5bd 100644
--- a/bundles/org.eclipse.orion.client.editor/web/orion/editor/regex.js
+++ b/bundles/org.eclipse.orion.client.editor/web/orion/editor/regex.js
@@ -16,7 +16,7 @@
  * @class Utilities for dealing with regular expressions.
  * @description Utilities for dealing with regular expressions.
  */
-define([], function() {
+define("orion/editor/regex", [], function() {
 	/**
 	 * @methodOf orion.editor.regex
 	 * @static
@@ -54,4 +54,4 @@
 		escape: escape,
 		parse: parse
 	};
-}, "orion/editor");
+});
diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/editor/textMateStyler.js b/bundles/org.eclipse.orion.client.editor/web/orion/editor/textMateStyler.js
index 78ac243..5edd17b 100644
--- a/bundles/org.eclipse.orion.client.editor/web/orion/editor/textMateStyler.js
+++ b/bundles/org.eclipse.orion.client.editor/web/orion/editor/textMateStyler.js
@@ -12,7 +12,7 @@
 /*jslint regexp:false laxbreak:true*/
 /*global define */
 
-define(['orion/editor/regex'], function(mRegex) {
+define("orion/editor/textMateStyler", ['orion/editor/regex'], function(mRegex) {
 
 var RegexUtil = {
 	// Rules to detect some unsupported Oniguruma features
@@ -1353,4 +1353,4 @@
 		RegexUtil: RegexUtil,
 		TextMateStyler: TextMateStyler
 	};
-}, "orion/editor");
+});
diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/editor/webContentAssist.js b/bundles/org.eclipse.orion.client.editor/web/orion/editor/webContentAssist.js
index 5247337..19fe72b 100644
--- a/bundles/org.eclipse.orion.client.editor/web/orion/editor/webContentAssist.js
+++ b/bundles/org.eclipse.orion.client.editor/web/orion/editor/webContentAssist.js
@@ -11,7 +11,7 @@
  *******************************************************************************/
 /*global define */
 
-define([], function() {
+define("orion/editor/webContentAssist", [], function() {
 
 	/**
 	 * @name orion.contentAssist.CssContentAssistProvider
@@ -57,4 +57,4 @@
 		CssContentAssistProvider: CssContentAssistProvider,
 		JavaScriptContentAssistProvider: JavaScriptContentAssistProvider
 	};
-}, "orion/editor");
+});
diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/textview/annotations.js b/bundles/org.eclipse.orion.client.editor/web/orion/textview/annotations.js
index 8b5afdc..9452fbe 100644
--- a/bundles/org.eclipse.orion.client.editor/web/orion/textview/annotations.js
+++ b/bundles/org.eclipse.orion.client.editor/web/orion/textview/annotations.js
@@ -13,7 +13,7 @@
 

 /*global define */

 

-define(['orion/textview/eventTarget'], function(mEventTarget) {

+define("orion/textview/annotations", ['orion/textview/eventTarget'], function(mEventTarget) {

 	/**

 	 * @class This object represents a decoration attached to a range of text. Annotations are added to a

 	 * <code>AnnotationModel</code> which is attached to a <code>TextModel</code>.

@@ -617,4 +617,4 @@
 		AnnotationModel: AnnotationModel,

 		AnnotationStyler: AnnotationStyler

 	};

-}, "orion/textview");

+});

diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/textview/eventTarget.js b/bundles/org.eclipse.orion.client.editor/web/orion/textview/eventTarget.js
index 8c788f9..90a11bd 100644
--- a/bundles/org.eclipse.orion.client.editor/web/orion/textview/eventTarget.js
+++ b/bundles/org.eclipse.orion.client.editor/web/orion/textview/eventTarget.js
@@ -11,7 +11,7 @@
  ******************************************************************************/

  

 /*global define */

-define([], function() {

+define("orion/textview/eventTarget", [], function() {

 	/** 

 	 * Constructs a new EventTarget object.

 	 * 

@@ -140,4 +140,4 @@
 		}

 	};

 	return {EventTarget: EventTarget};

-}, "orion/textview");

+});

diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/textview/global.js b/bundles/org.eclipse.orion.client.editor/web/orion/textview/global.js
index 5735c8d..bc5f721 100644
--- a/bundles/org.eclipse.orion.client.editor/web/orion/textview/global.js
+++ b/bundles/org.eclipse.orion.client.editor/web/orion/textview/global.js
@@ -21,15 +21,15 @@
  * This function is intented to by used when RequireJS is not available.

  * </p>

  *

+ * @param {String} name The mixin module name.

  * @param {String[]} deps The array of dependency names.

  * @param {Function} callback The definition function.

- * @param {String} moduleName The mixin module name.

  */

 if (!window.define) {

-	window.define = function(deps, callback, moduleName) {

+	window.define = function(name, deps, callback) {

 		var module = this;

-		var split = (moduleName || "").split("/"), i, j;

-		for (i = 0; i < split.length; i++) {

+		var split = (name || "").split("/"), i, j;

+		for (i = 0; i < split.length - 1; i++) {

 			module = module[split[i]] = (module[split[i]] || {});

 		}

 		var depModules = [], depModule;

diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/textview/keyBinding.js b/bundles/org.eclipse.orion.client.editor/web/orion/textview/keyBinding.js
index b1b3232..62b68ee 100644
--- a/bundles/org.eclipse.orion.client.editor/web/orion/textview/keyBinding.js
+++ b/bundles/org.eclipse.orion.client.editor/web/orion/textview/keyBinding.js
@@ -13,7 +13,7 @@
 
 /*global window define */
 
-define([], function() {
+define("orion/textview/keyBinding", [], function() {
 	var isMac = window.navigator.platform.indexOf("Mac") !== -1;
 
 	/**
@@ -82,4 +82,4 @@
 		} 
 	};
 	return {KeyBinding: KeyBinding};
-}, "orion/textview");
+});
diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/textview/projectionTextModel.js b/bundles/org.eclipse.orion.client.editor/web/orion/textview/projectionTextModel.js
index 03f0600..c42bbfd 100644
--- a/bundles/org.eclipse.orion.client.editor/web/orion/textview/projectionTextModel.js
+++ b/bundles/org.eclipse.orion.client.editor/web/orion/textview/projectionTextModel.js
@@ -13,7 +13,7 @@
 
 /*global define */
 
-define(['orion/textview/textModel', 'orion/textview/eventTarget'], function(mTextModel, mEventTarget) {
+define("orion/textview/projectionTextModel", ['orion/textview/textModel', 'orion/textview/eventTarget'], function(mTextModel, mEventTarget) {
 
 	/**
 	 * @class This object represents a projection range. A projection specifies a
@@ -581,4 +581,4 @@
 	mEventTarget.EventTarget.addMixin(ProjectionTextModel.prototype);
 
 	return {ProjectionTextModel: ProjectionTextModel};
-}, "orion/textview");
+});
diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/textview/rulers.js b/bundles/org.eclipse.orion.client.editor/web/orion/textview/rulers.js
index 99c4739..cee9126 100644
--- a/bundles/org.eclipse.orion.client.editor/web/orion/textview/rulers.js
+++ b/bundles/org.eclipse.orion.client.editor/web/orion/textview/rulers.js
@@ -11,7 +11,7 @@
 
 /*global define setTimeout clearTimeout setInterval clearInterval Node */
 
-define(['orion/textview/tooltip'], function(mTooltip) {
+define("orion/textview/rulers", ['orion/textview/tooltip'], function(mTooltip) {
 
 	/**
 	 * Constructs a new ruler. 
@@ -721,4 +721,4 @@
 		OverviewRuler: OverviewRuler,
 		FoldingRuler: FoldingRuler
 	};
-}, "orion/textview");
+});
diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/textview/textDND.js b/bundles/org.eclipse.orion.client.editor/web/orion/textview/textDND.js
index f92e697..c2e8d44 100644
--- a/bundles/org.eclipse.orion.client.editor/web/orion/textview/textDND.js
+++ b/bundles/org.eclipse.orion.client.editor/web/orion/textview/textDND.js
@@ -13,7 +13,7 @@
  
 /*global define */
 
-define([], function() {
+define("orion/textview/textDND", [], function() {
 
 	function TextDND(view, undoStack) {
 		this._view = view;
@@ -136,4 +136,4 @@
 	};
 
 	return {TextDND: TextDND};
-}, "orion/textview");
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/textview/textModel.js b/bundles/org.eclipse.orion.client.editor/web/orion/textview/textModel.js
index eb8a648..35766d6 100644
--- a/bundles/org.eclipse.orion.client.editor/web/orion/textview/textModel.js
+++ b/bundles/org.eclipse.orion.client.editor/web/orion/textview/textModel.js
@@ -13,7 +13,7 @@
  
 /*global define window*/
 
-define(['orion/textview/eventTarget'], function(mEventTarget) {
+define("orion/textview/textModel", ['orion/textview/eventTarget'], function(mEventTarget) {
 	var isWindows = window.navigator.platform.indexOf("Win") !== -1;
 
 	/**
@@ -440,4 +440,4 @@
 	mEventTarget.EventTarget.addMixin(TextModel.prototype);
 	
 	return {TextModel: TextModel};
-}, "orion/textview");
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/textview/textView.js b/bundles/org.eclipse.orion.client.editor/web/orion/textview/textView.js
index e69e770..fc81e9f 100644
--- a/bundles/org.eclipse.orion.client.editor/web/orion/textview/textView.js
+++ b/bundles/org.eclipse.orion.client.editor/web/orion/textview/textView.js
@@ -14,7 +14,7 @@
 
 /*global window document navigator setTimeout clearTimeout XMLHttpRequest define */
 
-define(['orion/textview/textModel', 'orion/textview/keyBinding', 'orion/textview/eventTarget'], function(mTextModel, mKeyBinding, mEventTarget) {
+define("orion/textview/textView", ['orion/textview/textModel', 'orion/textview/keyBinding', 'orion/textview/eventTarget'], function(mTextModel, mKeyBinding, mEventTarget) {
 
 	/** @private */
 	function addHandler(node, type, handler, capture) {
@@ -6077,5 +6077,5 @@
 	mEventTarget.EventTarget.addMixin(TextView.prototype);
 	
 	return {TextView: TextView};
-}, "orion/textview");
+});
 
diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/textview/tooltip.js b/bundles/org.eclipse.orion.client.editor/web/orion/textview/tooltip.js
index 6e989ad..6dbcaed 100644
--- a/bundles/org.eclipse.orion.client.editor/web/orion/textview/tooltip.js
+++ b/bundles/org.eclipse.orion.client.editor/web/orion/textview/tooltip.js
@@ -11,7 +11,7 @@
 

 /*global define setTimeout clearTimeout setInterval clearInterval Node */

 

-define(['orion/textview/textView', 'orion/textview/textModel', 'orion/textview/projectionTextModel'], function(mTextView, mTextModel, mProjectionTextModel) {

+define("orion/textview/tooltip", ['orion/textview/textView', 'orion/textview/textModel', 'orion/textview/projectionTextModel'], function(mTextView, mTextModel, mProjectionTextModel) {

 

 	/** @private */

 	function Tooltip (view) {

@@ -235,4 +235,4 @@
 		}

 	};

 	return {Tooltip: Tooltip};

-}, "orion/textview");

+});

diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/textview/undoStack.js b/bundles/org.eclipse.orion.client.editor/web/orion/textview/undoStack.js
index 2920821..86dd056 100644
--- a/bundles/org.eclipse.orion.client.editor/web/orion/textview/undoStack.js
+++ b/bundles/org.eclipse.orion.client.editor/web/orion/textview/undoStack.js
@@ -11,7 +11,7 @@
 
 /*global define */
 
-define([], function() {
+define("orion/textview/undoStack", [], function() {
 
 	/** 
 	 * Constructs a new Change object.
@@ -377,4 +377,4 @@
 	return {
 		UndoStack: UndoStack
 	};
-}, "orion/textview");
+});