id
int32
0
58k
repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
14,300
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/searchModel.js
getReplacedFileContent
function getReplacedFileContent(newContentHolder, updating, fileItem) { mSearchUtils.generateNewContents(updating, fileItem.contents, newContentHolder, fileItem, this._searchHelper.params.replace, this._searchHelper.inFileQuery.searchStrLength); newContentHolder.lineDelim = this._lineDelimiter; }
javascript
function getReplacedFileContent(newContentHolder, updating, fileItem) { mSearchUtils.generateNewContents(updating, fileItem.contents, newContentHolder, fileItem, this._searchHelper.params.replace, this._searchHelper.inFileQuery.searchStrLength); newContentHolder.lineDelim = this._lineDelimiter; }
[ "function", "getReplacedFileContent", "(", "newContentHolder", ",", "updating", ",", "fileItem", ")", "{", "mSearchUtils", ".", "generateNewContents", "(", "updating", ",", "fileItem", ".", "contents", ",", "newContentHolder", ",", "fileItem", ",", "this", ".", "_searchHelper", ".", "params", ".", "replace", ",", "this", ".", "_searchHelper", ".", "inFileQuery", ".", "searchStrLength", ")", ";", "newContentHolder", ".", "lineDelim", "=", "this", ".", "_lineDelimiter", ";", "}" ]
Get the replaced file contents by a given file model. Sync call. Required function. @param {Object} newContentHolder The returned replaced file content holder. The content holder has to have a property called "contents". It can be either type of the below: String type: the pure contents of the file Array type: the lines of the file exclude the line delimeter. If an array type of contents is provided, the lineDelim property has to be defined. Otherwise "\n" is used. @param {Boolean} updating The flag indicating if getting replaced file contets based on existing newContentHolder.contents. It can be ignored if over riding this function does not care the case below. The explorer basically caches the current file's replaced contents. If only check box is changed on the same file, the falg is set to true when call this fucntion. Lets say a file with 5000 lines has been changed only because one line is changed, then we do not have to replace the whole 5000 lines but only one line. @param {Object} fileItem The file item that generates the replaced contents. @override
[ "Get", "the", "replaced", "file", "contents", "by", "a", "given", "file", "model", ".", "Sync", "call", ".", "Required", "function", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/searchModel.js#L539-L542
14,301
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/searchModel.js
writeReplacedContents
function writeReplacedContents(reportList){ var promises = []; var validFileList = this.getValidFileList(); validFileList.forEach(function(fileItem) { promises.push(this._writeOneFile(fileItem, reportList)); }.bind(this)); return Deferred.all(promises, function(error) { return {_error: error}; }); }
javascript
function writeReplacedContents(reportList){ var promises = []; var validFileList = this.getValidFileList(); validFileList.forEach(function(fileItem) { promises.push(this._writeOneFile(fileItem, reportList)); }.bind(this)); return Deferred.all(promises, function(error) { return {_error: error}; }); }
[ "function", "writeReplacedContents", "(", "reportList", ")", "{", "var", "promises", "=", "[", "]", ";", "var", "validFileList", "=", "this", ".", "getValidFileList", "(", ")", ";", "validFileList", ".", "forEach", "(", "function", "(", "fileItem", ")", "{", "promises", ".", "push", "(", "this", ".", "_writeOneFile", "(", "fileItem", ",", "reportList", ")", ")", ";", "}", ".", "bind", "(", "this", ")", ")", ";", "return", "Deferred", ".", "all", "(", "promises", ",", "function", "(", "error", ")", "{", "return", "{", "_error", ":", "error", "}", ";", "}", ")", ";", "}" ]
Write the replace file contents. Required function. @param {Array} reportList The array of the report items. Each item of the reportList contains the following properties model: the file item matchesReplaced: The number of matches that replaced in this file status: "pass" or "failed" message: Optional. The error message when writing fails. @returns {orion.Promise} A new promise. The returned promise is generally fulfilled to an <code>Array</code> whose elements writes all the new contetns by checking the checked flag on all details matches. A file with no checked flag on all detail matches should not be written a new replaced contents. @override
[ "Write", "the", "replace", "file", "contents", ".", "Required", "function", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/searchModel.js#L555-L562
14,302
eclipse/orion.client
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-invalid-this.js
isReflectApply
function isReflectApply(node) { return node.type === "MemberExpression" && node.object.type === "Identifier" && node.object.name === "Reflect" && node.property.type === "Identifier" && node.property.name === "apply" && node.computed === false; }
javascript
function isReflectApply(node) { return node.type === "MemberExpression" && node.object.type === "Identifier" && node.object.name === "Reflect" && node.property.type === "Identifier" && node.property.name === "apply" && node.computed === false; }
[ "function", "isReflectApply", "(", "node", ")", "{", "return", "node", ".", "type", "===", "\"MemberExpression\"", "&&", "node", ".", "object", ".", "type", "===", "\"Identifier\"", "&&", "node", ".", "object", ".", "name", "===", "\"Reflect\"", "&&", "node", ".", "property", ".", "type", "===", "\"Identifier\"", "&&", "node", ".", "property", ".", "name", "===", "\"apply\"", "&&", "node", ".", "computed", "===", "false", ";", "}" ]
Checks whether or not a node is 'Reclect.apply'. @param {ASTNode} node - A node to check. @returns {boolean} Whether or not the node is a 'Reclect.apply'.
[ "Checks", "whether", "or", "not", "a", "node", "is", "Reclect", ".", "apply", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-invalid-this.js#L42-L49
14,303
eclipse/orion.client
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-invalid-this.js
isES5Constructor
function isES5Constructor(node) { return node.id && node.id.name[0] !== node.id.name[0].toLocaleLowerCase(); }
javascript
function isES5Constructor(node) { return node.id && node.id.name[0] !== node.id.name[0].toLocaleLowerCase(); }
[ "function", "isES5Constructor", "(", "node", ")", "{", "return", "node", ".", "id", "&&", "node", ".", "id", ".", "name", "[", "0", "]", "!==", "node", ".", "id", ".", "name", "[", "0", "]", ".", "toLocaleLowerCase", "(", ")", ";", "}" ]
Checks whether or not a node is a constructor. @param {ASTNode} node - A function node to check. @returns {boolean} Wehether or not a node is a constructor.
[ "Checks", "whether", "or", "not", "a", "node", "is", "a", "constructor", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-invalid-this.js#L92-L95
14,304
eclipse/orion.client
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-invalid-this.js
function(node) { var current = stack.getCurrent(); if (current && !current.valid) { context.report(node, ProblemMessages.noInvalidThis); } }
javascript
function(node) { var current = stack.getCurrent(); if (current && !current.valid) { context.report(node, ProblemMessages.noInvalidThis); } }
[ "function", "(", "node", ")", "{", "var", "current", "=", "stack", ".", "getCurrent", "(", ")", ";", "if", "(", "current", "&&", "!", "current", ".", "valid", ")", "{", "context", ".", "report", "(", "node", ",", "ProblemMessages", ".", "noInvalidThis", ")", ";", "}", "}" ]
Reports if 'this' of the current context is invalid.
[ "Reports", "if", "this", "of", "the", "current", "context", "is", "invalid", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-invalid-this.js#L322-L328
14,305
eclipse/orion.client
bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js
function() { BaseEditor.prototype.destroy.call(this); this._textViewFactory = this._undoStackFactory = this._textDNDFactory = this._annotationFactory = this._foldingRulerFactory = this._lineNumberRulerFactory = this._contentAssistFactory = this._keyBindingFactory = this._hoverFactory = this._zoomRulerFactory = null; }
javascript
function() { BaseEditor.prototype.destroy.call(this); this._textViewFactory = this._undoStackFactory = this._textDNDFactory = this._annotationFactory = this._foldingRulerFactory = this._lineNumberRulerFactory = this._contentAssistFactory = this._keyBindingFactory = this._hoverFactory = this._zoomRulerFactory = null; }
[ "function", "(", ")", "{", "BaseEditor", ".", "prototype", ".", "destroy", ".", "call", "(", "this", ")", ";", "this", ".", "_textViewFactory", "=", "this", ".", "_undoStackFactory", "=", "this", ".", "_textDNDFactory", "=", "this", ".", "_annotationFactory", "=", "this", ".", "_foldingRulerFactory", "=", "this", ".", "_lineNumberRulerFactory", "=", "this", ".", "_contentAssistFactory", "=", "this", ".", "_keyBindingFactory", "=", "this", ".", "_hoverFactory", "=", "this", ".", "_zoomRulerFactory", "=", "null", ";", "}" ]
Destroys the editor.
[ "Destroys", "the", "editor", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js#L327-L332
14,306
eclipse/orion.client
bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js
function(start, end) { var annotationModel = this.getAnnotationModel(); if(annotationModel) { var foldingAnnotation = new mAnnotations.FoldingAnnotation(start, end, this.getTextView().getModel()); annotationModel.addAnnotation(foldingAnnotation); return foldingAnnotation; } return null; }
javascript
function(start, end) { var annotationModel = this.getAnnotationModel(); if(annotationModel) { var foldingAnnotation = new mAnnotations.FoldingAnnotation(start, end, this.getTextView().getModel()); annotationModel.addAnnotation(foldingAnnotation); return foldingAnnotation; } return null; }
[ "function", "(", "start", ",", "end", ")", "{", "var", "annotationModel", "=", "this", ".", "getAnnotationModel", "(", ")", ";", "if", "(", "annotationModel", ")", "{", "var", "foldingAnnotation", "=", "new", "mAnnotations", ".", "FoldingAnnotation", "(", "start", ",", "end", ",", "this", ".", "getTextView", "(", ")", ".", "getModel", "(", ")", ")", ";", "annotationModel", ".", "addAnnotation", "(", "foldingAnnotation", ")", ";", "return", "foldingAnnotation", ";", "}", "return", "null", ";", "}" ]
Creates and add a FoldingAnnotation to the editor. @param {Number} start The start offset of the annotation in the text model. @param {Number} end The end offset of the annotation in the text model. @returns {orion.editor.FoldingAnnotation} The FoldingAnnotation added to the editor.
[ "Creates", "and", "add", "a", "FoldingAnnotation", "to", "the", "editor", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js#L398-L406
14,307
eclipse/orion.client
bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js
function() { if (!this._textView) { return null; } var model = this._textView.getModel(); if (model.getBaseModel) { model = model.getBaseModel(); } return model; }
javascript
function() { if (!this._textView) { return null; } var model = this._textView.getModel(); if (model.getBaseModel) { model = model.getBaseModel(); } return model; }
[ "function", "(", ")", "{", "if", "(", "!", "this", ".", "_textView", ")", "{", "return", "null", ";", "}", "var", "model", "=", "this", ".", "_textView", ".", "getModel", "(", ")", ";", "if", "(", "model", ".", "getBaseModel", ")", "{", "model", "=", "model", ".", "getBaseModel", "(", ")", ";", "}", "return", "model", ";", "}" ]
Returns the base text model of this editor. @returns {orion.editor.TextModel}
[ "Returns", "the", "base", "text", "model", "of", "this", "editor", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js#L454-L463
14,308
eclipse/orion.client
bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js
function(visible, force) { if (this._annotationRulerVisible === visible && !force) { return; } this._annotationRulerVisible = visible; if (!this._annotationRuler) { return; } var textView = this._textView; if (visible) { textView.addRuler(this._annotationRuler, 0); } else { textView.removeRuler(this._annotationRuler); } }
javascript
function(visible, force) { if (this._annotationRulerVisible === visible && !force) { return; } this._annotationRulerVisible = visible; if (!this._annotationRuler) { return; } var textView = this._textView; if (visible) { textView.addRuler(this._annotationRuler, 0); } else { textView.removeRuler(this._annotationRuler); } }
[ "function", "(", "visible", ",", "force", ")", "{", "if", "(", "this", ".", "_annotationRulerVisible", "===", "visible", "&&", "!", "force", ")", "{", "return", ";", "}", "this", ".", "_annotationRulerVisible", "=", "visible", ";", "if", "(", "!", "this", ".", "_annotationRuler", ")", "{", "return", ";", "}", "var", "textView", "=", "this", ".", "_textView", ";", "if", "(", "visible", ")", "{", "textView", ".", "addRuler", "(", "this", ".", "_annotationRuler", ",", "0", ")", ";", "}", "else", "{", "textView", ".", "removeRuler", "(", "this", ".", "_annotationRuler", ")", ";", "}", "}" ]
Sets whether the annotation ruler is visible. @param {Boolean} visible <code>true</code> to show ruler, <code>false</code> otherwise
[ "Sets", "whether", "the", "annotation", "ruler", "is", "visible", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js#L532-L542
14,309
eclipse/orion.client
bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js
function(visible, force) { if (this._foldingRulerVisible === visible && !force) { return; } if (!visible) { var textActions = this.getTextActions(); if (textActions) { textActions.expandAnnotations(true); } } this._foldingRulerVisible = visible; if (!this._foldingRuler) { return; } var textView = this._textView; if (!textView.getModel().getBaseModel) { return; } if (visible) { textView.addRuler(this._foldingRuler); } else { textView.removeRuler(this._foldingRuler); } }
javascript
function(visible, force) { if (this._foldingRulerVisible === visible && !force) { return; } if (!visible) { var textActions = this.getTextActions(); if (textActions) { textActions.expandAnnotations(true); } } this._foldingRulerVisible = visible; if (!this._foldingRuler) { return; } var textView = this._textView; if (!textView.getModel().getBaseModel) { return; } if (visible) { textView.addRuler(this._foldingRuler); } else { textView.removeRuler(this._foldingRuler); } }
[ "function", "(", "visible", ",", "force", ")", "{", "if", "(", "this", ".", "_foldingRulerVisible", "===", "visible", "&&", "!", "force", ")", "{", "return", ";", "}", "if", "(", "!", "visible", ")", "{", "var", "textActions", "=", "this", ".", "getTextActions", "(", ")", ";", "if", "(", "textActions", ")", "{", "textActions", ".", "expandAnnotations", "(", "true", ")", ";", "}", "}", "this", ".", "_foldingRulerVisible", "=", "visible", ";", "if", "(", "!", "this", ".", "_foldingRuler", ")", "{", "return", ";", "}", "var", "textView", "=", "this", ".", "_textView", ";", "if", "(", "!", "textView", ".", "getModel", "(", ")", ".", "getBaseModel", ")", "{", "return", ";", "}", "if", "(", "visible", ")", "{", "textView", ".", "addRuler", "(", "this", ".", "_foldingRuler", ")", ";", "}", "else", "{", "textView", ".", "removeRuler", "(", "this", ".", "_foldingRuler", ")", ";", "}", "}" ]
Sets whether the folding ruler is visible. @param {Boolean} visible <code>true</code> to show ruler, <code>false</code> otherwise
[ "Sets", "whether", "the", "folding", "ruler", "is", "visible", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js#L548-L565
14,310
eclipse/orion.client
bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js
function(visible, force) { if (this._lineNumberRulerVisible === visible && !force) { return; } this._lineNumberRulerVisible = visible; if (!this._lineNumberRuler) { return; } var textView = this._textView; if (visible) { textView.addRuler(this._lineNumberRuler, !this._annotationRulerVisible ? 0 : 1); } else { textView.removeRuler(this._lineNumberRuler); } }
javascript
function(visible, force) { if (this._lineNumberRulerVisible === visible && !force) { return; } this._lineNumberRulerVisible = visible; if (!this._lineNumberRuler) { return; } var textView = this._textView; if (visible) { textView.addRuler(this._lineNumberRuler, !this._annotationRulerVisible ? 0 : 1); } else { textView.removeRuler(this._lineNumberRuler); } }
[ "function", "(", "visible", ",", "force", ")", "{", "if", "(", "this", ".", "_lineNumberRulerVisible", "===", "visible", "&&", "!", "force", ")", "{", "return", ";", "}", "this", ".", "_lineNumberRulerVisible", "=", "visible", ";", "if", "(", "!", "this", ".", "_lineNumberRuler", ")", "{", "return", ";", "}", "var", "textView", "=", "this", ".", "_textView", ";", "if", "(", "visible", ")", "{", "textView", ".", "addRuler", "(", "this", ".", "_lineNumberRuler", ",", "!", "this", ".", "_annotationRulerVisible", "?", "0", ":", "1", ")", ";", "}", "else", "{", "textView", ".", "removeRuler", "(", "this", ".", "_lineNumberRuler", ")", ";", "}", "}" ]
Sets whether the line numbering ruler is visible. @param {Boolean} visible <code>true</code> to show ruler, <code>false</code> otherwise
[ "Sets", "whether", "the", "line", "numbering", "ruler", "is", "visible", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js#L571-L581
14,311
eclipse/orion.client
bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js
function(visible, force) { if (this._overviewRulerVisible === visible && !force) { return; } this._overviewRulerVisible = visible; if (!this._overviewRuler) { return; } var textView = this._textView; if (visible) { textView.addRuler(this._overviewRuler); } else { textView.removeRuler(this._overviewRuler); } }
javascript
function(visible, force) { if (this._overviewRulerVisible === visible && !force) { return; } this._overviewRulerVisible = visible; if (!this._overviewRuler) { return; } var textView = this._textView; if (visible) { textView.addRuler(this._overviewRuler); } else { textView.removeRuler(this._overviewRuler); } }
[ "function", "(", "visible", ",", "force", ")", "{", "if", "(", "this", ".", "_overviewRulerVisible", "===", "visible", "&&", "!", "force", ")", "{", "return", ";", "}", "this", ".", "_overviewRulerVisible", "=", "visible", ";", "if", "(", "!", "this", ".", "_overviewRuler", ")", "{", "return", ";", "}", "var", "textView", "=", "this", ".", "_textView", ";", "if", "(", "visible", ")", "{", "textView", ".", "addRuler", "(", "this", ".", "_overviewRuler", ")", ";", "}", "else", "{", "textView", ".", "removeRuler", "(", "this", ".", "_overviewRuler", ")", ";", "}", "}" ]
Sets whether the overview ruler is visible. @param {Boolean} visible <code>true</code> to show ruler, <code>false</code> otherwise
[ "Sets", "whether", "the", "overview", "ruler", "is", "visible", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js#L587-L597
14,312
eclipse/orion.client
bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js
function(visible, force) { if (this._zoomRulerVisible === visible && !force) { return; } this._zoomRulerVisible = visible; if (!this._zoomRuler) { return; } var textView = this._textView; if (visible) { textView.addRuler(this._zoomRuler); } else { textView.removeRuler(this._zoomRuler); } }
javascript
function(visible, force) { if (this._zoomRulerVisible === visible && !force) { return; } this._zoomRulerVisible = visible; if (!this._zoomRuler) { return; } var textView = this._textView; if (visible) { textView.addRuler(this._zoomRuler); } else { textView.removeRuler(this._zoomRuler); } }
[ "function", "(", "visible", ",", "force", ")", "{", "if", "(", "this", ".", "_zoomRulerVisible", "===", "visible", "&&", "!", "force", ")", "{", "return", ";", "}", "this", ".", "_zoomRulerVisible", "=", "visible", ";", "if", "(", "!", "this", ".", "_zoomRuler", ")", "{", "return", ";", "}", "var", "textView", "=", "this", ".", "_textView", ";", "if", "(", "visible", ")", "{", "textView", ".", "addRuler", "(", "this", ".", "_zoomRuler", ")", ";", "}", "else", "{", "textView", ".", "removeRuler", "(", "this", ".", "_zoomRuler", ")", ";", "}", "}" ]
Sets whether the zoom ruler is visible. @param {Boolean} visible <code>true</code> to show ruler, <code>false</code> otherwise
[ "Sets", "whether", "the", "zoom", "ruler", "is", "visible", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js#L603-L613
14,313
eclipse/orion.client
bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js
function(types) { if (textUtil.compare(this._annotationTypesVisible, types)) return; this._annotationTypesVisible = types; if (!this._annotationRuler || !this._textView || !this._annotationRulerVisible) { return; } this._annotationRuler.setAnnotationTypeVisible(types); this._textView.redrawLines(0, undefined, this._annotationRuler); }
javascript
function(types) { if (textUtil.compare(this._annotationTypesVisible, types)) return; this._annotationTypesVisible = types; if (!this._annotationRuler || !this._textView || !this._annotationRulerVisible) { return; } this._annotationRuler.setAnnotationTypeVisible(types); this._textView.redrawLines(0, undefined, this._annotationRuler); }
[ "function", "(", "types", ")", "{", "if", "(", "textUtil", ".", "compare", "(", "this", ".", "_annotationTypesVisible", ",", "types", ")", ")", "return", ";", "this", ".", "_annotationTypesVisible", "=", "types", ";", "if", "(", "!", "this", ".", "_annotationRuler", "||", "!", "this", ".", "_textView", "||", "!", "this", ".", "_annotationRulerVisible", ")", "{", "return", ";", "}", "this", ".", "_annotationRuler", ".", "setAnnotationTypeVisible", "(", "types", ")", ";", "this", ".", "_textView", ".", "redrawLines", "(", "0", ",", "undefined", ",", "this", ".", "_annotationRuler", ")", ";", "}" ]
Sets which annotations types are shown in the annotation ruler. Annotations are visible by default. @param {Object} types a hash table mapping annotation type to visibility (i.e. AnnotationType.ANNOTATION_INFO -> true). @since 14.0
[ "Sets", "which", "annotations", "types", "are", "shown", "in", "the", "annotation", "ruler", ".", "Annotations", "are", "visible", "by", "default", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js#L621-L627
14,314
eclipse/orion.client
bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js
function(types) { if (textUtil.compare(this._overviewAnnotationTypesVisible, types)) return; this._overviewAnnotationTypesVisible = types; if (!this._overviewRuler || !this._textView || !this._overviewRulerVisible) { return; } this._overviewRuler.setAnnotationTypeVisible(types); this._textView.redrawLines(0, undefined, this._overviewRuler); }
javascript
function(types) { if (textUtil.compare(this._overviewAnnotationTypesVisible, types)) return; this._overviewAnnotationTypesVisible = types; if (!this._overviewRuler || !this._textView || !this._overviewRulerVisible) { return; } this._overviewRuler.setAnnotationTypeVisible(types); this._textView.redrawLines(0, undefined, this._overviewRuler); }
[ "function", "(", "types", ")", "{", "if", "(", "textUtil", ".", "compare", "(", "this", ".", "_overviewAnnotationTypesVisible", ",", "types", ")", ")", "return", ";", "this", ".", "_overviewAnnotationTypesVisible", "=", "types", ";", "if", "(", "!", "this", ".", "_overviewRuler", "||", "!", "this", ".", "_textView", "||", "!", "this", ".", "_overviewRulerVisible", ")", "{", "return", ";", "}", "this", ".", "_overviewRuler", ".", "setAnnotationTypeVisible", "(", "types", ")", ";", "this", ".", "_textView", ".", "redrawLines", "(", "0", ",", "undefined", ",", "this", ".", "_overviewRuler", ")", ";", "}" ]
Sets which annotations types are shown in the overview ruler. Annotations are visible by default. @param {Object} types a hash table mapping annotation type to visibility (i.e. AnnotationType.ANNOTATION_INFO -> true). @since 14.0
[ "Sets", "which", "annotations", "types", "are", "shown", "in", "the", "overview", "ruler", ".", "Annotations", "are", "visible", "by", "default", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js#L635-L641
14,315
eclipse/orion.client
bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js
function(types) { if (textUtil.compare(this._textAnnotationTypesVisible, types)) return; this._textAnnotationTypesVisible = types; if (!this._annotationStyler || !this._textView) { return; } this._annotationStyler.setAnnotationTypeVisible(types); this._textView.redrawLines(0, undefined); }
javascript
function(types) { if (textUtil.compare(this._textAnnotationTypesVisible, types)) return; this._textAnnotationTypesVisible = types; if (!this._annotationStyler || !this._textView) { return; } this._annotationStyler.setAnnotationTypeVisible(types); this._textView.redrawLines(0, undefined); }
[ "function", "(", "types", ")", "{", "if", "(", "textUtil", ".", "compare", "(", "this", ".", "_textAnnotationTypesVisible", ",", "types", ")", ")", "return", ";", "this", ".", "_textAnnotationTypesVisible", "=", "types", ";", "if", "(", "!", "this", ".", "_annotationStyler", "||", "!", "this", ".", "_textView", ")", "{", "return", ";", "}", "this", ".", "_annotationStyler", ".", "setAnnotationTypeVisible", "(", "types", ")", ";", "this", ".", "_textView", ".", "redrawLines", "(", "0", ",", "undefined", ")", ";", "}" ]
Sets which annotations types are shown in the text. Annotations are visible by default. @param {Object} types a hash table mapping annotation type to visibility (i.e. AnnotationType.ANNOTATION_INFO -> true). @since 14.0
[ "Sets", "which", "annotations", "types", "are", "shown", "in", "the", "text", ".", "Annotations", "are", "visible", "by", "default", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js#L649-L655
14,316
eclipse/orion.client
bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js
function(line) { // Find any existing annotation var annotationModel = this.getAnnotationModel(); var textModel = this.getModel(); if (textModel.getBaseModel) { textModel = textModel.getBaseModel(); } var type = AT.ANNOTATION_HIGHLIGHTED_LINE; var annotations = annotationModel.getAnnotations(0, textModel.getCharCount()); var remove = null; while (annotations.hasNext()) { var annotation = annotations.next(); if (annotation.type === type) { remove = annotation; break; } } var lineStart = textModel.getLineStart(line); var lineEnd = textModel.getLineEnd(line); var add = AT.createAnnotation(type, lineStart, lineEnd); // Replace to or add the new annotation if (remove) { annotationModel.replaceAnnotations([remove], [add]); } else { annotationModel.addAnnotation(add); } }
javascript
function(line) { // Find any existing annotation var annotationModel = this.getAnnotationModel(); var textModel = this.getModel(); if (textModel.getBaseModel) { textModel = textModel.getBaseModel(); } var type = AT.ANNOTATION_HIGHLIGHTED_LINE; var annotations = annotationModel.getAnnotations(0, textModel.getCharCount()); var remove = null; while (annotations.hasNext()) { var annotation = annotations.next(); if (annotation.type === type) { remove = annotation; break; } } var lineStart = textModel.getLineStart(line); var lineEnd = textModel.getLineEnd(line); var add = AT.createAnnotation(type, lineStart, lineEnd); // Replace to or add the new annotation if (remove) { annotationModel.replaceAnnotations([remove], [add]); } else { annotationModel.addAnnotation(add); } }
[ "function", "(", "line", ")", "{", "// Find any existing annotation", "var", "annotationModel", "=", "this", ".", "getAnnotationModel", "(", ")", ";", "var", "textModel", "=", "this", ".", "getModel", "(", ")", ";", "if", "(", "textModel", ".", "getBaseModel", ")", "{", "textModel", "=", "textModel", ".", "getBaseModel", "(", ")", ";", "}", "var", "type", "=", "AT", ".", "ANNOTATION_HIGHLIGHTED_LINE", ";", "var", "annotations", "=", "annotationModel", ".", "getAnnotations", "(", "0", ",", "textModel", ".", "getCharCount", "(", ")", ")", ";", "var", "remove", "=", "null", ";", "while", "(", "annotations", ".", "hasNext", "(", ")", ")", "{", "var", "annotation", "=", "annotations", ".", "next", "(", ")", ";", "if", "(", "annotation", ".", "type", "===", "type", ")", "{", "remove", "=", "annotation", ";", "break", ";", "}", "}", "var", "lineStart", "=", "textModel", ".", "getLineStart", "(", "line", ")", ";", "var", "lineEnd", "=", "textModel", ".", "getLineEnd", "(", "line", ")", ";", "var", "add", "=", "AT", ".", "createAnnotation", "(", "type", ",", "lineStart", ",", "lineEnd", ")", ";", "// Replace to or add the new annotation", "if", "(", "remove", ")", "{", "annotationModel", ".", "replaceAnnotations", "(", "[", "remove", "]", ",", "[", "add", "]", ")", ";", "}", "else", "{", "annotationModel", ".", "addAnnotation", "(", "add", ")", ";", "}", "}" ]
Highlight a line. @param {number} line
[ "Highlight", "a", "line", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js#L930-L956
14,317
eclipse/orion.client
bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js
function() { var annotationModel = this.getAnnotationModel(); var textModel = this.getModel(); if (textModel.getBaseModel) { textModel = textModel.getBaseModel(); } var type = AT.ANNOTATION_HIGHLIGHTED_LINE; var annotations = annotationModel.getAnnotations(0, textModel.getCharCount()); var remove = null; while (annotations.hasNext()) { var annotation = annotations.next(); if (annotation.type === type) { remove = annotation; break; } } if (remove) { annotationModel.removeAnnotation(remove); } }
javascript
function() { var annotationModel = this.getAnnotationModel(); var textModel = this.getModel(); if (textModel.getBaseModel) { textModel = textModel.getBaseModel(); } var type = AT.ANNOTATION_HIGHLIGHTED_LINE; var annotations = annotationModel.getAnnotations(0, textModel.getCharCount()); var remove = null; while (annotations.hasNext()) { var annotation = annotations.next(); if (annotation.type === type) { remove = annotation; break; } } if (remove) { annotationModel.removeAnnotation(remove); } }
[ "function", "(", ")", "{", "var", "annotationModel", "=", "this", ".", "getAnnotationModel", "(", ")", ";", "var", "textModel", "=", "this", ".", "getModel", "(", ")", ";", "if", "(", "textModel", ".", "getBaseModel", ")", "{", "textModel", "=", "textModel", ".", "getBaseModel", "(", ")", ";", "}", "var", "type", "=", "AT", ".", "ANNOTATION_HIGHLIGHTED_LINE", ";", "var", "annotations", "=", "annotationModel", ".", "getAnnotations", "(", "0", ",", "textModel", ".", "getCharCount", "(", ")", ")", ";", "var", "remove", "=", "null", ";", "while", "(", "annotations", ".", "hasNext", "(", ")", ")", "{", "var", "annotation", "=", "annotations", ".", "next", "(", ")", ";", "if", "(", "annotation", ".", "type", "===", "type", ")", "{", "remove", "=", "annotation", ";", "break", ";", "}", "}", "if", "(", "remove", ")", "{", "annotationModel", ".", "removeAnnotation", "(", "remove", ")", ";", "}", "}" ]
Unhightlight the highlighted line
[ "Unhightlight", "the", "highlighted", "line" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js#L961-L980
14,318
eclipse/orion.client
bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js
function(diffs) { this.showAnnotations(diffs, [ AT.ANNOTATION_DIFF_ADDED, AT.ANNOTATION_DIFF_MODIFIED, AT.ANNOTATION_DIFF_DELETED ], null, function(annotation) { if(annotation.type === "added")//$NON-NLS-0$ return AT.ANNOTATION_DIFF_ADDED; else if (annotation.type === "modified")//$NON-NLS-0$ return AT.ANNOTATION_DIFF_MODIFIED; return AT.ANNOTATION_DIFF_DELETED; // assume deleted if not added or modified }); }
javascript
function(diffs) { this.showAnnotations(diffs, [ AT.ANNOTATION_DIFF_ADDED, AT.ANNOTATION_DIFF_MODIFIED, AT.ANNOTATION_DIFF_DELETED ], null, function(annotation) { if(annotation.type === "added")//$NON-NLS-0$ return AT.ANNOTATION_DIFF_ADDED; else if (annotation.type === "modified")//$NON-NLS-0$ return AT.ANNOTATION_DIFF_MODIFIED; return AT.ANNOTATION_DIFF_DELETED; // assume deleted if not added or modified }); }
[ "function", "(", "diffs", ")", "{", "this", ".", "showAnnotations", "(", "diffs", ",", "[", "AT", ".", "ANNOTATION_DIFF_ADDED", ",", "AT", ".", "ANNOTATION_DIFF_MODIFIED", ",", "AT", ".", "ANNOTATION_DIFF_DELETED", "]", ",", "null", ",", "function", "(", "annotation", ")", "{", "if", "(", "annotation", ".", "type", "===", "\"added\"", ")", "//$NON-NLS-0$", "return", "AT", ".", "ANNOTATION_DIFF_ADDED", ";", "else", "if", "(", "annotation", ".", "type", "===", "\"modified\"", ")", "//$NON-NLS-0$", "return", "AT", ".", "ANNOTATION_DIFF_MODIFIED", ";", "return", "AT", ".", "ANNOTATION_DIFF_DELETED", ";", "// assume deleted if not added or modified", "}", ")", ";", "}" ]
Display git diff annotation on the editor's annotation ruler and overview ruler. @param diffs [] with types "added", "modified", "deleted" Each property in diffs contains an array of objects { lineStart, lineEnd } that provides the starting and ending line index for the specified property.
[ "Display", "git", "diff", "annotation", "on", "the", "editor", "s", "annotation", "ruler", "and", "overview", "ruler", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js#L1478-L1490
14,319
eclipse/orion.client
bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js
function(start, end, line, offset, len) { // We use typeof because we need to distinguish the number 0 from an undefined or null parameter if (typeof(start) === "number") { //$NON-NLS-0$ if (typeof(end) !== "number") { //$NON-NLS-0$ end = start; } this.moveSelection(start, end); return true; } else if (typeof(line) === "number") { //$NON-NLS-0$ var model = this.getModel(); var pos = model.getLineStart(line-1); if (typeof(offset) === "number") { //$NON-NLS-0$ pos = pos + offset; } if (typeof(len) !== "number") { //$NON-NLS-0$ len = 0; } this.moveSelection(pos, pos+len); return true; } return false; }
javascript
function(start, end, line, offset, len) { // We use typeof because we need to distinguish the number 0 from an undefined or null parameter if (typeof(start) === "number") { //$NON-NLS-0$ if (typeof(end) !== "number") { //$NON-NLS-0$ end = start; } this.moveSelection(start, end); return true; } else if (typeof(line) === "number") { //$NON-NLS-0$ var model = this.getModel(); var pos = model.getLineStart(line-1); if (typeof(offset) === "number") { //$NON-NLS-0$ pos = pos + offset; } if (typeof(len) !== "number") { //$NON-NLS-0$ len = 0; } this.moveSelection(pos, pos+len); return true; } return false; }
[ "function", "(", "start", ",", "end", ",", "line", ",", "offset", ",", "len", ")", "{", "// We use typeof because we need to distinguish the number 0 from an undefined or null parameter", "if", "(", "typeof", "(", "start", ")", "===", "\"number\"", ")", "{", "//$NON-NLS-0$", "if", "(", "typeof", "(", "end", ")", "!==", "\"number\"", ")", "{", "//$NON-NLS-0$", "end", "=", "start", ";", "}", "this", ".", "moveSelection", "(", "start", ",", "end", ")", ";", "return", "true", ";", "}", "else", "if", "(", "typeof", "(", "line", ")", "===", "\"number\"", ")", "{", "//$NON-NLS-0$", "var", "model", "=", "this", ".", "getModel", "(", ")", ";", "var", "pos", "=", "model", ".", "getLineStart", "(", "line", "-", "1", ")", ";", "if", "(", "typeof", "(", "offset", ")", "===", "\"number\"", ")", "{", "//$NON-NLS-0$", "pos", "=", "pos", "+", "offset", ";", "}", "if", "(", "typeof", "(", "len", ")", "!==", "\"number\"", ")", "{", "//$NON-NLS-0$", "len", "=", "0", ";", "}", "this", ".", "moveSelection", "(", "pos", ",", "pos", "+", "len", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
Reveals and selects a portion of text. @param {Number} start @param {Number} end @param {Number} line @param {Number} offset @param {Number} length
[ "Reveals", "and", "selects", "a", "portion", "of", "text", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js#L1500-L1521
14,320
eclipse/orion.client
bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js
function(line, column, end, callback) { if (this._textView) { var model = this.getModel(); line = Math.max(0, Math.min(line, model.getLineCount() - 1)); var lineStart = model.getLineStart(line); var start = 0; if (end === undefined) { end = 0; } if (typeof column === "string") { //$NON-NLS-0$ var index = model.getLine(line).indexOf(column); if (index !== -1) { start = index; end = start + column.length; } } else { start = column; var lineLength = model.getLineEnd(line) - lineStart; start = Math.min(start, lineLength); end = Math.min(end, lineLength); } this.moveSelection(lineStart + start, lineStart + end, callback); } }
javascript
function(line, column, end, callback) { if (this._textView) { var model = this.getModel(); line = Math.max(0, Math.min(line, model.getLineCount() - 1)); var lineStart = model.getLineStart(line); var start = 0; if (end === undefined) { end = 0; } if (typeof column === "string") { //$NON-NLS-0$ var index = model.getLine(line).indexOf(column); if (index !== -1) { start = index; end = start + column.length; } } else { start = column; var lineLength = model.getLineEnd(line) - lineStart; start = Math.min(start, lineLength); end = Math.min(end, lineLength); } this.moveSelection(lineStart + start, lineStart + end, callback); } }
[ "function", "(", "line", ",", "column", ",", "end", ",", "callback", ")", "{", "if", "(", "this", ".", "_textView", ")", "{", "var", "model", "=", "this", ".", "getModel", "(", ")", ";", "line", "=", "Math", ".", "max", "(", "0", ",", "Math", ".", "min", "(", "line", ",", "model", ".", "getLineCount", "(", ")", "-", "1", ")", ")", ";", "var", "lineStart", "=", "model", ".", "getLineStart", "(", "line", ")", ";", "var", "start", "=", "0", ";", "if", "(", "end", "===", "undefined", ")", "{", "end", "=", "0", ";", "}", "if", "(", "typeof", "column", "===", "\"string\"", ")", "{", "//$NON-NLS-0$", "var", "index", "=", "model", ".", "getLine", "(", "line", ")", ".", "indexOf", "(", "column", ")", ";", "if", "(", "index", "!==", "-", "1", ")", "{", "start", "=", "index", ";", "end", "=", "start", "+", "column", ".", "length", ";", "}", "}", "else", "{", "start", "=", "column", ";", "var", "lineLength", "=", "model", ".", "getLineEnd", "(", "line", ")", "-", "lineStart", ";", "start", "=", "Math", ".", "min", "(", "start", ",", "lineLength", ")", ";", "end", "=", "Math", ".", "min", "(", "end", ",", "lineLength", ")", ";", "}", "this", ".", "moveSelection", "(", "lineStart", "+", "start", ",", "lineStart", "+", "end", ",", "callback", ")", ";", "}", "}" ]
Reveals a line in the editor, and optionally selects a portion of the line. @param {Number} line - document base line index @param {Number|String} column @param {Number} [end]
[ "Reveals", "a", "line", "in", "the", "editor", "and", "optionally", "selects", "a", "portion", "of", "the", "line", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js#L1564-L1587
14,321
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/globalCommands.js
generateUserInfo
function generateUserInfo(serviceRegistry, keyAssistFunction, prefsService) { prefsService.get("/userMenu").then(function(prefs) { if (Boolean(prefs) && prefs.disabled === true) { var menu = lib.node("userMenu"); if (Boolean(menu)) { menu.parentElement.removeChild(menu); } return; } var authServices = serviceRegistry.getServiceReferences("orion.core.auth"); //$NON-NLS-0$ authenticationIds = []; var menuGenerator = customGlobalCommands.createMenuGenerator.call(this, serviceRegistry, keyAssistFunction, prefsService); if (!menuGenerator) { return; } for (var i = 0; i < authServices.length; i++) { var servicePtr = authServices[i]; var authService = serviceRegistry.getService(servicePtr); getLabel(authService, servicePtr).then(function (label) { authService.getKey().then(function (key) { authenticationIds.push(key); authService.getUser().then(function (jsonData) { menuGenerator.addUserItem(key, authService, label, jsonData); }, function (errorData, jsonData) { menuGenerator.addUserItem(key, authService, label, jsonData); }); window.addEventListener("storage", function (e) { if (authRendered[key] === localStorage.getItem(key)) { return; } authRendered[key] = localStorage.getItem(key); authService.getUser().then(function (jsonData) { menuGenerator.addUserItem(key, authService, label, jsonData); }, function (errorData) { menuGenerator.addUserItem(key, authService, label); }); }, false); }); }); } }); }
javascript
function generateUserInfo(serviceRegistry, keyAssistFunction, prefsService) { prefsService.get("/userMenu").then(function(prefs) { if (Boolean(prefs) && prefs.disabled === true) { var menu = lib.node("userMenu"); if (Boolean(menu)) { menu.parentElement.removeChild(menu); } return; } var authServices = serviceRegistry.getServiceReferences("orion.core.auth"); //$NON-NLS-0$ authenticationIds = []; var menuGenerator = customGlobalCommands.createMenuGenerator.call(this, serviceRegistry, keyAssistFunction, prefsService); if (!menuGenerator) { return; } for (var i = 0; i < authServices.length; i++) { var servicePtr = authServices[i]; var authService = serviceRegistry.getService(servicePtr); getLabel(authService, servicePtr).then(function (label) { authService.getKey().then(function (key) { authenticationIds.push(key); authService.getUser().then(function (jsonData) { menuGenerator.addUserItem(key, authService, label, jsonData); }, function (errorData, jsonData) { menuGenerator.addUserItem(key, authService, label, jsonData); }); window.addEventListener("storage", function (e) { if (authRendered[key] === localStorage.getItem(key)) { return; } authRendered[key] = localStorage.getItem(key); authService.getUser().then(function (jsonData) { menuGenerator.addUserItem(key, authService, label, jsonData); }, function (errorData) { menuGenerator.addUserItem(key, authService, label); }); }, false); }); }); } }); }
[ "function", "generateUserInfo", "(", "serviceRegistry", ",", "keyAssistFunction", ",", "prefsService", ")", "{", "prefsService", ".", "get", "(", "\"/userMenu\"", ")", ".", "then", "(", "function", "(", "prefs", ")", "{", "if", "(", "Boolean", "(", "prefs", ")", "&&", "prefs", ".", "disabled", "===", "true", ")", "{", "var", "menu", "=", "lib", ".", "node", "(", "\"userMenu\"", ")", ";", "if", "(", "Boolean", "(", "menu", ")", ")", "{", "menu", ".", "parentElement", ".", "removeChild", "(", "menu", ")", ";", "}", "return", ";", "}", "var", "authServices", "=", "serviceRegistry", ".", "getServiceReferences", "(", "\"orion.core.auth\"", ")", ";", "//$NON-NLS-0$", "authenticationIds", "=", "[", "]", ";", "var", "menuGenerator", "=", "customGlobalCommands", ".", "createMenuGenerator", ".", "call", "(", "this", ",", "serviceRegistry", ",", "keyAssistFunction", ",", "prefsService", ")", ";", "if", "(", "!", "menuGenerator", ")", "{", "return", ";", "}", "for", "(", "var", "i", "=", "0", ";", "i", "<", "authServices", ".", "length", ";", "i", "++", ")", "{", "var", "servicePtr", "=", "authServices", "[", "i", "]", ";", "var", "authService", "=", "serviceRegistry", ".", "getService", "(", "servicePtr", ")", ";", "getLabel", "(", "authService", ",", "servicePtr", ")", ".", "then", "(", "function", "(", "label", ")", "{", "authService", ".", "getKey", "(", ")", ".", "then", "(", "function", "(", "key", ")", "{", "authenticationIds", ".", "push", "(", "key", ")", ";", "authService", ".", "getUser", "(", ")", ".", "then", "(", "function", "(", "jsonData", ")", "{", "menuGenerator", ".", "addUserItem", "(", "key", ",", "authService", ",", "label", ",", "jsonData", ")", ";", "}", ",", "function", "(", "errorData", ",", "jsonData", ")", "{", "menuGenerator", ".", "addUserItem", "(", "key", ",", "authService", ",", "label", ",", "jsonData", ")", ";", "}", ")", ";", "window", ".", "addEventListener", "(", "\"storage\"", ",", "function", "(", "e", ")", "{", "if", "(", "authRendered", "[", "key", "]", "===", "localStorage", ".", "getItem", "(", "key", ")", ")", "{", "return", ";", "}", "authRendered", "[", "key", "]", "=", "localStorage", ".", "getItem", "(", "key", ")", ";", "authService", ".", "getUser", "(", ")", ".", "then", "(", "function", "(", "jsonData", ")", "{", "menuGenerator", ".", "addUserItem", "(", "key", ",", "authService", ",", "label", ",", "jsonData", ")", ";", "}", ",", "function", "(", "errorData", ")", "{", "menuGenerator", ".", "addUserItem", "(", "key", ",", "authService", ",", "label", ")", ";", "}", ")", ";", "}", ",", "false", ")", ";", "}", ")", ";", "}", ")", ";", "}", "}", ")", ";", "}" ]
Adds the user-related commands to the toolbar @name orion.globalCommands#generateUserInfo @function
[ "Adds", "the", "user", "-", "related", "commands", "to", "the", "toolbar" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/globalCommands.js#L135-L179
14,322
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/globalCommands.js
setInvocation
function setInvocation(commandItem) { var command = commandItem.command; if (!command.visibleWhen || command.visibleWhen(item)) { commandItem.invocation = new mCommands.CommandInvocation(item, item, null, command, commandRegistry); return new Deferred().resolve(commandItem); } else if (typeof alternateItem === "function") { if (!alternateItemDeferred) { alternateItemDeferred = alternateItem(); } return Deferred.when(alternateItemDeferred, function (newItem) { if (newItem && (item === pageItem)) { // there is an alternate, and it still applies to the current page target if (!command.visibleWhen || command.visibleWhen(newItem)) { commandItem.invocation = new mCommands.CommandInvocation(newItem, newItem, null, command, commandRegistry); return commandItem; } } }); } return new Deferred().resolve(); }
javascript
function setInvocation(commandItem) { var command = commandItem.command; if (!command.visibleWhen || command.visibleWhen(item)) { commandItem.invocation = new mCommands.CommandInvocation(item, item, null, command, commandRegistry); return new Deferred().resolve(commandItem); } else if (typeof alternateItem === "function") { if (!alternateItemDeferred) { alternateItemDeferred = alternateItem(); } return Deferred.when(alternateItemDeferred, function (newItem) { if (newItem && (item === pageItem)) { // there is an alternate, and it still applies to the current page target if (!command.visibleWhen || command.visibleWhen(newItem)) { commandItem.invocation = new mCommands.CommandInvocation(newItem, newItem, null, command, commandRegistry); return commandItem; } } }); } return new Deferred().resolve(); }
[ "function", "setInvocation", "(", "commandItem", ")", "{", "var", "command", "=", "commandItem", ".", "command", ";", "if", "(", "!", "command", ".", "visibleWhen", "||", "command", ".", "visibleWhen", "(", "item", ")", ")", "{", "commandItem", ".", "invocation", "=", "new", "mCommands", ".", "CommandInvocation", "(", "item", ",", "item", ",", "null", ",", "command", ",", "commandRegistry", ")", ";", "return", "new", "Deferred", "(", ")", ".", "resolve", "(", "commandItem", ")", ";", "}", "else", "if", "(", "typeof", "alternateItem", "===", "\"function\"", ")", "{", "if", "(", "!", "alternateItemDeferred", ")", "{", "alternateItemDeferred", "=", "alternateItem", "(", ")", ";", "}", "return", "Deferred", ".", "when", "(", "alternateItemDeferred", ",", "function", "(", "newItem", ")", "{", "if", "(", "newItem", "&&", "(", "item", "===", "pageItem", ")", ")", "{", "// there is an alternate, and it still applies to the current page target", "if", "(", "!", "command", ".", "visibleWhen", "||", "command", ".", "visibleWhen", "(", "newItem", ")", ")", "{", "commandItem", ".", "invocation", "=", "new", "mCommands", ".", "CommandInvocation", "(", "newItem", ",", "newItem", ",", "null", ",", "command", ",", "commandRegistry", ")", ";", "return", "commandItem", ";", "}", "}", "}", ")", ";", "}", "return", "new", "Deferred", "(", ")", ".", "resolve", "(", ")", ";", "}" ]
Creates a CommandInvocation for given commandItem. @returns {orion.Promise} A promise resolving to: commandItem with its "invocation" field set, or undefined if we failed
[ "Creates", "a", "CommandInvocation", "for", "given", "commandItem", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/globalCommands.js#L234-L254
14,323
eclipse/orion.client
bundles/org.eclipse.orion.client.editor/web/orion/editor/vi.js
StatusLineMode
function StatusLineMode(viMode) { var view = viMode.getView(); this.viMode = viMode; mKeyMode.KeyMode.call(this, view); this._createActions(view); }
javascript
function StatusLineMode(viMode) { var view = viMode.getView(); this.viMode = viMode; mKeyMode.KeyMode.call(this, view); this._createActions(view); }
[ "function", "StatusLineMode", "(", "viMode", ")", "{", "var", "view", "=", "viMode", ".", "getView", "(", ")", ";", "this", ".", "viMode", "=", "viMode", ";", "mKeyMode", ".", "KeyMode", ".", "call", "(", "this", ",", "view", ")", ";", "this", ".", "_createActions", "(", "view", ")", ";", "}" ]
Status Line Mode
[ "Status", "Line", "Mode" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/vi.js#L482-L487
14,324
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/plugins/samples/largeFileSearch/i18n.js
addPart
function addPart(locale, master, needed, toLoad, prefix, suffix) { if (master[locale]) { needed.push(locale); if (master[locale] === true || master[locale] === 1) { toLoad.push(prefix + locale + '/' + suffix); } } }
javascript
function addPart(locale, master, needed, toLoad, prefix, suffix) { if (master[locale]) { needed.push(locale); if (master[locale] === true || master[locale] === 1) { toLoad.push(prefix + locale + '/' + suffix); } } }
[ "function", "addPart", "(", "locale", ",", "master", ",", "needed", ",", "toLoad", ",", "prefix", ",", "suffix", ")", "{", "if", "(", "master", "[", "locale", "]", ")", "{", "needed", ".", "push", "(", "locale", ")", ";", "if", "(", "master", "[", "locale", "]", "===", "true", "||", "master", "[", "locale", "]", "===", "1", ")", "{", "toLoad", ".", "push", "(", "prefix", "+", "locale", "+", "'/'", "+", "suffix", ")", ";", "}", "}", "}" ]
Helper function to avoid repeating code. Lots of arguments in the desire to stay functional and support RequireJS contexts without having to know about the RequireJS contexts.
[ "Helper", "function", "to", "avoid", "repeating", "code", ".", "Lots", "of", "arguments", "in", "the", "desire", "to", "stay", "functional", "and", "support", "RequireJS", "contexts", "without", "having", "to", "know", "about", "the", "RequireJS", "contexts", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/plugins/samples/largeFileSearch/i18n.js#L51-L58
14,325
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/gcli/util/l10n.js
getPluralRule
function getPluralRule() { if (!pluralRule) { var lang = navigator.language || navigator.userLanguage; // Convert lang to a rule index pluralRules.some(function(rule) { if (rule.locales.indexOf(lang) !== -1) { pluralRule = rule; return true; } return false; }); // Use rule 0 by default, which is no plural forms at all if (!pluralRule) { console.error('Failed to find plural rule for ' + lang); pluralRule = pluralRules[0]; } } return pluralRule; }
javascript
function getPluralRule() { if (!pluralRule) { var lang = navigator.language || navigator.userLanguage; // Convert lang to a rule index pluralRules.some(function(rule) { if (rule.locales.indexOf(lang) !== -1) { pluralRule = rule; return true; } return false; }); // Use rule 0 by default, which is no plural forms at all if (!pluralRule) { console.error('Failed to find plural rule for ' + lang); pluralRule = pluralRules[0]; } } return pluralRule; }
[ "function", "getPluralRule", "(", ")", "{", "if", "(", "!", "pluralRule", ")", "{", "var", "lang", "=", "navigator", ".", "language", "||", "navigator", ".", "userLanguage", ";", "// Convert lang to a rule index", "pluralRules", ".", "some", "(", "function", "(", "rule", ")", "{", "if", "(", "rule", ".", "locales", ".", "indexOf", "(", "lang", ")", "!==", "-", "1", ")", "{", "pluralRule", "=", "rule", ";", "return", "true", ";", "}", "return", "false", ";", "}", ")", ";", "// Use rule 0 by default, which is no plural forms at all", "if", "(", "!", "pluralRule", ")", "{", "console", ".", "error", "(", "'Failed to find plural rule for '", "+", "lang", ")", ";", "pluralRule", "=", "pluralRules", "[", "0", "]", ";", "}", "}", "return", "pluralRule", ";", "}" ]
Find the correct plural rule for the current locale @return a plural rule with a 'get()' function
[ "Find", "the", "correct", "plural", "rule", "for", "the", "current", "locale" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/util/l10n.js#L281-L301
14,326
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/explorers/navigationUtils.js
removeNavGrid
function removeNavGrid(domNodeWrapperList, domNode) { if(!domNodeWrapperList){ return; } for(var i = 0; i < domNodeWrapperList.length ; i++){ if(domNodeWrapperList[i].domNode === domNode){ domNodeWrapperList.splice(i, 1); return; } } }
javascript
function removeNavGrid(domNodeWrapperList, domNode) { if(!domNodeWrapperList){ return; } for(var i = 0; i < domNodeWrapperList.length ; i++){ if(domNodeWrapperList[i].domNode === domNode){ domNodeWrapperList.splice(i, 1); return; } } }
[ "function", "removeNavGrid", "(", "domNodeWrapperList", ",", "domNode", ")", "{", "if", "(", "!", "domNodeWrapperList", ")", "{", "return", ";", "}", "for", "(", "var", "i", "=", "0", ";", "i", "<", "domNodeWrapperList", ".", "length", ";", "i", "++", ")", "{", "if", "(", "domNodeWrapperList", "[", "i", "]", ".", "domNode", "===", "domNode", ")", "{", "domNodeWrapperList", ".", "splice", "(", "i", ",", "1", ")", ";", "return", ";", "}", "}", "}" ]
Remove a grid navigation item from a given array. A grid navigation item is presented by a wrapper object wrapping the domNode, widget and onClick properties. @param {Array} domNodeWrapperList the array that holds the grid navigation item. Normally the .gridChildren property from a row model. @param {DomNode} domNode the html dom node representing a grid. Normally left or right arrow keys on the current row highlight the dom node. When a grid is rendered, the caller has to decide what dom node can be passed.
[ "Remove", "a", "grid", "navigation", "item", "from", "a", "given", "array", ".", "A", "grid", "navigation", "item", "is", "presented", "by", "a", "wrapper", "object", "wrapping", "the", "domNode", "widget", "and", "onClick", "properties", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/navigationUtils.js#L65-L76
14,327
eclipse/orion.client
bundles/org.eclipse.orion.client.core/web/orion/projectClient.js
ProjectClient
function ProjectClient(serviceRegistry, fileClient) { this.serviceRegistry = serviceRegistry; this.fileClient = fileClient; this.allProjectHandlersReferences = serviceRegistry.getServiceReferences("orion.project.handler"); //$NON-NLS-0$ this.allProjectDeployReferences = serviceRegistry.getServiceReferences("orion.project.deploy"); //$NON-NLS-0$ this._serviceRegistration = serviceRegistry.registerService("orion.project.client", this); //$NON-NLS-0$ this._launchConfigurationsDir = "launchConfigurations"; //$NON-NLS-0$ }
javascript
function ProjectClient(serviceRegistry, fileClient) { this.serviceRegistry = serviceRegistry; this.fileClient = fileClient; this.allProjectHandlersReferences = serviceRegistry.getServiceReferences("orion.project.handler"); //$NON-NLS-0$ this.allProjectDeployReferences = serviceRegistry.getServiceReferences("orion.project.deploy"); //$NON-NLS-0$ this._serviceRegistration = serviceRegistry.registerService("orion.project.client", this); //$NON-NLS-0$ this._launchConfigurationsDir = "launchConfigurations"; //$NON-NLS-0$ }
[ "function", "ProjectClient", "(", "serviceRegistry", ",", "fileClient", ")", "{", "this", ".", "serviceRegistry", "=", "serviceRegistry", ";", "this", ".", "fileClient", "=", "fileClient", ";", "this", ".", "allProjectHandlersReferences", "=", "serviceRegistry", ".", "getServiceReferences", "(", "\"orion.project.handler\"", ")", ";", "//$NON-NLS-0$", "this", ".", "allProjectDeployReferences", "=", "serviceRegistry", ".", "getServiceReferences", "(", "\"orion.project.deploy\"", ")", ";", "//$NON-NLS-0$", "this", ".", "_serviceRegistration", "=", "serviceRegistry", ".", "registerService", "(", "\"orion.project.client\"", ",", "this", ")", ";", "//$NON-NLS-0$", "this", ".", "_launchConfigurationsDir", "=", "\"launchConfigurations\"", ";", "//$NON-NLS-0$", "}" ]
Creates a new project client. @class Project client provides client-side API to handle projects based on given file client. @name orion.projectClient.ProjectClient
[ "Creates", "a", "new", "project", "client", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.core/web/orion/projectClient.js#L43-L50
14,328
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/widgets/themes/ThemeImporter.js
xmlToJson
function xmlToJson(xml) { // Create the return object var obj = {}; if (xml.nodeType === 1) { // element // do attributes if (xml.attributes.length > 0) { for (var j = 0; j < xml.attributes.length; j++) { var attribute = xml.attributes.item(j); obj[attribute.nodeName] = attribute.value; } } } else if (xml.nodeType === 3) { // text obj = xml.nodeValue.trim(); // add trim here } // do children if (xml.hasChildNodes()) { for (var i = 0; i < xml.childNodes.length; i++) { var item = xml.childNodes.item(i); var nodeName = item.nodeName; if (typeof(obj[nodeName]) === "undefined") { //$NON-NLS-0$ var tmp = xmlToJson(item); if (tmp !== "") // if not empty string obj[nodeName] = tmp; } else { if (typeof(obj[nodeName].push) === "undefined") { //$NON-NLS-0$ var old = obj[nodeName]; obj[nodeName] = []; obj[nodeName].push(old); } tmp = xmlToJson(item); if (tmp !== "") // if not empty string obj[nodeName].push(tmp); } } } return obj; }
javascript
function xmlToJson(xml) { // Create the return object var obj = {}; if (xml.nodeType === 1) { // element // do attributes if (xml.attributes.length > 0) { for (var j = 0; j < xml.attributes.length; j++) { var attribute = xml.attributes.item(j); obj[attribute.nodeName] = attribute.value; } } } else if (xml.nodeType === 3) { // text obj = xml.nodeValue.trim(); // add trim here } // do children if (xml.hasChildNodes()) { for (var i = 0; i < xml.childNodes.length; i++) { var item = xml.childNodes.item(i); var nodeName = item.nodeName; if (typeof(obj[nodeName]) === "undefined") { //$NON-NLS-0$ var tmp = xmlToJson(item); if (tmp !== "") // if not empty string obj[nodeName] = tmp; } else { if (typeof(obj[nodeName].push) === "undefined") { //$NON-NLS-0$ var old = obj[nodeName]; obj[nodeName] = []; obj[nodeName].push(old); } tmp = xmlToJson(item); if (tmp !== "") // if not empty string obj[nodeName].push(tmp); } } } return obj; }
[ "function", "xmlToJson", "(", "xml", ")", "{", "// Create the return object\r", "var", "obj", "=", "{", "}", ";", "if", "(", "xml", ".", "nodeType", "===", "1", ")", "{", "// element\r", "// do attributes\r", "if", "(", "xml", ".", "attributes", ".", "length", ">", "0", ")", "{", "for", "(", "var", "j", "=", "0", ";", "j", "<", "xml", ".", "attributes", ".", "length", ";", "j", "++", ")", "{", "var", "attribute", "=", "xml", ".", "attributes", ".", "item", "(", "j", ")", ";", "obj", "[", "attribute", ".", "nodeName", "]", "=", "attribute", ".", "value", ";", "}", "}", "}", "else", "if", "(", "xml", ".", "nodeType", "===", "3", ")", "{", "// text\r", "obj", "=", "xml", ".", "nodeValue", ".", "trim", "(", ")", ";", "// add trim here\r", "}", "// do children\r", "if", "(", "xml", ".", "hasChildNodes", "(", ")", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "xml", ".", "childNodes", ".", "length", ";", "i", "++", ")", "{", "var", "item", "=", "xml", ".", "childNodes", ".", "item", "(", "i", ")", ";", "var", "nodeName", "=", "item", ".", "nodeName", ";", "if", "(", "typeof", "(", "obj", "[", "nodeName", "]", ")", "===", "\"undefined\"", ")", "{", "//$NON-NLS-0$\r", "var", "tmp", "=", "xmlToJson", "(", "item", ")", ";", "if", "(", "tmp", "!==", "\"\"", ")", "// if not empty string\r", "obj", "[", "nodeName", "]", "=", "tmp", ";", "}", "else", "{", "if", "(", "typeof", "(", "obj", "[", "nodeName", "]", ".", "push", ")", "===", "\"undefined\"", ")", "{", "//$NON-NLS-0$\r", "var", "old", "=", "obj", "[", "nodeName", "]", ";", "obj", "[", "nodeName", "]", "=", "[", "]", ";", "obj", "[", "nodeName", "]", ".", "push", "(", "old", ")", ";", "}", "tmp", "=", "xmlToJson", "(", "item", ")", ";", "if", "(", "tmp", "!==", "\"\"", ")", "// if not empty string\r", "obj", "[", "nodeName", "]", ".", "push", "(", "tmp", ")", ";", "}", "}", "}", "return", "obj", ";", "}" ]
Changes XML to JSON
[ "Changes", "XML", "to", "JSON" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/widgets/themes/ThemeImporter.js#L59-L95
14,329
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/widgets/projects/RunBar.js
RunBar
function RunBar(options) { this._project = null; this._parentNode = options.parentNode; this._serviceRegistry = options.serviceRegistry; this._commandRegistry = options.commandRegistry; this._fileClient = options.fileClient; this._progressService = options.progressService; this._preferencesService = options.preferencesService; this.statusService = options.statusService; this.actionScopeId = options.actionScopeId; this._projectCommands = options.projectCommands; this._projectClient = options.projectClient; this._preferences = options.preferences; this._editorInputManager = options.editorInputManager; this._generalPreferences = options.generalPreferences; this._initialize(); this._setLaunchConfigurationsLabel(null); this._disableAllControls(); // start with controls disabled until a launch configuration is selected }
javascript
function RunBar(options) { this._project = null; this._parentNode = options.parentNode; this._serviceRegistry = options.serviceRegistry; this._commandRegistry = options.commandRegistry; this._fileClient = options.fileClient; this._progressService = options.progressService; this._preferencesService = options.preferencesService; this.statusService = options.statusService; this.actionScopeId = options.actionScopeId; this._projectCommands = options.projectCommands; this._projectClient = options.projectClient; this._preferences = options.preferences; this._editorInputManager = options.editorInputManager; this._generalPreferences = options.generalPreferences; this._initialize(); this._setLaunchConfigurationsLabel(null); this._disableAllControls(); // start with controls disabled until a launch configuration is selected }
[ "function", "RunBar", "(", "options", ")", "{", "this", ".", "_project", "=", "null", ";", "this", ".", "_parentNode", "=", "options", ".", "parentNode", ";", "this", ".", "_serviceRegistry", "=", "options", ".", "serviceRegistry", ";", "this", ".", "_commandRegistry", "=", "options", ".", "commandRegistry", ";", "this", ".", "_fileClient", "=", "options", ".", "fileClient", ";", "this", ".", "_progressService", "=", "options", ".", "progressService", ";", "this", ".", "_preferencesService", "=", "options", ".", "preferencesService", ";", "this", ".", "statusService", "=", "options", ".", "statusService", ";", "this", ".", "actionScopeId", "=", "options", ".", "actionScopeId", ";", "this", ".", "_projectCommands", "=", "options", ".", "projectCommands", ";", "this", ".", "_projectClient", "=", "options", ".", "projectClient", ";", "this", ".", "_preferences", "=", "options", ".", "preferences", ";", "this", ".", "_editorInputManager", "=", "options", ".", "editorInputManager", ";", "this", ".", "_generalPreferences", "=", "options", ".", "generalPreferences", ";", "this", ".", "_initialize", "(", ")", ";", "this", ".", "_setLaunchConfigurationsLabel", "(", "null", ")", ";", "this", ".", "_disableAllControls", "(", ")", ";", "// start with controls disabled until a launch configuration is selected", "}" ]
Creates a new RunBar. @class RunBar @name orion.projects.RunBar @param options @param options.parentNode @param options.serviceRegistry @param options.commandRegistry @param options.fileClient @param options.progressService @param options.preferencesService @param options.statusService @param options.actionScopeId @param options.generalPreferences
[ "Creates", "a", "new", "RunBar", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/widgets/projects/RunBar.js#L46-L65
14,330
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/widgets/projects/RunBar.js
function(launchConfiguration, checkStatus) { var errorHandler = function (error) { // stop the progress spinner in the launch config dropdown trigger this.setStatus({ error: error || true //if no error was passed in we still want to ensure that the error state is recorded }); }.bind(this); if (launchConfiguration) { this._selectedLaunchConfiguration = launchConfiguration; this._setLaunchConfigurationsLabel(launchConfiguration); if (checkStatus) { this._displayStatusCheck(launchConfiguration); var startTime = Date.now(); this._checkLaunchConfigurationStatus(launchConfiguration).then(function(_status) { var interval = Date.now() - startTime; mMetrics.logTiming("deployment", "check status (launch config)", interval, launchConfiguration.Type); //$NON-NLS-1$ //$NON-NLS-2$ launchConfiguration.status = _status; this._updateLaunchConfiguration(launchConfiguration); }.bind(this), errorHandler); } else { // do not check the status, only set it in the UI if it is already in the launchConfiguration if (launchConfiguration.status) { this.setStatus(launchConfiguration.status); } } } else { this._stopStatusPolling(); //stop before clearing selected config this._selectedLaunchConfiguration = null; this._setLaunchConfigurationsLabel(null); this.setStatus({}); } this._menuItemsCache = []; }
javascript
function(launchConfiguration, checkStatus) { var errorHandler = function (error) { // stop the progress spinner in the launch config dropdown trigger this.setStatus({ error: error || true //if no error was passed in we still want to ensure that the error state is recorded }); }.bind(this); if (launchConfiguration) { this._selectedLaunchConfiguration = launchConfiguration; this._setLaunchConfigurationsLabel(launchConfiguration); if (checkStatus) { this._displayStatusCheck(launchConfiguration); var startTime = Date.now(); this._checkLaunchConfigurationStatus(launchConfiguration).then(function(_status) { var interval = Date.now() - startTime; mMetrics.logTiming("deployment", "check status (launch config)", interval, launchConfiguration.Type); //$NON-NLS-1$ //$NON-NLS-2$ launchConfiguration.status = _status; this._updateLaunchConfiguration(launchConfiguration); }.bind(this), errorHandler); } else { // do not check the status, only set it in the UI if it is already in the launchConfiguration if (launchConfiguration.status) { this.setStatus(launchConfiguration.status); } } } else { this._stopStatusPolling(); //stop before clearing selected config this._selectedLaunchConfiguration = null; this._setLaunchConfigurationsLabel(null); this.setStatus({}); } this._menuItemsCache = []; }
[ "function", "(", "launchConfiguration", ",", "checkStatus", ")", "{", "var", "errorHandler", "=", "function", "(", "error", ")", "{", "// stop the progress spinner in the launch config dropdown trigger", "this", ".", "setStatus", "(", "{", "error", ":", "error", "||", "true", "//if no error was passed in we still want to ensure that the error state is recorded", "}", ")", ";", "}", ".", "bind", "(", "this", ")", ";", "if", "(", "launchConfiguration", ")", "{", "this", ".", "_selectedLaunchConfiguration", "=", "launchConfiguration", ";", "this", ".", "_setLaunchConfigurationsLabel", "(", "launchConfiguration", ")", ";", "if", "(", "checkStatus", ")", "{", "this", ".", "_displayStatusCheck", "(", "launchConfiguration", ")", ";", "var", "startTime", "=", "Date", ".", "now", "(", ")", ";", "this", ".", "_checkLaunchConfigurationStatus", "(", "launchConfiguration", ")", ".", "then", "(", "function", "(", "_status", ")", "{", "var", "interval", "=", "Date", ".", "now", "(", ")", "-", "startTime", ";", "mMetrics", ".", "logTiming", "(", "\"deployment\"", ",", "\"check status (launch config)\"", ",", "interval", ",", "launchConfiguration", ".", "Type", ")", ";", "//$NON-NLS-1$ //$NON-NLS-2$", "launchConfiguration", ".", "status", "=", "_status", ";", "this", ".", "_updateLaunchConfiguration", "(", "launchConfiguration", ")", ";", "}", ".", "bind", "(", "this", ")", ",", "errorHandler", ")", ";", "}", "else", "{", "// do not check the status, only set it in the UI if it is already in the launchConfiguration", "if", "(", "launchConfiguration", ".", "status", ")", "{", "this", ".", "setStatus", "(", "launchConfiguration", ".", "status", ")", ";", "}", "}", "}", "else", "{", "this", ".", "_stopStatusPolling", "(", ")", ";", "//stop before clearing selected config", "this", ".", "_selectedLaunchConfiguration", "=", "null", ";", "this", ".", "_setLaunchConfigurationsLabel", "(", "null", ")", ";", "this", ".", "setStatus", "(", "{", "}", ")", ";", "}", "this", ".", "_menuItemsCache", "=", "[", "]", ";", "}" ]
Selects the specified launch configuration @param {Object} launchConfiguration The launch configuration to select @param {Boolean} checkStatus Specifies whether or not the status of the launchConfiguration should be checked
[ "Selects", "the", "specified", "launch", "configuration" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/widgets/projects/RunBar.js#L401-L436
14,331
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/widgets/projects/RunBar.js
function (project) { if (project) { this._projectClient.getProjectLaunchConfigurations(project).then(function(launchConfigurations){ if (project !== this._project) return; this._setLaunchConfigurations(launchConfigurations); }.bind(this)); } else { this._setLaunchConfigurations(null); } }
javascript
function (project) { if (project) { this._projectClient.getProjectLaunchConfigurations(project).then(function(launchConfigurations){ if (project !== this._project) return; this._setLaunchConfigurations(launchConfigurations); }.bind(this)); } else { this._setLaunchConfigurations(null); } }
[ "function", "(", "project", ")", "{", "if", "(", "project", ")", "{", "this", ".", "_projectClient", ".", "getProjectLaunchConfigurations", "(", "project", ")", ".", "then", "(", "function", "(", "launchConfigurations", ")", "{", "if", "(", "project", "!==", "this", ".", "_project", ")", "return", ";", "this", ".", "_setLaunchConfigurations", "(", "launchConfigurations", ")", ";", "}", ".", "bind", "(", "this", ")", ")", ";", "}", "else", "{", "this", ".", "_setLaunchConfigurations", "(", "null", ")", ";", "}", "}" ]
Get launch configurations from the specified project and load them into this run bar. @param[in] {Object} project The project from which to load the launch configurations
[ "Get", "launch", "configurations", "from", "the", "specified", "project", "and", "load", "them", "into", "this", "run", "bar", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/widgets/projects/RunBar.js#L656-L665
14,332
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/widgets/projects/RunBar.js
function(launchConfigurations) { if (launchConfigurations) { this._enableLaunchConfigurationsDropdown(); launchConfigurations.sort(function(launchConf1, launchConf2) { return launchConf1.Name.localeCompare(launchConf2.Name); }); } else { this._disableLaunchConfigurationsDropdown(); } this._cacheLaunchConfigurations(launchConfigurations); if (launchConfigurations && launchConfigurations[0]) { // select first launch configuration var hash = this._getHash(launchConfigurations[0]); var cachedConfig = this._cachedLaunchConfigurations[hash]; this.selectLaunchConfiguration(cachedConfig, true); } else { this.selectLaunchConfiguration(null); } }
javascript
function(launchConfigurations) { if (launchConfigurations) { this._enableLaunchConfigurationsDropdown(); launchConfigurations.sort(function(launchConf1, launchConf2) { return launchConf1.Name.localeCompare(launchConf2.Name); }); } else { this._disableLaunchConfigurationsDropdown(); } this._cacheLaunchConfigurations(launchConfigurations); if (launchConfigurations && launchConfigurations[0]) { // select first launch configuration var hash = this._getHash(launchConfigurations[0]); var cachedConfig = this._cachedLaunchConfigurations[hash]; this.selectLaunchConfiguration(cachedConfig, true); } else { this.selectLaunchConfiguration(null); } }
[ "function", "(", "launchConfigurations", ")", "{", "if", "(", "launchConfigurations", ")", "{", "this", ".", "_enableLaunchConfigurationsDropdown", "(", ")", ";", "launchConfigurations", ".", "sort", "(", "function", "(", "launchConf1", ",", "launchConf2", ")", "{", "return", "launchConf1", ".", "Name", ".", "localeCompare", "(", "launchConf2", ".", "Name", ")", ";", "}", ")", ";", "}", "else", "{", "this", ".", "_disableLaunchConfigurationsDropdown", "(", ")", ";", "}", "this", ".", "_cacheLaunchConfigurations", "(", "launchConfigurations", ")", ";", "if", "(", "launchConfigurations", "&&", "launchConfigurations", "[", "0", "]", ")", "{", "// select first launch configuration", "var", "hash", "=", "this", ".", "_getHash", "(", "launchConfigurations", "[", "0", "]", ")", ";", "var", "cachedConfig", "=", "this", ".", "_cachedLaunchConfigurations", "[", "hash", "]", ";", "this", ".", "selectLaunchConfiguration", "(", "cachedConfig", ",", "true", ")", ";", "}", "else", "{", "this", ".", "selectLaunchConfiguration", "(", "null", ")", ";", "}", "}" ]
Sets the list of launch configurations to be used by this run bar. This method may be called more than once. Any previously cached launch configurations will be replaced with the newly specified ones. @param {Array} launchConfigurations An array of launch configurations
[ "Sets", "the", "list", "of", "launch", "configurations", "to", "be", "used", "by", "this", "run", "bar", ".", "This", "method", "may", "be", "called", "more", "than", "once", ".", "Any", "previously", "cached", "launch", "configurations", "will", "be", "replaced", "with", "the", "newly", "specified", "ones", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/widgets/projects/RunBar.js#L674-L694
14,333
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/widgets/projects/RunBar.js
function(command, evnt) { var buttonNode = evnt.target; var id = buttonNode.id; var isEnabled = this._isEnabled(buttonNode); var disabled = isEnabled ? "" : ".disabled"; //$NON-NLS-1$ //$NON-NLS-0$ mMetrics.logEvent("ui", "invoke", METRICS_LABEL_PREFIX + "." + id +".clicked" + disabled, evnt.which); //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$ if (isEnabled) { if (typeof command === "function") { //$NON-NLS-0$ command.call(this, buttonNode); } else { this._commandRegistry.runCommand(command, this._selectedLaunchConfiguration, this, null, null, buttonNode); //$NON-NLS-0$ } } }
javascript
function(command, evnt) { var buttonNode = evnt.target; var id = buttonNode.id; var isEnabled = this._isEnabled(buttonNode); var disabled = isEnabled ? "" : ".disabled"; //$NON-NLS-1$ //$NON-NLS-0$ mMetrics.logEvent("ui", "invoke", METRICS_LABEL_PREFIX + "." + id +".clicked" + disabled, evnt.which); //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$ if (isEnabled) { if (typeof command === "function") { //$NON-NLS-0$ command.call(this, buttonNode); } else { this._commandRegistry.runCommand(command, this._selectedLaunchConfiguration, this, null, null, buttonNode); //$NON-NLS-0$ } } }
[ "function", "(", "command", ",", "evnt", ")", "{", "var", "buttonNode", "=", "evnt", ".", "target", ";", "var", "id", "=", "buttonNode", ".", "id", ";", "var", "isEnabled", "=", "this", ".", "_isEnabled", "(", "buttonNode", ")", ";", "var", "disabled", "=", "isEnabled", "?", "\"\"", ":", "\".disabled\"", ";", "//$NON-NLS-1$ //$NON-NLS-0$", "mMetrics", ".", "logEvent", "(", "\"ui\"", ",", "\"invoke\"", ",", "METRICS_LABEL_PREFIX", "+", "\".\"", "+", "id", "+", "\".clicked\"", "+", "disabled", ",", "evnt", ".", "which", ")", ";", "//$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$", "if", "(", "isEnabled", ")", "{", "if", "(", "typeof", "command", "===", "\"function\"", ")", "{", "//$NON-NLS-0$", "command", ".", "call", "(", "this", ",", "buttonNode", ")", ";", "}", "else", "{", "this", ".", "_commandRegistry", ".", "runCommand", "(", "command", ",", "this", ".", "_selectedLaunchConfiguration", ",", "this", ",", "null", ",", "null", ",", "buttonNode", ")", ";", "//$NON-NLS-0$", "}", "}", "}" ]
Implements a generic button listener which executes the specified command when it is invoked and collects metrics @param[in] {String | Function} command A String containing the id of the command to run or a Function to call @param[in] {Event} event The event which triggered the listener
[ "Implements", "a", "generic", "button", "listener", "which", "executes", "the", "specified", "command", "when", "it", "is", "invoked", "and", "collects", "metrics" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/widgets/projects/RunBar.js#L734-L749
14,334
eclipse/orion.client
bundles/org.eclipse.orion.client.javascript/web/javascript/hover.js
_getNodeText
function _getNodeText(node) { return node.sourceFile.text.substr(node.start, node.end - node.start); }
javascript
function _getNodeText(node) { return node.sourceFile.text.substr(node.start, node.end - node.start); }
[ "function", "_getNodeText", "(", "node", ")", "{", "return", "node", ".", "sourceFile", ".", "text", ".", "substr", "(", "node", ".", "start", ",", "node", ".", "end", "-", "node", ".", "start", ")", ";", "}" ]
Get the plain text of a node. @param {Node} node @return {string}
[ "Get", "the", "plain", "text", "of", "a", "node", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/javascript/hover.js#L460-L462
14,335
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/sites/siteMappingsTable.js
function(item, fieldName) { if (fieldName === "FriendlyPath") { //$NON-NLS-0$ // Just update the "is valid" column var rowNode = document.getElementById(this.myTree._treeModel.getId(item)); var oldCell = lib.$(".isValidCell", rowNode); //$NON-NLS-0$ var col_no = lib.$$array("td", rowNode).indexOf(oldCell); //$NON-NLS-0$ var cell = this.renderer.getIsValidCell(col_no, item, rowNode); // replace oldCell with cell oldCell.parentNode.replaceChild(cell, oldCell); } }
javascript
function(item, fieldName) { if (fieldName === "FriendlyPath") { //$NON-NLS-0$ // Just update the "is valid" column var rowNode = document.getElementById(this.myTree._treeModel.getId(item)); var oldCell = lib.$(".isValidCell", rowNode); //$NON-NLS-0$ var col_no = lib.$$array("td", rowNode).indexOf(oldCell); //$NON-NLS-0$ var cell = this.renderer.getIsValidCell(col_no, item, rowNode); // replace oldCell with cell oldCell.parentNode.replaceChild(cell, oldCell); } }
[ "function", "(", "item", ",", "fieldName", ")", "{", "if", "(", "fieldName", "===", "\"FriendlyPath\"", ")", "{", "//$NON-NLS-0$", "// Just update the \"is valid\" column", "var", "rowNode", "=", "document", ".", "getElementById", "(", "this", ".", "myTree", ".", "_treeModel", ".", "getId", "(", "item", ")", ")", ";", "var", "oldCell", "=", "lib", ".", "$", "(", "\".isValidCell\"", ",", "rowNode", ")", ";", "//$NON-NLS-0$", "var", "col_no", "=", "lib", ".", "$$array", "(", "\"td\"", ",", "rowNode", ")", ".", "indexOf", "(", "oldCell", ")", ";", "//$NON-NLS-0$", "var", "cell", "=", "this", ".", "renderer", ".", "getIsValidCell", "(", "col_no", ",", "item", ",", "rowNode", ")", ";", "// replace oldCell with cell", "oldCell", ".", "parentNode", ".", "replaceChild", "(", "cell", ",", "oldCell", ")", ";", "}", "}" ]
Render the row of a single item, without rendering its siblings.
[ "Render", "the", "row", "of", "a", "single", "item", "without", "rendering", "its", "siblings", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/sites/siteMappingsTable.js#L231-L241
14,336
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/inputter.js
Inputter
function Inputter(options, components) { this.requisition = components.requisition; this.focusManager = components.focusManager; this.element = components.element; this.element.classList.add('gcli-in-input'); this.element.spellcheck = false; this.document = this.element.ownerDocument; this.scratchpad = options.scratchpad; if (inputterCss != null) { this.style = util.importCss(inputterCss, this.document, 'gcli-inputter'); } // Used to distinguish focus from TAB in CLI. See onKeyUp() this.lastTabDownAt = 0; // Used to effect caret changes. See _processCaretChange() this._caretChange = null; // Ensure that TAB/UP/DOWN isn't handled by the browser this.onKeyDown = this.onKeyDown.bind(this); this.onKeyUp = this.onKeyUp.bind(this); this.element.addEventListener('keydown', this.onKeyDown, false); this.element.addEventListener('keyup', this.onKeyUp, false); // Setup History this.history = new History(); this._scrollingThroughHistory = false; // Used when we're selecting which prediction to complete with this._choice = null; this.onChoiceChange = util.createEvent('Inputter.onChoiceChange'); // Cursor position affects hint severity this.onMouseUp = this.onMouseUp.bind(this); this.element.addEventListener('mouseup', this.onMouseUp, false); if (this.focusManager) { this.focusManager.addMonitoredElement(this.element, 'input'); } // Start looking like an asynchronous completion isn't happening this._completed = RESOLVED; this.requisition.onTextChange.add(this.textChanged, this); this.assignment = this.requisition.getAssignmentAt(0); this.onAssignmentChange = util.createEvent('Inputter.onAssignmentChange'); this.onInputChange = util.createEvent('Inputter.onInputChange'); this.onResize = util.createEvent('Inputter.onResize'); this.onWindowResize = this.onWindowResize.bind(this); this.document.defaultView.addEventListener('resize', this.onWindowResize, false); this.requisition.update(this.element.value || ''); }
javascript
function Inputter(options, components) { this.requisition = components.requisition; this.focusManager = components.focusManager; this.element = components.element; this.element.classList.add('gcli-in-input'); this.element.spellcheck = false; this.document = this.element.ownerDocument; this.scratchpad = options.scratchpad; if (inputterCss != null) { this.style = util.importCss(inputterCss, this.document, 'gcli-inputter'); } // Used to distinguish focus from TAB in CLI. See onKeyUp() this.lastTabDownAt = 0; // Used to effect caret changes. See _processCaretChange() this._caretChange = null; // Ensure that TAB/UP/DOWN isn't handled by the browser this.onKeyDown = this.onKeyDown.bind(this); this.onKeyUp = this.onKeyUp.bind(this); this.element.addEventListener('keydown', this.onKeyDown, false); this.element.addEventListener('keyup', this.onKeyUp, false); // Setup History this.history = new History(); this._scrollingThroughHistory = false; // Used when we're selecting which prediction to complete with this._choice = null; this.onChoiceChange = util.createEvent('Inputter.onChoiceChange'); // Cursor position affects hint severity this.onMouseUp = this.onMouseUp.bind(this); this.element.addEventListener('mouseup', this.onMouseUp, false); if (this.focusManager) { this.focusManager.addMonitoredElement(this.element, 'input'); } // Start looking like an asynchronous completion isn't happening this._completed = RESOLVED; this.requisition.onTextChange.add(this.textChanged, this); this.assignment = this.requisition.getAssignmentAt(0); this.onAssignmentChange = util.createEvent('Inputter.onAssignmentChange'); this.onInputChange = util.createEvent('Inputter.onInputChange'); this.onResize = util.createEvent('Inputter.onResize'); this.onWindowResize = this.onWindowResize.bind(this); this.document.defaultView.addEventListener('resize', this.onWindowResize, false); this.requisition.update(this.element.value || ''); }
[ "function", "Inputter", "(", "options", ",", "components", ")", "{", "this", ".", "requisition", "=", "components", ".", "requisition", ";", "this", ".", "focusManager", "=", "components", ".", "focusManager", ";", "this", ".", "element", "=", "components", ".", "element", ";", "this", ".", "element", ".", "classList", ".", "add", "(", "'gcli-in-input'", ")", ";", "this", ".", "element", ".", "spellcheck", "=", "false", ";", "this", ".", "document", "=", "this", ".", "element", ".", "ownerDocument", ";", "this", ".", "scratchpad", "=", "options", ".", "scratchpad", ";", "if", "(", "inputterCss", "!=", "null", ")", "{", "this", ".", "style", "=", "util", ".", "importCss", "(", "inputterCss", ",", "this", ".", "document", ",", "'gcli-inputter'", ")", ";", "}", "// Used to distinguish focus from TAB in CLI. See onKeyUp()", "this", ".", "lastTabDownAt", "=", "0", ";", "// Used to effect caret changes. See _processCaretChange()", "this", ".", "_caretChange", "=", "null", ";", "// Ensure that TAB/UP/DOWN isn't handled by the browser", "this", ".", "onKeyDown", "=", "this", ".", "onKeyDown", ".", "bind", "(", "this", ")", ";", "this", ".", "onKeyUp", "=", "this", ".", "onKeyUp", ".", "bind", "(", "this", ")", ";", "this", ".", "element", ".", "addEventListener", "(", "'keydown'", ",", "this", ".", "onKeyDown", ",", "false", ")", ";", "this", ".", "element", ".", "addEventListener", "(", "'keyup'", ",", "this", ".", "onKeyUp", ",", "false", ")", ";", "// Setup History", "this", ".", "history", "=", "new", "History", "(", ")", ";", "this", ".", "_scrollingThroughHistory", "=", "false", ";", "// Used when we're selecting which prediction to complete with", "this", ".", "_choice", "=", "null", ";", "this", ".", "onChoiceChange", "=", "util", ".", "createEvent", "(", "'Inputter.onChoiceChange'", ")", ";", "// Cursor position affects hint severity", "this", ".", "onMouseUp", "=", "this", ".", "onMouseUp", ".", "bind", "(", "this", ")", ";", "this", ".", "element", ".", "addEventListener", "(", "'mouseup'", ",", "this", ".", "onMouseUp", ",", "false", ")", ";", "if", "(", "this", ".", "focusManager", ")", "{", "this", ".", "focusManager", ".", "addMonitoredElement", "(", "this", ".", "element", ",", "'input'", ")", ";", "}", "// Start looking like an asynchronous completion isn't happening", "this", ".", "_completed", "=", "RESOLVED", ";", "this", ".", "requisition", ".", "onTextChange", ".", "add", "(", "this", ".", "textChanged", ",", "this", ")", ";", "this", ".", "assignment", "=", "this", ".", "requisition", ".", "getAssignmentAt", "(", "0", ")", ";", "this", ".", "onAssignmentChange", "=", "util", ".", "createEvent", "(", "'Inputter.onAssignmentChange'", ")", ";", "this", ".", "onInputChange", "=", "util", ".", "createEvent", "(", "'Inputter.onInputChange'", ")", ";", "this", ".", "onResize", "=", "util", ".", "createEvent", "(", "'Inputter.onResize'", ")", ";", "this", ".", "onWindowResize", "=", "this", ".", "onWindowResize", ".", "bind", "(", "this", ")", ";", "this", ".", "document", ".", "defaultView", ".", "addEventListener", "(", "'resize'", ",", "this", ".", "onWindowResize", ",", "false", ")", ";", "this", ".", "requisition", ".", "update", "(", "this", ".", "element", ".", "value", "||", "''", ")", ";", "}" ]
A wrapper to take care of the functions concerning an input element @param options Object containing user customization properties, including: - scratchpad (default=none) - promptWidth (default=22px) @param components Object that links to other UI components. GCLI provided: - requisition - focusManager - element
[ "A", "wrapper", "to", "take", "care", "of", "the", "functions", "concerning", "an", "input", "element" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/inputter.js#L43-L101
14,337
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/navoutliner.js
NavigationOutliner
function NavigationOutliner(options) { var parent = lib.node(options.parent); if (!parent) { throw "no parent"; } //$NON-NLS-0$ if (!options.serviceRegistry) {throw "no service registry"; } //$NON-NLS-0$ this._parent = parent; this._registry = options.serviceRegistry; this.commandService = options.commandService; this.render(); }
javascript
function NavigationOutliner(options) { var parent = lib.node(options.parent); if (!parent) { throw "no parent"; } //$NON-NLS-0$ if (!options.serviceRegistry) {throw "no service registry"; } //$NON-NLS-0$ this._parent = parent; this._registry = options.serviceRegistry; this.commandService = options.commandService; this.render(); }
[ "function", "NavigationOutliner", "(", "options", ")", "{", "var", "parent", "=", "lib", ".", "node", "(", "options", ".", "parent", ")", ";", "if", "(", "!", "parent", ")", "{", "throw", "\"no parent\"", ";", "}", "//$NON-NLS-0$", "if", "(", "!", "options", ".", "serviceRegistry", ")", "{", "throw", "\"no service registry\"", ";", "}", "//$NON-NLS-0$", "this", ".", "_parent", "=", "parent", ";", "this", ".", "_registry", "=", "options", ".", "serviceRegistry", ";", "this", ".", "commandService", "=", "options", ".", "commandService", ";", "this", ".", "render", "(", ")", ";", "}" ]
Creates a new user interface element showing an outliner used for navigation @name orion.navoutliner.NavigationOutliner @class A user interface element showing a list of various navigation links. @param {Object} options The service options @param {Object} options.parent The parent of this outliner widget @param {orion.serviceregistry.ServiceRegistry} options.serviceRegistry The service registry @param {orion.commands.CommandService} options.commandService The in-page (synchronous) command service.
[ "Creates", "a", "new", "user", "interface", "element", "showing", "an", "outliner", "used", "for", "navigation" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/navoutliner.js#L78-L86
14,338
eclipse/orion.client
bundles/org.eclipse.orion.client.git/web/orion/git/gitClient.js
function(gitStashLocation, indexMessage, workingDirectoryMessage, includeUntracked){ var service = this; var payload = {}; if(indexMessage != null) /* note that undefined == null */ payload.IndexMessage = indexMessage; if(workingDirectoryMessage != null) /* note that undefined == null */ payload.WorkingDirectoryMessage = workingDirectoryMessage; if(includeUntracked === true) payload.IncludeUntracked = true; var clientDeferred = new Deferred(); xhr("POST", gitStashLocation, { headers : { "Orion-Version" : "1", "Content-Type" : contentType }, timeout : GIT_TIMEOUT, data: JSON.stringify(payload) }).then(function(result) { service._getGitServiceResponse(clientDeferred, result); }, function(error){ service._handleGitServiceResponseError(clientDeferred, error); }); return clientDeferred; }
javascript
function(gitStashLocation, indexMessage, workingDirectoryMessage, includeUntracked){ var service = this; var payload = {}; if(indexMessage != null) /* note that undefined == null */ payload.IndexMessage = indexMessage; if(workingDirectoryMessage != null) /* note that undefined == null */ payload.WorkingDirectoryMessage = workingDirectoryMessage; if(includeUntracked === true) payload.IncludeUntracked = true; var clientDeferred = new Deferred(); xhr("POST", gitStashLocation, { headers : { "Orion-Version" : "1", "Content-Type" : contentType }, timeout : GIT_TIMEOUT, data: JSON.stringify(payload) }).then(function(result) { service._getGitServiceResponse(clientDeferred, result); }, function(error){ service._handleGitServiceResponseError(clientDeferred, error); }); return clientDeferred; }
[ "function", "(", "gitStashLocation", ",", "indexMessage", ",", "workingDirectoryMessage", ",", "includeUntracked", ")", "{", "var", "service", "=", "this", ";", "var", "payload", "=", "{", "}", ";", "if", "(", "indexMessage", "!=", "null", ")", "/* note that undefined == null */", "payload", ".", "IndexMessage", "=", "indexMessage", ";", "if", "(", "workingDirectoryMessage", "!=", "null", ")", "/* note that undefined == null */", "payload", ".", "WorkingDirectoryMessage", "=", "workingDirectoryMessage", ";", "if", "(", "includeUntracked", "===", "true", ")", "payload", ".", "IncludeUntracked", "=", "true", ";", "var", "clientDeferred", "=", "new", "Deferred", "(", ")", ";", "xhr", "(", "\"POST\"", ",", "gitStashLocation", ",", "{", "headers", ":", "{", "\"Orion-Version\"", ":", "\"1\"", ",", "\"Content-Type\"", ":", "contentType", "}", ",", "timeout", ":", "GIT_TIMEOUT", ",", "data", ":", "JSON", ".", "stringify", "(", "payload", ")", "}", ")", ".", "then", "(", "function", "(", "result", ")", "{", "service", ".", "_getGitServiceResponse", "(", "clientDeferred", ",", "result", ")", ";", "}", ",", "function", "(", "error", ")", "{", "service", ".", "_handleGitServiceResponseError", "(", "clientDeferred", ",", "error", ")", ";", "}", ")", ";", "return", "clientDeferred", ";", "}" ]
Performs git stash create @param gitStashLocation @param indexMessage [optional) @param workingDirectoryMessage [optional] @param includeUntracked [optional] @returns {Deferred}
[ "Performs", "git", "stash", "create" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.git/web/orion/git/gitClient.js#L918-L946
14,339
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js
FileModel
function FileModel(serviceRegistry, root, fileClient, idPrefix, excludeFiles, excludeFolders, filteredResources) { this.registry = serviceRegistry; this.root = root; this.fileClient = fileClient; this.idPrefix = idPrefix || ""; if (typeof this.idPrefix !== "string") { this.idPrefix = this.idPrefix.id; } this.excludeFiles = Boolean(excludeFiles); this.excludeFolders = Boolean(excludeFolders); if(!this.filteredResources) { //is set from project nav not via arguments this.filteredResources = filteredResources; } this.filter = new FileFilter(this.filteredResources); this._annotations = []; // Listen to annotation changed events this._annotationChangedHandler = this._handleAnnotationChanged.bind(this) this.fileClient.addEventListener('AnnotationChanged', this._annotationChangedHandler); }
javascript
function FileModel(serviceRegistry, root, fileClient, idPrefix, excludeFiles, excludeFolders, filteredResources) { this.registry = serviceRegistry; this.root = root; this.fileClient = fileClient; this.idPrefix = idPrefix || ""; if (typeof this.idPrefix !== "string") { this.idPrefix = this.idPrefix.id; } this.excludeFiles = Boolean(excludeFiles); this.excludeFolders = Boolean(excludeFolders); if(!this.filteredResources) { //is set from project nav not via arguments this.filteredResources = filteredResources; } this.filter = new FileFilter(this.filteredResources); this._annotations = []; // Listen to annotation changed events this._annotationChangedHandler = this._handleAnnotationChanged.bind(this) this.fileClient.addEventListener('AnnotationChanged', this._annotationChangedHandler); }
[ "function", "FileModel", "(", "serviceRegistry", ",", "root", ",", "fileClient", ",", "idPrefix", ",", "excludeFiles", ",", "excludeFolders", ",", "filteredResources", ")", "{", "this", ".", "registry", "=", "serviceRegistry", ";", "this", ".", "root", "=", "root", ";", "this", ".", "fileClient", "=", "fileClient", ";", "this", ".", "idPrefix", "=", "idPrefix", "||", "\"\"", ";", "if", "(", "typeof", "this", ".", "idPrefix", "!==", "\"string\"", ")", "{", "this", ".", "idPrefix", "=", "this", ".", "idPrefix", ".", "id", ";", "}", "this", ".", "excludeFiles", "=", "Boolean", "(", "excludeFiles", ")", ";", "this", ".", "excludeFolders", "=", "Boolean", "(", "excludeFolders", ")", ";", "if", "(", "!", "this", ".", "filteredResources", ")", "{", "//is set from project nav not via arguments", "this", ".", "filteredResources", "=", "filteredResources", ";", "}", "this", ".", "filter", "=", "new", "FileFilter", "(", "this", ".", "filteredResources", ")", ";", "this", ".", "_annotations", "=", "[", "]", ";", "// Listen to annotation changed events", "this", ".", "_annotationChangedHandler", "=", "this", ".", "_handleAnnotationChanged", ".", "bind", "(", "this", ")", "this", ".", "fileClient", ".", "addEventListener", "(", "'AnnotationChanged'", ",", "this", ".", "_annotationChangedHandler", ")", ";", "}" ]
Tree model used by the FileExplorer @param {?} serviceRegistry The backing registry @param {?} root The root item for the model @param {FileClient} fileClient The backing FileClient instance @param {string} idPrefix The prefix to use for the new model nodes @param {boolean} excludeFiles The optional flag for if files should be left out of the model @param {boolean} excludeFolders The optional flag for if folders should be left out of the model @param {?} filteredResources The optional map of names to be left out of the model (filtered)
[ "Tree", "model", "used", "by", "the", "FileExplorer" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js#L41-L60
14,340
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js
function(item, reroot) { var deferred = new Deferred(); if (!item || !this.model || !this.myTree) { return deferred.reject(); } if (!this.myTree.showRoot && (item.Location === this.treeRoot.Location || item.Location === this.treeRoot.ContentLocation)) { return deferred.resolve(this.treeRoot); } var row = this.getRow(item); if (row) { deferred.resolve(row._item || item); } else if (item.Parents && item.Parents.length > 0) { item.Parents[0].Parents = item.Parents.slice(1); return this.expandItem(item.Parents[0], reroot).then(function(parent) { // Handles model out of sync var row = this.getRow(item); if (!row) { return this.changedItem(parent, true).then(function() { var row = this.getRow(item); if (!row) { parent.children.unshift(item); this.myTree.refresh(parent, parent.children, false); row = this.getRow(item); } return row ? row._item : new Deferred().reject(); }.bind(this)); } return row._item || item; }.bind(this)); } else { // Handles file not in current tree if (reroot === undefined || reroot) { return this.reroot(item); } return deferred.reject(); } return deferred; }
javascript
function(item, reroot) { var deferred = new Deferred(); if (!item || !this.model || !this.myTree) { return deferred.reject(); } if (!this.myTree.showRoot && (item.Location === this.treeRoot.Location || item.Location === this.treeRoot.ContentLocation)) { return deferred.resolve(this.treeRoot); } var row = this.getRow(item); if (row) { deferred.resolve(row._item || item); } else if (item.Parents && item.Parents.length > 0) { item.Parents[0].Parents = item.Parents.slice(1); return this.expandItem(item.Parents[0], reroot).then(function(parent) { // Handles model out of sync var row = this.getRow(item); if (!row) { return this.changedItem(parent, true).then(function() { var row = this.getRow(item); if (!row) { parent.children.unshift(item); this.myTree.refresh(parent, parent.children, false); row = this.getRow(item); } return row ? row._item : new Deferred().reject(); }.bind(this)); } return row._item || item; }.bind(this)); } else { // Handles file not in current tree if (reroot === undefined || reroot) { return this.reroot(item); } return deferred.reject(); } return deferred; }
[ "function", "(", "item", ",", "reroot", ")", "{", "var", "deferred", "=", "new", "Deferred", "(", ")", ";", "if", "(", "!", "item", "||", "!", "this", ".", "model", "||", "!", "this", ".", "myTree", ")", "{", "return", "deferred", ".", "reject", "(", ")", ";", "}", "if", "(", "!", "this", ".", "myTree", ".", "showRoot", "&&", "(", "item", ".", "Location", "===", "this", ".", "treeRoot", ".", "Location", "||", "item", ".", "Location", "===", "this", ".", "treeRoot", ".", "ContentLocation", ")", ")", "{", "return", "deferred", ".", "resolve", "(", "this", ".", "treeRoot", ")", ";", "}", "var", "row", "=", "this", ".", "getRow", "(", "item", ")", ";", "if", "(", "row", ")", "{", "deferred", ".", "resolve", "(", "row", ".", "_item", "||", "item", ")", ";", "}", "else", "if", "(", "item", ".", "Parents", "&&", "item", ".", "Parents", ".", "length", ">", "0", ")", "{", "item", ".", "Parents", "[", "0", "]", ".", "Parents", "=", "item", ".", "Parents", ".", "slice", "(", "1", ")", ";", "return", "this", ".", "expandItem", "(", "item", ".", "Parents", "[", "0", "]", ",", "reroot", ")", ".", "then", "(", "function", "(", "parent", ")", "{", "// Handles model out of sync", "var", "row", "=", "this", ".", "getRow", "(", "item", ")", ";", "if", "(", "!", "row", ")", "{", "return", "this", ".", "changedItem", "(", "parent", ",", "true", ")", ".", "then", "(", "function", "(", ")", "{", "var", "row", "=", "this", ".", "getRow", "(", "item", ")", ";", "if", "(", "!", "row", ")", "{", "parent", ".", "children", ".", "unshift", "(", "item", ")", ";", "this", ".", "myTree", ".", "refresh", "(", "parent", ",", "parent", ".", "children", ",", "false", ")", ";", "row", "=", "this", ".", "getRow", "(", "item", ")", ";", "}", "return", "row", "?", "row", ".", "_item", ":", "new", "Deferred", "(", ")", ".", "reject", "(", ")", ";", "}", ".", "bind", "(", "this", ")", ")", ";", "}", "return", "row", ".", "_item", "||", "item", ";", "}", ".", "bind", "(", "this", ")", ")", ";", "}", "else", "{", "// Handles file not in current tree", "if", "(", "reroot", "===", "undefined", "||", "reroot", ")", "{", "return", "this", ".", "reroot", "(", "item", ")", ";", "}", "return", "deferred", ".", "reject", "(", ")", ";", "}", "return", "deferred", ";", "}" ]
Shows the given item. @param {Object} The item to be shown. @param {Booelan} [reroot=true] whether the receiver should re-root the tree if the item is not displayable. @returns {orion.Promise}
[ "Shows", "the", "given", "item", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js#L1307-L1344
14,341
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js
function(item, reroot) { return this.showItem(item, reroot).then(function(result) { this.select(result); }.bind(this)); }
javascript
function(item, reroot) { return this.showItem(item, reroot).then(function(result) { this.select(result); }.bind(this)); }
[ "function", "(", "item", ",", "reroot", ")", "{", "return", "this", ".", "showItem", "(", "item", ",", "reroot", ")", ".", "then", "(", "function", "(", "result", ")", "{", "this", ".", "select", "(", "result", ")", ";", "}", ".", "bind", "(", "this", ")", ")", ";", "}" ]
Shows and selects the given item. @param {Object} The item to be revealed. @param {Booelan} [reroot=true] whether the receiver should re-root the tree if the item is not displayable. @returns {orion.Promise}
[ "Shows", "and", "selects", "the", "given", "item", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js#L1384-L1388
14,342
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js
function(path, force, postLoad) { if (path && typeof path === "object") { path = path.ChildrenLocation || path.ContentLocation; } path = mFileUtils.makeRelative(path); var self = this; if (force || path !== this.treeRoot.Path || path !== this._lastPath) { this._lastPath = path; return this.load(this.fileClient.read(path, true), i18nUtil.formatMessage(messages["Loading ${0}"], path), postLoad).then(function() { self.treeRoot.Path = path; return self.treeRoot; }, function(err) { self.treeRoot.Path = null; return new Deferred().reject(err); }); } return new Deferred().resolve(self.treeRoot); }
javascript
function(path, force, postLoad) { if (path && typeof path === "object") { path = path.ChildrenLocation || path.ContentLocation; } path = mFileUtils.makeRelative(path); var self = this; if (force || path !== this.treeRoot.Path || path !== this._lastPath) { this._lastPath = path; return this.load(this.fileClient.read(path, true), i18nUtil.formatMessage(messages["Loading ${0}"], path), postLoad).then(function() { self.treeRoot.Path = path; return self.treeRoot; }, function(err) { self.treeRoot.Path = null; return new Deferred().reject(err); }); } return new Deferred().resolve(self.treeRoot); }
[ "function", "(", "path", ",", "force", ",", "postLoad", ")", "{", "if", "(", "path", "&&", "typeof", "path", "===", "\"object\"", ")", "{", "path", "=", "path", ".", "ChildrenLocation", "||", "path", ".", "ContentLocation", ";", "}", "path", "=", "mFileUtils", ".", "makeRelative", "(", "path", ")", ";", "var", "self", "=", "this", ";", "if", "(", "force", "||", "path", "!==", "this", ".", "treeRoot", ".", "Path", "||", "path", "!==", "this", ".", "_lastPath", ")", "{", "this", ".", "_lastPath", "=", "path", ";", "return", "this", ".", "load", "(", "this", ".", "fileClient", ".", "read", "(", "path", ",", "true", ")", ",", "i18nUtil", ".", "formatMessage", "(", "messages", "[", "\"Loading ${0}\"", "]", ",", "path", ")", ",", "postLoad", ")", ".", "then", "(", "function", "(", ")", "{", "self", ".", "treeRoot", ".", "Path", "=", "path", ";", "return", "self", ".", "treeRoot", ";", "}", ",", "function", "(", "err", ")", "{", "self", ".", "treeRoot", ".", "Path", "=", "null", ";", "return", "new", "Deferred", "(", ")", ".", "reject", "(", "err", ")", ";", "}", ")", ";", "}", "return", "new", "Deferred", "(", ")", ".", "resolve", "(", "self", ".", "treeRoot", ")", ";", "}" ]
Load the resource at the given path. @name orion.explorer.FileExplorer#loadResourceList @function @param {String|Object} path The path of the resource to load, or an object with a ChildrenLocation or ContentLocation field giving the path. @param {Boolean} [force] If true, force reload even if the path is unchanged. Useful when the client knows the resource underlying the current path has changed. @param {Function} postLoad a function to call after loading the resource. <b>Deprecated</b>: use the returned promise instead. @returns {orion.Promise}
[ "Load", "the", "resource", "at", "the", "given", "path", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js#L1452-L1469
14,343
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/sites/siteCommands.js
createSiteServiceCommands
function createSiteServiceCommands(serviceRegistry, commandService, options) { function getFileService(siteServiceRef) { return mSiteClient.getFileClient(serviceRegistry, siteServiceRef.getProperty('filePattern')); //$NON-NLS-0$ } options = options || {}; var createCommand = new mCommands.Command({ name : messages["Create"], tooltip: messages["Create a new site configuration"], id: "orion.site.create", //$NON-NLS-0$ parameters: new mCommandRegistry.ParametersDescription([new mCommandRegistry.CommandParameter('name', 'text', messages["Name"])]), //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$ visibleWhen: function(bah) { return true; }, callback : function(data) { var siteServiceRef = data.items, siteService = serviceRegistry.getService(siteServiceRef); var fileService = getFileService(siteServiceRef); var name = data.parameters && data.parameters.valueFor('name'); //$NON-NLS-0$ var progress = serviceRegistry.getService("orion.page.progress"); (progress ? progress.progress(fileService.loadWorkspaces(), "Loading workspaces") : fileService.loadWorkspaces()).then(function(workspaces) { var workspaceId = workspaces && workspaces[0] && workspaces[0].Id; if (workspaceId && name) { siteService.createSiteConfiguration(name, workspaceId).then(function(site) { options.createCallback(mSiteUtils.generateEditSiteHref(site), site); }, options.errorCallback); } }); }}); commandService.addCommand(createCommand); }
javascript
function createSiteServiceCommands(serviceRegistry, commandService, options) { function getFileService(siteServiceRef) { return mSiteClient.getFileClient(serviceRegistry, siteServiceRef.getProperty('filePattern')); //$NON-NLS-0$ } options = options || {}; var createCommand = new mCommands.Command({ name : messages["Create"], tooltip: messages["Create a new site configuration"], id: "orion.site.create", //$NON-NLS-0$ parameters: new mCommandRegistry.ParametersDescription([new mCommandRegistry.CommandParameter('name', 'text', messages["Name"])]), //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$ visibleWhen: function(bah) { return true; }, callback : function(data) { var siteServiceRef = data.items, siteService = serviceRegistry.getService(siteServiceRef); var fileService = getFileService(siteServiceRef); var name = data.parameters && data.parameters.valueFor('name'); //$NON-NLS-0$ var progress = serviceRegistry.getService("orion.page.progress"); (progress ? progress.progress(fileService.loadWorkspaces(), "Loading workspaces") : fileService.loadWorkspaces()).then(function(workspaces) { var workspaceId = workspaces && workspaces[0] && workspaces[0].Id; if (workspaceId && name) { siteService.createSiteConfiguration(name, workspaceId).then(function(site) { options.createCallback(mSiteUtils.generateEditSiteHref(site), site); }, options.errorCallback); } }); }}); commandService.addCommand(createCommand); }
[ "function", "createSiteServiceCommands", "(", "serviceRegistry", ",", "commandService", ",", "options", ")", "{", "function", "getFileService", "(", "siteServiceRef", ")", "{", "return", "mSiteClient", ".", "getFileClient", "(", "serviceRegistry", ",", "siteServiceRef", ".", "getProperty", "(", "'filePattern'", ")", ")", ";", "//$NON-NLS-0$", "}", "options", "=", "options", "||", "{", "}", ";", "var", "createCommand", "=", "new", "mCommands", ".", "Command", "(", "{", "name", ":", "messages", "[", "\"Create\"", "]", ",", "tooltip", ":", "messages", "[", "\"Create a new site configuration\"", "]", ",", "id", ":", "\"orion.site.create\"", ",", "//$NON-NLS-0$", "parameters", ":", "new", "mCommandRegistry", ".", "ParametersDescription", "(", "[", "new", "mCommandRegistry", ".", "CommandParameter", "(", "'name'", ",", "'text'", ",", "messages", "[", "\"Name\"", "]", ")", "]", ")", ",", "//$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$", "visibleWhen", ":", "function", "(", "bah", ")", "{", "return", "true", ";", "}", ",", "callback", ":", "function", "(", "data", ")", "{", "var", "siteServiceRef", "=", "data", ".", "items", ",", "siteService", "=", "serviceRegistry", ".", "getService", "(", "siteServiceRef", ")", ";", "var", "fileService", "=", "getFileService", "(", "siteServiceRef", ")", ";", "var", "name", "=", "data", ".", "parameters", "&&", "data", ".", "parameters", ".", "valueFor", "(", "'name'", ")", ";", "//$NON-NLS-0$", "var", "progress", "=", "serviceRegistry", ".", "getService", "(", "\"orion.page.progress\"", ")", ";", "(", "progress", "?", "progress", ".", "progress", "(", "fileService", ".", "loadWorkspaces", "(", ")", ",", "\"Loading workspaces\"", ")", ":", "fileService", ".", "loadWorkspaces", "(", ")", ")", ".", "then", "(", "function", "(", "workspaces", ")", "{", "var", "workspaceId", "=", "workspaces", "&&", "workspaces", "[", "0", "]", "&&", "workspaces", "[", "0", "]", ".", "Id", ";", "if", "(", "workspaceId", "&&", "name", ")", "{", "siteService", ".", "createSiteConfiguration", "(", "name", ",", "workspaceId", ")", ".", "then", "(", "function", "(", "site", ")", "{", "options", ".", "createCallback", "(", "mSiteUtils", ".", "generateEditSiteHref", "(", "site", ")", ",", "site", ")", ";", "}", ",", "options", ".", "errorCallback", ")", ";", "}", "}", ")", ";", "}", "}", ")", ";", "commandService", ".", "addCommand", "(", "createCommand", ")", ";", "}" ]
Creates & adds commands that act on an site service. @param {orion.serviceregistry.ServiceRegistry} serviceRegistry @param {Function} options.createCallback @param {Function} options.errorCallback @name orion.sites.siteCommands#createSiteServiceCommands
[ "Creates", "&", "adds", "commands", "that", "act", "on", "an", "site", "service", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/sites/siteCommands.js#L25-L53
14,344
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/gcli/gcli/types/command.js
ParamType
function ParamType(typeSpec) { this.requisition = typeSpec.requisition; this.isIncompleteName = typeSpec.isIncompleteName; this.stringifyProperty = 'name'; this.neverForceAsync = true; }
javascript
function ParamType(typeSpec) { this.requisition = typeSpec.requisition; this.isIncompleteName = typeSpec.isIncompleteName; this.stringifyProperty = 'name'; this.neverForceAsync = true; }
[ "function", "ParamType", "(", "typeSpec", ")", "{", "this", ".", "requisition", "=", "typeSpec", ".", "requisition", ";", "this", ".", "isIncompleteName", "=", "typeSpec", ".", "isIncompleteName", ";", "this", ".", "stringifyProperty", "=", "'name'", ";", "this", ".", "neverForceAsync", "=", "true", ";", "}" ]
Select from the available commands. This is very similar to a SelectionType, however the level of hackery in SelectionType to make it handle Commands correctly was to high, so we simplified. If you are making changes to this code, you should check there too.
[ "Select", "from", "the", "available", "commands", ".", "This", "is", "very", "similar", "to", "a", "SelectionType", "however", "the", "level", "of", "hackery", "in", "SelectionType", "to", "make", "it", "handle", "Commands", "correctly", "was", "to", "high", "so", "we", "simplified", ".", "If", "you", "are", "making", "changes", "to", "this", "code", "you", "should", "check", "there", "too", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/types/command.js#L57-L62
14,345
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/status.js
StatusReportingService
function StatusReportingService(serviceRegistry, operationsClient, domId, progressDomId, notificationContainerDomId) { this._serviceRegistry = serviceRegistry; this._serviceRegistration = serviceRegistry.registerService("orion.page.message", this); //$NON-NLS-0$ this._operationsClient = operationsClient; this.notificationContainerDomId = notificationContainerDomId; this.domId = domId; this.progressDomId = progressDomId || domId; this._hookedClose = false; this._timer = null; this._clickToDisMiss = true; this._cancelMsg = null; this.statusMessage = this.progressMessage = null; }
javascript
function StatusReportingService(serviceRegistry, operationsClient, domId, progressDomId, notificationContainerDomId) { this._serviceRegistry = serviceRegistry; this._serviceRegistration = serviceRegistry.registerService("orion.page.message", this); //$NON-NLS-0$ this._operationsClient = operationsClient; this.notificationContainerDomId = notificationContainerDomId; this.domId = domId; this.progressDomId = progressDomId || domId; this._hookedClose = false; this._timer = null; this._clickToDisMiss = true; this._cancelMsg = null; this.statusMessage = this.progressMessage = null; }
[ "function", "StatusReportingService", "(", "serviceRegistry", ",", "operationsClient", ",", "domId", ",", "progressDomId", ",", "notificationContainerDomId", ")", "{", "this", ".", "_serviceRegistry", "=", "serviceRegistry", ";", "this", ".", "_serviceRegistration", "=", "serviceRegistry", ".", "registerService", "(", "\"orion.page.message\"", ",", "this", ")", ";", "//$NON-NLS-0$\r", "this", ".", "_operationsClient", "=", "operationsClient", ";", "this", ".", "notificationContainerDomId", "=", "notificationContainerDomId", ";", "this", ".", "domId", "=", "domId", ";", "this", ".", "progressDomId", "=", "progressDomId", "||", "domId", ";", "this", ".", "_hookedClose", "=", "false", ";", "this", ".", "_timer", "=", "null", ";", "this", ".", "_clickToDisMiss", "=", "true", ";", "this", ".", "_cancelMsg", "=", "null", ";", "this", ".", "statusMessage", "=", "this", ".", "progressMessage", "=", "null", ";", "}" ]
Service for reporting status @class Service for reporting status @name orion.status.StatusReportingService @param {orion.serviceregistry.ServiceRegistry} serviceRegistry @param {orion.operationclient.OperationsClient} operationsClient @param {String} domId ID of the DOM node under which status will be displayed. @param {String} progressDomId ID of the DOM node used to display progress messages.
[ "Service", "for", "reporting", "status" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/status.js#L43-L55
14,346
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/status.js
function(msg, timeout, isAccessible) { this._init(); this.statusMessage = msg; var node = lib.node(this.domId); if(typeof isAccessible === "boolean") { // this is kind of a hack; when there is good screen reader support for aria-busy, // this should be done by toggling that instead var readSetting = node.getAttribute("aria-live"); //$NON-NLS-0$ node.setAttribute("aria-live", isAccessible ? "polite" : "off"); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-3$ window.setTimeout(function() { if (msg === this.statusMessage) { lib.empty(node); node.appendChild(document.createTextNode(msg)); window.setTimeout(function() { node.setAttribute("aria-live", readSetting); }, 100); //$NON-NLS-0$ } }.bind(this), 100); } else { lib.empty(node); node.appendChild(document.createTextNode(msg)); } if (typeof timeout === "number") { window.setTimeout(function() { if (msg === this.statusMessage) { lib.empty(node); node.appendChild(document.createTextNode("")); } }.bind(this), timeout); } }
javascript
function(msg, timeout, isAccessible) { this._init(); this.statusMessage = msg; var node = lib.node(this.domId); if(typeof isAccessible === "boolean") { // this is kind of a hack; when there is good screen reader support for aria-busy, // this should be done by toggling that instead var readSetting = node.getAttribute("aria-live"); //$NON-NLS-0$ node.setAttribute("aria-live", isAccessible ? "polite" : "off"); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-3$ window.setTimeout(function() { if (msg === this.statusMessage) { lib.empty(node); node.appendChild(document.createTextNode(msg)); window.setTimeout(function() { node.setAttribute("aria-live", readSetting); }, 100); //$NON-NLS-0$ } }.bind(this), 100); } else { lib.empty(node); node.appendChild(document.createTextNode(msg)); } if (typeof timeout === "number") { window.setTimeout(function() { if (msg === this.statusMessage) { lib.empty(node); node.appendChild(document.createTextNode("")); } }.bind(this), timeout); } }
[ "function", "(", "msg", ",", "timeout", ",", "isAccessible", ")", "{", "this", ".", "_init", "(", ")", ";", "this", ".", "statusMessage", "=", "msg", ";", "var", "node", "=", "lib", ".", "node", "(", "this", ".", "domId", ")", ";", "if", "(", "typeof", "isAccessible", "===", "\"boolean\"", ")", "{", "// this is kind of a hack; when there is good screen reader support for aria-busy,\r", "// this should be done by toggling that instead\r", "var", "readSetting", "=", "node", ".", "getAttribute", "(", "\"aria-live\"", ")", ";", "//$NON-NLS-0$\r", "node", ".", "setAttribute", "(", "\"aria-live\"", ",", "isAccessible", "?", "\"polite\"", ":", "\"off\"", ")", ";", "//$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-3$\r", "window", ".", "setTimeout", "(", "function", "(", ")", "{", "if", "(", "msg", "===", "this", ".", "statusMessage", ")", "{", "lib", ".", "empty", "(", "node", ")", ";", "node", ".", "appendChild", "(", "document", ".", "createTextNode", "(", "msg", ")", ")", ";", "window", ".", "setTimeout", "(", "function", "(", ")", "{", "node", ".", "setAttribute", "(", "\"aria-live\"", ",", "readSetting", ")", ";", "}", ",", "100", ")", ";", "//$NON-NLS-0$\r", "}", "}", ".", "bind", "(", "this", ")", ",", "100", ")", ";", "}", "else", "{", "lib", ".", "empty", "(", "node", ")", ";", "node", ".", "appendChild", "(", "document", ".", "createTextNode", "(", "msg", ")", ")", ";", "}", "if", "(", "typeof", "timeout", "===", "\"number\"", ")", "{", "window", ".", "setTimeout", "(", "function", "(", ")", "{", "if", "(", "msg", "===", "this", ".", "statusMessage", ")", "{", "lib", ".", "empty", "(", "node", ")", ";", "node", ".", "appendChild", "(", "document", ".", "createTextNode", "(", "\"\"", ")", ")", ";", "}", "}", ".", "bind", "(", "this", ")", ",", "timeout", ")", ";", "}", "}" ]
Displays a status message to the user. @param {String} msg Message to display. @param {Number} [timeout] Time to display the message before hiding it. @param {Boolean} [isAccessible] If <code>true</code>, a screen reader will read this message. Otherwise defaults to the domNode default.
[ "Displays", "a", "status", "message", "to", "the", "user", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/status.js#L120-L149
14,347
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/status.js
function(st) { this._clickToDisMiss = true; this.statusMessage = st; this._init(); //could be: responseText from xhrGet, deferred error object, or plain string var _status = st.responseText || st.message || st; //accept either a string or a JSON representation of an IStatus if (typeof _status === "string") { try { _status = JSON.parse(_status); } catch(error) { //it is not JSON, just continue; } } var message = _status.DetailedMessage || _status.Message || _status; var color = "#DF0000"; //$NON-NLS-0$ if (_status.Severity) { switch (_status.Severity) { case SEV_WARNING: color = "#FFCC00"; //$NON-NLS-0$ break; case SEV_ERROR: color = "#DF0000"; //$NON-NLS-0$ break; case SEV_INFO: case SEV_OK: color = "green"; //$NON-NLS-0$ break; } } var span = document.createElement("span"); span.style.color = color; span.appendChild(document.createTextNode(message)); var node = lib.node(this.domId); lib.empty(node); node.appendChild(span); this._takeDownSplash(); }
javascript
function(st) { this._clickToDisMiss = true; this.statusMessage = st; this._init(); //could be: responseText from xhrGet, deferred error object, or plain string var _status = st.responseText || st.message || st; //accept either a string or a JSON representation of an IStatus if (typeof _status === "string") { try { _status = JSON.parse(_status); } catch(error) { //it is not JSON, just continue; } } var message = _status.DetailedMessage || _status.Message || _status; var color = "#DF0000"; //$NON-NLS-0$ if (_status.Severity) { switch (_status.Severity) { case SEV_WARNING: color = "#FFCC00"; //$NON-NLS-0$ break; case SEV_ERROR: color = "#DF0000"; //$NON-NLS-0$ break; case SEV_INFO: case SEV_OK: color = "green"; //$NON-NLS-0$ break; } } var span = document.createElement("span"); span.style.color = color; span.appendChild(document.createTextNode(message)); var node = lib.node(this.domId); lib.empty(node); node.appendChild(span); this._takeDownSplash(); }
[ "function", "(", "st", ")", "{", "this", ".", "_clickToDisMiss", "=", "true", ";", "this", ".", "statusMessage", "=", "st", ";", "this", ".", "_init", "(", ")", ";", "//could be: responseText from xhrGet, deferred error object, or plain string\r", "var", "_status", "=", "st", ".", "responseText", "||", "st", ".", "message", "||", "st", ";", "//accept either a string or a JSON representation of an IStatus\r", "if", "(", "typeof", "_status", "===", "\"string\"", ")", "{", "try", "{", "_status", "=", "JSON", ".", "parse", "(", "_status", ")", ";", "}", "catch", "(", "error", ")", "{", "//it is not JSON, just continue;\r", "}", "}", "var", "message", "=", "_status", ".", "DetailedMessage", "||", "_status", ".", "Message", "||", "_status", ";", "var", "color", "=", "\"#DF0000\"", ";", "//$NON-NLS-0$\r", "if", "(", "_status", ".", "Severity", ")", "{", "switch", "(", "_status", ".", "Severity", ")", "{", "case", "SEV_WARNING", ":", "color", "=", "\"#FFCC00\"", ";", "//$NON-NLS-0$\r", "break", ";", "case", "SEV_ERROR", ":", "color", "=", "\"#DF0000\"", ";", "//$NON-NLS-0$\r", "break", ";", "case", "SEV_INFO", ":", "case", "SEV_OK", ":", "color", "=", "\"green\"", ";", "//$NON-NLS-0$\r", "break", ";", "}", "}", "var", "span", "=", "document", ".", "createElement", "(", "\"span\"", ")", ";", "span", ".", "style", ".", "color", "=", "color", ";", "span", ".", "appendChild", "(", "document", ".", "createTextNode", "(", "message", ")", ")", ";", "var", "node", "=", "lib", ".", "node", "(", "this", ".", "domId", ")", ";", "lib", ".", "empty", "(", "node", ")", ";", "node", ".", "appendChild", "(", "span", ")", ";", "this", ".", "_takeDownSplash", "(", ")", ";", "}" ]
Displays an error message to the user. @param {String|orionError} st The error to display. Can be a simple String, or an error object from a XHR error callback, or the body of an error response from the Orion server.
[ "Displays", "an", "error", "message", "to", "the", "user", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/status.js#L158-L195
14,348
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/status.js
function(message) { this._clickToDisMiss = false; this._init(); this.progressMessage = message; var pageLoader = getPageLoader(); if (pageLoader) { var step = pageLoader.getStep(); if(step) { if (typeof message === "object") { step.message = message.message; step.detailedMessage = message.detailedMessage; } else { step.message = message; step.detailedMessage = ""; } pageLoader.update(); return; } } var node = lib.node(this.progressDomId); lib.empty(node); node.appendChild(document.createTextNode(message)); var container = lib.node(this.notificationContainerDomId); container.classList.remove("notificationHide"); //$NON-NLS-0$ if (message && message.length > 0) { container.classList.add("progressNormal"); //$NON-NLS-0$ container.classList.add("notificationShow"); //$NON-NLS-0$ } else if(this._progressMonitors && this._progressMonitors.length > 0){ return this._renderOngoingMonitors(); }else{ container.classList.remove("notificationShow"); //$NON-NLS-0$ container.classList.add("notificationHide"); //$NON-NLS-0$ } }
javascript
function(message) { this._clickToDisMiss = false; this._init(); this.progressMessage = message; var pageLoader = getPageLoader(); if (pageLoader) { var step = pageLoader.getStep(); if(step) { if (typeof message === "object") { step.message = message.message; step.detailedMessage = message.detailedMessage; } else { step.message = message; step.detailedMessage = ""; } pageLoader.update(); return; } } var node = lib.node(this.progressDomId); lib.empty(node); node.appendChild(document.createTextNode(message)); var container = lib.node(this.notificationContainerDomId); container.classList.remove("notificationHide"); //$NON-NLS-0$ if (message && message.length > 0) { container.classList.add("progressNormal"); //$NON-NLS-0$ container.classList.add("notificationShow"); //$NON-NLS-0$ } else if(this._progressMonitors && this._progressMonitors.length > 0){ return this._renderOngoingMonitors(); }else{ container.classList.remove("notificationShow"); //$NON-NLS-0$ container.classList.add("notificationHide"); //$NON-NLS-0$ } }
[ "function", "(", "message", ")", "{", "this", ".", "_clickToDisMiss", "=", "false", ";", "this", ".", "_init", "(", ")", ";", "this", ".", "progressMessage", "=", "message", ";", "var", "pageLoader", "=", "getPageLoader", "(", ")", ";", "if", "(", "pageLoader", ")", "{", "var", "step", "=", "pageLoader", ".", "getStep", "(", ")", ";", "if", "(", "step", ")", "{", "if", "(", "typeof", "message", "===", "\"object\"", ")", "{", "step", ".", "message", "=", "message", ".", "message", ";", "step", ".", "detailedMessage", "=", "message", ".", "detailedMessage", ";", "}", "else", "{", "step", ".", "message", "=", "message", ";", "step", ".", "detailedMessage", "=", "\"\"", ";", "}", "pageLoader", ".", "update", "(", ")", ";", "return", ";", "}", "}", "var", "node", "=", "lib", ".", "node", "(", "this", ".", "progressDomId", ")", ";", "lib", ".", "empty", "(", "node", ")", ";", "node", ".", "appendChild", "(", "document", ".", "createTextNode", "(", "message", ")", ")", ";", "var", "container", "=", "lib", ".", "node", "(", "this", ".", "notificationContainerDomId", ")", ";", "container", ".", "classList", ".", "remove", "(", "\"notificationHide\"", ")", ";", "//$NON-NLS-0$\r", "if", "(", "message", "&&", "message", ".", "length", ">", "0", ")", "{", "container", ".", "classList", ".", "add", "(", "\"progressNormal\"", ")", ";", "//$NON-NLS-0$\r", "container", ".", "classList", ".", "add", "(", "\"notificationShow\"", ")", ";", "//$NON-NLS-0$\r", "}", "else", "if", "(", "this", ".", "_progressMonitors", "&&", "this", ".", "_progressMonitors", ".", "length", ">", "0", ")", "{", "return", "this", ".", "_renderOngoingMonitors", "(", ")", ";", "}", "else", "{", "container", ".", "classList", ".", "remove", "(", "\"notificationShow\"", ")", ";", "//$NON-NLS-0$\r", "container", ".", "classList", ".", "add", "(", "\"notificationHide\"", ")", ";", "//$NON-NLS-0$\r", "}", "}" ]
Set a message that will be shown in the progress reporting area on the page. @param {String} message The progress message to display.
[ "Set", "a", "message", "that", "will", "be", "shown", "in", "the", "progress", "reporting", "area", "on", "the", "page", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/status.js#L201-L238
14,349
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/status.js
function(deferred, message) { var that = this; if(message){ that.setProgressMessage(message); var finish = function(){ if(message === that.progressMessage){ that.setProgressMessage(""); } }; deferred.then(finish, finish); } return deferred; }
javascript
function(deferred, message) { var that = this; if(message){ that.setProgressMessage(message); var finish = function(){ if(message === that.progressMessage){ that.setProgressMessage(""); } }; deferred.then(finish, finish); } return deferred; }
[ "function", "(", "deferred", ",", "message", ")", "{", "var", "that", "=", "this", ";", "if", "(", "message", ")", "{", "that", ".", "setProgressMessage", "(", "message", ")", ";", "var", "finish", "=", "function", "(", ")", "{", "if", "(", "message", "===", "that", ".", "progressMessage", ")", "{", "that", ".", "setProgressMessage", "(", "\"\"", ")", ";", "}", "}", ";", "deferred", ".", "then", "(", "finish", ",", "finish", ")", ";", "}", "return", "deferred", ";", "}" ]
Shows a progress message in the progress area until the given deferred is resolved.
[ "Shows", "a", "progress", "message", "in", "the", "progress", "area", "until", "the", "given", "deferred", "is", "resolved", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/status.js#L402-L414
14,350
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/gcli/gcli/types/spell.js
damerauLevenshteinDistance
function damerauLevenshteinDistance(wordi, wordj) { var wordiLen = wordi.length; var wordjLen = wordj.length; // We only need to store three rows of our dynamic programming matrix. // (Without swap, it would have been two.) var row0 = new Array(wordiLen+1); var row1 = new Array(wordiLen+1); var row2 = new Array(wordiLen+1); var tmp; var i, j; // The distance between the empty string and a string of size i is the cost // of i insertions. for (i = 0; i <= wordiLen; i++) { row1[i] = i * INSERTION_COST; } // Row-by-row, we're computing the edit distance between substrings wordi[0..i] // and wordj[0..j]. for (j = 1; j <= wordjLen; j++) { // Edit distance between wordi[0..0] and wordj[0..j] is the cost of j // insertions. row0[0] = j * INSERTION_COST; for (i = 1; i <= wordiLen; i++) { // Handle deletion, insertion and substitution: we can reach each cell // from three other cells corresponding to those three operations. We // want the minimum cost. row0[i] = Math.min( row0[i-1] + DELETION_COST, row1[i] + INSERTION_COST, row1[i-1] + (wordi[i-1] === wordj[j-1] ? 0 : SUBSTITUTION_COST)); // We handle swap too, eg. distance between help and hlep should be 1. If // we find such a swap, there's a chance to update row0[1] to be lower. if (i > 1 && j > 1 && wordi[i-1] === wordj[j-2] && wordj[j-1] === wordi[i-2]) { row0[i] = Math.min(row0[i], row2[i-2] + SWAP_COST); } } tmp = row2; row2 = row1; row1 = row0; row0 = tmp; } return row1[wordiLen]; }
javascript
function damerauLevenshteinDistance(wordi, wordj) { var wordiLen = wordi.length; var wordjLen = wordj.length; // We only need to store three rows of our dynamic programming matrix. // (Without swap, it would have been two.) var row0 = new Array(wordiLen+1); var row1 = new Array(wordiLen+1); var row2 = new Array(wordiLen+1); var tmp; var i, j; // The distance between the empty string and a string of size i is the cost // of i insertions. for (i = 0; i <= wordiLen; i++) { row1[i] = i * INSERTION_COST; } // Row-by-row, we're computing the edit distance between substrings wordi[0..i] // and wordj[0..j]. for (j = 1; j <= wordjLen; j++) { // Edit distance between wordi[0..0] and wordj[0..j] is the cost of j // insertions. row0[0] = j * INSERTION_COST; for (i = 1; i <= wordiLen; i++) { // Handle deletion, insertion and substitution: we can reach each cell // from three other cells corresponding to those three operations. We // want the minimum cost. row0[i] = Math.min( row0[i-1] + DELETION_COST, row1[i] + INSERTION_COST, row1[i-1] + (wordi[i-1] === wordj[j-1] ? 0 : SUBSTITUTION_COST)); // We handle swap too, eg. distance between help and hlep should be 1. If // we find such a swap, there's a chance to update row0[1] to be lower. if (i > 1 && j > 1 && wordi[i-1] === wordj[j-2] && wordj[j-1] === wordi[i-2]) { row0[i] = Math.min(row0[i], row2[i-2] + SWAP_COST); } } tmp = row2; row2 = row1; row1 = row0; row0 = tmp; } return row1[wordiLen]; }
[ "function", "damerauLevenshteinDistance", "(", "wordi", ",", "wordj", ")", "{", "var", "wordiLen", "=", "wordi", ".", "length", ";", "var", "wordjLen", "=", "wordj", ".", "length", ";", "// We only need to store three rows of our dynamic programming matrix.", "// (Without swap, it would have been two.)", "var", "row0", "=", "new", "Array", "(", "wordiLen", "+", "1", ")", ";", "var", "row1", "=", "new", "Array", "(", "wordiLen", "+", "1", ")", ";", "var", "row2", "=", "new", "Array", "(", "wordiLen", "+", "1", ")", ";", "var", "tmp", ";", "var", "i", ",", "j", ";", "// The distance between the empty string and a string of size i is the cost", "// of i insertions.", "for", "(", "i", "=", "0", ";", "i", "<=", "wordiLen", ";", "i", "++", ")", "{", "row1", "[", "i", "]", "=", "i", "*", "INSERTION_COST", ";", "}", "// Row-by-row, we're computing the edit distance between substrings wordi[0..i]", "// and wordj[0..j].", "for", "(", "j", "=", "1", ";", "j", "<=", "wordjLen", ";", "j", "++", ")", "{", "// Edit distance between wordi[0..0] and wordj[0..j] is the cost of j", "// insertions.", "row0", "[", "0", "]", "=", "j", "*", "INSERTION_COST", ";", "for", "(", "i", "=", "1", ";", "i", "<=", "wordiLen", ";", "i", "++", ")", "{", "// Handle deletion, insertion and substitution: we can reach each cell", "// from three other cells corresponding to those three operations. We", "// want the minimum cost.", "row0", "[", "i", "]", "=", "Math", ".", "min", "(", "row0", "[", "i", "-", "1", "]", "+", "DELETION_COST", ",", "row1", "[", "i", "]", "+", "INSERTION_COST", ",", "row1", "[", "i", "-", "1", "]", "+", "(", "wordi", "[", "i", "-", "1", "]", "===", "wordj", "[", "j", "-", "1", "]", "?", "0", ":", "SUBSTITUTION_COST", ")", ")", ";", "// We handle swap too, eg. distance between help and hlep should be 1. If", "// we find such a swap, there's a chance to update row0[1] to be lower.", "if", "(", "i", ">", "1", "&&", "j", ">", "1", "&&", "wordi", "[", "i", "-", "1", "]", "===", "wordj", "[", "j", "-", "2", "]", "&&", "wordj", "[", "j", "-", "1", "]", "===", "wordi", "[", "i", "-", "2", "]", ")", "{", "row0", "[", "i", "]", "=", "Math", ".", "min", "(", "row0", "[", "i", "]", ",", "row2", "[", "i", "-", "2", "]", "+", "SWAP_COST", ")", ";", "}", "}", "tmp", "=", "row2", ";", "row2", "=", "row1", ";", "row1", "=", "row0", ";", "row0", "=", "tmp", ";", "}", "return", "row1", "[", "wordiLen", "]", ";", "}" ]
Compute Damerau-Levenshtein Distance @see http://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance
[ "Compute", "Damerau", "-", "Levenshtein", "Distance" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/types/spell.js#L35-L84
14,351
eclipse/orion.client
modules/orionode/lib/metastore/mongodb/store.js
findUser
function findUser(id, user, callback) { if (typeof user.save === 'function') { callback(null, user); } else { orionAccount.findByUsername(id, callback); } }
javascript
function findUser(id, user, callback) { if (typeof user.save === 'function') { callback(null, user); } else { orionAccount.findByUsername(id, callback); } }
[ "function", "findUser", "(", "id", ",", "user", ",", "callback", ")", "{", "if", "(", "typeof", "user", ".", "save", "===", "'function'", ")", "{", "callback", "(", "null", ",", "user", ")", ";", "}", "else", "{", "orionAccount", ".", "findByUsername", "(", "id", ",", "callback", ")", ";", "}", "}" ]
If `user` has already been fetched from DB, use it, otherwise obtain from findByUsername
[ "If", "user", "has", "already", "been", "fetched", "from", "DB", "use", "it", "otherwise", "obtain", "from", "findByUsername" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/metastore/mongodb/store.js#L118-L124
14,352
eclipse/orion.client
modules/orionode/lib/metastore/mongodb/store.js
function(oauth, callback) { orionAccount.find({oauth: new RegExp("^" + oauth + "$", "m")}, function(err, user) { if (err) { return callback(err); } if (user && user.length) { return callback(null, user[0]); } return callback(null, null); }); }
javascript
function(oauth, callback) { orionAccount.find({oauth: new RegExp("^" + oauth + "$", "m")}, function(err, user) { if (err) { return callback(err); } if (user && user.length) { return callback(null, user[0]); } return callback(null, null); }); }
[ "function", "(", "oauth", ",", "callback", ")", "{", "orionAccount", ".", "find", "(", "{", "oauth", ":", "new", "RegExp", "(", "\"^\"", "+", "oauth", "+", "\"$\"", ",", "\"m\"", ")", "}", ",", "function", "(", "err", ",", "user", ")", "{", "if", "(", "err", ")", "{", "return", "callback", "(", "err", ")", ";", "}", "if", "(", "user", "&&", "user", ".", "length", ")", "{", "return", "callback", "(", "null", ",", "user", "[", "0", "]", ")", ";", "}", "return", "callback", "(", "null", ",", "null", ")", ";", "}", ")", ";", "}" ]
returns the user with the given oauth token
[ "returns", "the", "user", "with", "the", "given", "oauth", "token" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/metastore/mongodb/store.js#L266-L276
14,353
eclipse/orion.client
modules/orionode/lib/metastore/mongodb/store.js
deleteUser
function deleteUser(id, callback) { orionAccount.findByUsername(id, function(err, user) { if(err) { callback(err); } const userPath = path.join(this.options.workspaceDir, id.substring(0,2)); fs.access(userPath, (err) => { if(err) { callback(err); } //TODO should a delete failure prevent the user delete? return rimraf(userPath, (err) => { if(err) { callback(err); } orionAccount.remove({username: id}, callback); }); }); }.bind(this)); }
javascript
function deleteUser(id, callback) { orionAccount.findByUsername(id, function(err, user) { if(err) { callback(err); } const userPath = path.join(this.options.workspaceDir, id.substring(0,2)); fs.access(userPath, (err) => { if(err) { callback(err); } //TODO should a delete failure prevent the user delete? return rimraf(userPath, (err) => { if(err) { callback(err); } orionAccount.remove({username: id}, callback); }); }); }.bind(this)); }
[ "function", "deleteUser", "(", "id", ",", "callback", ")", "{", "orionAccount", ".", "findByUsername", "(", "id", ",", "function", "(", "err", ",", "user", ")", "{", "if", "(", "err", ")", "{", "callback", "(", "err", ")", ";", "}", "const", "userPath", "=", "path", ".", "join", "(", "this", ".", "options", ".", "workspaceDir", ",", "id", ".", "substring", "(", "0", ",", "2", ")", ")", ";", "fs", ".", "access", "(", "userPath", ",", "(", "err", ")", "=>", "{", "if", "(", "err", ")", "{", "callback", "(", "err", ")", ";", "}", "//TODO should a delete failure prevent the user delete?", "return", "rimraf", "(", "userPath", ",", "(", "err", ")", "=>", "{", "if", "(", "err", ")", "{", "callback", "(", "err", ")", ";", "}", "orionAccount", ".", "remove", "(", "{", "username", ":", "id", "}", ",", "callback", ")", ";", "}", ")", ";", "}", ")", ";", "}", ".", "bind", "(", "this", ")", ")", ";", "}" ]
Delete the user from the store with the given user ID @param {string} id The user identifier to delete @param {fn(Error: err)} callback The callback to call when complete
[ "Delete", "the", "user", "from", "the", "store", "with", "the", "given", "user", "ID" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/metastore/mongodb/store.js#L325-L344
14,354
eclipse/orion.client
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/quotes.js
isDirective
function isDirective(node) { return node.type === "ExpressionStatement" && node.expression.type === "Literal" && typeof node.expression.value === "string"; }
javascript
function isDirective(node) { return node.type === "ExpressionStatement" && node.expression.type === "Literal" && typeof node.expression.value === "string"; }
[ "function", "isDirective", "(", "node", ")", "{", "return", "node", ".", "type", "===", "\"ExpressionStatement\"", "&&", "node", ".", "expression", ".", "type", "===", "\"Literal\"", "&&", "typeof", "node", ".", "expression", ".", "value", "===", "\"string\"", ";", "}" ]
Checks whether or not a given node is a directive. The directive is a `ExpressionStatement` which has only a string literal. @param {ASTNode} node - A node to check. @returns {boolean} Whether or not the node is a directive. @private
[ "Checks", "whether", "or", "not", "a", "given", "node", "is", "a", "directive", ".", "The", "directive", "is", "a", "ExpressionStatement", "which", "has", "only", "a", "string", "literal", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/quotes.js#L82-L86
14,355
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/tasks.js
TaskList
function TaskList(options) { var parent = lib.node(options.parent); if (!parent) { throw messages['no parent']; } if (!options.serviceRegistry) {throw messages["no service registry"]; } this._parent = parent; this._registry = options.serviceRegistry; this._description = options.description; this._tasks = options.tasks; this._title = options.title || messages["Tasks"]; this._collapsed = options.collapsed; this._id = options.id || this._parent.id + "taskList"; //$NON-NLS-0$ this._contentId = this._parent.id + "taskContent"; //$NON-NLS-0$ this._item = options.item; this._handler = options.handler; this._commandService = options.commandService; this._descriptionProperty = options.descriptionProperty; this.renderTasks(); }
javascript
function TaskList(options) { var parent = lib.node(options.parent); if (!parent) { throw messages['no parent']; } if (!options.serviceRegistry) {throw messages["no service registry"]; } this._parent = parent; this._registry = options.serviceRegistry; this._description = options.description; this._tasks = options.tasks; this._title = options.title || messages["Tasks"]; this._collapsed = options.collapsed; this._id = options.id || this._parent.id + "taskList"; //$NON-NLS-0$ this._contentId = this._parent.id + "taskContent"; //$NON-NLS-0$ this._item = options.item; this._handler = options.handler; this._commandService = options.commandService; this._descriptionProperty = options.descriptionProperty; this.renderTasks(); }
[ "function", "TaskList", "(", "options", ")", "{", "var", "parent", "=", "lib", ".", "node", "(", "options", ".", "parent", ")", ";", "if", "(", "!", "parent", ")", "{", "throw", "messages", "[", "'no parent'", "]", ";", "}", "if", "(", "!", "options", ".", "serviceRegistry", ")", "{", "throw", "messages", "[", "\"no service registry\"", "]", ";", "}", "this", ".", "_parent", "=", "parent", ";", "this", ".", "_registry", "=", "options", ".", "serviceRegistry", ";", "this", ".", "_description", "=", "options", ".", "description", ";", "this", ".", "_tasks", "=", "options", ".", "tasks", ";", "this", ".", "_title", "=", "options", ".", "title", "||", "messages", "[", "\"Tasks\"", "]", ";", "this", ".", "_collapsed", "=", "options", ".", "collapsed", ";", "this", ".", "_id", "=", "options", ".", "id", "||", "this", ".", "_parent", ".", "id", "+", "\"taskList\"", ";", "//$NON-NLS-0$", "this", ".", "_contentId", "=", "this", ".", "_parent", ".", "id", "+", "\"taskContent\"", ";", "//$NON-NLS-0$", "this", ".", "_item", "=", "options", ".", "item", ";", "this", ".", "_handler", "=", "options", ".", "handler", ";", "this", ".", "_commandService", "=", "options", ".", "commandService", ";", "this", ".", "_descriptionProperty", "=", "options", ".", "descriptionProperty", ";", "this", ".", "renderTasks", "(", ")", ";", "}" ]
Creates a new user interface element showing a list of tasks @name orion.tasks.TaskList @class A user interface element showing a list of various user tasks. @param {Object} options The service options @param {Object} options.parent The parent of this task list @prarm {String} options.id The id of the section @param {String} options.tasks The array of tasks this list should display @param {String} options.title The title of the task list @param {String} options.description A description of the task list shown the user @param {orion.serviceregistry.ServiceRegistry} options.serviceRegistry The service registry @param {Boolean} options.collapsed Whether the list should be initially collapsed @param {Object} options.item The item used as the target when running a task command @param {Object} options.handler The handler when running a task command @param {orion.commands.CommandService} The command service used for running commands @param {String} options.descriptionProperty The name of the property on the command that will provide the description. Optional. The command tooltip will be used as the description if no descriptionProperty is provided.
[ "Creates", "a", "new", "user", "interface", "element", "showing", "a", "list", "of", "tasks" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/tasks.js#L34-L52
14,356
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/edit/setup.js
function() { /** All events from last tick */ var pendingEvents = this._annotationChangedContext.events; var pendingLocations = this._annotationChangedContext.locations; var pendingModels = this._annotationChangedContext.textModels; /** All unique events from last tick */ var handlingEvents = []; var handlingLocations = []; var handlingModels = []; // Cleanup this._annotationChangedContext.timeout = undefined; this._annotationChangedContext.events = []; this._annotationChangedContext.locations = []; // Remove duplicate events for (var i = 0; i < pendingEvents.length; i++) { var duplicate = false; for (var j = 0; j < i; j++) { if (pendingEvents[i].textModelChangedEvent === pendingEvents[j].textModelChangedEvent) { duplicate = true; } break; } if (!duplicate) { handlingEvents.push(pendingEvents[i]); handlingLocations.push(pendingLocations[i]); handlingModels.push(pendingModels[i]); } } // Handle for (i = 0; i < handlingEvents.length; i++) { var e = handlingEvents[i]; for (j = 0; j < e.changed.length; j++) { var annotation = e.changed[j]; var location = handlingLocations[i]; var oldLine; var newLine = handlingModels[i].getLineAtOffset(annotation.start); if (annotation._oldStart > e.textModelChangedEvent.start) { oldLine = newLine - e.textModelChangedEvent.addedLineCount + e.textModelChangedEvent.removedLineCount; } else { oldLine = handlingModels[i].getLineAtOffset(annotation._oldStart); } var before = null; var after = null; if (annotation.type === AT.ANNOTATION_BOOKMARK) { before = new mBreakpoint.LineBookmark(location, oldLine, annotation.title); after = new mBreakpoint.LineBookmark(location, newLine, annotation.title); } else if (annotation.type === AT.ANNOTATION_BREAKPOINT) { before = new mBreakpoint.LineBreakpoint(location, oldLine, annotation.title, true); after = new mBreakpoint.LineBreakpoint(location, newLine, annotation.title, true); } else if (annotation.type === AT.ANNOTATION_CONDITIONAL_BREAKPOINT) { before = new mBreakpoint.LineConditionalBreakpoint(location, oldLine, annotation.title, annotation.title, true); after = new mBreakpoint.LineConditionalBreakpoint(location, newLine, annotation.title, annotation.title, true); } if (before && after) { this.debugService.updateBreakpoint(before, after, true); } } } }
javascript
function() { /** All events from last tick */ var pendingEvents = this._annotationChangedContext.events; var pendingLocations = this._annotationChangedContext.locations; var pendingModels = this._annotationChangedContext.textModels; /** All unique events from last tick */ var handlingEvents = []; var handlingLocations = []; var handlingModels = []; // Cleanup this._annotationChangedContext.timeout = undefined; this._annotationChangedContext.events = []; this._annotationChangedContext.locations = []; // Remove duplicate events for (var i = 0; i < pendingEvents.length; i++) { var duplicate = false; for (var j = 0; j < i; j++) { if (pendingEvents[i].textModelChangedEvent === pendingEvents[j].textModelChangedEvent) { duplicate = true; } break; } if (!duplicate) { handlingEvents.push(pendingEvents[i]); handlingLocations.push(pendingLocations[i]); handlingModels.push(pendingModels[i]); } } // Handle for (i = 0; i < handlingEvents.length; i++) { var e = handlingEvents[i]; for (j = 0; j < e.changed.length; j++) { var annotation = e.changed[j]; var location = handlingLocations[i]; var oldLine; var newLine = handlingModels[i].getLineAtOffset(annotation.start); if (annotation._oldStart > e.textModelChangedEvent.start) { oldLine = newLine - e.textModelChangedEvent.addedLineCount + e.textModelChangedEvent.removedLineCount; } else { oldLine = handlingModels[i].getLineAtOffset(annotation._oldStart); } var before = null; var after = null; if (annotation.type === AT.ANNOTATION_BOOKMARK) { before = new mBreakpoint.LineBookmark(location, oldLine, annotation.title); after = new mBreakpoint.LineBookmark(location, newLine, annotation.title); } else if (annotation.type === AT.ANNOTATION_BREAKPOINT) { before = new mBreakpoint.LineBreakpoint(location, oldLine, annotation.title, true); after = new mBreakpoint.LineBreakpoint(location, newLine, annotation.title, true); } else if (annotation.type === AT.ANNOTATION_CONDITIONAL_BREAKPOINT) { before = new mBreakpoint.LineConditionalBreakpoint(location, oldLine, annotation.title, annotation.title, true); after = new mBreakpoint.LineConditionalBreakpoint(location, newLine, annotation.title, annotation.title, true); } if (before && after) { this.debugService.updateBreakpoint(before, after, true); } } } }
[ "function", "(", ")", "{", "/** All events from last tick */", "var", "pendingEvents", "=", "this", ".", "_annotationChangedContext", ".", "events", ";", "var", "pendingLocations", "=", "this", ".", "_annotationChangedContext", ".", "locations", ";", "var", "pendingModels", "=", "this", ".", "_annotationChangedContext", ".", "textModels", ";", "/** All unique events from last tick */", "var", "handlingEvents", "=", "[", "]", ";", "var", "handlingLocations", "=", "[", "]", ";", "var", "handlingModels", "=", "[", "]", ";", "// Cleanup", "this", ".", "_annotationChangedContext", ".", "timeout", "=", "undefined", ";", "this", ".", "_annotationChangedContext", ".", "events", "=", "[", "]", ";", "this", ".", "_annotationChangedContext", ".", "locations", "=", "[", "]", ";", "// Remove duplicate events", "for", "(", "var", "i", "=", "0", ";", "i", "<", "pendingEvents", ".", "length", ";", "i", "++", ")", "{", "var", "duplicate", "=", "false", ";", "for", "(", "var", "j", "=", "0", ";", "j", "<", "i", ";", "j", "++", ")", "{", "if", "(", "pendingEvents", "[", "i", "]", ".", "textModelChangedEvent", "===", "pendingEvents", "[", "j", "]", ".", "textModelChangedEvent", ")", "{", "duplicate", "=", "true", ";", "}", "break", ";", "}", "if", "(", "!", "duplicate", ")", "{", "handlingEvents", ".", "push", "(", "pendingEvents", "[", "i", "]", ")", ";", "handlingLocations", ".", "push", "(", "pendingLocations", "[", "i", "]", ")", ";", "handlingModels", ".", "push", "(", "pendingModels", "[", "i", "]", ")", ";", "}", "}", "// Handle", "for", "(", "i", "=", "0", ";", "i", "<", "handlingEvents", ".", "length", ";", "i", "++", ")", "{", "var", "e", "=", "handlingEvents", "[", "i", "]", ";", "for", "(", "j", "=", "0", ";", "j", "<", "e", ".", "changed", ".", "length", ";", "j", "++", ")", "{", "var", "annotation", "=", "e", ".", "changed", "[", "j", "]", ";", "var", "location", "=", "handlingLocations", "[", "i", "]", ";", "var", "oldLine", ";", "var", "newLine", "=", "handlingModels", "[", "i", "]", ".", "getLineAtOffset", "(", "annotation", ".", "start", ")", ";", "if", "(", "annotation", ".", "_oldStart", ">", "e", ".", "textModelChangedEvent", ".", "start", ")", "{", "oldLine", "=", "newLine", "-", "e", ".", "textModelChangedEvent", ".", "addedLineCount", "+", "e", ".", "textModelChangedEvent", ".", "removedLineCount", ";", "}", "else", "{", "oldLine", "=", "handlingModels", "[", "i", "]", ".", "getLineAtOffset", "(", "annotation", ".", "_oldStart", ")", ";", "}", "var", "before", "=", "null", ";", "var", "after", "=", "null", ";", "if", "(", "annotation", ".", "type", "===", "AT", ".", "ANNOTATION_BOOKMARK", ")", "{", "before", "=", "new", "mBreakpoint", ".", "LineBookmark", "(", "location", ",", "oldLine", ",", "annotation", ".", "title", ")", ";", "after", "=", "new", "mBreakpoint", ".", "LineBookmark", "(", "location", ",", "newLine", ",", "annotation", ".", "title", ")", ";", "}", "else", "if", "(", "annotation", ".", "type", "===", "AT", ".", "ANNOTATION_BREAKPOINT", ")", "{", "before", "=", "new", "mBreakpoint", ".", "LineBreakpoint", "(", "location", ",", "oldLine", ",", "annotation", ".", "title", ",", "true", ")", ";", "after", "=", "new", "mBreakpoint", ".", "LineBreakpoint", "(", "location", ",", "newLine", ",", "annotation", ".", "title", ",", "true", ")", ";", "}", "else", "if", "(", "annotation", ".", "type", "===", "AT", ".", "ANNOTATION_CONDITIONAL_BREAKPOINT", ")", "{", "before", "=", "new", "mBreakpoint", ".", "LineConditionalBreakpoint", "(", "location", ",", "oldLine", ",", "annotation", ".", "title", ",", "annotation", ".", "title", ",", "true", ")", ";", "after", "=", "new", "mBreakpoint", ".", "LineConditionalBreakpoint", "(", "location", ",", "newLine", ",", "annotation", ".", "title", ",", "annotation", ".", "title", ",", "true", ")", ";", "}", "if", "(", "before", "&&", "after", ")", "{", "this", ".", "debugService", ".", "updateBreakpoint", "(", "before", ",", "after", ",", "true", ")", ";", "}", "}", "}", "}" ]
Handle all annotation changed events in the last tick. This avoids duplicate events from a single text model.
[ "Handle", "all", "annotation", "changed", "events", "in", "the", "last", "tick", ".", "This", "avoids", "duplicate", "events", "from", "a", "single", "text", "model", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/edit/setup.js#L1523-L1582
14,357
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/edit/setup.js
function(serviceRegistry, setup) { this._setup = setup; this._projectClient = serviceRegistry.getService("orion.project.client"); serviceRegistry.registerService("orion.edit.hover", this, { name: 'Hover Evaluation', contentType: ["application/javascript", "text/x-c++src", "text/x-python"] // TODO: get by sub-services }); }
javascript
function(serviceRegistry, setup) { this._setup = setup; this._projectClient = serviceRegistry.getService("orion.project.client"); serviceRegistry.registerService("orion.edit.hover", this, { name: 'Hover Evaluation', contentType: ["application/javascript", "text/x-c++src", "text/x-python"] // TODO: get by sub-services }); }
[ "function", "(", "serviceRegistry", ",", "setup", ")", "{", "this", ".", "_setup", "=", "setup", ";", "this", ".", "_projectClient", "=", "serviceRegistry", ".", "getService", "(", "\"orion.project.client\"", ")", ";", "serviceRegistry", ".", "registerService", "(", "\"orion.edit.hover\"", ",", "this", ",", "{", "name", ":", "'Hover Evaluation'", ",", "contentType", ":", "[", "\"application/javascript\"", ",", "\"text/x-c++src\"", ",", "\"text/x-python\"", "]", "// TODO: get by sub-services", "}", ")", ";", "}" ]
Provides hover evaluation by project @name orion.projects.HoverEvaluationService @param {orion.serviceregistry.ServiceRegistry} serviceRegistry @param {EditorSetup} setup - need this to get the current project
[ "Provides", "hover", "evaluation", "by", "project" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/edit/setup.js#L2353-L2360
14,358
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/edit/setup.js
function(editorContext, ctxt) { var promise = new Deferred(); var launchConf = this._setup.runBar.getSelectedLaunchConfiguration(); if (launchConf) { this._projectClient.getProjectDeployService(launchConf.ServiceId, launchConf.Type).then(function(service){ if (service && service.computeHoverInfo) { service.computeHoverInfo(launchConf, editorContext, ctxt).then(function(value) { promise.resolve(value); }, function() { promise.resolve(null); }); } else { console.error('Failed to evaluate hover.'); promise.resolve(null); } }); } else { promise.resolve(null); } return promise; }
javascript
function(editorContext, ctxt) { var promise = new Deferred(); var launchConf = this._setup.runBar.getSelectedLaunchConfiguration(); if (launchConf) { this._projectClient.getProjectDeployService(launchConf.ServiceId, launchConf.Type).then(function(service){ if (service && service.computeHoverInfo) { service.computeHoverInfo(launchConf, editorContext, ctxt).then(function(value) { promise.resolve(value); }, function() { promise.resolve(null); }); } else { console.error('Failed to evaluate hover.'); promise.resolve(null); } }); } else { promise.resolve(null); } return promise; }
[ "function", "(", "editorContext", ",", "ctxt", ")", "{", "var", "promise", "=", "new", "Deferred", "(", ")", ";", "var", "launchConf", "=", "this", ".", "_setup", ".", "runBar", ".", "getSelectedLaunchConfiguration", "(", ")", ";", "if", "(", "launchConf", ")", "{", "this", ".", "_projectClient", ".", "getProjectDeployService", "(", "launchConf", ".", "ServiceId", ",", "launchConf", ".", "Type", ")", ".", "then", "(", "function", "(", "service", ")", "{", "if", "(", "service", "&&", "service", ".", "computeHoverInfo", ")", "{", "service", ".", "computeHoverInfo", "(", "launchConf", ",", "editorContext", ",", "ctxt", ")", ".", "then", "(", "function", "(", "value", ")", "{", "promise", ".", "resolve", "(", "value", ")", ";", "}", ",", "function", "(", ")", "{", "promise", ".", "resolve", "(", "null", ")", ";", "}", ")", ";", "}", "else", "{", "console", ".", "error", "(", "'Failed to evaluate hover.'", ")", ";", "promise", ".", "resolve", "(", "null", ")", ";", "}", "}", ")", ";", "}", "else", "{", "promise", ".", "resolve", "(", "null", ")", ";", "}", "return", "promise", ";", "}" ]
Evaluate the hover @param {Object} editorContext @param {Object} ctxt @return {Promise.<string>}
[ "Evaluate", "the", "hover" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/edit/setup.js#L2369-L2389
14,359
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/fields/basic.js
StringField
function StringField(type, options) { Field.call(this, type, options); this.arg = new Argument(); this.element = util.createElement(this.document, 'input'); this.element.type = 'text'; this.element.classList.add('gcli-field'); this.onInputChange = this.onInputChange.bind(this); this.element.addEventListener('keyup', this.onInputChange, false); this.onFieldChange = util.createEvent('StringField.onFieldChange'); }
javascript
function StringField(type, options) { Field.call(this, type, options); this.arg = new Argument(); this.element = util.createElement(this.document, 'input'); this.element.type = 'text'; this.element.classList.add('gcli-field'); this.onInputChange = this.onInputChange.bind(this); this.element.addEventListener('keyup', this.onInputChange, false); this.onFieldChange = util.createEvent('StringField.onFieldChange'); }
[ "function", "StringField", "(", "type", ",", "options", ")", "{", "Field", ".", "call", "(", "this", ",", "type", ",", "options", ")", ";", "this", ".", "arg", "=", "new", "Argument", "(", ")", ";", "this", ".", "element", "=", "util", ".", "createElement", "(", "this", ".", "document", ",", "'input'", ")", ";", "this", ".", "element", ".", "type", "=", "'text'", ";", "this", ".", "element", ".", "classList", ".", "add", "(", "'gcli-field'", ")", ";", "this", ".", "onInputChange", "=", "this", ".", "onInputChange", ".", "bind", "(", "this", ")", ";", "this", ".", "element", ".", "addEventListener", "(", "'keyup'", ",", "this", ".", "onInputChange", ",", "false", ")", ";", "this", ".", "onFieldChange", "=", "util", ".", "createEvent", "(", "'StringField.onFieldChange'", ")", ";", "}" ]
A field that allows editing of strings
[ "A", "field", "that", "allows", "editing", "of", "strings" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/fields/basic.js#L63-L75
14,360
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/fields/basic.js
BooleanField
function BooleanField(type, options) { Field.call(this, type, options); this.name = options.name; this.named = options.named; this.element = util.createElement(this.document, 'input'); this.element.type = 'checkbox'; this.element.id = 'gcliForm' + this.name; this.onInputChange = this.onInputChange.bind(this); this.element.addEventListener('change', this.onInputChange, false); this.onFieldChange = util.createEvent('BooleanField.onFieldChange'); }
javascript
function BooleanField(type, options) { Field.call(this, type, options); this.name = options.name; this.named = options.named; this.element = util.createElement(this.document, 'input'); this.element.type = 'checkbox'; this.element.id = 'gcliForm' + this.name; this.onInputChange = this.onInputChange.bind(this); this.element.addEventListener('change', this.onInputChange, false); this.onFieldChange = util.createEvent('BooleanField.onFieldChange'); }
[ "function", "BooleanField", "(", "type", ",", "options", ")", "{", "Field", ".", "call", "(", "this", ",", "type", ",", "options", ")", ";", "this", ".", "name", "=", "options", ".", "name", ";", "this", ".", "named", "=", "options", ".", "named", ";", "this", ".", "element", "=", "util", ".", "createElement", "(", "this", ".", "document", ",", "'input'", ")", ";", "this", ".", "element", ".", "type", "=", "'checkbox'", ";", "this", ".", "element", ".", "id", "=", "'gcliForm'", "+", "this", ".", "name", ";", "this", ".", "onInputChange", "=", "this", ".", "onInputChange", ".", "bind", "(", "this", ")", ";", "this", ".", "element", ".", "addEventListener", "(", "'change'", ",", "this", ".", "onInputChange", ",", "false", ")", ";", "this", ".", "onFieldChange", "=", "util", ".", "createEvent", "(", "'BooleanField.onFieldChange'", ")", ";", "}" ]
A field that uses a checkbox to toggle a boolean field
[ "A", "field", "that", "uses", "a", "checkbox", "to", "toggle", "a", "boolean", "field" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/fields/basic.js#L158-L172
14,361
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/fields/basic.js
DelegateField
function DelegateField(type, options) { Field.call(this, type, options); this.options = options; this.requisition.onAssignmentChange.add(this.update, this); this.element = util.createElement(this.document, 'div'); this.update(); this.onFieldChange = util.createEvent('DelegateField.onFieldChange'); }
javascript
function DelegateField(type, options) { Field.call(this, type, options); this.options = options; this.requisition.onAssignmentChange.add(this.update, this); this.element = util.createElement(this.document, 'div'); this.update(); this.onFieldChange = util.createEvent('DelegateField.onFieldChange'); }
[ "function", "DelegateField", "(", "type", ",", "options", ")", "{", "Field", ".", "call", "(", "this", ",", "type", ",", "options", ")", ";", "this", ".", "options", "=", "options", ";", "this", ".", "requisition", ".", "onAssignmentChange", ".", "add", "(", "this", ".", "update", ",", "this", ")", ";", "this", ".", "element", "=", "util", ".", "createElement", "(", "this", ".", "document", ",", "'div'", ")", ";", "this", ".", "update", "(", ")", ";", "this", ".", "onFieldChange", "=", "util", ".", "createEvent", "(", "'DelegateField.onFieldChange'", ")", ";", "}" ]
A field that works with delegate types by delaying resolution until that last possible time
[ "A", "field", "that", "works", "with", "delegate", "types", "by", "delaying", "resolution", "until", "that", "last", "possible", "time" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/fields/basic.js#L211-L220
14,362
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/editorCommands.js
function() { this._createSettingsCommand(); this._createGotoLineCommnand(); this._createFindCommnand(); this._createBlameCommand(); this._createDiffCommand(); this._createShowTooltipCommand(); this._createUndoStackCommands(); this._createClipboardCommands(); this._createDelimiterCommands(); this._createEncodingCommand(); this._createFormatterCommand(); this._createSaveCommand(); this._createOpenFolderCommand(); this._createOpenRecentCommand(); this._createSwitchWorkspaceCommand(); this._createReferencesCommand(); this._createOpenDeclCommand(); return this._createEditCommands(); }
javascript
function() { this._createSettingsCommand(); this._createGotoLineCommnand(); this._createFindCommnand(); this._createBlameCommand(); this._createDiffCommand(); this._createShowTooltipCommand(); this._createUndoStackCommands(); this._createClipboardCommands(); this._createDelimiterCommands(); this._createEncodingCommand(); this._createFormatterCommand(); this._createSaveCommand(); this._createOpenFolderCommand(); this._createOpenRecentCommand(); this._createSwitchWorkspaceCommand(); this._createReferencesCommand(); this._createOpenDeclCommand(); return this._createEditCommands(); }
[ "function", "(", ")", "{", "this", ".", "_createSettingsCommand", "(", ")", ";", "this", ".", "_createGotoLineCommnand", "(", ")", ";", "this", ".", "_createFindCommnand", "(", ")", ";", "this", ".", "_createBlameCommand", "(", ")", ";", "this", ".", "_createDiffCommand", "(", ")", ";", "this", ".", "_createShowTooltipCommand", "(", ")", ";", "this", ".", "_createUndoStackCommands", "(", ")", ";", "this", ".", "_createClipboardCommands", "(", ")", ";", "this", ".", "_createDelimiterCommands", "(", ")", ";", "this", ".", "_createEncodingCommand", "(", ")", ";", "this", ".", "_createFormatterCommand", "(", ")", ";", "this", ".", "_createSaveCommand", "(", ")", ";", "this", ".", "_createOpenFolderCommand", "(", ")", ";", "this", ".", "_createOpenRecentCommand", "(", ")", ";", "this", ".", "_createSwitchWorkspaceCommand", "(", ")", ";", "this", ".", "_createReferencesCommand", "(", ")", ";", "this", ".", "_createOpenDeclCommand", "(", ")", ";", "return", "this", ".", "_createEditCommands", "(", ")", ";", "}" ]
Creates the common text editing commands. Also generates commands for any installed plug-ins that contribute editor actions.
[ "Creates", "the", "common", "text", "editing", "commands", ".", "Also", "generates", "commands", "for", "any", "installed", "plug", "-", "ins", "that", "contribute", "editor", "actions", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/editorCommands.js#L175-L195
14,363
eclipse/orion.client
bundles/org.eclipse.orion.client.javascript/web/javascript/astManager.js
ASTManager
function ASTManager(serviceRegistry, jsProject) { this.cache = new LRU(10); this.orionAcorn = new OrionAcorn(); this.jsProject = jsProject; registry = serviceRegistry; }
javascript
function ASTManager(serviceRegistry, jsProject) { this.cache = new LRU(10); this.orionAcorn = new OrionAcorn(); this.jsProject = jsProject; registry = serviceRegistry; }
[ "function", "ASTManager", "(", "serviceRegistry", ",", "jsProject", ")", "{", "this", ".", "cache", "=", "new", "LRU", "(", "10", ")", ";", "this", ".", "orionAcorn", "=", "new", "OrionAcorn", "(", ")", ";", "this", ".", "jsProject", "=", "jsProject", ";", "registry", "=", "serviceRegistry", ";", "}" ]
Provides a shared AST. @name javascript.ASTManager @class Provides a shared AST. @param {?} serviceRegistry The platform service registry @param {?} servjsProject The backing project context
[ "Provides", "a", "shared", "AST", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/javascript/astManager.js#L30-L35
14,364
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js
CommandRegistry
function CommandRegistry(options) { this._commandList = {}; this._contributionsByScopeId = {}; this._activeBindings = {}; this._urlBindings = {}; this._pendingBindings = {}; // bindings for as-yet-unknown commands this._parameterCollector = null; this._init(options || {}); }
javascript
function CommandRegistry(options) { this._commandList = {}; this._contributionsByScopeId = {}; this._activeBindings = {}; this._urlBindings = {}; this._pendingBindings = {}; // bindings for as-yet-unknown commands this._parameterCollector = null; this._init(options || {}); }
[ "function", "CommandRegistry", "(", "options", ")", "{", "this", ".", "_commandList", "=", "{", "}", ";", "this", ".", "_contributionsByScopeId", "=", "{", "}", ";", "this", ".", "_activeBindings", "=", "{", "}", ";", "this", ".", "_urlBindings", "=", "{", "}", ";", "this", ".", "_pendingBindings", "=", "{", "}", ";", "// bindings for as-yet-unknown commands", "this", ".", "_parameterCollector", "=", "null", ";", "this", ".", "_init", "(", "options", "||", "{", "}", ")", ";", "}" ]
Constructs a new command registry with the given options. @class CommandRegistry can render commands appropriate for a particular scope and DOM element. @name orion.commandregistry.CommandRegistry @param {Object} options The registry options object @param {orion.selection.Selection} [options.selection] Optional selection service.
[ "Constructs", "a", "new", "command", "registry", "with", "the", "given", "options", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js#L37-L45
14,365
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js
function(url) { for (var id in this._urlBindings) { if (this._urlBindings[id] && this._urlBindings[id].urlBinding && this._urlBindings[id].command) { var match = this._urlBindings[id].urlBinding.match(url); if (match) { var urlBinding = this._urlBindings[id]; var command = urlBinding.command; var invocation = urlBinding.invocation; // If the command has not rendered (visibleWhen=false, etc.) we don't have an invocation. if (invocation && invocation.parameters && command.callback) { invocation.parameters.setValue(match.parameterName, match.parameterValue); var self = this; window.setTimeout(function() { self._invoke(invocation); }, 0); return; } } } } }
javascript
function(url) { for (var id in this._urlBindings) { if (this._urlBindings[id] && this._urlBindings[id].urlBinding && this._urlBindings[id].command) { var match = this._urlBindings[id].urlBinding.match(url); if (match) { var urlBinding = this._urlBindings[id]; var command = urlBinding.command; var invocation = urlBinding.invocation; // If the command has not rendered (visibleWhen=false, etc.) we don't have an invocation. if (invocation && invocation.parameters && command.callback) { invocation.parameters.setValue(match.parameterName, match.parameterValue); var self = this; window.setTimeout(function() { self._invoke(invocation); }, 0); return; } } } } }
[ "function", "(", "url", ")", "{", "for", "(", "var", "id", "in", "this", ".", "_urlBindings", ")", "{", "if", "(", "this", ".", "_urlBindings", "[", "id", "]", "&&", "this", ".", "_urlBindings", "[", "id", "]", ".", "urlBinding", "&&", "this", ".", "_urlBindings", "[", "id", "]", ".", "command", ")", "{", "var", "match", "=", "this", ".", "_urlBindings", "[", "id", "]", ".", "urlBinding", ".", "match", "(", "url", ")", ";", "if", "(", "match", ")", "{", "var", "urlBinding", "=", "this", ".", "_urlBindings", "[", "id", "]", ";", "var", "command", "=", "urlBinding", ".", "command", ";", "var", "invocation", "=", "urlBinding", ".", "invocation", ";", "// If the command has not rendered (visibleWhen=false, etc.) we don't have an invocation.", "if", "(", "invocation", "&&", "invocation", ".", "parameters", "&&", "command", ".", "callback", ")", "{", "invocation", ".", "parameters", ".", "setValue", "(", "match", ".", "parameterName", ",", "match", ".", "parameterValue", ")", ";", "var", "self", "=", "this", ";", "window", ".", "setTimeout", "(", "function", "(", ")", "{", "self", ".", "_invoke", "(", "invocation", ")", ";", "}", ",", "0", ")", ";", "return", ";", "}", "}", "}", "}", "}" ]
Process the provided URL to determine whether any commands should be invoked. Note that we never invoke a command callback by URL, only its parameter collector. If a parameter collector is not specified, commands in the URL will be ignored. @param {String} url a url that may contain URL bindings.
[ "Process", "the", "provided", "URL", "to", "determine", "whether", "any", "commands", "should", "be", "invoked", ".", "Note", "that", "we", "never", "invoke", "a", "command", "callback", "by", "URL", "only", "its", "parameter", "collector", ".", "If", "a", "parameter", "collector", "is", "not", "specified", "commands", "in", "the", "URL", "will", "be", "ignored", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js#L92-L112
14,366
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js
function(commandId, item, handler, parameters, userData, parent) { var self = this; if (item) { var command = this._commandList[commandId]; var enabled = command && (command.visibleWhen ? command.visibleWhen(item) : true); if (enabled && command.callback) { var commandInvocation = new Commands.CommandInvocation(handler, item, userData, command, self); commandInvocation.domParent = parent; return self._invoke(commandInvocation, parameters); } } else { //TODO should we be keeping invocation context for commands without bindings? var binding = this._urlBindings[commandId]; if (binding && binding.command) { if (binding.command.callback) { return self._invoke(binding.invocation, parameters); } } } }
javascript
function(commandId, item, handler, parameters, userData, parent) { var self = this; if (item) { var command = this._commandList[commandId]; var enabled = command && (command.visibleWhen ? command.visibleWhen(item) : true); if (enabled && command.callback) { var commandInvocation = new Commands.CommandInvocation(handler, item, userData, command, self); commandInvocation.domParent = parent; return self._invoke(commandInvocation, parameters); } } else { //TODO should we be keeping invocation context for commands without bindings? var binding = this._urlBindings[commandId]; if (binding && binding.command) { if (binding.command.callback) { return self._invoke(binding.invocation, parameters); } } } }
[ "function", "(", "commandId", ",", "item", ",", "handler", ",", "parameters", ",", "userData", ",", "parent", ")", "{", "var", "self", "=", "this", ";", "if", "(", "item", ")", "{", "var", "command", "=", "this", ".", "_commandList", "[", "commandId", "]", ";", "var", "enabled", "=", "command", "&&", "(", "command", ".", "visibleWhen", "?", "command", ".", "visibleWhen", "(", "item", ")", ":", "true", ")", ";", "if", "(", "enabled", "&&", "command", ".", "callback", ")", "{", "var", "commandInvocation", "=", "new", "Commands", ".", "CommandInvocation", "(", "handler", ",", "item", ",", "userData", ",", "command", ",", "self", ")", ";", "commandInvocation", ".", "domParent", "=", "parent", ";", "return", "self", ".", "_invoke", "(", "commandInvocation", ",", "parameters", ")", ";", "}", "}", "else", "{", "//TODO should we be keeping invocation context for commands without bindings? ", "var", "binding", "=", "this", ".", "_urlBindings", "[", "commandId", "]", ";", "if", "(", "binding", "&&", "binding", ".", "command", ")", "{", "if", "(", "binding", ".", "command", ".", "callback", ")", "{", "return", "self", ".", "_invoke", "(", "binding", ".", "invocation", ",", "parameters", ")", ";", "}", "}", "}", "}" ]
Run the command with the specified commandId. @param {String} commandId the id of the command to run. @param {Object} item the item on which the command should run. @param {Object} handler the handler for the command. @param {orion.commands.ParametersDescription} [parameters] Parameters used on this invocation. Optional. @param {Object} [userData] Optional user data that should be attached to generated command callbacks. @param {DOMElement} [parent] Optional parent for the parameter collector. Note: The current implementation will only run the command if a URL binding has been specified, or if an item to run the command against has been specified.
[ "Run", "the", "command", "with", "the", "specified", "commandId", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js#L135-L154
14,367
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js
function(node, fillFunction, onClose, name) { if (this._parameterCollector) { this._parameterCollector.close(); this._parameterCollector.open(node, fillFunction, onClose, name); } }
javascript
function(node, fillFunction, onClose, name) { if (this._parameterCollector) { this._parameterCollector.close(); this._parameterCollector.open(node, fillFunction, onClose, name); } }
[ "function", "(", "node", ",", "fillFunction", ",", "onClose", ",", "name", ")", "{", "if", "(", "this", ".", "_parameterCollector", ")", "{", "this", ".", "_parameterCollector", ".", "close", "(", ")", ";", "this", ".", "_parameterCollector", ".", "open", "(", "node", ",", "fillFunction", ",", "onClose", ",", "name", ")", ";", "}", "}" ]
Open a parameter collector suitable for collecting information about a command. Once a collector is created, the specified function is used to fill it with information needed by the command. This method is used for commands that cannot rely on a simple parameter description to collect parameters. Commands that describe their required parameters do not need to use this method because the command framework will open and close parameter collectors as needed and call the command callback with the values of those parameters. @param {DOMElement} node the dom node that is displaying the command, or a node in the parameter collector area @param {Function} fillFunction a function that will fill the parameter area @param {Function} onClose a function that will be called when the user closes the collector @param {String} name the label that will be used for the dialog title
[ "Open", "a", "parameter", "collector", "suitable", "for", "collecting", "information", "about", "a", "command", ".", "Once", "a", "collector", "is", "created", "the", "specified", "function", "is", "used", "to", "fill", "it", "with", "information", "needed", "by", "the", "command", ".", "This", "method", "is", "used", "for", "commands", "that", "cannot", "rely", "on", "a", "simple", "parameter", "description", "to", "collect", "parameters", ".", "Commands", "that", "describe", "their", "required", "parameters", "do", "not", "need", "to", "use", "this", "method", "because", "the", "command", "framework", "will", "open", "and", "close", "parameter", "collectors", "as", "needed", "and", "call", "the", "command", "callback", "with", "the", "values", "of", "those", "parameters", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js#L226-L231
14,368
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js
function(node, message, yesString, noString, modal, onConfirm) { this._popupDialog(modal,"CONFIRM", node, message, [{label:yesString,callback:onConfirm,type:"ok"},{label:noString,callback:null,type:"cancel"}]); }
javascript
function(node, message, yesString, noString, modal, onConfirm) { this._popupDialog(modal,"CONFIRM", node, message, [{label:yesString,callback:onConfirm,type:"ok"},{label:noString,callback:null,type:"cancel"}]); }
[ "function", "(", "node", ",", "message", ",", "yesString", ",", "noString", ",", "modal", ",", "onConfirm", ")", "{", "this", ".", "_popupDialog", "(", "modal", ",", "\"CONFIRM\"", ",", "node", ",", "message", ",", "[", "{", "label", ":", "yesString", ",", "callback", ":", "onConfirm", ",", "type", ":", "\"ok\"", "}", ",", "{", "label", ":", "noString", ",", "callback", ":", "null", ",", "type", ":", "\"cancel\"", "}", "]", ")", ";", "}" ]
Open a parameter collector to confirm a command. @param {DOMElement} node the dom node that is displaying the command @param {String} message the message to show when confirming the command @param {String} yesString the label to show on a yes/true choice @param {String} noString the label to show on a no/false choice @param {Boolean} modal indicates whether the confirmation prompt should be modal. @param {Function} onConfirm a function that will be called when the user confirms the command. The function will be called with boolean indicating whether the command was confirmed.
[ "Open", "a", "parameter", "collector", "to", "confirm", "a", "command", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js#L244-L246
14,369
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js
function(node, message, yesString, onConfirm) { this._popupDialog(false, "ALERT", node, message, [{label:yesString,callback:onConfirm,type:"ok"}]); }
javascript
function(node, message, yesString, onConfirm) { this._popupDialog(false, "ALERT", node, message, [{label:yesString,callback:onConfirm,type:"ok"}]); }
[ "function", "(", "node", ",", "message", ",", "yesString", ",", "onConfirm", ")", "{", "this", ".", "_popupDialog", "(", "false", ",", "\"ALERT\"", ",", "node", ",", "message", ",", "[", "{", "label", ":", "yesString", ",", "callback", ":", "onConfirm", ",", "type", ":", "\"ok\"", "}", "]", ")", ";", "}" ]
Open an alert tooltip @param {DOMElement} node the dom node that is displaying the command @param {String} message the message to show when confirming the command @param {String} yesString the label to show on a yes/true choice @param {Function} onConfirm a function that will be called when the user confirms the command. The function will be called with boolean indicating whether the command was confirmed.
[ "Open", "an", "alert", "tooltip" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js#L257-L259
14,370
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js
function(node, message, yesString, noString, defaultInput, modal, onConfirm, positionString) { var position = null; if(positionString === "below"){position = ["below", "right", "above", "left"];} else if(positionString === "right"){position = ["right", "above", "below", "left"];} this._popupDialog(modal,"PROMPT", node, message, [{label:yesString,callback:onConfirm,type:"ok"},{label:noString,callback:null,type:"cancel"}], defaultInput, position); }
javascript
function(node, message, yesString, noString, defaultInput, modal, onConfirm, positionString) { var position = null; if(positionString === "below"){position = ["below", "right", "above", "left"];} else if(positionString === "right"){position = ["right", "above", "below", "left"];} this._popupDialog(modal,"PROMPT", node, message, [{label:yesString,callback:onConfirm,type:"ok"},{label:noString,callback:null,type:"cancel"}], defaultInput, position); }
[ "function", "(", "node", ",", "message", ",", "yesString", ",", "noString", ",", "defaultInput", ",", "modal", ",", "onConfirm", ",", "positionString", ")", "{", "var", "position", "=", "null", ";", "if", "(", "positionString", "===", "\"below\"", ")", "{", "position", "=", "[", "\"below\"", ",", "\"right\"", ",", "\"above\"", ",", "\"left\"", "]", ";", "}", "else", "if", "(", "positionString", "===", "\"right\"", ")", "{", "position", "=", "[", "\"right\"", ",", "\"above\"", ",", "\"below\"", ",", "\"left\"", "]", ";", "}", "this", ".", "_popupDialog", "(", "modal", ",", "\"PROMPT\"", ",", "node", ",", "message", ",", "[", "{", "label", ":", "yesString", ",", "callback", ":", "onConfirm", ",", "type", ":", "\"ok\"", "}", ",", "{", "label", ":", "noString", ",", "callback", ":", "null", ",", "type", ":", "\"cancel\"", "}", "]", ",", "defaultInput", ",", "position", ")", ";", "}" ]
Open a tolltip parameter collector to collect user input. @param {DOMElement} node the dom node that is displaying the command @param {String} message the message to show when confirming the command @param {String} yesString the label to show on a yes/true choice @param {String} noString the label to show on a no/false choice @param {String} default message in the input box. @param {Boolean} modal indicates whether the confirmation prompt should be modal. @param {Function} onConfirm a function that will be called when the user confirms the command. The function will be called with boolean indicating whether the command was confirmed. @param [Optional]{String} postion of the popupDialog if specified, have to be one of "below", "right"
[ "Open", "a", "tolltip", "parameter", "collector", "to", "collect", "user", "input", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js#L384-L389
14,371
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js
function(keyAssist) { var scopes = {}; var binding; // see commands.js _processKey function execute(activeBinding) { return function() { Commands.executeBinding(activeBinding); }; } var bindings = []; for (var aBinding in this._activeBindings) { binding = this._activeBindings[aBinding]; if (binding && binding.keyBinding && binding.command && (binding.command.name || binding.command.tooltip)) { bindings.push(binding); } } bindings.sort(function (a, b) { var ta = a.command.name || a.command.tooltip; var tb = b.command.name || b.command.tooltip; return ta.localeCompare(tb); }); for (var i=0; i<bindings.length; i++) { binding = bindings[i]; // skip scopes and process at end if (binding.keyBinding.scopeName) { if (!scopes[binding.keyBinding.scopeName]) { scopes[binding.keyBinding.scopeName] = []; } scopes[binding.keyBinding.scopeName].push(binding); } else { keyAssist.createItem(binding.keyBinding, binding.command.name || binding.command.tooltip, binding.command.id, execute(binding)); } } for (var scopedBinding in scopes) { if (scopes[scopedBinding].length && scopes[scopedBinding].length > 0) { keyAssist.createHeader(scopedBinding, lib.validId(scopedBinding) + "Scope"); //$NON-NLS-0$ scopes[scopedBinding].forEach(function(binding) { keyAssist.createItem(binding.keyBinding, binding.command.name || binding.command.tooltip, binding.command.id, execute(binding)); }); } } }
javascript
function(keyAssist) { var scopes = {}; var binding; // see commands.js _processKey function execute(activeBinding) { return function() { Commands.executeBinding(activeBinding); }; } var bindings = []; for (var aBinding in this._activeBindings) { binding = this._activeBindings[aBinding]; if (binding && binding.keyBinding && binding.command && (binding.command.name || binding.command.tooltip)) { bindings.push(binding); } } bindings.sort(function (a, b) { var ta = a.command.name || a.command.tooltip; var tb = b.command.name || b.command.tooltip; return ta.localeCompare(tb); }); for (var i=0; i<bindings.length; i++) { binding = bindings[i]; // skip scopes and process at end if (binding.keyBinding.scopeName) { if (!scopes[binding.keyBinding.scopeName]) { scopes[binding.keyBinding.scopeName] = []; } scopes[binding.keyBinding.scopeName].push(binding); } else { keyAssist.createItem(binding.keyBinding, binding.command.name || binding.command.tooltip, binding.command.id, execute(binding)); } } for (var scopedBinding in scopes) { if (scopes[scopedBinding].length && scopes[scopedBinding].length > 0) { keyAssist.createHeader(scopedBinding, lib.validId(scopedBinding) + "Scope"); //$NON-NLS-0$ scopes[scopedBinding].forEach(function(binding) { keyAssist.createItem(binding.keyBinding, binding.command.name || binding.command.tooltip, binding.command.id, execute(binding)); }); } } }
[ "function", "(", "keyAssist", ")", "{", "var", "scopes", "=", "{", "}", ";", "var", "binding", ";", "// see commands.js _processKey", "function", "execute", "(", "activeBinding", ")", "{", "return", "function", "(", ")", "{", "Commands", ".", "executeBinding", "(", "activeBinding", ")", ";", "}", ";", "}", "var", "bindings", "=", "[", "]", ";", "for", "(", "var", "aBinding", "in", "this", ".", "_activeBindings", ")", "{", "binding", "=", "this", ".", "_activeBindings", "[", "aBinding", "]", ";", "if", "(", "binding", "&&", "binding", ".", "keyBinding", "&&", "binding", ".", "command", "&&", "(", "binding", ".", "command", ".", "name", "||", "binding", ".", "command", ".", "tooltip", ")", ")", "{", "bindings", ".", "push", "(", "binding", ")", ";", "}", "}", "bindings", ".", "sort", "(", "function", "(", "a", ",", "b", ")", "{", "var", "ta", "=", "a", ".", "command", ".", "name", "||", "a", ".", "command", ".", "tooltip", ";", "var", "tb", "=", "b", ".", "command", ".", "name", "||", "b", ".", "command", ".", "tooltip", ";", "return", "ta", ".", "localeCompare", "(", "tb", ")", ";", "}", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "bindings", ".", "length", ";", "i", "++", ")", "{", "binding", "=", "bindings", "[", "i", "]", ";", "// skip scopes and process at end", "if", "(", "binding", ".", "keyBinding", ".", "scopeName", ")", "{", "if", "(", "!", "scopes", "[", "binding", ".", "keyBinding", ".", "scopeName", "]", ")", "{", "scopes", "[", "binding", ".", "keyBinding", ".", "scopeName", "]", "=", "[", "]", ";", "}", "scopes", "[", "binding", ".", "keyBinding", ".", "scopeName", "]", ".", "push", "(", "binding", ")", ";", "}", "else", "{", "keyAssist", ".", "createItem", "(", "binding", ".", "keyBinding", ",", "binding", ".", "command", ".", "name", "||", "binding", ".", "command", ".", "tooltip", ",", "binding", ".", "command", ".", "id", ",", "execute", "(", "binding", ")", ")", ";", "}", "}", "for", "(", "var", "scopedBinding", "in", "scopes", ")", "{", "if", "(", "scopes", "[", "scopedBinding", "]", ".", "length", "&&", "scopes", "[", "scopedBinding", "]", ".", "length", ">", "0", ")", "{", "keyAssist", ".", "createHeader", "(", "scopedBinding", ",", "lib", ".", "validId", "(", "scopedBinding", ")", "+", "\"Scope\"", ")", ";", "//$NON-NLS-0$", "scopes", "[", "scopedBinding", "]", ".", "forEach", "(", "function", "(", "binding", ")", "{", "keyAssist", ".", "createItem", "(", "binding", ".", "keyBinding", ",", "binding", ".", "command", ".", "name", "||", "binding", ".", "command", ".", "tooltip", ",", "binding", ".", "command", ".", "id", ",", "execute", "(", "binding", ")", ")", ";", "}", ")", ";", "}", "}", "}" ]
Show the keybindings that are registered with the command registry inside the specified target node. @param {KeyAssistPanel} keyAssist the key assist panel
[ "Show", "the", "keybindings", "that", "are", "registered", "with", "the", "command", "registry", "inside", "the", "specified", "target", "node", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js#L524-L566
14,372
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js
function(command) { this._commandList[command.id] = command; // Resolve any pending key/url bindings against this command var pending = this._pendingBindings[command.id]; if (pending) { var _self = this; pending.forEach(function(binding) { _self._addBinding(command, binding.type, binding.binding, binding.bindingOnly); }); delete this._pendingBindings[command.id]; } }
javascript
function(command) { this._commandList[command.id] = command; // Resolve any pending key/url bindings against this command var pending = this._pendingBindings[command.id]; if (pending) { var _self = this; pending.forEach(function(binding) { _self._addBinding(command, binding.type, binding.binding, binding.bindingOnly); }); delete this._pendingBindings[command.id]; } }
[ "function", "(", "command", ")", "{", "this", ".", "_commandList", "[", "command", ".", "id", "]", "=", "command", ";", "// Resolve any pending key/url bindings against this command", "var", "pending", "=", "this", ".", "_pendingBindings", "[", "command", ".", "id", "]", ";", "if", "(", "pending", ")", "{", "var", "_self", "=", "this", ";", "pending", ".", "forEach", "(", "function", "(", "binding", ")", "{", "_self", ".", "_addBinding", "(", "command", ",", "binding", ".", "type", ",", "binding", ".", "binding", ",", "binding", ".", "bindingOnly", ")", ";", "}", ")", ";", "delete", "this", ".", "_pendingBindings", "[", "command", ".", "id", "]", ";", "}", "}" ]
Add a command to the command registry. Nothing will be shown in the UI until this command is referenced in a contribution. @param {orion.commands.Command} command The command being added. @see registerCommandContribution
[ "Add", "a", "command", "to", "the", "command", "registry", ".", "Nothing", "will", "be", "shown", "in", "the", "UI", "until", "this", "command", "is", "referenced", "in", "a", "contribution", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js#L703-L714
14,373
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js
function(scopeId, groupId, position, title, parentPath, emptyGroupMessage, imageClass, tooltip, selectionClass, defaultActionId, extraClasses) { if (!this._contributionsByScopeId[scopeId]) { this._contributionsByScopeId[scopeId] = {}; } var parentTable = this._contributionsByScopeId[scopeId]; if (parentPath) { parentTable = this._createEntryForPath(parentTable, parentPath); } if (parentTable[groupId]) { // update existing group definition if info has been supplied if (title) { parentTable[groupId].title = title; } if (position) { parentTable[groupId].position = position; } if (imageClass) { parentTable[groupId].imageClass = imageClass; } if (tooltip) { parentTable[groupId].tooltip = tooltip; } if (selectionClass) { parentTable[groupId].selectionClass = selectionClass; } if (extraClasses) { parentTable[groupId].extraClass = extraClasses; } if(defaultActionId === true){ parentTable[groupId].pretendDefaultActionId = true; } else { parentTable[groupId].defaultActionId = defaultActionId; } parentTable[groupId].emptyGroupMessage = emptyGroupMessage; } else { // create new group definition parentTable[groupId] = {title: title, position: position, emptyGroupMessage: emptyGroupMessage, imageClass: imageClass, tooltip: tooltip, selectionClass: selectionClass, defaultActionId: defaultActionId === true ? null : defaultActionId, pretendDefaultActionId: defaultActionId === true, children: {}, extraClasses: extraClasses}; parentTable.sortedContributions = null; } }
javascript
function(scopeId, groupId, position, title, parentPath, emptyGroupMessage, imageClass, tooltip, selectionClass, defaultActionId, extraClasses) { if (!this._contributionsByScopeId[scopeId]) { this._contributionsByScopeId[scopeId] = {}; } var parentTable = this._contributionsByScopeId[scopeId]; if (parentPath) { parentTable = this._createEntryForPath(parentTable, parentPath); } if (parentTable[groupId]) { // update existing group definition if info has been supplied if (title) { parentTable[groupId].title = title; } if (position) { parentTable[groupId].position = position; } if (imageClass) { parentTable[groupId].imageClass = imageClass; } if (tooltip) { parentTable[groupId].tooltip = tooltip; } if (selectionClass) { parentTable[groupId].selectionClass = selectionClass; } if (extraClasses) { parentTable[groupId].extraClass = extraClasses; } if(defaultActionId === true){ parentTable[groupId].pretendDefaultActionId = true; } else { parentTable[groupId].defaultActionId = defaultActionId; } parentTable[groupId].emptyGroupMessage = emptyGroupMessage; } else { // create new group definition parentTable[groupId] = {title: title, position: position, emptyGroupMessage: emptyGroupMessage, imageClass: imageClass, tooltip: tooltip, selectionClass: selectionClass, defaultActionId: defaultActionId === true ? null : defaultActionId, pretendDefaultActionId: defaultActionId === true, children: {}, extraClasses: extraClasses}; parentTable.sortedContributions = null; } }
[ "function", "(", "scopeId", ",", "groupId", ",", "position", ",", "title", ",", "parentPath", ",", "emptyGroupMessage", ",", "imageClass", ",", "tooltip", ",", "selectionClass", ",", "defaultActionId", ",", "extraClasses", ")", "{", "if", "(", "!", "this", ".", "_contributionsByScopeId", "[", "scopeId", "]", ")", "{", "this", ".", "_contributionsByScopeId", "[", "scopeId", "]", "=", "{", "}", ";", "}", "var", "parentTable", "=", "this", ".", "_contributionsByScopeId", "[", "scopeId", "]", ";", "if", "(", "parentPath", ")", "{", "parentTable", "=", "this", ".", "_createEntryForPath", "(", "parentTable", ",", "parentPath", ")", ";", "}", "if", "(", "parentTable", "[", "groupId", "]", ")", "{", "// update existing group definition if info has been supplied", "if", "(", "title", ")", "{", "parentTable", "[", "groupId", "]", ".", "title", "=", "title", ";", "}", "if", "(", "position", ")", "{", "parentTable", "[", "groupId", "]", ".", "position", "=", "position", ";", "}", "if", "(", "imageClass", ")", "{", "parentTable", "[", "groupId", "]", ".", "imageClass", "=", "imageClass", ";", "}", "if", "(", "tooltip", ")", "{", "parentTable", "[", "groupId", "]", ".", "tooltip", "=", "tooltip", ";", "}", "if", "(", "selectionClass", ")", "{", "parentTable", "[", "groupId", "]", ".", "selectionClass", "=", "selectionClass", ";", "}", "if", "(", "extraClasses", ")", "{", "parentTable", "[", "groupId", "]", ".", "extraClass", "=", "extraClasses", ";", "}", "if", "(", "defaultActionId", "===", "true", ")", "{", "parentTable", "[", "groupId", "]", ".", "pretendDefaultActionId", "=", "true", ";", "}", "else", "{", "parentTable", "[", "groupId", "]", ".", "defaultActionId", "=", "defaultActionId", ";", "}", "parentTable", "[", "groupId", "]", ".", "emptyGroupMessage", "=", "emptyGroupMessage", ";", "}", "else", "{", "// create new group definition", "parentTable", "[", "groupId", "]", "=", "{", "title", ":", "title", ",", "position", ":", "position", ",", "emptyGroupMessage", ":", "emptyGroupMessage", ",", "imageClass", ":", "imageClass", ",", "tooltip", ":", "tooltip", ",", "selectionClass", ":", "selectionClass", ",", "defaultActionId", ":", "defaultActionId", "===", "true", "?", "null", ":", "defaultActionId", ",", "pretendDefaultActionId", ":", "defaultActionId", "===", "true", ",", "children", ":", "{", "}", ",", "extraClasses", ":", "extraClasses", "}", ";", "parentTable", ".", "sortedContributions", "=", "null", ";", "}", "}" ]
Registers a command group and specifies visual information about the group. @param {String} scopeId The id of a DOM element in which the group should be visible. Required. When commands are rendered for a particular element, the group will be shown only if its scopeId matches the id being rendered. @param {String} groupId The id of the group, must be unique. May be used for a dom node id of the element representing the group @param {Number} position The relative position of the group within its parent. Required. @param {String} [title] The title of the group, optional @param {String} [parentPath] The path of parent groups, separated by '/'. For example, a path of "group1Id/group2Id" indicates that the group belongs as a child of group2Id, which is itself a child of group1Id. Optional. @param {String} [emptyGroupMessage] A message to show if the group is empty and the user activates the UI element representing the group. Optional. If not specified, then the group UI element won't be shown when it is empty. @param {String} [imageClass] CSS class of an image to use for this group. @param {String} [tooltip] Tooltip to show on this group. If not provided, and the group uses an <code>imageClass</code>, the <code>title</code> will be used as the tooltip. @param {String} [selectionClass] CSS class to be appended when the command button is selected. Optional. @param {String} or {boolean} [defaultActionId] Id of an action from this group that should be invoked when the group is selected. This will add an arrow to the group that will open the dropdown. Optionally this can be set to <code>true</code> instead of adding a particular action. If set to <code>true</code> the group will be rendered as if there was a default action, but instead of invoking the default action it will open the dropdown. Optional. @param {String} [extraClasses] A string containing space separated css classes that will be applied to group button
[ "Registers", "a", "command", "group", "and", "specifies", "visual", "information", "about", "the", "group", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js#L740-L793
14,374
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js
function(scopeId, selectionService) { if (!this._contributionsByScopeId[scopeId]) { this._contributionsByScopeId[scopeId] = {}; } this._contributionsByScopeId[scopeId].localSelectionService = selectionService; }
javascript
function(scopeId, selectionService) { if (!this._contributionsByScopeId[scopeId]) { this._contributionsByScopeId[scopeId] = {}; } this._contributionsByScopeId[scopeId].localSelectionService = selectionService; }
[ "function", "(", "scopeId", ",", "selectionService", ")", "{", "if", "(", "!", "this", ".", "_contributionsByScopeId", "[", "scopeId", "]", ")", "{", "this", ".", "_contributionsByScopeId", "[", "scopeId", "]", "=", "{", "}", ";", "}", "this", ".", "_contributionsByScopeId", "[", "scopeId", "]", ".", "localSelectionService", "=", "selectionService", ";", "}" ]
Register a selection service that should be used for certain command scopes. @param {String} scopeId The id describing the scope for which this selection service applies. Required. Only contributions made to this scope will use the selection service. @param {orion.selection.Selection} selectionService the selection service for the scope.
[ "Register", "a", "selection", "service", "that", "should", "be", "used", "for", "certain", "command", "scopes", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js#L818-L823
14,375
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js
function(scopeId, commandId, position, parentPath, bindingOnly, keyBinding, urlBinding, handler) { if (!this._contributionsByScopeId[scopeId]) { this._contributionsByScopeId[scopeId] = {}; } var parentTable = this._contributionsByScopeId[scopeId]; if (parentPath) { parentTable = this._createEntryForPath(parentTable, parentPath); } // store the contribution parentTable[commandId] = {position: position, handler: handler}; var command; if (this._bindingOverrides) { var bindingOverride = this.getBindingOverride(commandId, keyBinding); if (bindingOverride) { keyBinding = bindingOverride; } } // add to the bindings table now if (keyBinding) { command = this._commandList[commandId]; if (command) { this._addBinding(command, "key", keyBinding, bindingOnly); //$NON-NLS-0$ } else { this._addPendingBinding(commandId, "key", keyBinding, bindingOnly); //$NON-NLS-0$ } } // add to the url key table if (urlBinding) { command = this._commandList[commandId]; if (command) { this._addBinding(command, "url", urlBinding, bindingOnly); //$NON-NLS-0$ } else { this._addPendingBinding(commandId, "url", urlBinding, bindingOnly); //$NON-NLS-0$ } } // get rid of sort cache because we have a new contribution parentTable.sortedContributions = null; }
javascript
function(scopeId, commandId, position, parentPath, bindingOnly, keyBinding, urlBinding, handler) { if (!this._contributionsByScopeId[scopeId]) { this._contributionsByScopeId[scopeId] = {}; } var parentTable = this._contributionsByScopeId[scopeId]; if (parentPath) { parentTable = this._createEntryForPath(parentTable, parentPath); } // store the contribution parentTable[commandId] = {position: position, handler: handler}; var command; if (this._bindingOverrides) { var bindingOverride = this.getBindingOverride(commandId, keyBinding); if (bindingOverride) { keyBinding = bindingOverride; } } // add to the bindings table now if (keyBinding) { command = this._commandList[commandId]; if (command) { this._addBinding(command, "key", keyBinding, bindingOnly); //$NON-NLS-0$ } else { this._addPendingBinding(commandId, "key", keyBinding, bindingOnly); //$NON-NLS-0$ } } // add to the url key table if (urlBinding) { command = this._commandList[commandId]; if (command) { this._addBinding(command, "url", urlBinding, bindingOnly); //$NON-NLS-0$ } else { this._addPendingBinding(commandId, "url", urlBinding, bindingOnly); //$NON-NLS-0$ } } // get rid of sort cache because we have a new contribution parentTable.sortedContributions = null; }
[ "function", "(", "scopeId", ",", "commandId", ",", "position", ",", "parentPath", ",", "bindingOnly", ",", "keyBinding", ",", "urlBinding", ",", "handler", ")", "{", "if", "(", "!", "this", ".", "_contributionsByScopeId", "[", "scopeId", "]", ")", "{", "this", ".", "_contributionsByScopeId", "[", "scopeId", "]", "=", "{", "}", ";", "}", "var", "parentTable", "=", "this", ".", "_contributionsByScopeId", "[", "scopeId", "]", ";", "if", "(", "parentPath", ")", "{", "parentTable", "=", "this", ".", "_createEntryForPath", "(", "parentTable", ",", "parentPath", ")", ";", "}", "// store the contribution", "parentTable", "[", "commandId", "]", "=", "{", "position", ":", "position", ",", "handler", ":", "handler", "}", ";", "var", "command", ";", "if", "(", "this", ".", "_bindingOverrides", ")", "{", "var", "bindingOverride", "=", "this", ".", "getBindingOverride", "(", "commandId", ",", "keyBinding", ")", ";", "if", "(", "bindingOverride", ")", "{", "keyBinding", "=", "bindingOverride", ";", "}", "}", "// add to the bindings table now", "if", "(", "keyBinding", ")", "{", "command", "=", "this", ".", "_commandList", "[", "commandId", "]", ";", "if", "(", "command", ")", "{", "this", ".", "_addBinding", "(", "command", ",", "\"key\"", ",", "keyBinding", ",", "bindingOnly", ")", ";", "//$NON-NLS-0$", "}", "else", "{", "this", ".", "_addPendingBinding", "(", "commandId", ",", "\"key\"", ",", "keyBinding", ",", "bindingOnly", ")", ";", "//$NON-NLS-0$", "}", "}", "// add to the url key table", "if", "(", "urlBinding", ")", "{", "command", "=", "this", ".", "_commandList", "[", "commandId", "]", ";", "if", "(", "command", ")", "{", "this", ".", "_addBinding", "(", "command", ",", "\"url\"", ",", "urlBinding", ",", "bindingOnly", ")", ";", "//$NON-NLS-0$", "}", "else", "{", "this", ".", "_addPendingBinding", "(", "commandId", ",", "\"url\"", ",", "urlBinding", ",", "bindingOnly", ")", ";", "//$NON-NLS-0$", "}", "}", "// get rid of sort cache because we have a new contribution", "parentTable", ".", "sortedContributions", "=", "null", ";", "}" ]
Register a command contribution, which identifies how a command appears on a page and how it is invoked. @param {String} scopeId The id describing the scope of the command. Required. This scope id is used when rendering commands. @param {String} commandId the id of the command. Required. @param {Number} position the relative position of the command within its parent. Required. @param {String} [parentPath=null] the path of any parent groups, separated by '/'. For example, a path of "group1Id/group2Id/command" indicates that the command belongs as a child of group2Id, which is itself a child of group1Id. Optional. @param {boolean} [bindingOnly=false] if true, then the command is never rendered, but the key or URL binding is hooked. @param {orion.KeyBinding} [keyBinding] a keyBinding for the command. Optional. @param {orion.commands.URLBinding} [urlBinding] a url binding for the command. Optional. @param {Object} [handler] the object that should perform the command for this contribution. Optional.
[ "Register", "a", "command", "contribution", "which", "identifies", "how", "a", "command", "appears", "on", "a", "page", "and", "how", "it", "is", "invoked", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js#L891-L931
14,376
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js
function(commandId, type, binding, bindingOnly) { this._pendingBindings[commandId] = this._pendingBindings[commandId] || []; this._pendingBindings[commandId].push({ type: type, binding: binding, bindingOnly: bindingOnly }); }
javascript
function(commandId, type, binding, bindingOnly) { this._pendingBindings[commandId] = this._pendingBindings[commandId] || []; this._pendingBindings[commandId].push({ type: type, binding: binding, bindingOnly: bindingOnly }); }
[ "function", "(", "commandId", ",", "type", ",", "binding", ",", "bindingOnly", ")", "{", "this", ".", "_pendingBindings", "[", "commandId", "]", "=", "this", ".", "_pendingBindings", "[", "commandId", "]", "||", "[", "]", ";", "this", ".", "_pendingBindings", "[", "commandId", "]", ".", "push", "(", "{", "type", ":", "type", ",", "binding", ":", "binding", ",", "bindingOnly", ":", "bindingOnly", "}", ")", ";", "}" ]
Remembers a key or url binding that has not yet been resolved to a command. @param {String} type One of <code>"key"</code>, <code>"url"</code>.
[ "Remembers", "a", "key", "or", "url", "binding", "that", "has", "not", "yet", "been", "resolved", "to", "a", "command", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js#L978-L985
14,377
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js
function(scopeId, parent, items, handler, renderType, userData, domNodeWrapperList) { if (typeof(scopeId) !== "string") { //$NON-NLS-0$ throw "a scope id for rendering must be specified"; //$NON-NLS-0$ } parent = lib.node(parent); if (!parent) { throw "no parent"; //$NON-NLS-0$ } var contributions = this._contributionsByScopeId[scopeId]; if (!items && contributions) { var selectionService = contributions.localSelectionService || this._selectionService; var self = this; if (selectionService) { selectionService.getSelections(function(selections) { self.renderCommands(scopeId, parent, selections, handler, renderType, userData); }); } return; } if (contributions) { this._render(scopeId, contributions, parent, items, handler, renderType || "button", userData, domNodeWrapperList); //$NON-NLS-0$ // If the last thing we rendered was a group, it's possible there is an unnecessary trailing separator. this._checkForTrailingSeparator(parent, renderType, true); } }
javascript
function(scopeId, parent, items, handler, renderType, userData, domNodeWrapperList) { if (typeof(scopeId) !== "string") { //$NON-NLS-0$ throw "a scope id for rendering must be specified"; //$NON-NLS-0$ } parent = lib.node(parent); if (!parent) { throw "no parent"; //$NON-NLS-0$ } var contributions = this._contributionsByScopeId[scopeId]; if (!items && contributions) { var selectionService = contributions.localSelectionService || this._selectionService; var self = this; if (selectionService) { selectionService.getSelections(function(selections) { self.renderCommands(scopeId, parent, selections, handler, renderType, userData); }); } return; } if (contributions) { this._render(scopeId, contributions, parent, items, handler, renderType || "button", userData, domNodeWrapperList); //$NON-NLS-0$ // If the last thing we rendered was a group, it's possible there is an unnecessary trailing separator. this._checkForTrailingSeparator(parent, renderType, true); } }
[ "function", "(", "scopeId", ",", "parent", ",", "items", ",", "handler", ",", "renderType", ",", "userData", ",", "domNodeWrapperList", ")", "{", "if", "(", "typeof", "(", "scopeId", ")", "!==", "\"string\"", ")", "{", "//$NON-NLS-0$", "throw", "\"a scope id for rendering must be specified\"", ";", "//$NON-NLS-0$", "}", "parent", "=", "lib", ".", "node", "(", "parent", ")", ";", "if", "(", "!", "parent", ")", "{", "throw", "\"no parent\"", ";", "//$NON-NLS-0$", "}", "var", "contributions", "=", "this", ".", "_contributionsByScopeId", "[", "scopeId", "]", ";", "if", "(", "!", "items", "&&", "contributions", ")", "{", "var", "selectionService", "=", "contributions", ".", "localSelectionService", "||", "this", ".", "_selectionService", ";", "var", "self", "=", "this", ";", "if", "(", "selectionService", ")", "{", "selectionService", ".", "getSelections", "(", "function", "(", "selections", ")", "{", "self", ".", "renderCommands", "(", "scopeId", ",", "parent", ",", "selections", ",", "handler", ",", "renderType", ",", "userData", ")", ";", "}", ")", ";", "}", "return", ";", "}", "if", "(", "contributions", ")", "{", "this", ".", "_render", "(", "scopeId", ",", "contributions", ",", "parent", ",", "items", ",", "handler", ",", "renderType", "||", "\"button\"", ",", "userData", ",", "domNodeWrapperList", ")", ";", "//$NON-NLS-0$", "// If the last thing we rendered was a group, it's possible there is an unnecessary trailing separator.", "this", ".", "_checkForTrailingSeparator", "(", "parent", ",", "renderType", ",", "true", ")", ";", "}", "}" ]
Render the commands that are appropriate for the given scope. @param {String} scopeId The id describing the scope for which we are rendering commands. Required. Only contributions made to this scope will be rendered. @param {DOMElement} parent The element in which commands should be rendered. If commands have been previously rendered into this element, it is up to the caller to empty any previously generated content. @param {Object} [items] An item or array of items to which the command applies. Optional. If no items are specified and a selection service was specified at creation time, then the selection service will be used to determine which items are involved. @param {Object} handler The object that should perform the command @param {String} renderType The style in which the command should be rendered. "tool" will render a tool image in the dom. "button" will render a text button. "menu" will render menu items. @param {Object} [userData] Optional user data that should be attached to generated command callbacks @param {Object[]} [domNodeWrapperList] Optional an array used to record any DOM nodes that are rendered during this call. If an array is provided, then as commands are rendered, an object will be created to represent the command's node. The object will always have the property "domNode" which contains the node created for the command. If the command is rendered using other means (toolkit widget) then the optional property "widget" should contain the toolkit object that represents the specified dom node.
[ "Render", "the", "commands", "that", "are", "appropriate", "for", "the", "given", "scope", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js#L1034-L1061
14,378
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js
function(parent) { parent = lib.node(parent); if (!parent) { throw "no parent"; //$NON-NLS-0$ } while (parent.hasChildNodes()) { var node = parent.firstChild; if (node.commandTooltip) { node.commandTooltip.destroy(); } if (node.emptyGroupTooltip) { node.emptyGroupTooltip.destroy(); } this.destroy(node); parent.removeChild(node); } }
javascript
function(parent) { parent = lib.node(parent); if (!parent) { throw "no parent"; //$NON-NLS-0$ } while (parent.hasChildNodes()) { var node = parent.firstChild; if (node.commandTooltip) { node.commandTooltip.destroy(); } if (node.emptyGroupTooltip) { node.emptyGroupTooltip.destroy(); } this.destroy(node); parent.removeChild(node); } }
[ "function", "(", "parent", ")", "{", "parent", "=", "lib", ".", "node", "(", "parent", ")", ";", "if", "(", "!", "parent", ")", "{", "throw", "\"no parent\"", ";", "//$NON-NLS-0$", "}", "while", "(", "parent", ".", "hasChildNodes", "(", ")", ")", "{", "var", "node", "=", "parent", ".", "firstChild", ";", "if", "(", "node", ".", "commandTooltip", ")", "{", "node", ".", "commandTooltip", ".", "destroy", "(", ")", ";", "}", "if", "(", "node", ".", "emptyGroupTooltip", ")", "{", "node", ".", "emptyGroupTooltip", ".", "destroy", "(", ")", ";", "}", "this", ".", "destroy", "(", "node", ")", ";", "parent", ".", "removeChild", "(", "node", ")", ";", "}", "}" ]
Destroy all DOM nodes and any other resources used by rendered commands. This call does not remove the commands from the command registry. Clients typically call this function to empty a command area when a client wants to render the commands again due to some change in state. @param {String|DOMElement} parent The id or DOM node that should be emptied.
[ "Destroy", "all", "DOM", "nodes", "and", "any", "other", "resources", "used", "by", "rendered", "commands", ".", "This", "call", "does", "not", "remove", "the", "commands", "from", "the", "command", "registry", ".", "Clients", "typically", "call", "this", "function", "to", "empty", "a", "command", "area", "when", "a", "client", "wants", "to", "render", "the", "commands", "again", "due", "to", "some", "change", "in", "state", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js#L1070-L1086
14,379
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js
function (url) { //ensure this is only the hash portion var params = PageUtil.matchResourceParameters(url); if (typeof params[this.token] !== "undefined") { //$NON-NLS-0$ this.parameterValue = params[this.token]; return this; } return null; }
javascript
function (url) { //ensure this is only the hash portion var params = PageUtil.matchResourceParameters(url); if (typeof params[this.token] !== "undefined") { //$NON-NLS-0$ this.parameterValue = params[this.token]; return this; } return null; }
[ "function", "(", "url", ")", "{", "//ensure this is only the hash portion", "var", "params", "=", "PageUtil", ".", "matchResourceParameters", "(", "url", ")", ";", "if", "(", "typeof", "params", "[", "this", ".", "token", "]", "!==", "\"undefined\"", ")", "{", "//$NON-NLS-0$", "this", ".", "parameterValue", "=", "params", "[", "this", ".", "token", "]", ";", "return", "this", ";", "}", "return", "null", ";", "}" ]
Returns whether this URL binding matches the given URL @param url the URL. @returns {Boolean} whether this URL binding matches
[ "Returns", "whether", "this", "URL", "binding", "matches", "the", "given", "URL" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js#L1509-L1517
14,380
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js
CommandParameter
function CommandParameter (name, type, label, value, lines, eventListeners, validator) { this.name = name; this.type = type; this.label = label; this.value = value; this.lines = lines || 1; this.validator = validator; this.eventListeners = (Array.isArray(eventListeners)) ? eventListeners : (eventListeners ? [eventListeners] : []); }
javascript
function CommandParameter (name, type, label, value, lines, eventListeners, validator) { this.name = name; this.type = type; this.label = label; this.value = value; this.lines = lines || 1; this.validator = validator; this.eventListeners = (Array.isArray(eventListeners)) ? eventListeners : (eventListeners ? [eventListeners] : []); }
[ "function", "CommandParameter", "(", "name", ",", "type", ",", "label", ",", "value", ",", "lines", ",", "eventListeners", ",", "validator", ")", "{", "this", ".", "name", "=", "name", ";", "this", ".", "type", "=", "type", ";", "this", ".", "label", "=", "label", ";", "this", ".", "value", "=", "value", ";", "this", ".", "lines", "=", "lines", "||", "1", ";", "this", ".", "validator", "=", "validator", ";", "this", ".", "eventListeners", "=", "(", "Array", ".", "isArray", "(", "eventListeners", ")", ")", "?", "eventListeners", ":", "(", "eventListeners", "?", "[", "eventListeners", "]", ":", "[", "]", ")", ";", "}" ]
A CommandParameter defines a parameter that is required by a command. @param {String} name the name of the parameter @param {String} type the type of the parameter, one of the HTML5 input types, or "boolean" @param {String} [label] the (optional) label that should be used when showing the parameter @param {String} [value] the (optional) default value for the parameter @param {Number} [lines] the (optional) number of lines that should be shown when collecting the value. Valid for type "text" only. @param {Object|Array} [eventListeners] the (optional) array or single command event listener @param {Function} [validator] a (optional) validator function @name orion.commands.CommandParameter @class
[ "A", "CommandParameter", "defines", "a", "parameter", "that", "is", "required", "by", "a", "command", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js#L1551-L1561
14,381
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js
ParametersDescription
function ParametersDescription (parameters, options, getParameters) { this._storeParameters(parameters); this._hasOptionalParameters = options && options.hasOptionalParameters; this._options = options; // saved for making a copy this.optionsRequested = false; this.getParameters = getParameters; this.clientCollect = options && options.clientCollect; this.getParameterElement = options && options.getParameterElement; this.getSubmitName = options && options.getSubmitName; this.getCancelName = options && options.getCancelName; this.message = options && options.message; }
javascript
function ParametersDescription (parameters, options, getParameters) { this._storeParameters(parameters); this._hasOptionalParameters = options && options.hasOptionalParameters; this._options = options; // saved for making a copy this.optionsRequested = false; this.getParameters = getParameters; this.clientCollect = options && options.clientCollect; this.getParameterElement = options && options.getParameterElement; this.getSubmitName = options && options.getSubmitName; this.getCancelName = options && options.getCancelName; this.message = options && options.message; }
[ "function", "ParametersDescription", "(", "parameters", ",", "options", ",", "getParameters", ")", "{", "this", ".", "_storeParameters", "(", "parameters", ")", ";", "this", ".", "_hasOptionalParameters", "=", "options", "&&", "options", ".", "hasOptionalParameters", ";", "this", ".", "_options", "=", "options", ";", "// saved for making a copy", "this", ".", "optionsRequested", "=", "false", ";", "this", ".", "getParameters", "=", "getParameters", ";", "this", ".", "clientCollect", "=", "options", "&&", "options", ".", "clientCollect", ";", "this", ".", "getParameterElement", "=", "options", "&&", "options", ".", "getParameterElement", ";", "this", ".", "getSubmitName", "=", "options", "&&", "options", ".", "getSubmitName", ";", "this", ".", "getCancelName", "=", "options", "&&", "options", ".", "getCancelName", ";", "this", ".", "message", "=", "options", "&&", "options", ".", "message", ";", "}" ]
A ParametersDescription defines the parameters required by a command, and whether there are additional optional parameters that can be specified. The command registry will attempt to collect required parameters before calling a command callback. The command is expected to provide UI for optional parameter, when the user has signaled a desire to provide optional information. @param {orion.commands.CommandParameter[]} parameters an array of CommandParameters that are required @param {Object} options The parameters description options object. @param {Boolean} options.hasOptionalParameters specifies whether there are additional optional parameters that could be collected. If true, then the collector will show an affordance for invoking an additional options collector and the client can use the optionsRequested flag to determine whether additional parameters should be shown. Default is false. @param {Boolean} options.clientCollect specifies whether the client will collect the parameters in its callback. Default is false, which means the callback will not be called until an attempt has been made to collect parameters. @param {Function} options.getParameterElement a function used to look up the DOM element for a given parameter. @param {Function} options.getSubmitName a function used to return a name to use for the Submit button. @param {Function} [getParameters] a function used to define the parameters just before the command is invoked. This is used when a particular invocation of the command will change the parameters. The function will be passed the CommandInvocation as a parameter. Any stored parameters will be ignored, and replaced with those returned by this function. If no parameters (empty array or <code>null</code>) are returned, then it is assumed that the command should not try to obtain parameters before invoking the command's callback (similar to <code>options.clientCollect === true</code>). @name orion.commands.ParametersDescription @class
[ "A", "ParametersDescription", "defines", "the", "parameters", "required", "by", "a", "command", "and", "whether", "there", "are", "additional", "optional", "parameters", "that", "can", "be", "specified", ".", "The", "command", "registry", "will", "attempt", "to", "collect", "required", "parameters", "before", "calling", "a", "command", "callback", ".", "The", "command", "is", "expected", "to", "provide", "UI", "for", "optional", "parameter", "when", "the", "user", "has", "signaled", "a", "desire", "to", "provide", "optional", "information", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js#L1601-L1612
14,382
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js
function(func) { for (var key in this.parameterTable) { if (this.parameterTable[key].type && this.parameterTable[key].name) { func(this.parameterTable[key]); } } }
javascript
function(func) { for (var key in this.parameterTable) { if (this.parameterTable[key].type && this.parameterTable[key].name) { func(this.parameterTable[key]); } } }
[ "function", "(", "func", ")", "{", "for", "(", "var", "key", "in", "this", ".", "parameterTable", ")", "{", "if", "(", "this", ".", "parameterTable", "[", "key", "]", ".", "type", "&&", "this", ".", "parameterTable", "[", "key", "]", ".", "name", ")", "{", "func", "(", "this", ".", "parameterTable", "[", "key", "]", ")", ";", "}", "}", "}" ]
Evaluate the specified function for each parameter. @param {Function} func a function which operates on a provided command parameter
[ "Evaluate", "the", "specified", "function", "for", "each", "parameter", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js#L1699-L1705
14,383
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js
function() { var parameters = []; this.forEach(function(parm) { var newParm = new CommandParameter(parm.name, parm.type, parm.label, parm.value, parm.lines, parm.eventListeners, parm.validator); parameters.push(newParm); }); var copy = new ParametersDescription(parameters, this._options, this.getParameters); // this value may have changed since the options copy.clientCollect = this.clientCollect; copy.message = this.message; return copy; }
javascript
function() { var parameters = []; this.forEach(function(parm) { var newParm = new CommandParameter(parm.name, parm.type, parm.label, parm.value, parm.lines, parm.eventListeners, parm.validator); parameters.push(newParm); }); var copy = new ParametersDescription(parameters, this._options, this.getParameters); // this value may have changed since the options copy.clientCollect = this.clientCollect; copy.message = this.message; return copy; }
[ "function", "(", ")", "{", "var", "parameters", "=", "[", "]", ";", "this", ".", "forEach", "(", "function", "(", "parm", ")", "{", "var", "newParm", "=", "new", "CommandParameter", "(", "parm", ".", "name", ",", "parm", ".", "type", ",", "parm", ".", "label", ",", "parm", ".", "value", ",", "parm", ".", "lines", ",", "parm", ".", "eventListeners", ",", "parm", ".", "validator", ")", ";", "parameters", ".", "push", "(", "newParm", ")", ";", "}", ")", ";", "var", "copy", "=", "new", "ParametersDescription", "(", "parameters", ",", "this", ".", "_options", ",", "this", ".", "getParameters", ")", ";", "// this value may have changed since the options", "copy", ".", "clientCollect", "=", "this", ".", "clientCollect", ";", "copy", ".", "message", "=", "this", ".", "message", ";", "return", "copy", ";", "}" ]
Make a copy of this description. Used for collecting values when a client doesn't want the values to be persisted across different objects.
[ "Make", "a", "copy", "of", "this", "description", ".", "Used", "for", "collecting", "values", "when", "a", "client", "doesn", "t", "want", "the", "values", "to", "be", "persisted", "across", "different", "objects", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commandRegistry.js#L1720-L1732
14,384
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/plugins/site/siteServiceImpl.js
xhrJson
function xhrJson(method, url, options) { if (options && typeof options.data !== 'undefined') { options.data = JSON.stringify(options.data); } return xhr.apply(null, Array.prototype.slice.call(arguments)).then(function(result) { return JSON.parse(result.response || null); }); }
javascript
function xhrJson(method, url, options) { if (options && typeof options.data !== 'undefined') { options.data = JSON.stringify(options.data); } return xhr.apply(null, Array.prototype.slice.call(arguments)).then(function(result) { return JSON.parse(result.response || null); }); }
[ "function", "xhrJson", "(", "method", ",", "url", ",", "options", ")", "{", "if", "(", "options", "&&", "typeof", "options", ".", "data", "!==", "'undefined'", ")", "{", "options", ".", "data", "=", "JSON", ".", "stringify", "(", "options", ".", "data", ")", ";", "}", "return", "xhr", ".", "apply", "(", "null", ",", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ")", ")", ".", "then", "(", "function", "(", "result", ")", "{", "return", "JSON", ".", "parse", "(", "result", ".", "response", "||", "null", ")", ";", "}", ")", ";", "}" ]
Invoke the xhr API passing JSON data and returning the response as JSON. @returns {Deferred} A deferred that resolves to a JS object, or null if the server returned an empty response.
[ "Invoke", "the", "xhr", "API", "passing", "JSON", "data", "and", "returning", "the", "response", "as", "JSON", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/plugins/site/siteServiceImpl.js#L81-L88
14,385
eclipse/orion.client
bundles/org.eclipse.orion.client.ui/web/gcli/util/host.js
flashNode
function flashNode(node, match) { if (!node.__gcliHighlighting) { node.__gcliHighlighting = true; var original = node.style.background; node.style.background = match ? 'green' : 'red'; setTimeout(function() { node.style.background = original; delete node.__gcliHighlighting; }, 500); } }
javascript
function flashNode(node, match) { if (!node.__gcliHighlighting) { node.__gcliHighlighting = true; var original = node.style.background; node.style.background = match ? 'green' : 'red'; setTimeout(function() { node.style.background = original; delete node.__gcliHighlighting; }, 500); } }
[ "function", "flashNode", "(", "node", ",", "match", ")", "{", "if", "(", "!", "node", ".", "__gcliHighlighting", ")", "{", "node", ".", "__gcliHighlighting", "=", "true", ";", "var", "original", "=", "node", ".", "style", ".", "background", ";", "node", ".", "style", ".", "background", "=", "match", "?", "'green'", ":", "'red'", ";", "setTimeout", "(", "function", "(", ")", "{", "node", ".", "style", ".", "background", "=", "original", ";", "delete", "node", ".", "__gcliHighlighting", ";", "}", ",", "500", ")", ";", "}", "}" ]
Internal helper to turn a single nodes background another color for 0.5 second. There is likely a better way to do this, but this will do for now.
[ "Internal", "helper", "to", "turn", "a", "single", "nodes", "background", "another", "color", "for", "0", ".", "5", "second", ".", "There", "is", "likely", "a", "better", "way", "to", "do", "this", "but", "this", "will", "do", "for", "now", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/util/host.js#L40-L50
14,386
eclipse/orion.client
modules/orionode/lib/accessRights.js
removeWorkspaceAccess
function removeWorkspaceAccess(userAccessRights, workspaceId) { var newAccessRights = []; if(Array.isArray(userAccessRights)) { userAccessRights.forEach(function(accessRight) { if(!new RegExp("/" + workspaceId + "(\/|$)").test(accessRight.Uri)) { newAccessRights.push(accessRight); } }); } return newAccessRights; }
javascript
function removeWorkspaceAccess(userAccessRights, workspaceId) { var newAccessRights = []; if(Array.isArray(userAccessRights)) { userAccessRights.forEach(function(accessRight) { if(!new RegExp("/" + workspaceId + "(\/|$)").test(accessRight.Uri)) { newAccessRights.push(accessRight); } }); } return newAccessRights; }
[ "function", "removeWorkspaceAccess", "(", "userAccessRights", ",", "workspaceId", ")", "{", "var", "newAccessRights", "=", "[", "]", ";", "if", "(", "Array", ".", "isArray", "(", "userAccessRights", ")", ")", "{", "userAccessRights", ".", "forEach", "(", "function", "(", "accessRight", ")", "{", "if", "(", "!", "new", "RegExp", "(", "\"/\"", "+", "workspaceId", "+", "\"(\\/|$)\"", ")", ".", "test", "(", "accessRight", ".", "Uri", ")", ")", "{", "newAccessRights", ".", "push", "(", "accessRight", ")", ";", "}", "}", ")", ";", "}", "return", "newAccessRights", ";", "}" ]
Remove the workspace access for the given workspace ID @param {{?}[]} userAccessRights The current array of access rights @param {string} workspaceId The ID of the workspace to remove access for @returns {{?}[]} The new array of access rights
[ "Remove", "the", "workspace", "access", "for", "the", "given", "workspace", "ID" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/accessRights.js#L52-L62
14,387
eclipse/orion.client
modules/orionode/lib/accessRights.js
hasAccess
function hasAccess(access, res, err, next, uri){ if (err) { api.writeError(404, res, err); } if(access) { next(); } else { api.writeError(403, res, "You are not authorized to access: " + uri); } }
javascript
function hasAccess(access, res, err, next, uri){ if (err) { api.writeError(404, res, err); } if(access) { next(); } else { api.writeError(403, res, "You are not authorized to access: " + uri); } }
[ "function", "hasAccess", "(", "access", ",", "res", ",", "err", ",", "next", ",", "uri", ")", "{", "if", "(", "err", ")", "{", "api", ".", "writeError", "(", "404", ",", "res", ",", "err", ")", ";", "}", "if", "(", "access", ")", "{", "next", "(", ")", ";", "}", "else", "{", "api", ".", "writeError", "(", "403", ",", "res", ",", "\"You are not authorized to access: \"", "+", "uri", ")", ";", "}", "}" ]
Callback used in checkAccess @param {bool} access If the requesting user has access @param {XmlHttpRespsose} res The backing response @param {*} err The returned error, if any @param {fn} next The function to move the express routing queue @param {string} uri The URI that attempted to be accessed
[ "Callback", "used", "in", "checkAccess" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/accessRights.js#L86-L95
14,388
eclipse/orion.client
modules/orionode/lib/accessRights.js
wildCardMatch
function wildCardMatch(text, pattern){ var cards = pattern.split("*"); if (!pattern.startsWith("*") && !text.startsWith(cards[0])) { //$NON-NLS-1$ return false; } if (!pattern.endsWith("*") && !text.endsWith(cards[cards.length - 1])) { //$NON-NLS-1$ return false; } return !cards.some(function(card){ var idx = text.indexOf(card); if (idx === -1){ return true; } text = text.substring(idx + card.length); }); }
javascript
function wildCardMatch(text, pattern){ var cards = pattern.split("*"); if (!pattern.startsWith("*") && !text.startsWith(cards[0])) { //$NON-NLS-1$ return false; } if (!pattern.endsWith("*") && !text.endsWith(cards[cards.length - 1])) { //$NON-NLS-1$ return false; } return !cards.some(function(card){ var idx = text.indexOf(card); if (idx === -1){ return true; } text = text.substring(idx + card.length); }); }
[ "function", "wildCardMatch", "(", "text", ",", "pattern", ")", "{", "var", "cards", "=", "pattern", ".", "split", "(", "\"*\"", ")", ";", "if", "(", "!", "pattern", ".", "startsWith", "(", "\"*\"", ")", "&&", "!", "text", ".", "startsWith", "(", "cards", "[", "0", "]", ")", ")", "{", "//$NON-NLS-1$", "return", "false", ";", "}", "if", "(", "!", "pattern", ".", "endsWith", "(", "\"*\"", ")", "&&", "!", "text", ".", "endsWith", "(", "cards", "[", "cards", ".", "length", "-", "1", "]", ")", ")", "{", "//$NON-NLS-1$", "return", "false", ";", "}", "return", "!", "cards", ".", "some", "(", "function", "(", "card", ")", "{", "var", "idx", "=", "text", ".", "indexOf", "(", "card", ")", ";", "if", "(", "idx", "===", "-", "1", ")", "{", "return", "true", ";", "}", "text", "=", "text", ".", "substring", "(", "idx", "+", "card", ".", "length", ")", ";", "}", ")", ";", "}" ]
Utility function to check if the request matches a given pattern of access @param {string} text The text to check @param {string} pattern The access pattern @returns {bool} If the text matches the given access pattern
[ "Utility", "function", "to", "check", "if", "the", "request", "matches", "a", "given", "pattern", "of", "access" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/accessRights.js#L117-L132
14,389
eclipse/orion.client
modules/orionode/lib/accessRights.js
getAuthorizationData
function getAuthorizationData(metadata, store){ var properties; var workspaceIDs; var isPropertyString; if (typeof metadata.properties === "string") { isPropertyString = true; properties = JSON.parse(metadata.properties); // metadata.properties need to be parse when using MongoDB workspaceIDs = metadata.workspaces.map(function(workspace){ return workspace.id; }); } else { isPropertyString = false; properties = metadata.properties; // metadata.properties don't need to be parse when using FS workspaceIDs = metadata.WorkspaceIds; // This is only needed for Java server's metadata migration from old Java code } var version = properties["UserRightsVersion"] || 1; //assume version 1 if not specified var userRightArray = []; if (version === 1 || version === 2) { // This only for Java server's metadata migration workspaceIDs.forEach(function(workspaceId){ userRightArray = userRightArray.concat(createUserAccess(metadata["UniqueId"]).concat(createWorkspaceAccess(workspaceId))); }); properties["UserRights"] = userRightArray; properties["UserRightsVersion"] = CURRENT_VERSION; if (isPropertyString) { metadata.properties = JSON.stringify(properties, null, 2); } store.updateUser(metadata["UniqueId"], metadata, function(){}); } else { userRightArray = properties.UserRights; } return userRightArray; }
javascript
function getAuthorizationData(metadata, store){ var properties; var workspaceIDs; var isPropertyString; if (typeof metadata.properties === "string") { isPropertyString = true; properties = JSON.parse(metadata.properties); // metadata.properties need to be parse when using MongoDB workspaceIDs = metadata.workspaces.map(function(workspace){ return workspace.id; }); } else { isPropertyString = false; properties = metadata.properties; // metadata.properties don't need to be parse when using FS workspaceIDs = metadata.WorkspaceIds; // This is only needed for Java server's metadata migration from old Java code } var version = properties["UserRightsVersion"] || 1; //assume version 1 if not specified var userRightArray = []; if (version === 1 || version === 2) { // This only for Java server's metadata migration workspaceIDs.forEach(function(workspaceId){ userRightArray = userRightArray.concat(createUserAccess(metadata["UniqueId"]).concat(createWorkspaceAccess(workspaceId))); }); properties["UserRights"] = userRightArray; properties["UserRightsVersion"] = CURRENT_VERSION; if (isPropertyString) { metadata.properties = JSON.stringify(properties, null, 2); } store.updateUser(metadata["UniqueId"], metadata, function(){}); } else { userRightArray = properties.UserRights; } return userRightArray; }
[ "function", "getAuthorizationData", "(", "metadata", ",", "store", ")", "{", "var", "properties", ";", "var", "workspaceIDs", ";", "var", "isPropertyString", ";", "if", "(", "typeof", "metadata", ".", "properties", "===", "\"string\"", ")", "{", "isPropertyString", "=", "true", ";", "properties", "=", "JSON", ".", "parse", "(", "metadata", ".", "properties", ")", ";", "// metadata.properties need to be parse when using MongoDB", "workspaceIDs", "=", "metadata", ".", "workspaces", ".", "map", "(", "function", "(", "workspace", ")", "{", "return", "workspace", ".", "id", ";", "}", ")", ";", "}", "else", "{", "isPropertyString", "=", "false", ";", "properties", "=", "metadata", ".", "properties", ";", "// metadata.properties don't need to be parse when using FS", "workspaceIDs", "=", "metadata", ".", "WorkspaceIds", ";", "// This is only needed for Java server's metadata migration from old Java code", "}", "var", "version", "=", "properties", "[", "\"UserRightsVersion\"", "]", "||", "1", ";", "//assume version 1 if not specified", "var", "userRightArray", "=", "[", "]", ";", "if", "(", "version", "===", "1", "||", "version", "===", "2", ")", "{", "// This only for Java server's metadata migration ", "workspaceIDs", ".", "forEach", "(", "function", "(", "workspaceId", ")", "{", "userRightArray", "=", "userRightArray", ".", "concat", "(", "createUserAccess", "(", "metadata", "[", "\"UniqueId\"", "]", ")", ".", "concat", "(", "createWorkspaceAccess", "(", "workspaceId", ")", ")", ")", ";", "}", ")", ";", "properties", "[", "\"UserRights\"", "]", "=", "userRightArray", ";", "properties", "[", "\"UserRightsVersion\"", "]", "=", "CURRENT_VERSION", ";", "if", "(", "isPropertyString", ")", "{", "metadata", ".", "properties", "=", "JSON", ".", "stringify", "(", "properties", ",", "null", ",", "2", ")", ";", "}", "store", ".", "updateUser", "(", "metadata", "[", "\"UniqueId\"", "]", ",", "metadata", ",", "function", "(", ")", "{", "}", ")", ";", "}", "else", "{", "userRightArray", "=", "properties", ".", "UserRights", ";", "}", "return", "userRightArray", ";", "}" ]
Function to fetch the authorization data from the given metadata @param {{?}} metadata The metadata object @param {{?}} store The backing metastore @returns {{?}[]}
[ "Function", "to", "fetch", "the", "authorization", "data", "from", "the", "given", "metadata" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/accessRights.js#L140-L171
14,390
eclipse/orion.client
bundles/org.eclipse.orion.client.core/web/lsp/languageServer.js
function() { if (this.capabilities && this.capabilities.textDocumentSync) { var kind = this.capabilities.textDocumentSync; if (this.capabilities.textDocumentSync.change) { kind = this.capabilities.textDocumentSync.change; } switch (kind) { case this.ipc.TEXT_DOCUMENT_SYNC_KIND.None: case this.ipc.TEXT_DOCUMENT_SYNC_KIND.Incremental: case this.ipc.TEXT_DOCUMENT_SYNC_KIND.Full: return kind; } } return this.ipc.TEXT_DOCUMENT_SYNC_KIND.None; }
javascript
function() { if (this.capabilities && this.capabilities.textDocumentSync) { var kind = this.capabilities.textDocumentSync; if (this.capabilities.textDocumentSync.change) { kind = this.capabilities.textDocumentSync.change; } switch (kind) { case this.ipc.TEXT_DOCUMENT_SYNC_KIND.None: case this.ipc.TEXT_DOCUMENT_SYNC_KIND.Incremental: case this.ipc.TEXT_DOCUMENT_SYNC_KIND.Full: return kind; } } return this.ipc.TEXT_DOCUMENT_SYNC_KIND.None; }
[ "function", "(", ")", "{", "if", "(", "this", ".", "capabilities", "&&", "this", ".", "capabilities", ".", "textDocumentSync", ")", "{", "var", "kind", "=", "this", ".", "capabilities", ".", "textDocumentSync", ";", "if", "(", "this", ".", "capabilities", ".", "textDocumentSync", ".", "change", ")", "{", "kind", "=", "this", ".", "capabilities", ".", "textDocumentSync", ".", "change", ";", "}", "switch", "(", "kind", ")", "{", "case", "this", ".", "ipc", ".", "TEXT_DOCUMENT_SYNC_KIND", ".", "None", ":", "case", "this", ".", "ipc", ".", "TEXT_DOCUMENT_SYNC_KIND", ".", "Incremental", ":", "case", "this", ".", "ipc", ".", "TEXT_DOCUMENT_SYNC_KIND", ".", "Full", ":", "return", "kind", ";", "}", "}", "return", "this", ".", "ipc", ".", "TEXT_DOCUMENT_SYNC_KIND", ".", "None", ";", "}" ]
Retrieves the method in which the server wishes to have documents synchronized by. @return {number} a TextDocumentSyncKind, may be None, Full, or Incremental
[ "Retrieves", "the", "method", "in", "which", "the", "server", "wishes", "to", "have", "documents", "synchronized", "by", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.core/web/lsp/languageServer.js#L115-L129
14,391
eclipse/orion.client
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/eslint.js
parseJsonConfig
function parseJsonConfig(string, location, messages) { var items = {}; // Parses a JSON-like comment by the same way as parsing CLI option. /*try { items = levn.parse("Object", string) || {}; // Some tests say that it should ignore invalid comments such as `/*eslint no-alert:abc* /`. // Also, commaless notations have invalid severity: // "no-alert: 2 no-console: 2" --> {"no-alert": "2 no-console: 2"} // Should ignore that case as well. if (ConfigOps.isEverySeverityValid(items)) { return items; } } catch (ex) { // ignore to parse the string by a fallback. }*/ // Optionator cannot parse commaless notations. // But we are supporting that. So this is a fallback for that. items = {}; string = string.replace(/([a-zA-Z0-9\-\/]+):/g, "\"$1\":").replace(/(\]|[0-9])\s+(?=")/, "$1,"); try { items = JSON.parse("{" + string + "}"); } catch (ex) { messages.push({ ruleId: null, fatal: true, severity: 2, source: null, message: "Failed to parse JSON from '" + string + "': " + ex.message, line: location.start.line, column: location.start.column + 1 }); } return items; }
javascript
function parseJsonConfig(string, location, messages) { var items = {}; // Parses a JSON-like comment by the same way as parsing CLI option. /*try { items = levn.parse("Object", string) || {}; // Some tests say that it should ignore invalid comments such as `/*eslint no-alert:abc* /`. // Also, commaless notations have invalid severity: // "no-alert: 2 no-console: 2" --> {"no-alert": "2 no-console: 2"} // Should ignore that case as well. if (ConfigOps.isEverySeverityValid(items)) { return items; } } catch (ex) { // ignore to parse the string by a fallback. }*/ // Optionator cannot parse commaless notations. // But we are supporting that. So this is a fallback for that. items = {}; string = string.replace(/([a-zA-Z0-9\-\/]+):/g, "\"$1\":").replace(/(\]|[0-9])\s+(?=")/, "$1,"); try { items = JSON.parse("{" + string + "}"); } catch (ex) { messages.push({ ruleId: null, fatal: true, severity: 2, source: null, message: "Failed to parse JSON from '" + string + "': " + ex.message, line: location.start.line, column: location.start.column + 1 }); } return items; }
[ "function", "parseJsonConfig", "(", "string", ",", "location", ",", "messages", ")", "{", "var", "items", "=", "{", "}", ";", "// Parses a JSON-like comment by the same way as parsing CLI option.", "/*try {\n\t\t\titems = levn.parse(\"Object\", string) || {};\n\n\t\t\t// Some tests say that it should ignore invalid comments such as `/*eslint no-alert:abc* /`.\n\t\t\t// Also, commaless notations have invalid severity:\n\t\t\t// \"no-alert: 2 no-console: 2\" --> {\"no-alert\": \"2 no-console: 2\"}\n\t\t\t// Should ignore that case as well.\n\t\t\tif (ConfigOps.isEverySeverityValid(items)) {\n\t\t\t\treturn items;\n\t\t\t}\n\t\t} catch (ex) {\n\n\t\t\t// ignore to parse the string by a fallback.\n\t\t}*/", "// Optionator cannot parse commaless notations.", "// But we are supporting that. So this is a fallback for that.", "items", "=", "{", "}", ";", "string", "=", "string", ".", "replace", "(", "/", "([a-zA-Z0-9\\-\\/]+):", "/", "g", ",", "\"\\\"$1\\\":\"", ")", ".", "replace", "(", "/", "(\\]|[0-9])\\s+(?=\")", "/", ",", "\"$1,\"", ")", ";", "try", "{", "items", "=", "JSON", ".", "parse", "(", "\"{\"", "+", "string", "+", "\"}\"", ")", ";", "}", "catch", "(", "ex", ")", "{", "messages", ".", "push", "(", "{", "ruleId", ":", "null", ",", "fatal", ":", "true", ",", "severity", ":", "2", ",", "source", ":", "null", ",", "message", ":", "\"Failed to parse JSON from '\"", "+", "string", "+", "\"': \"", "+", "ex", ".", "message", ",", "line", ":", "location", ".", "start", ".", "line", ",", "column", ":", "location", ".", "start", ".", "column", "+", "1", "}", ")", ";", "}", "return", "items", ";", "}" ]
Parses a JSON-like config. @param {string} string The string to parse. @param {Object} location Start line and column of comments for potential error message. @param {Object[]} messages The messages queue for potential error message. @returns {Object} Result map object
[ "Parses", "a", "JSON", "-", "like", "config", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/eslint.js#L79-L119
14,392
eclipse/orion.client
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/eslint.js
parseListConfig
function parseListConfig(string) { var items = {}; // Collapse whitespace around , string = string.replace(/\s*,\s*/g, ","); string.split(/,+/).forEach(function(name) { name = name.trim(); if (!name) { return; } items[name] = true; }); return items; }
javascript
function parseListConfig(string) { var items = {}; // Collapse whitespace around , string = string.replace(/\s*,\s*/g, ","); string.split(/,+/).forEach(function(name) { name = name.trim(); if (!name) { return; } items[name] = true; }); return items; }
[ "function", "parseListConfig", "(", "string", ")", "{", "var", "items", "=", "{", "}", ";", "// Collapse whitespace around ,", "string", "=", "string", ".", "replace", "(", "/", "\\s*,\\s*", "/", "g", ",", "\",\"", ")", ";", "string", ".", "split", "(", "/", ",+", "/", ")", ".", "forEach", "(", "function", "(", "name", ")", "{", "name", "=", "name", ".", "trim", "(", ")", ";", "if", "(", "!", "name", ")", "{", "return", ";", "}", "items", "[", "name", "]", "=", "true", ";", "}", ")", ";", "return", "items", ";", "}" ]
Parses a config of values separated by comma. @param {string} string The string to parse. @returns {Object} Result map of values and true values
[ "Parses", "a", "config", "of", "values", "separated", "by", "comma", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/eslint.js#L126-L140
14,393
eclipse/orion.client
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/eslint.js
addDeclaredGlobals
function addDeclaredGlobals(program, globalScope, config) { var declaredGlobals = {}, exportedGlobals = {}, explicitGlobals = {}, builtin = Environments.get("builtin"); assign(declaredGlobals, builtin); Object.keys(config.env).forEach(function(name) { if (config.env[name]) { var env = Environments.get(name), environmentGlobals = env && env.globals; if (environmentGlobals) { assign(declaredGlobals, environmentGlobals); } } }); assign(exportedGlobals, config.exported); assign(declaredGlobals, config.globals); assign(explicitGlobals, config.astGlobals); Object.keys(declaredGlobals).forEach(function(name) { var variable = globalScope.set.get(name); if (!variable) { variable = new escope.Variable(name, globalScope); variable.eslintExplicitGlobal = false; globalScope.variables.push(variable); globalScope.set.set(name, variable); } variable.writeable = declaredGlobals[name]; }); Object.keys(explicitGlobals).forEach(function(name) { var variable = globalScope.set.get(name); if (!variable) { variable = new escope.Variable(name, globalScope); variable.eslintExplicitGlobal = true; variable.eslintExplicitGlobalComment = explicitGlobals[name].comment; globalScope.variables.push(variable); globalScope.set.set(name, variable); } variable.writeable = explicitGlobals[name].value; }); // mark all exported variables as such Object.keys(exportedGlobals).forEach(function(name) { var variable = globalScope.set.get(name); if (variable) { variable.eslintUsed = true; } }); /* * "through" contains all references which definitions cannot be found. * Since we augment the global scope using configuration, we need to update * references and remove the ones that were added by configuration. */ globalScope.through = globalScope.through.filter(function(reference) { var name = reference.identifier.name; var variable = globalScope.set.get(name); if (variable) { /* * Links the variable and the reference. * And this reference is removed from `Scope#through`. */ reference.resolved = variable; variable.references.push(reference); return false; } return true; }); }
javascript
function addDeclaredGlobals(program, globalScope, config) { var declaredGlobals = {}, exportedGlobals = {}, explicitGlobals = {}, builtin = Environments.get("builtin"); assign(declaredGlobals, builtin); Object.keys(config.env).forEach(function(name) { if (config.env[name]) { var env = Environments.get(name), environmentGlobals = env && env.globals; if (environmentGlobals) { assign(declaredGlobals, environmentGlobals); } } }); assign(exportedGlobals, config.exported); assign(declaredGlobals, config.globals); assign(explicitGlobals, config.astGlobals); Object.keys(declaredGlobals).forEach(function(name) { var variable = globalScope.set.get(name); if (!variable) { variable = new escope.Variable(name, globalScope); variable.eslintExplicitGlobal = false; globalScope.variables.push(variable); globalScope.set.set(name, variable); } variable.writeable = declaredGlobals[name]; }); Object.keys(explicitGlobals).forEach(function(name) { var variable = globalScope.set.get(name); if (!variable) { variable = new escope.Variable(name, globalScope); variable.eslintExplicitGlobal = true; variable.eslintExplicitGlobalComment = explicitGlobals[name].comment; globalScope.variables.push(variable); globalScope.set.set(name, variable); } variable.writeable = explicitGlobals[name].value; }); // mark all exported variables as such Object.keys(exportedGlobals).forEach(function(name) { var variable = globalScope.set.get(name); if (variable) { variable.eslintUsed = true; } }); /* * "through" contains all references which definitions cannot be found. * Since we augment the global scope using configuration, we need to update * references and remove the ones that were added by configuration. */ globalScope.through = globalScope.through.filter(function(reference) { var name = reference.identifier.name; var variable = globalScope.set.get(name); if (variable) { /* * Links the variable and the reference. * And this reference is removed from `Scope#through`. */ reference.resolved = variable; variable.references.push(reference); return false; } return true; }); }
[ "function", "addDeclaredGlobals", "(", "program", ",", "globalScope", ",", "config", ")", "{", "var", "declaredGlobals", "=", "{", "}", ",", "exportedGlobals", "=", "{", "}", ",", "explicitGlobals", "=", "{", "}", ",", "builtin", "=", "Environments", ".", "get", "(", "\"builtin\"", ")", ";", "assign", "(", "declaredGlobals", ",", "builtin", ")", ";", "Object", ".", "keys", "(", "config", ".", "env", ")", ".", "forEach", "(", "function", "(", "name", ")", "{", "if", "(", "config", ".", "env", "[", "name", "]", ")", "{", "var", "env", "=", "Environments", ".", "get", "(", "name", ")", ",", "environmentGlobals", "=", "env", "&&", "env", ".", "globals", ";", "if", "(", "environmentGlobals", ")", "{", "assign", "(", "declaredGlobals", ",", "environmentGlobals", ")", ";", "}", "}", "}", ")", ";", "assign", "(", "exportedGlobals", ",", "config", ".", "exported", ")", ";", "assign", "(", "declaredGlobals", ",", "config", ".", "globals", ")", ";", "assign", "(", "explicitGlobals", ",", "config", ".", "astGlobals", ")", ";", "Object", ".", "keys", "(", "declaredGlobals", ")", ".", "forEach", "(", "function", "(", "name", ")", "{", "var", "variable", "=", "globalScope", ".", "set", ".", "get", "(", "name", ")", ";", "if", "(", "!", "variable", ")", "{", "variable", "=", "new", "escope", ".", "Variable", "(", "name", ",", "globalScope", ")", ";", "variable", ".", "eslintExplicitGlobal", "=", "false", ";", "globalScope", ".", "variables", ".", "push", "(", "variable", ")", ";", "globalScope", ".", "set", ".", "set", "(", "name", ",", "variable", ")", ";", "}", "variable", ".", "writeable", "=", "declaredGlobals", "[", "name", "]", ";", "}", ")", ";", "Object", ".", "keys", "(", "explicitGlobals", ")", ".", "forEach", "(", "function", "(", "name", ")", "{", "var", "variable", "=", "globalScope", ".", "set", ".", "get", "(", "name", ")", ";", "if", "(", "!", "variable", ")", "{", "variable", "=", "new", "escope", ".", "Variable", "(", "name", ",", "globalScope", ")", ";", "variable", ".", "eslintExplicitGlobal", "=", "true", ";", "variable", ".", "eslintExplicitGlobalComment", "=", "explicitGlobals", "[", "name", "]", ".", "comment", ";", "globalScope", ".", "variables", ".", "push", "(", "variable", ")", ";", "globalScope", ".", "set", ".", "set", "(", "name", ",", "variable", ")", ";", "}", "variable", ".", "writeable", "=", "explicitGlobals", "[", "name", "]", ".", "value", ";", "}", ")", ";", "// mark all exported variables as such", "Object", ".", "keys", "(", "exportedGlobals", ")", ".", "forEach", "(", "function", "(", "name", ")", "{", "var", "variable", "=", "globalScope", ".", "set", ".", "get", "(", "name", ")", ";", "if", "(", "variable", ")", "{", "variable", ".", "eslintUsed", "=", "true", ";", "}", "}", ")", ";", "/*\n\t\t * \"through\" contains all references which definitions cannot be found.\n\t\t * Since we augment the global scope using configuration, we need to update\n\t\t * references and remove the ones that were added by configuration.\n\t\t */", "globalScope", ".", "through", "=", "globalScope", ".", "through", ".", "filter", "(", "function", "(", "reference", ")", "{", "var", "name", "=", "reference", ".", "identifier", ".", "name", ";", "var", "variable", "=", "globalScope", ".", "set", ".", "get", "(", "name", ")", ";", "if", "(", "variable", ")", "{", "/*\n\t\t\t\t * Links the variable and the reference.\n\t\t\t\t * And this reference is removed from `Scope#through`.\n\t\t\t\t */", "reference", ".", "resolved", "=", "variable", ";", "variable", ".", "references", ".", "push", "(", "reference", ")", ";", "return", "false", ";", "}", "return", "true", ";", "}", ")", ";", "}" ]
Ensures that variables representing built-in properties of the Global Object, and any globals declared by special block comments, are present in the global scope. @param {ASTNode} program The top node of the AST. @param {Scope} globalScope The global scope. @param {Object} config The existing configuration data. @returns {void}
[ "Ensures", "that", "variables", "representing", "built", "-", "in", "properties", "of", "the", "Global", "Object", "and", "any", "globals", "declared", "by", "special", "block", "comments", "are", "present", "in", "the", "global", "scope", "." ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/eslint.js#L151-L231
14,394
eclipse/orion.client
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/eslint.js
disableReporting
function disableReporting(reportingConfig, start, rulesToDisable) { if (rulesToDisable.length) { rulesToDisable.forEach(function(rule) { reportingConfig.push({ start: start, end: null, rule: rule }); }); } else { reportingConfig.push({ start: start, end: null, rule: null }); } }
javascript
function disableReporting(reportingConfig, start, rulesToDisable) { if (rulesToDisable.length) { rulesToDisable.forEach(function(rule) { reportingConfig.push({ start: start, end: null, rule: rule }); }); } else { reportingConfig.push({ start: start, end: null, rule: null }); } }
[ "function", "disableReporting", "(", "reportingConfig", ",", "start", ",", "rulesToDisable", ")", "{", "if", "(", "rulesToDisable", ".", "length", ")", "{", "rulesToDisable", ".", "forEach", "(", "function", "(", "rule", ")", "{", "reportingConfig", ".", "push", "(", "{", "start", ":", "start", ",", "end", ":", "null", ",", "rule", ":", "rule", "}", ")", ";", "}", ")", ";", "}", "else", "{", "reportingConfig", ".", "push", "(", "{", "start", ":", "start", ",", "end", ":", "null", ",", "rule", ":", "null", "}", ")", ";", "}", "}" ]
Add data to reporting configuration to disable reporting for list of rules starting from start location @param {Object[]} reportingConfig Current reporting configuration @param {Object} start Position to start @param {string[]} rulesToDisable List of rules @returns {void}
[ "Add", "data", "to", "reporting", "configuration", "to", "disable", "reporting", "for", "list", "of", "rules", "starting", "from", "start", "location" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/eslint.js#L241-L258
14,395
eclipse/orion.client
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/eslint.js
enableReporting
function enableReporting(reportingConfig, start, rulesToEnable) { var i; if (rulesToEnable.length) { rulesToEnable.forEach(function(rule) { for (i = reportingConfig.length - 1; i >= 0; i--) { if (!reportingConfig[i].end && reportingConfig[i].rule === rule) { reportingConfig[i].end = start; break; } } }); } else { // find all previous disabled locations if they was started as list of rules var prevStart; for (i = reportingConfig.length - 1; i >= 0; i--) { if (prevStart && prevStart !== reportingConfig[i].start) { break; } if (!reportingConfig[i].end) { reportingConfig[i].end = start; prevStart = reportingConfig[i].start; } } } }
javascript
function enableReporting(reportingConfig, start, rulesToEnable) { var i; if (rulesToEnable.length) { rulesToEnable.forEach(function(rule) { for (i = reportingConfig.length - 1; i >= 0; i--) { if (!reportingConfig[i].end && reportingConfig[i].rule === rule) { reportingConfig[i].end = start; break; } } }); } else { // find all previous disabled locations if they was started as list of rules var prevStart; for (i = reportingConfig.length - 1; i >= 0; i--) { if (prevStart && prevStart !== reportingConfig[i].start) { break; } if (!reportingConfig[i].end) { reportingConfig[i].end = start; prevStart = reportingConfig[i].start; } } } }
[ "function", "enableReporting", "(", "reportingConfig", ",", "start", ",", "rulesToEnable", ")", "{", "var", "i", ";", "if", "(", "rulesToEnable", ".", "length", ")", "{", "rulesToEnable", ".", "forEach", "(", "function", "(", "rule", ")", "{", "for", "(", "i", "=", "reportingConfig", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "!", "reportingConfig", "[", "i", "]", ".", "end", "&&", "reportingConfig", "[", "i", "]", ".", "rule", "===", "rule", ")", "{", "reportingConfig", "[", "i", "]", ".", "end", "=", "start", ";", "break", ";", "}", "}", "}", ")", ";", "}", "else", "{", "// find all previous disabled locations if they was started as list of rules", "var", "prevStart", ";", "for", "(", "i", "=", "reportingConfig", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "prevStart", "&&", "prevStart", "!==", "reportingConfig", "[", "i", "]", ".", "start", ")", "{", "break", ";", "}", "if", "(", "!", "reportingConfig", "[", "i", "]", ".", "end", ")", "{", "reportingConfig", "[", "i", "]", ".", "end", "=", "start", ";", "prevStart", "=", "reportingConfig", "[", "i", "]", ".", "start", ";", "}", "}", "}", "}" ]
Add data to reporting configuration to enable reporting for list of rules starting from start location @param {Object[]} reportingConfig Current reporting configuration @param {Object} start Position to start @param {string[]} rulesToEnable List of rules @returns {void}
[ "Add", "data", "to", "reporting", "configuration", "to", "enable", "reporting", "for", "list", "of", "rules", "starting", "from", "start", "location" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/eslint.js#L268-L296
14,396
eclipse/orion.client
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/eslint.js
isDisabledByReportingConfig
function isDisabledByReportingConfig(reportingConfig, ruleId, location) { for (var i = 0, c = reportingConfig.length; i < c; i++) { var ignore = reportingConfig[i]; if ((!ignore.rule || ignore.rule === ruleId) && (location.line > ignore.start.line || (location.line === ignore.start.line && location.column >= ignore.start.column)) && (!ignore.end || (location.line < ignore.end.line || (location.line === ignore.end.line && location.column <= ignore.end.column)))) { return true; } } return false; }
javascript
function isDisabledByReportingConfig(reportingConfig, ruleId, location) { for (var i = 0, c = reportingConfig.length; i < c; i++) { var ignore = reportingConfig[i]; if ((!ignore.rule || ignore.rule === ruleId) && (location.line > ignore.start.line || (location.line === ignore.start.line && location.column >= ignore.start.column)) && (!ignore.end || (location.line < ignore.end.line || (location.line === ignore.end.line && location.column <= ignore.end.column)))) { return true; } } return false; }
[ "function", "isDisabledByReportingConfig", "(", "reportingConfig", ",", "ruleId", ",", "location", ")", "{", "for", "(", "var", "i", "=", "0", ",", "c", "=", "reportingConfig", ".", "length", ";", "i", "<", "c", ";", "i", "++", ")", "{", "var", "ignore", "=", "reportingConfig", "[", "i", "]", ";", "if", "(", "(", "!", "ignore", ".", "rule", "||", "ignore", ".", "rule", "===", "ruleId", ")", "&&", "(", "location", ".", "line", ">", "ignore", ".", "start", ".", "line", "||", "(", "location", ".", "line", "===", "ignore", ".", "start", ".", "line", "&&", "location", ".", "column", ">=", "ignore", ".", "start", ".", "column", ")", ")", "&&", "(", "!", "ignore", ".", "end", "||", "(", "location", ".", "line", "<", "ignore", ".", "end", ".", "line", "||", "(", "location", ".", "line", "===", "ignore", ".", "end", ".", "line", "&&", "location", ".", "column", "<=", "ignore", ".", "end", ".", "column", ")", ")", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Check if message of rule with ruleId should be ignored in location @param {Object[]} reportingConfig Collection of ignore records @param {string} ruleId Id of rule @param {Object} location Location of message @returns {boolean} True if message should be ignored, false otherwise
[ "Check", "if", "message", "of", "rule", "with", "ruleId", "should", "be", "ignored", "in", "location" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/eslint.js#L400-L414
14,397
eclipse/orion.client
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/eslint.js
prepareConfig
function prepareConfig(config) { config.globals = config.globals || config.global || {}; delete config.global; var copiedRules = {}, parserOptions = {}, preparedConfig; if (typeof config.rules === "object") { Object.keys(config.rules).forEach(function(k) { var rule = config.rules[k]; if (rule === null) { throw new Error("Invalid config for rule '" + k + "'\."); } if (Array.isArray(rule)) { copiedRules[k] = rule.slice(); } else { copiedRules[k] = rule; } }); } // merge in environment parserOptions if (typeof config.env === "object") { Object.keys(config.env).forEach(function(envName) { var env = Environments.get(envName); if (config.env[envName] && env && env.parserOptions) { parserOptions = ConfigOps.merge(parserOptions, env.parserOptions); } }); } preparedConfig = { rules: copiedRules, parser: config.parser || DEFAULT_PARSER, globals: ConfigOps.merge({}, config.globals), env: ConfigOps.merge({}, config.env || {}), settings: ConfigOps.merge({}, config.settings || {}), parserOptions: ConfigOps.merge(parserOptions, config.parserOptions || {}), tern: config.tern // ORION }; if (preparedConfig.parserOptions.sourceType === "module") { if (!preparedConfig.parserOptions.ecmaFeatures) { preparedConfig.parserOptions.ecmaFeatures = {}; } // can't have global return inside of modules preparedConfig.parserOptions.ecmaFeatures.globalReturn = false; // also need at least ES6 for modules if (!preparedConfig.parserOptions.ecmaVersion || preparedConfig.parserOptions.ecmaVersion < 6) { preparedConfig.parserOptions.ecmaVersion = 6; } } return preparedConfig; }
javascript
function prepareConfig(config) { config.globals = config.globals || config.global || {}; delete config.global; var copiedRules = {}, parserOptions = {}, preparedConfig; if (typeof config.rules === "object") { Object.keys(config.rules).forEach(function(k) { var rule = config.rules[k]; if (rule === null) { throw new Error("Invalid config for rule '" + k + "'\."); } if (Array.isArray(rule)) { copiedRules[k] = rule.slice(); } else { copiedRules[k] = rule; } }); } // merge in environment parserOptions if (typeof config.env === "object") { Object.keys(config.env).forEach(function(envName) { var env = Environments.get(envName); if (config.env[envName] && env && env.parserOptions) { parserOptions = ConfigOps.merge(parserOptions, env.parserOptions); } }); } preparedConfig = { rules: copiedRules, parser: config.parser || DEFAULT_PARSER, globals: ConfigOps.merge({}, config.globals), env: ConfigOps.merge({}, config.env || {}), settings: ConfigOps.merge({}, config.settings || {}), parserOptions: ConfigOps.merge(parserOptions, config.parserOptions || {}), tern: config.tern // ORION }; if (preparedConfig.parserOptions.sourceType === "module") { if (!preparedConfig.parserOptions.ecmaFeatures) { preparedConfig.parserOptions.ecmaFeatures = {}; } // can't have global return inside of modules preparedConfig.parserOptions.ecmaFeatures.globalReturn = false; // also need at least ES6 for modules if (!preparedConfig.parserOptions.ecmaVersion || preparedConfig.parserOptions.ecmaVersion < 6) { preparedConfig.parserOptions.ecmaVersion = 6; } } return preparedConfig; }
[ "function", "prepareConfig", "(", "config", ")", "{", "config", ".", "globals", "=", "config", ".", "globals", "||", "config", ".", "global", "||", "{", "}", ";", "delete", "config", ".", "global", ";", "var", "copiedRules", "=", "{", "}", ",", "parserOptions", "=", "{", "}", ",", "preparedConfig", ";", "if", "(", "typeof", "config", ".", "rules", "===", "\"object\"", ")", "{", "Object", ".", "keys", "(", "config", ".", "rules", ")", ".", "forEach", "(", "function", "(", "k", ")", "{", "var", "rule", "=", "config", ".", "rules", "[", "k", "]", ";", "if", "(", "rule", "===", "null", ")", "{", "throw", "new", "Error", "(", "\"Invalid config for rule '\"", "+", "k", "+", "\"'\\.\"", ")", ";", "}", "if", "(", "Array", ".", "isArray", "(", "rule", ")", ")", "{", "copiedRules", "[", "k", "]", "=", "rule", ".", "slice", "(", ")", ";", "}", "else", "{", "copiedRules", "[", "k", "]", "=", "rule", ";", "}", "}", ")", ";", "}", "// merge in environment parserOptions", "if", "(", "typeof", "config", ".", "env", "===", "\"object\"", ")", "{", "Object", ".", "keys", "(", "config", ".", "env", ")", ".", "forEach", "(", "function", "(", "envName", ")", "{", "var", "env", "=", "Environments", ".", "get", "(", "envName", ")", ";", "if", "(", "config", ".", "env", "[", "envName", "]", "&&", "env", "&&", "env", ".", "parserOptions", ")", "{", "parserOptions", "=", "ConfigOps", ".", "merge", "(", "parserOptions", ",", "env", ".", "parserOptions", ")", ";", "}", "}", ")", ";", "}", "preparedConfig", "=", "{", "rules", ":", "copiedRules", ",", "parser", ":", "config", ".", "parser", "||", "DEFAULT_PARSER", ",", "globals", ":", "ConfigOps", ".", "merge", "(", "{", "}", ",", "config", ".", "globals", ")", ",", "env", ":", "ConfigOps", ".", "merge", "(", "{", "}", ",", "config", ".", "env", "||", "{", "}", ")", ",", "settings", ":", "ConfigOps", ".", "merge", "(", "{", "}", ",", "config", ".", "settings", "||", "{", "}", ")", ",", "parserOptions", ":", "ConfigOps", ".", "merge", "(", "parserOptions", ",", "config", ".", "parserOptions", "||", "{", "}", ")", ",", "tern", ":", "config", ".", "tern", "// ORION", "}", ";", "if", "(", "preparedConfig", ".", "parserOptions", ".", "sourceType", "===", "\"module\"", ")", "{", "if", "(", "!", "preparedConfig", ".", "parserOptions", ".", "ecmaFeatures", ")", "{", "preparedConfig", ".", "parserOptions", ".", "ecmaFeatures", "=", "{", "}", ";", "}", "// can't have global return inside of modules", "preparedConfig", ".", "parserOptions", ".", "ecmaFeatures", ".", "globalReturn", "=", "false", ";", "// also need at least ES6 for modules", "if", "(", "!", "preparedConfig", ".", "parserOptions", ".", "ecmaVersion", "||", "preparedConfig", ".", "parserOptions", ".", "ecmaVersion", "<", "6", ")", "{", "preparedConfig", ".", "parserOptions", ".", "ecmaVersion", "=", "6", ";", "}", "}", "return", "preparedConfig", ";", "}" ]
Process initial config to make it safe to extend by file comment config @param {Object} config Initial config @returns {Object} Processed config
[ "Process", "initial", "config", "to", "make", "it", "safe", "to", "extend", "by", "file", "comment", "config" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/eslint.js#L421-L482
14,398
eclipse/orion.client
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/eslint.js
createStubRule
function createStubRule(message) { /** * Creates a fake rule object * @param {object} context context object for each rule * @returns {object} collection of node to listen on */ function createRuleModule(context) { return { Program: function(node) { context.report(node, message); } }; } if (message) { return createRuleModule; } else { throw new Error("No message passed to stub rule"); } }
javascript
function createStubRule(message) { /** * Creates a fake rule object * @param {object} context context object for each rule * @returns {object} collection of node to listen on */ function createRuleModule(context) { return { Program: function(node) { context.report(node, message); } }; } if (message) { return createRuleModule; } else { throw new Error("No message passed to stub rule"); } }
[ "function", "createStubRule", "(", "message", ")", "{", "/**\n\t\t * Creates a fake rule object\n\t\t * @param {object} context context object for each rule\n\t\t * @returns {object} collection of node to listen on\n\t\t */", "function", "createRuleModule", "(", "context", ")", "{", "return", "{", "Program", ":", "function", "(", "node", ")", "{", "context", ".", "report", "(", "node", ",", "message", ")", ";", "}", "}", ";", "}", "if", "(", "message", ")", "{", "return", "createRuleModule", ";", "}", "else", "{", "throw", "new", "Error", "(", "\"No message passed to stub rule\"", ")", ";", "}", "}" ]
Provide a stub rule with a given message @param {string} message The message to be displayed for the rule @returns {Function} Stub rule function
[ "Provide", "a", "stub", "rule", "with", "a", "given", "message" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/eslint.js#L489-L509
14,399
eclipse/orion.client
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/eslint.js
getRuleReplacementMessage
function getRuleReplacementMessage(ruleId) { if (ruleId in replacements.rules) { var newRules = replacements.rules[ruleId]; return "Rule \'" + ruleId + "\' was removed and replaced by: " + newRules.join(", "); } return null; }
javascript
function getRuleReplacementMessage(ruleId) { if (ruleId in replacements.rules) { var newRules = replacements.rules[ruleId]; return "Rule \'" + ruleId + "\' was removed and replaced by: " + newRules.join(", "); } return null; }
[ "function", "getRuleReplacementMessage", "(", "ruleId", ")", "{", "if", "(", "ruleId", "in", "replacements", ".", "rules", ")", "{", "var", "newRules", "=", "replacements", ".", "rules", "[", "ruleId", "]", ";", "return", "\"Rule \\'\"", "+", "ruleId", "+", "\"\\' was removed and replaced by: \"", "+", "newRules", ".", "join", "(", "\", \"", ")", ";", "}", "return", "null", ";", "}" ]
Provide a rule replacement message @param {string} ruleId Name of the rule @returns {string} Message detailing rule replacement
[ "Provide", "a", "rule", "replacement", "message" ]
eb2583100c662b5cfc1b461a978b31d3b8555ce1
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/eslint.js#L516-L524