function ContentAssistMode(contentAssist, ContentAssistWidget) {
		var textView = contentAssist.textView;
		mKeyModes.KeyMode.call(this, textView);
		this.contentAssist = contentAssist;
		this.widget = ContentAssistWidget;
		this.proposals = [];
		var self = this;
		this.contentAssist.addEventListener("ProposalsComputed", function(event) {
			self.proposals = event.data.proposals;
			if (self.proposals.length === 0) {
				self.selectedIndex = -1;
				self.cancel();
			} else {
				self.selectedIndex = 0;
				while(self.proposals[self.selectedIndex] && self.proposals[self.selectedIndex].unselectable) {
					self.selectedIndex++;
				}
				if (self.proposals[self.selectedIndex]) {
					if (self.widget) {
						var showWidget = true;
						
						if (event.autoApply) {
							var nextIndex = self.selectedIndex + 1;
							while (self.proposals[nextIndex] && self.proposals[nextIndex].unselectable) {
								nextIndex++;
							}
							if (!self.proposals[nextIndex]) {
								// if there is only one selectable proposal apply it automatically
								showWidget = false;
								self.contentAssist.apply(self.proposals[self.selectedIndex]);
							}
						}
						
						if (showWidget) {
							self.widget.show();
							self.widget.selectNode(self.selectedIndex);
						}
					}
				} else {
					self.selectedIndex = -1; // didn't find any selectable items
					self.cancel();
				}
			}
		});
		textView.setAction("contentAssistApply", function() { //$NON-NLS-0$
			return this.enter();
		}.bind(this));
		textView.setAction("contentAssistCancel", function() { //$NON-NLS-0$
			return this.cancel();
		}.bind(this));
		textView.setAction("contentAssistNextProposal", function() { //$NON-NLS-0$
			return this.lineDown();
		}.bind(this));
		textView.setAction("contentAssistPreviousProposal", function() { //$NON-NLS-0$
			return this.lineUp();
		}.bind(this));
		textView.setAction("contentAssistNextPage", function() { //$NON-NLS-0$
			return this.pageDown();
		}.bind(this));
		textView.setAction("contentAssistPreviousPage", function() { //$NON-NLS-0$
			return this.pageUp();
		}.bind(this));
		textView.setAction("contentAssistHome", function() { //$NON-NLS-0$
			if (this.widget) {
				this.widget.scrollIndex(0, true);
			}
			return this.lineDown(0); // select first selectable element starting at the top and moving downwards
		}.bind(this));
		textView.setAction("contentAssistEnd", function() { //$NON-NLS-0$
			return this.lineUp(this.proposals.length - 1); // select first selectable element starting at the bottom and moving up
		}.bind(this));
		textView.setAction("contentAssistTab", function() { //$NON-NLS-0$
			return this.tab();
		}.bind(this));
		
		if (this.widget) {
			this.widget.setContentAssistMode(this);
			this.widget.createAccessible();
		}
	}
/**
	 * @name orion.editor.ContentAssistMode
	 * @class Editor mode for interacting with content assist proposals.
	 * @description Creates a ContentAssistMode. A ContentAssistMode is a key mode for {@link orion.editor.Editor}
	 * that provides interaction with content assist proposals retrieved from an {@link orion.editor.ContentAssist}. 
	 * Interaction is performed via the {@link #lineUp}, {@link #lineDown}, and {@link #enter} actions. An 
	 * {@link orion.editor.ContentAssistWidget} may optionally be provided to display which proposal is currently selected.
	 * @param {orion.editor.ContentAssist} contentAssist
	 * @param {orion.editor.ContentAssistWidget} [ContentAssistWidget]
	 */
@name orion.editor.ContentAssistMode
@class Editor mode for interacting with content assist proposals.
@description Creates a ContentAssistMode. A ContentAssistMode is a key mode for  orion.editor.Editor
that provides interaction with content assist proposals retrieved from an  orion.editor.ContentAssist.
Interaction is performed via the  #lineUp,  #lineDown, and  #enter actions. An
orion.editor.ContentAssistWidget may optionally be provided to display which proposal is currently selected.
@name orion . editor . ContentAssistMode @class Editor mode for interacting with content assist proposals . @description Creates a ContentAssistMode . A ContentAssistMode is a key mode for orion . editor . Editor that provides interaction with content assist proposals retrieved from an orion . editor . ContentAssist . Interaction is performed via the #lineUp #lineDown and #enter actions . An orion . editor . ContentAssistWidget may optionally be provided to display which proposal is currently selected .
function ContentAssistMode(contentAssist, ContentAssistWidget) {
		var textView = contentAssist.textView;
		mKeyModes.KeyMode.call(this, textView);
		this.contentAssist = contentAssist;
		this.widget = ContentAssistWidget;
		this.proposals = [];
		var self = this;
		this.contentAssist.addEventListener("ProposalsComputed", function(event) {
			self.proposals = event.data.proposals;
			if (self.proposals.length === 0) {
				self.selectedIndex = -1;
				self.cancel();
			} else {
				self.selectedIndex = 0;
				while(self.proposals[self.selectedIndex] && self.proposals[self.selectedIndex].unselectable) {
					self.selectedIndex++;
				}
				if (self.proposals[self.selectedIndex]) {
					if (self.widget) {
						var showWidget = true;
						if (event.autoApply) {
							var nextIndex = self.selectedIndex + 1;
							while (self.proposals[nextIndex] && self.proposals[nextIndex].unselectable) {
								nextIndex++;
							}
							if (!self.proposals[nextIndex]) {
								showWidget = false;
								self.contentAssist.apply(self.proposals[self.selectedIndex]);
							}
						}
						if (showWidget) {
							self.widget.show();
							self.widget.selectNode(self.selectedIndex);
						}
					}
				} else {
					self.selectedIndex = -1; 
					self.cancel();
				}
			}
		});
		textView.setAction("contentAssistApply", function() { 
			return this.enter();
		}.bind(this));
		textView.setAction("contentAssistCancel", function() { 
			return this.cancel();
		}.bind(this));
		textView.setAction("contentAssistNextProposal", function() { 
			return this.lineDown();
		}.bind(this));
		textView.setAction("contentAssistPreviousProposal", function() { 
			return this.lineUp();
		}.bind(this));
		textView.setAction("contentAssistNextPage", function() { 
			return this.pageDown();
		}.bind(this));
		textView.setAction("contentAssistPreviousPage", function() { 
			return this.pageUp();
		}.bind(this));
		textView.setAction("contentAssistHome", function() { 
			if (this.widget) {
				this.widget.scrollIndex(0, true);
			}
			return this.lineDown(0); 
		}.bind(this));
		textView.setAction("contentAssistEnd", function() { 
			return this.lineUp(this.proposals.length - 1); 
		}.bind(this));
		textView.setAction("contentAssistTab", function() { 
			return this.tab();
		}.bind(this));
		if (this.widget) {
			this.widget.setContentAssistMode(this);
			this.widget.createAccessible();
		}
	}
function ContentAssistMode ( contentAssist , ContentAssistWidget ) { var textView = contentAssist . textView ; mKeyModes . KeyMode . call ( this , textView ) ; this . contentAssist = contentAssist ; this . widget = ContentAssistWidget ; this . proposals = [ ] ; var self = this ; this . contentAssist . addEventListener ( "ProposalsComputed" , function ( event ) { self . proposals = event . data . proposals ; if ( self . proposals . length === 0 ) { self . selectedIndex = - 1 ; self . cancel ( ) ; } else { self . selectedIndex = 0 ; while ( self . proposals [ self . selectedIndex ] && self . proposals [ self . selectedIndex ] . unselectable ) { self . selectedIndex ++ ; } if ( self . proposals [ self . selectedIndex ] ) { if ( self . widget ) { var showWidget = true ; if ( event . autoApply ) { var nextIndex = self . selectedIndex + 1 ; while ( self . proposals [ nextIndex ] && self . proposals [ nextIndex ] . unselectable ) { nextIndex ++ ; } if ( ! self . proposals [ nextIndex ] ) { showWidget = false ; self . contentAssist . apply ( self . proposals [ self . selectedIndex ] ) ; } } if ( showWidget ) { self . widget . show ( ) ; self . widget . selectNode ( self . selectedIndex ) ; } } } else { self . selectedIndex = - 1 ; self . cancel ( ) ; } } } ) ; textView . setAction ( "contentAssistApply" , function ( ) { return this . enter ( ) ; } . bind ( this ) ) ; textView . setAction ( "contentAssistCancel" , function ( ) { return this . cancel ( ) ; } . bind ( this ) ) ; textView . setAction ( "contentAssistNextProposal" , function ( ) { return this . lineDown ( ) ; } . bind ( this ) ) ; textView . setAction ( "contentAssistPreviousProposal" , function ( ) { return this . lineUp ( ) ; } . bind ( this ) ) ; textView . setAction ( "contentAssistNextPage" , function ( ) { return this . pageDown ( ) ; } . bind ( this ) ) ; textView . setAction ( "contentAssistPreviousPage" , function ( ) { return this . pageUp ( ) ; } . bind ( this ) ) ; textView . setAction ( "contentAssistHome" , function ( ) { if ( this . widget ) { this . widget . scrollIndex ( 0 , true ) ; } return this . lineDown ( 0 ) ; } . bind ( this ) ) ; textView . setAction ( "contentAssistEnd" , function ( ) { return this . lineUp ( this . proposals . length - 1 ) ; } . bind ( this ) ) ; textView . setAction ( "contentAssistTab" , function ( ) { return this . tab ( ) ; } . bind ( this ) ) ; if ( this . widget ) { this . widget . setContentAssistMode ( this ) ; this . widget . createAccessible ( ) ; } }
@name orion.editor.ContentAssistMode
 @class Editor mode for interacting with content assist proposals.
@name orion . editor . ContentAssistMode @class Editor mode for interacting with content assist proposals .
// if there is only one selectable proposal apply it automatically
 // didn't find any selectable items
 //$NON-NLS-0$
 //$NON-NLS-0$
 //$NON-NLS-0$
 //$NON-NLS-0$
 //$NON-NLS-0$
 //$NON-NLS-0$
 //$NON-NLS-0$
 // select first selectable element starting at the top and moving downwards
 //$NON-NLS-0$
 // select first selectable element starting at the bottom and moving up
 //$NON-NLS-0$
