summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorMike Rennie2013-10-21 12:12:42 (EDT)
committer Mark Macdonald2013-10-21 15:03:36 (EDT)
commitf2fc515f791a14a6f61d9d7952e20c21c793b45e (patch)
treefef79a5ee8617d7be6ccd9c1d1797a37b7640ac4
parent0bc9c618788d16fde7f25e07930a12bd2abefa01 (diff)
downloadorg.eclipse.orion.client-f2fc515f791a14a6f61d9d7952e20c21c793b45e.zip
org.eclipse.orion.client-f2fc515f791a14a6f61d9d7952e20c21c793b45e.tar.gz
org.eclipse.orion.client-f2fc515f791a14a6f61d9d7952e20c21c793b45e.tar.bz2
Bug 417958 - Document orion.core.astproviderv20131021-1903
Signed-off-by: Mike Rennie <Michael_Rennie@ca.ibm.com>
-rw-r--r--bundles/org.eclipse.orion.client.ui/web/orion/edit/ast.js52
1 files changed, 44 insertions, 8 deletions
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/edit/ast.js b/bundles/org.eclipse.orion.client.ui/web/orion/edit/ast.js
index 72b9ef1..6248f3f 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/edit/ast.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/edit/ast.js
@@ -33,6 +33,13 @@ define([
this.start();
}
objects.mixin(ASTManager.prototype, /** @lends orion.edit.ASTManager.prototype */ {
+ /**
+ * @name start
+ * @description starts the manager, throws an error if the manager has already been started
+ * @function
+ * @public
+ * @memberof orion.edit.ASTManager.prototype
+ */
start: function() {
if (this.registration) {
throw new Error("Already started");
@@ -46,20 +53,39 @@ define([
getAST: this.getAST.bind(this)
}, null); //$NON-NLS-0$
},
+ /**
+ * @name stop
+ * @description stops the manager, throws an error if the manager is not running
+ * @function
+ * @public
+ * @memberof orion.edit.ASTManager.prototype
+ */
stop: function() {
+ if(!this.registration) {
+ throw new Error("Manager not running");
+ }
this.registration.unregister();
this.contextRegistration.unregister();
this.tracker.close();
this.listener = this.cachedAST = null;
},
/**
- * Notifies the AST manager of a change to the model.
+ * @name updated
+ * @description Notifies the AST manager of a change to the model
+ * @function
+ * @public
+ * @memberof orion.edit.ASTManager.prototype
* @param {Object} event
*/
updated: function(event) {
this.cachedAST = null;
},
/**
+ * @name _getASTProvider
+ * @description Returns the AST provider for the given content type identifier
+ * @function
+ * @private
+ * @memberof orion.edit.ASTManager.prototype
* @param {String} contentTypeId
* @returns {Object} An AST provider capable of providing an AST for the given contentType.
*/
@@ -71,24 +97,34 @@ define([
return serviceRef ? this.serviceRegistry.getService(serviceRef) : null;
},
/**
- * @param {String} contentTypeId
- * @returns {Object|orion.Promise}
+ * @name _getAST
+ * @description Computes the AST for the given content type identifier and context
+ * @function
+ * @private
+ * @memberof orion.edit.ASTManager.prototype
+ * @param {String} contentTypeId the identifier of the content type to compute the AST for
+ * @param {Object} astContext the context in which to compute the AST
+ * @returns {Object|orion.Promise} or <code>null</code> if there are no providers for an AST of the given content type
*/
- _getAST: function(contentTypeId, options) {
+ _getAST: function(contentTypeId, astContext) {
if (this.cachedAST) {
return this.cachedAST;
}
var provider = this._getASTProvider(contentTypeId);
if (provider) {
- options.text = this.inputManager.getEditor().getText();
- return provider.computeAST(options);
+ astContext.text = this.inputManager.getEditor().getText();
+ return provider.computeAST(astContext);
}
return null;
},
/**
- * Retrieves an AST from a capable AST provider.
+ * @name getAST
+ * @description Retrieves an AST from a capable AST provider.
+ * @function
+ * @public
+ * @memberof orion.edit.ASTManager.prototype
* @param {Object} [options={}] Options to be passed to the AST provider.
- * @returns {orion.Promise} A promise that resolves to the AST. Resolves to <code>null</code> if no capable provider was found.
+ * @returns {Object|orion.Promise} A promise that resolves to the AST. Resolves to <code>null</code> if no capable provider was found.
*/
getAST: function(options) {
options = options || {};