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,400
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.git/web/orion/git/gitPreferenceStorage.js
|
function(repository, userCredentials){
var credentials = {
gitSshUsername : "",
gitSshPassword : "",
gitPrivateKey : "",
gitPassphrase : ""
};
if(userCredentials !== undefined){
if(userCredentials.gitSshUsername !== undefined && userCredentials.gitSshUsername !== null) { credentials.gitSshUsername = userCredentials.gitSshUsername; }
if(userCredentials.gitSshPassword !== undefined && userCredentials.gitSshPassword !== null) { credentials.gitSshPassword = userCredentials.gitSshPassword; }
if(userCredentials.gitPrivateKey !== undefined && userCredentials.gitPrivateKey !== null) { credentials.gitPrivateKey = userCredentials.gitPrivateKey; }
if(userCredentials.gitPassphrase !== undefined && userCredentials.gitPassphrase !== null) { credentials.gitPassphrase = userCredentials.gitPassphrase; }
}
var d = new Deferred();
this._preferenceService.get(this._prefix, undefined, {scope: 2}).then(
function(pref){
var settings = pref["settings"];
if(settings === undefined){
d.reject();
return;
}
if(settings.enabled){
var data = {};
data[repository] = credentials;
this._preferenceService.put(this._prefix, data, {scope: 2}).then(d.resolve, d.reject);
} else { d.reject(); }
}.bind(this)
);
return d;
}
|
javascript
|
function(repository, userCredentials){
var credentials = {
gitSshUsername : "",
gitSshPassword : "",
gitPrivateKey : "",
gitPassphrase : ""
};
if(userCredentials !== undefined){
if(userCredentials.gitSshUsername !== undefined && userCredentials.gitSshUsername !== null) { credentials.gitSshUsername = userCredentials.gitSshUsername; }
if(userCredentials.gitSshPassword !== undefined && userCredentials.gitSshPassword !== null) { credentials.gitSshPassword = userCredentials.gitSshPassword; }
if(userCredentials.gitPrivateKey !== undefined && userCredentials.gitPrivateKey !== null) { credentials.gitPrivateKey = userCredentials.gitPrivateKey; }
if(userCredentials.gitPassphrase !== undefined && userCredentials.gitPassphrase !== null) { credentials.gitPassphrase = userCredentials.gitPassphrase; }
}
var d = new Deferred();
this._preferenceService.get(this._prefix, undefined, {scope: 2}).then(
function(pref){
var settings = pref["settings"];
if(settings === undefined){
d.reject();
return;
}
if(settings.enabled){
var data = {};
data[repository] = credentials;
this._preferenceService.put(this._prefix, data, {scope: 2}).then(d.resolve, d.reject);
} else { d.reject(); }
}.bind(this)
);
return d;
}
|
[
"function",
"(",
"repository",
",",
"userCredentials",
")",
"{",
"var",
"credentials",
"=",
"{",
"gitSshUsername",
":",
"\"\"",
",",
"gitSshPassword",
":",
"\"\"",
",",
"gitPrivateKey",
":",
"\"\"",
",",
"gitPassphrase",
":",
"\"\"",
"}",
";",
"if",
"(",
"userCredentials",
"!==",
"undefined",
")",
"{",
"if",
"(",
"userCredentials",
".",
"gitSshUsername",
"!==",
"undefined",
"&&",
"userCredentials",
".",
"gitSshUsername",
"!==",
"null",
")",
"{",
"credentials",
".",
"gitSshUsername",
"=",
"userCredentials",
".",
"gitSshUsername",
";",
"}",
"if",
"(",
"userCredentials",
".",
"gitSshPassword",
"!==",
"undefined",
"&&",
"userCredentials",
".",
"gitSshPassword",
"!==",
"null",
")",
"{",
"credentials",
".",
"gitSshPassword",
"=",
"userCredentials",
".",
"gitSshPassword",
";",
"}",
"if",
"(",
"userCredentials",
".",
"gitPrivateKey",
"!==",
"undefined",
"&&",
"userCredentials",
".",
"gitPrivateKey",
"!==",
"null",
")",
"{",
"credentials",
".",
"gitPrivateKey",
"=",
"userCredentials",
".",
"gitPrivateKey",
";",
"}",
"if",
"(",
"userCredentials",
".",
"gitPassphrase",
"!==",
"undefined",
"&&",
"userCredentials",
".",
"gitPassphrase",
"!==",
"null",
")",
"{",
"credentials",
".",
"gitPassphrase",
"=",
"userCredentials",
".",
"gitPassphrase",
";",
"}",
"}",
"var",
"d",
"=",
"new",
"Deferred",
"(",
")",
";",
"this",
".",
"_preferenceService",
".",
"get",
"(",
"this",
".",
"_prefix",
",",
"undefined",
",",
"{",
"scope",
":",
"2",
"}",
")",
".",
"then",
"(",
"function",
"(",
"pref",
")",
"{",
"var",
"settings",
"=",
"pref",
"[",
"\"settings\"",
"]",
";",
"if",
"(",
"settings",
"===",
"undefined",
")",
"{",
"d",
".",
"reject",
"(",
")",
";",
"return",
";",
"}",
"if",
"(",
"settings",
".",
"enabled",
")",
"{",
"var",
"data",
"=",
"{",
"}",
";",
"data",
"[",
"repository",
"]",
"=",
"credentials",
";",
"this",
".",
"_preferenceService",
".",
"put",
"(",
"this",
".",
"_prefix",
",",
"data",
",",
"{",
"scope",
":",
"2",
"}",
")",
".",
"then",
"(",
"d",
".",
"resolve",
",",
"d",
".",
"reject",
")",
";",
"}",
"else",
"{",
"d",
".",
"reject",
"(",
")",
";",
"}",
"}",
".",
"bind",
"(",
"this",
")",
")",
";",
"return",
"d",
";",
"}"
] |
Saves the given git credentials for the given repository.
@param repository [required] unique repository URL
@param userCredentials.gitSshUsername [optional] git ssh username
@param userCredentials.gitSshPassword [optional] git ssh password
@param userCredentials.gitPrivateKey [optional] git private key
@param userCredentials.gitPassphrase [optional] git passphrase
|
[
"Saves",
"the",
"given",
"git",
"credentials",
"for",
"the",
"given",
"repository",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.git/web/orion/git/gitPreferenceStorage.js#L37-L70
|
|
14,401
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.git/web/orion/git/gitPreferenceStorage.js
|
function(repository){
var credentials = {
gitSshUsername : "",
gitSshPassword : "",
gitPrivateKey : "",
gitPassphrase : ""
};
var d = new Deferred();
this._preferenceService.get(this._prefix, undefined, {scope: 2}).then(
function(pref){
var settings = pref["settings"];
if(settings === undefined){
d.reject();
return;
}
if(settings.enabled){
var userCredentials = pref[repository];
if(userCredentials !== undefined) { d.resolve(userCredentials); }
else { d.resolve(credentials); }
} else { d.reject(); }
}
);
return d;
}
|
javascript
|
function(repository){
var credentials = {
gitSshUsername : "",
gitSshPassword : "",
gitPrivateKey : "",
gitPassphrase : ""
};
var d = new Deferred();
this._preferenceService.get(this._prefix, undefined, {scope: 2}).then(
function(pref){
var settings = pref["settings"];
if(settings === undefined){
d.reject();
return;
}
if(settings.enabled){
var userCredentials = pref[repository];
if(userCredentials !== undefined) { d.resolve(userCredentials); }
else { d.resolve(credentials); }
} else { d.reject(); }
}
);
return d;
}
|
[
"function",
"(",
"repository",
")",
"{",
"var",
"credentials",
"=",
"{",
"gitSshUsername",
":",
"\"\"",
",",
"gitSshPassword",
":",
"\"\"",
",",
"gitPrivateKey",
":",
"\"\"",
",",
"gitPassphrase",
":",
"\"\"",
"}",
";",
"var",
"d",
"=",
"new",
"Deferred",
"(",
")",
";",
"this",
".",
"_preferenceService",
".",
"get",
"(",
"this",
".",
"_prefix",
",",
"undefined",
",",
"{",
"scope",
":",
"2",
"}",
")",
".",
"then",
"(",
"function",
"(",
"pref",
")",
"{",
"var",
"settings",
"=",
"pref",
"[",
"\"settings\"",
"]",
";",
"if",
"(",
"settings",
"===",
"undefined",
")",
"{",
"d",
".",
"reject",
"(",
")",
";",
"return",
";",
"}",
"if",
"(",
"settings",
".",
"enabled",
")",
"{",
"var",
"userCredentials",
"=",
"pref",
"[",
"repository",
"]",
";",
"if",
"(",
"userCredentials",
"!==",
"undefined",
")",
"{",
"d",
".",
"resolve",
"(",
"userCredentials",
")",
";",
"}",
"else",
"{",
"d",
".",
"resolve",
"(",
"credentials",
")",
";",
"}",
"}",
"else",
"{",
"d",
".",
"reject",
"(",
")",
";",
"}",
"}",
")",
";",
"return",
"d",
";",
"}"
] |
Retrieves git credentials for the given repository.
Some credentials fields may be in form of empty strings if not present in the storage.
@param repository [required] unique repository URL
|
[
"Retrieves",
"git",
"credentials",
"for",
"the",
"given",
"repository",
".",
"Some",
"credentials",
"fields",
"may",
"be",
"in",
"form",
"of",
"empty",
"strings",
"if",
"not",
"present",
"in",
"the",
"storage",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.git/web/orion/git/gitPreferenceStorage.js#L78-L104
|
|
14,402
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.git/web/orion/git/gitPreferenceStorage.js
|
function(){
var d = new Deferred();
this._preferenceService.get(this._prefix, undefined, {scope: 2}).then(
function(pref){
var settings = pref["settings"];
if(settings === undefined){
d.resolve(false);
return;
}
d.resolve(settings.enabled);
}
);
return d;
}
|
javascript
|
function(){
var d = new Deferred();
this._preferenceService.get(this._prefix, undefined, {scope: 2}).then(
function(pref){
var settings = pref["settings"];
if(settings === undefined){
d.resolve(false);
return;
}
d.resolve(settings.enabled);
}
);
return d;
}
|
[
"function",
"(",
")",
"{",
"var",
"d",
"=",
"new",
"Deferred",
"(",
")",
";",
"this",
".",
"_preferenceService",
".",
"get",
"(",
"this",
".",
"_prefix",
",",
"undefined",
",",
"{",
"scope",
":",
"2",
"}",
")",
".",
"then",
"(",
"function",
"(",
"pref",
")",
"{",
"var",
"settings",
"=",
"pref",
"[",
"\"settings\"",
"]",
";",
"if",
"(",
"settings",
"===",
"undefined",
")",
"{",
"d",
".",
"resolve",
"(",
"false",
")",
";",
"return",
";",
"}",
"d",
".",
"resolve",
"(",
"settings",
".",
"enabled",
")",
";",
"}",
")",
";",
"return",
"d",
";",
"}"
] |
Determines whether the storage is enabled by the user or not.
|
[
"Determines",
"whether",
"the",
"storage",
"is",
"enabled",
"by",
"the",
"user",
"or",
"not",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.git/web/orion/git/gitPreferenceStorage.js#L109-L124
|
|
14,403
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.git/web/orion/git/gitPreferenceStorage.js
|
function(){
var d = new Deferred();
this._preferenceService.get(this._prefix, undefined, {scope: 2}).then(
function(pref){
var result = [];
var repositories = Object.keys(pref);
for(var i=0; i<repositories.length; ++i){
if(repositories[i] !== "settings"){
result.push(repositories[i]);
}
}
d.resolve(result);
}
);
return d;
}
|
javascript
|
function(){
var d = new Deferred();
this._preferenceService.get(this._prefix, undefined, {scope: 2}).then(
function(pref){
var result = [];
var repositories = Object.keys(pref);
for(var i=0; i<repositories.length; ++i){
if(repositories[i] !== "settings"){
result.push(repositories[i]);
}
}
d.resolve(result);
}
);
return d;
}
|
[
"function",
"(",
")",
"{",
"var",
"d",
"=",
"new",
"Deferred",
"(",
")",
";",
"this",
".",
"_preferenceService",
".",
"get",
"(",
"this",
".",
"_prefix",
",",
"undefined",
",",
"{",
"scope",
":",
"2",
"}",
")",
".",
"then",
"(",
"function",
"(",
"pref",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"var",
"repositories",
"=",
"Object",
".",
"keys",
"(",
"pref",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"repositories",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"repositories",
"[",
"i",
"]",
"!==",
"\"settings\"",
")",
"{",
"result",
".",
"push",
"(",
"repositories",
"[",
"i",
"]",
")",
";",
"}",
"}",
"d",
".",
"resolve",
"(",
"result",
")",
";",
"}",
")",
";",
"return",
"d",
";",
"}"
] |
Returns all repository URLs, which have stored
credentials in the storage.
|
[
"Returns",
"all",
"repository",
"URLs",
"which",
"have",
"stored",
"credentials",
"in",
"the",
"storage",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.git/web/orion/git/gitPreferenceStorage.js#L154-L172
|
|
14,404
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js
|
Selection
|
function Selection (start, end, caret) {
/**
* The selection start offset.
*
* @name orion.editor.Selection#start
*/
this.start = start;
/**
* The selection end offset.
*
* @name orion.editor.Selection#end
*/
this.end = end;
/** @private */
this.caret = caret; //true if the start, false if the caret is at end
/** @private */
this._columnX = -1;
}
|
javascript
|
function Selection (start, end, caret) {
/**
* The selection start offset.
*
* @name orion.editor.Selection#start
*/
this.start = start;
/**
* The selection end offset.
*
* @name orion.editor.Selection#end
*/
this.end = end;
/** @private */
this.caret = caret; //true if the start, false if the caret is at end
/** @private */
this._columnX = -1;
}
|
[
"function",
"Selection",
"(",
"start",
",",
"end",
",",
"caret",
")",
"{",
"/**\n\t\t * The selection start offset.\n\t\t *\n\t\t * @name orion.editor.Selection#start\n\t\t */",
"this",
".",
"start",
"=",
"start",
";",
"/**\n\t\t * The selection end offset.\n\t\t *\n\t\t * @name orion.editor.Selection#end\n\t\t */",
"this",
".",
"end",
"=",
"end",
";",
"/** @private */",
"this",
".",
"caret",
"=",
"caret",
";",
"//true if the start, false if the caret is at end",
"/** @private */",
"this",
".",
"_columnX",
"=",
"-",
"1",
";",
"}"
] |
Constructs a new Selection object.
@class A Selection represents a range of selected text in the view.
@name orion.editor.Selection
|
[
"Constructs",
"a",
"new",
"Selection",
"object",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js#L243-L260
|
14,405
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js
|
TextLine
|
function TextLine (view, lineIndex, lineDiv) {
/**
* The view.
*
* @name orion.editor.TextLine#view
* @private
*/
this.view = view;
/**
* The line index.
*
* @name orion.editor.TextLine#lineIndex
* @private
*/
this.lineIndex = lineIndex;
this._lineDiv = lineDiv;
}
|
javascript
|
function TextLine (view, lineIndex, lineDiv) {
/**
* The view.
*
* @name orion.editor.TextLine#view
* @private
*/
this.view = view;
/**
* The line index.
*
* @name orion.editor.TextLine#lineIndex
* @private
*/
this.lineIndex = lineIndex;
this._lineDiv = lineDiv;
}
|
[
"function",
"TextLine",
"(",
"view",
",",
"lineIndex",
",",
"lineDiv",
")",
"{",
"/**\n\t\t * The view.\n\t\t *\n\t\t * @name orion.editor.TextLine#view\n\t\t * @private\n\t\t */",
"this",
".",
"view",
"=",
"view",
";",
"/**\n\t\t * The line index.\n\t\t *\n\t\t * @name orion.editor.TextLine#lineIndex\n\t\t * @private\n\t\t */",
"this",
".",
"lineIndex",
"=",
"lineIndex",
";",
"this",
".",
"_lineDiv",
"=",
"lineDiv",
";",
"}"
] |
Constructs a new TextLine object.
@class A TextLine represents a line of text in the view.
@name orion.editor.TextLine
@private
|
[
"Constructs",
"a",
"new",
"TextLine",
"object",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js#L633-L650
|
14,406
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js
|
function(mode, index) {
var keyModes = this._keyModes;
if (index !== undefined) {
keyModes.splice(index, 0, mode);
} else {
keyModes.push(mode);
}
//TODO: API needed for this
if (mode._modeAdded) {
mode._modeAdded();
}
}
|
javascript
|
function(mode, index) {
var keyModes = this._keyModes;
if (index !== undefined) {
keyModes.splice(index, 0, mode);
} else {
keyModes.push(mode);
}
//TODO: API needed for this
if (mode._modeAdded) {
mode._modeAdded();
}
}
|
[
"function",
"(",
"mode",
",",
"index",
")",
"{",
"var",
"keyModes",
"=",
"this",
".",
"_keyModes",
";",
"if",
"(",
"index",
"!==",
"undefined",
")",
"{",
"keyModes",
".",
"splice",
"(",
"index",
",",
"0",
",",
"mode",
")",
";",
"}",
"else",
"{",
"keyModes",
".",
"push",
"(",
"mode",
")",
";",
"}",
"//TODO: API needed for this",
"if",
"(",
"mode",
".",
"_modeAdded",
")",
"{",
"mode",
".",
"_modeAdded",
"(",
")",
";",
"}",
"}"
] |
Adds a keyMode to the text view at the specified position.
@param {orion.editor.KeyMode} mode the editor keyMode.
@param {Number} [index=length] the index.
|
[
"Adds",
"a",
"keyMode",
"to",
"the",
"text",
"view",
"at",
"the",
"specified",
"position",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js#L1740-L1751
|
|
14,407
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js
|
function(offset, options) {
var selection = new Selection(offset, offset, false);
this._doMove(options, selection);
return selection.getCaret();
}
|
javascript
|
function(offset, options) {
var selection = new Selection(offset, offset, false);
this._doMove(options, selection);
return selection.getCaret();
}
|
[
"function",
"(",
"offset",
",",
"options",
")",
"{",
"var",
"selection",
"=",
"new",
"Selection",
"(",
"offset",
",",
"offset",
",",
"false",
")",
";",
"this",
".",
"_doMove",
"(",
"options",
",",
"selection",
")",
";",
"return",
"selection",
".",
"getCaret",
"(",
")",
";",
"}"
] |
Returns the next character offset after the given offset and options
@param {Number} offset the offset to start from
@param {Object} options
{ unit: the type of unit to advance to (eg "character", "word", "wordend", "wordWS", "wordendWS"),
count: the number of units to advance (negative to advance backwards) }
@returns {Number} the next character offset
|
[
"Returns",
"the",
"next",
"character",
"offset",
"after",
"the",
"given",
"offset",
"and",
"options"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js#L2268-L2272
|
|
14,408
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js
|
function(x, y) {
if (!this._clientDiv) { return 0; }
var lineIndex = this._getLineIndex(y);
var line = this._getLine(lineIndex);
var offset = line.getOffset(x, y - this._getLinePixel(lineIndex));
line.destroy();
return offset;
}
|
javascript
|
function(x, y) {
if (!this._clientDiv) { return 0; }
var lineIndex = this._getLineIndex(y);
var line = this._getLine(lineIndex);
var offset = line.getOffset(x, y - this._getLinePixel(lineIndex));
line.destroy();
return offset;
}
|
[
"function",
"(",
"x",
",",
"y",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_clientDiv",
")",
"{",
"return",
"0",
";",
"}",
"var",
"lineIndex",
"=",
"this",
".",
"_getLineIndex",
"(",
"y",
")",
";",
"var",
"line",
"=",
"this",
".",
"_getLine",
"(",
"lineIndex",
")",
";",
"var",
"offset",
"=",
"line",
".",
"getOffset",
"(",
"x",
",",
"y",
"-",
"this",
".",
"_getLinePixel",
"(",
"lineIndex",
")",
")",
";",
"line",
".",
"destroy",
"(",
")",
";",
"return",
"offset",
";",
"}"
] |
Returns the character offset nearest to the given pixel location. The
pixel location is relative to the document.
@param x the x of the location
@param y the y of the location
@returns {Number} the character offset at the given location.
@see orion.editor.TextView#getLocationAtOffset
|
[
"Returns",
"the",
"character",
"offset",
"nearest",
"to",
"the",
"given",
"pixel",
"location",
".",
"The",
"pixel",
"location",
"is",
"relative",
"to",
"the",
"document",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js#L2329-L2336
|
|
14,409
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js
|
function (mode) {
var keyModes = this._keyModes;
for (var i=0; i<keyModes.length; i++) {
if (keyModes[i] === mode) {
keyModes.splice(i, 1);
break;
}
}
//TODO: API needed for this
if (mode._modeRemoved) {
mode._modeRemoved();
}
}
|
javascript
|
function (mode) {
var keyModes = this._keyModes;
for (var i=0; i<keyModes.length; i++) {
if (keyModes[i] === mode) {
keyModes.splice(i, 1);
break;
}
}
//TODO: API needed for this
if (mode._modeRemoved) {
mode._modeRemoved();
}
}
|
[
"function",
"(",
"mode",
")",
"{",
"var",
"keyModes",
"=",
"this",
".",
"_keyModes",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"keyModes",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"keyModes",
"[",
"i",
"]",
"===",
"mode",
")",
"{",
"keyModes",
".",
"splice",
"(",
"i",
",",
"1",
")",
";",
"break",
";",
"}",
"}",
"//TODO: API needed for this",
"if",
"(",
"mode",
".",
"_modeRemoved",
")",
"{",
"mode",
".",
"_modeRemoved",
"(",
")",
";",
"}",
"}"
] |
Removes a key mode from the text view.
@param {orion.editor.KeyMode} mode the key mode.
|
[
"Removes",
"a",
"key",
"mode",
"from",
"the",
"text",
"view",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js#L3021-L3033
|
|
14,410
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js
|
function (ruler) {
var rulers = this._rulers;
for (var i=0; i<rulers.length; i++) {
if (rulers[i] === ruler) {
rulers.splice(i, 1);
ruler.setView(null);
this._destroyRuler(ruler);
this._update();
break;
}
}
}
|
javascript
|
function (ruler) {
var rulers = this._rulers;
for (var i=0; i<rulers.length; i++) {
if (rulers[i] === ruler) {
rulers.splice(i, 1);
ruler.setView(null);
this._destroyRuler(ruler);
this._update();
break;
}
}
}
|
[
"function",
"(",
"ruler",
")",
"{",
"var",
"rulers",
"=",
"this",
".",
"_rulers",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"rulers",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"rulers",
"[",
"i",
"]",
"===",
"ruler",
")",
"{",
"rulers",
".",
"splice",
"(",
"i",
",",
"1",
")",
";",
"ruler",
".",
"setView",
"(",
"null",
")",
";",
"this",
".",
"_destroyRuler",
"(",
"ruler",
")",
";",
"this",
".",
"_update",
"(",
")",
";",
"break",
";",
"}",
"}",
"}"
] |
Removes a ruler from the text view.
@param {orion.editor.Ruler} ruler the ruler.
|
[
"Removes",
"a",
"ruler",
"from",
"the",
"text",
"view",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js#L3039-L3050
|
|
14,411
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js
|
function(offset, show, callback) {
var charCount = this._model.getCharCount();
offset = Math.max(0, Math.min (offset, charCount));
var selection = new Selection(offset, offset, false);
this._setSelection (selection, show === undefined || show, true, callback);
}
|
javascript
|
function(offset, show, callback) {
var charCount = this._model.getCharCount();
offset = Math.max(0, Math.min (offset, charCount));
var selection = new Selection(offset, offset, false);
this._setSelection (selection, show === undefined || show, true, callback);
}
|
[
"function",
"(",
"offset",
",",
"show",
",",
"callback",
")",
"{",
"var",
"charCount",
"=",
"this",
".",
"_model",
".",
"getCharCount",
"(",
")",
";",
"offset",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"Math",
".",
"min",
"(",
"offset",
",",
"charCount",
")",
")",
";",
"var",
"selection",
"=",
"new",
"Selection",
"(",
"offset",
",",
"offset",
",",
"false",
")",
";",
"this",
".",
"_setSelection",
"(",
"selection",
",",
"show",
"===",
"undefined",
"||",
"show",
",",
"true",
",",
"callback",
")",
";",
"}"
] |
Sets the caret offset relative to the start of the document.
@param {Number} caret the caret offset relative to the start of the document.
@param {Boolean|Number|orion.editor.TextViewShowOptions} [show=true]
if <code>true</code>, the view will scroll the minimum amount necessary to show the caret location. If
<code>show</code> is a <code>Number</code>, the view will scroll the minimum amount necessary to show the caret location plus a
percentage of the client area height. The parameter is clamped to the [0,1] range. In either case, the view will only scroll
if the new caret location is not visible already. The <code>show</code> parameter can also be a <code>orion.editor.TextViewShowOptions</code> object. See
{@link orion.editor.TextViewShowOptions} for further information in how the options can be used to control the scrolling behavior.
@param {Function} [callback] if callback is specified and <code>scrollAnimation</code> is not zero, view scrolling is animated and
the callback is called when the animation is done. Otherwise, callback is callback right away.
@see orion.editor.TextView#getCaretOffset
@see orion.editor.TextView#setSelection
@see orion.editor.TextView#getSelection
|
[
"Sets",
"the",
"caret",
"offset",
"relative",
"to",
"the",
"start",
"of",
"the",
"document",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js#L3121-L3126
|
|
14,412
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js
|
function(model) {
if (model === this._model) { return; }
model = model || new mTextModel.TextModel();
this._model.removeEventListener("preChanging", this._modelListener.onChanging); //$NON-NLS-1$
this._model.removeEventListener("postChanged", this._modelListener.onChanged); //$NON-NLS-1$
var oldLineCount = this._model.getLineCount();
var oldCharCount = this._model.getCharCount();
var newLineCount = model.getLineCount();
var newCharCount = model.getCharCount();
var newText = model.getText();
var e = {
type: "ModelChanging", //$NON-NLS-1$
text: newText,
start: 0,
removedCharCount: oldCharCount,
addedCharCount: newCharCount,
removedLineCount: oldLineCount,
addedLineCount: newLineCount
};
this.onModelChanging(e);
this._model = model;
e = {
type: "ModelChanged", //$NON-NLS-1$
start: 0,
removedCharCount: oldCharCount,
addedCharCount: newCharCount,
removedLineCount: oldLineCount,
addedLineCount: newLineCount
};
this.onModelChanged(e);
this._model.addEventListener("preChanging", this._modelListener.onChanging); //$NON-NLS-1$
this._model.addEventListener("postChanged", this._modelListener.onChanged); //$NON-NLS-1$
this._reset();
this._update();
}
|
javascript
|
function(model) {
if (model === this._model) { return; }
model = model || new mTextModel.TextModel();
this._model.removeEventListener("preChanging", this._modelListener.onChanging); //$NON-NLS-1$
this._model.removeEventListener("postChanged", this._modelListener.onChanged); //$NON-NLS-1$
var oldLineCount = this._model.getLineCount();
var oldCharCount = this._model.getCharCount();
var newLineCount = model.getLineCount();
var newCharCount = model.getCharCount();
var newText = model.getText();
var e = {
type: "ModelChanging", //$NON-NLS-1$
text: newText,
start: 0,
removedCharCount: oldCharCount,
addedCharCount: newCharCount,
removedLineCount: oldLineCount,
addedLineCount: newLineCount
};
this.onModelChanging(e);
this._model = model;
e = {
type: "ModelChanged", //$NON-NLS-1$
start: 0,
removedCharCount: oldCharCount,
addedCharCount: newCharCount,
removedLineCount: oldLineCount,
addedLineCount: newLineCount
};
this.onModelChanged(e);
this._model.addEventListener("preChanging", this._modelListener.onChanging); //$NON-NLS-1$
this._model.addEventListener("postChanged", this._modelListener.onChanged); //$NON-NLS-1$
this._reset();
this._update();
}
|
[
"function",
"(",
"model",
")",
"{",
"if",
"(",
"model",
"===",
"this",
".",
"_model",
")",
"{",
"return",
";",
"}",
"model",
"=",
"model",
"||",
"new",
"mTextModel",
".",
"TextModel",
"(",
")",
";",
"this",
".",
"_model",
".",
"removeEventListener",
"(",
"\"preChanging\"",
",",
"this",
".",
"_modelListener",
".",
"onChanging",
")",
";",
"//$NON-NLS-1$",
"this",
".",
"_model",
".",
"removeEventListener",
"(",
"\"postChanged\"",
",",
"this",
".",
"_modelListener",
".",
"onChanged",
")",
";",
"//$NON-NLS-1$",
"var",
"oldLineCount",
"=",
"this",
".",
"_model",
".",
"getLineCount",
"(",
")",
";",
"var",
"oldCharCount",
"=",
"this",
".",
"_model",
".",
"getCharCount",
"(",
")",
";",
"var",
"newLineCount",
"=",
"model",
".",
"getLineCount",
"(",
")",
";",
"var",
"newCharCount",
"=",
"model",
".",
"getCharCount",
"(",
")",
";",
"var",
"newText",
"=",
"model",
".",
"getText",
"(",
")",
";",
"var",
"e",
"=",
"{",
"type",
":",
"\"ModelChanging\"",
",",
"//$NON-NLS-1$",
"text",
":",
"newText",
",",
"start",
":",
"0",
",",
"removedCharCount",
":",
"oldCharCount",
",",
"addedCharCount",
":",
"newCharCount",
",",
"removedLineCount",
":",
"oldLineCount",
",",
"addedLineCount",
":",
"newLineCount",
"}",
";",
"this",
".",
"onModelChanging",
"(",
"e",
")",
";",
"this",
".",
"_model",
"=",
"model",
";",
"e",
"=",
"{",
"type",
":",
"\"ModelChanged\"",
",",
"//$NON-NLS-1$",
"start",
":",
"0",
",",
"removedCharCount",
":",
"oldCharCount",
",",
"addedCharCount",
":",
"newCharCount",
",",
"removedLineCount",
":",
"oldLineCount",
",",
"addedLineCount",
":",
"newLineCount",
"}",
";",
"this",
".",
"onModelChanged",
"(",
"e",
")",
";",
"this",
".",
"_model",
".",
"addEventListener",
"(",
"\"preChanging\"",
",",
"this",
".",
"_modelListener",
".",
"onChanging",
")",
";",
"//$NON-NLS-1$",
"this",
".",
"_model",
".",
"addEventListener",
"(",
"\"postChanged\"",
",",
"this",
".",
"_modelListener",
".",
"onChanged",
")",
";",
"//$NON-NLS-1$",
"this",
".",
"_reset",
"(",
")",
";",
"this",
".",
"_update",
"(",
")",
";",
"}"
] |
Sets the text model of the text view.
@param {orion.editor.TextModel} model the text model of the view.
|
[
"Sets",
"the",
"text",
"model",
"of",
"the",
"text",
"view",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js#L3173-L3207
|
|
14,413
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js
|
function (options) {
var defaultOptions = this._defaultOptions();
for (var option in options) {
if (options.hasOwnProperty(option)) {
var newValue = options[option], oldValue = this["_" + option]; //$NON-NLS-1$
if (compare(oldValue, newValue)) { continue; }
var update = defaultOptions[option] ? defaultOptions[option].update : null;
if (update) {
update.call(this, newValue);
continue;
}
this["_" + option] = clone(newValue); //$NON-NLS-1$
}
}
this.onOptions({type: "Options", options: options}); //$NON-NLS-1$
}
|
javascript
|
function (options) {
var defaultOptions = this._defaultOptions();
for (var option in options) {
if (options.hasOwnProperty(option)) {
var newValue = options[option], oldValue = this["_" + option]; //$NON-NLS-1$
if (compare(oldValue, newValue)) { continue; }
var update = defaultOptions[option] ? defaultOptions[option].update : null;
if (update) {
update.call(this, newValue);
continue;
}
this["_" + option] = clone(newValue); //$NON-NLS-1$
}
}
this.onOptions({type: "Options", options: options}); //$NON-NLS-1$
}
|
[
"function",
"(",
"options",
")",
"{",
"var",
"defaultOptions",
"=",
"this",
".",
"_defaultOptions",
"(",
")",
";",
"for",
"(",
"var",
"option",
"in",
"options",
")",
"{",
"if",
"(",
"options",
".",
"hasOwnProperty",
"(",
"option",
")",
")",
"{",
"var",
"newValue",
"=",
"options",
"[",
"option",
"]",
",",
"oldValue",
"=",
"this",
"[",
"\"_\"",
"+",
"option",
"]",
";",
"//$NON-NLS-1$",
"if",
"(",
"compare",
"(",
"oldValue",
",",
"newValue",
")",
")",
"{",
"continue",
";",
"}",
"var",
"update",
"=",
"defaultOptions",
"[",
"option",
"]",
"?",
"defaultOptions",
"[",
"option",
"]",
".",
"update",
":",
"null",
";",
"if",
"(",
"update",
")",
"{",
"update",
".",
"call",
"(",
"this",
",",
"newValue",
")",
";",
"continue",
";",
"}",
"this",
"[",
"\"_\"",
"+",
"option",
"]",
"=",
"clone",
"(",
"newValue",
")",
";",
"//$NON-NLS-1$",
"}",
"}",
"this",
".",
"onOptions",
"(",
"{",
"type",
":",
"\"Options\"",
",",
"options",
":",
"options",
"}",
")",
";",
"//$NON-NLS-1$",
"}"
] |
Sets the view options for the view.
@param {orion.editor.TextViewOptions} options the view options.
@see orion.editor.TextView#getOptions
|
[
"Sets",
"the",
"view",
"options",
"for",
"the",
"view",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/textView.js#L3215-L3230
|
|
14,414
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/javascript/quickFixes.js
|
function(editorContext, context, astManager) {
return astManager.getAST(editorContext).then(function(ast) {
var node = Finder.findNode(context.annotation.start, ast, {parents:true});
if(node && node.type === 'ArrayExpression') {
var model = new TextModel.TextModel(ast.sourceFile.text.slice(context.annotation.start, context.annotation.end));
var len = node.elements.length;
var idx = len-1;
var item = node.elements[idx];
if(item === null) {
var end = Finder.findToken(node.range[1], ast.tokens);
if(end.value !== ']') {
//for a follow-on token we want the previous - i.e. a token immediately following the ']' that has no space
end = ast.tokens[end.index-1];
}
//wipe all trailing entries first using the ']' token start as the end
for(; idx > -1; idx--) {
item = node.elements[idx];
if(item !== null) {
break;
}
}
if(item === null) {
//whole array is sparse - wipe it
return editorContext.setText('', context.annotation.start+1, context.annotation.end-1);
}
model.setText('', item.range[1]-context.annotation.start, end.range[0]-context.annotation.start);
}
var prev = item;
for(; idx > -1; idx--) {
item = node.elements[idx];
if(item === null || item.range[0] === prev.range[0]) {
continue;
}
model.setText(', ', item.range[1]-context.annotation.start, prev.range[0]-context.annotation.start); //$NON-NLS-1$
prev = item;
}
if(item === null && prev !== null) {
//need to wipe the front of the array
model.setText('', node.range[0]+1-context.annotation.start, prev.range[0]-context.annotation.start);
}
return editorContext.setText(model.getText(), context.annotation.start, context.annotation.end);
}
return null;
});
}
|
javascript
|
function(editorContext, context, astManager) {
return astManager.getAST(editorContext).then(function(ast) {
var node = Finder.findNode(context.annotation.start, ast, {parents:true});
if(node && node.type === 'ArrayExpression') {
var model = new TextModel.TextModel(ast.sourceFile.text.slice(context.annotation.start, context.annotation.end));
var len = node.elements.length;
var idx = len-1;
var item = node.elements[idx];
if(item === null) {
var end = Finder.findToken(node.range[1], ast.tokens);
if(end.value !== ']') {
//for a follow-on token we want the previous - i.e. a token immediately following the ']' that has no space
end = ast.tokens[end.index-1];
}
//wipe all trailing entries first using the ']' token start as the end
for(; idx > -1; idx--) {
item = node.elements[idx];
if(item !== null) {
break;
}
}
if(item === null) {
//whole array is sparse - wipe it
return editorContext.setText('', context.annotation.start+1, context.annotation.end-1);
}
model.setText('', item.range[1]-context.annotation.start, end.range[0]-context.annotation.start);
}
var prev = item;
for(; idx > -1; idx--) {
item = node.elements[idx];
if(item === null || item.range[0] === prev.range[0]) {
continue;
}
model.setText(', ', item.range[1]-context.annotation.start, prev.range[0]-context.annotation.start); //$NON-NLS-1$
prev = item;
}
if(item === null && prev !== null) {
//need to wipe the front of the array
model.setText('', node.range[0]+1-context.annotation.start, prev.range[0]-context.annotation.start);
}
return editorContext.setText(model.getText(), context.annotation.start, context.annotation.end);
}
return null;
});
}
|
[
"function",
"(",
"editorContext",
",",
"context",
",",
"astManager",
")",
"{",
"return",
"astManager",
".",
"getAST",
"(",
"editorContext",
")",
".",
"then",
"(",
"function",
"(",
"ast",
")",
"{",
"var",
"node",
"=",
"Finder",
".",
"findNode",
"(",
"context",
".",
"annotation",
".",
"start",
",",
"ast",
",",
"{",
"parents",
":",
"true",
"}",
")",
";",
"if",
"(",
"node",
"&&",
"node",
".",
"type",
"===",
"'ArrayExpression'",
")",
"{",
"var",
"model",
"=",
"new",
"TextModel",
".",
"TextModel",
"(",
"ast",
".",
"sourceFile",
".",
"text",
".",
"slice",
"(",
"context",
".",
"annotation",
".",
"start",
",",
"context",
".",
"annotation",
".",
"end",
")",
")",
";",
"var",
"len",
"=",
"node",
".",
"elements",
".",
"length",
";",
"var",
"idx",
"=",
"len",
"-",
"1",
";",
"var",
"item",
"=",
"node",
".",
"elements",
"[",
"idx",
"]",
";",
"if",
"(",
"item",
"===",
"null",
")",
"{",
"var",
"end",
"=",
"Finder",
".",
"findToken",
"(",
"node",
".",
"range",
"[",
"1",
"]",
",",
"ast",
".",
"tokens",
")",
";",
"if",
"(",
"end",
".",
"value",
"!==",
"']'",
")",
"{",
"//for a follow-on token we want the previous - i.e. a token immediately following the ']' that has no space",
"end",
"=",
"ast",
".",
"tokens",
"[",
"end",
".",
"index",
"-",
"1",
"]",
";",
"}",
"//wipe all trailing entries first using the ']' token start as the end",
"for",
"(",
";",
"idx",
">",
"-",
"1",
";",
"idx",
"--",
")",
"{",
"item",
"=",
"node",
".",
"elements",
"[",
"idx",
"]",
";",
"if",
"(",
"item",
"!==",
"null",
")",
"{",
"break",
";",
"}",
"}",
"if",
"(",
"item",
"===",
"null",
")",
"{",
"//whole array is sparse - wipe it",
"return",
"editorContext",
".",
"setText",
"(",
"''",
",",
"context",
".",
"annotation",
".",
"start",
"+",
"1",
",",
"context",
".",
"annotation",
".",
"end",
"-",
"1",
")",
";",
"}",
"model",
".",
"setText",
"(",
"''",
",",
"item",
".",
"range",
"[",
"1",
"]",
"-",
"context",
".",
"annotation",
".",
"start",
",",
"end",
".",
"range",
"[",
"0",
"]",
"-",
"context",
".",
"annotation",
".",
"start",
")",
";",
"}",
"var",
"prev",
"=",
"item",
";",
"for",
"(",
";",
"idx",
">",
"-",
"1",
";",
"idx",
"--",
")",
"{",
"item",
"=",
"node",
".",
"elements",
"[",
"idx",
"]",
";",
"if",
"(",
"item",
"===",
"null",
"||",
"item",
".",
"range",
"[",
"0",
"]",
"===",
"prev",
".",
"range",
"[",
"0",
"]",
")",
"{",
"continue",
";",
"}",
"model",
".",
"setText",
"(",
"', '",
",",
"item",
".",
"range",
"[",
"1",
"]",
"-",
"context",
".",
"annotation",
".",
"start",
",",
"prev",
".",
"range",
"[",
"0",
"]",
"-",
"context",
".",
"annotation",
".",
"start",
")",
";",
"//$NON-NLS-1$",
"prev",
"=",
"item",
";",
"}",
"if",
"(",
"item",
"===",
"null",
"&&",
"prev",
"!==",
"null",
")",
"{",
"//need to wipe the front of the array",
"model",
".",
"setText",
"(",
"''",
",",
"node",
".",
"range",
"[",
"0",
"]",
"+",
"1",
"-",
"context",
".",
"annotation",
".",
"start",
",",
"prev",
".",
"range",
"[",
"0",
"]",
"-",
"context",
".",
"annotation",
".",
"start",
")",
";",
"}",
"return",
"editorContext",
".",
"setText",
"(",
"model",
".",
"getText",
"(",
")",
",",
"context",
".",
"annotation",
".",
"start",
",",
"context",
".",
"annotation",
".",
"end",
")",
";",
"}",
"return",
"null",
";",
"}",
")",
";",
"}"
] |
fix for the no-sparse-arrays linting rule
@callback
|
[
"fix",
"for",
"the",
"no",
"-",
"sparse",
"-",
"arrays",
"linting",
"rule"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/javascript/quickFixes.js#L347-L391
|
|
14,415
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-const-assign.js
|
isModifyingReference
|
function isModifyingReference(reference, index, references) {
var identifier = reference.identifier;
return identifier &&
reference.init === false &&
reference.isWrite() &&
// Destructuring assignments can have multiple default value,
// so possibly there are multiple writeable references for the same identifier.
(index === 0 || references[index - 1].identifier !== identifier
);
}
|
javascript
|
function isModifyingReference(reference, index, references) {
var identifier = reference.identifier;
return identifier &&
reference.init === false &&
reference.isWrite() &&
// Destructuring assignments can have multiple default value,
// so possibly there are multiple writeable references for the same identifier.
(index === 0 || references[index - 1].identifier !== identifier
);
}
|
[
"function",
"isModifyingReference",
"(",
"reference",
",",
"index",
",",
"references",
")",
"{",
"var",
"identifier",
"=",
"reference",
".",
"identifier",
";",
"return",
"identifier",
"&&",
"reference",
".",
"init",
"===",
"false",
"&&",
"reference",
".",
"isWrite",
"(",
")",
"&&",
"// Destructuring assignments can have multiple default value,",
"// so possibly there are multiple writeable references for the same identifier.",
"(",
"index",
"===",
"0",
"||",
"references",
"[",
"index",
"-",
"1",
"]",
".",
"identifier",
"!==",
"identifier",
")",
";",
"}"
] |
Checks reference if is non initializer and writable.
@param {Reference} reference - A reference to check.
@param {int} index - The index of the reference in the references.
@param {Reference[]} references - The array that the reference belongs to.
@returns {boolean} Success/Failure
@private
|
[
"Checks",
"reference",
"if",
"is",
"non",
"initializer",
"and",
"writable",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-const-assign.js#L26-L36
|
14,416
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.debug/web/orion/debug/breakpoint.js
|
function(location, line, description, enabled) {
this.location = location;
this.line = line;
this.description = description;
this.enabled = enabled;
}
|
javascript
|
function(location, line, description, enabled) {
this.location = location;
this.line = line;
this.description = description;
this.enabled = enabled;
}
|
[
"function",
"(",
"location",
",",
"line",
",",
"description",
",",
"enabled",
")",
"{",
"this",
".",
"location",
"=",
"location",
";",
"this",
".",
"line",
"=",
"line",
";",
"this",
".",
"description",
"=",
"description",
";",
"this",
".",
"enabled",
"=",
"enabled",
";",
"}"
] |
Line breakpoint class.
@class {orion.debug.LineBreakpoint}
@implements {orion.debug.IBreakpoint}
@param {string} location - Location of document
@param {number} line
@param {string} description - Description HTML
@param {boolean} enabled
|
[
"Line",
"breakpoint",
"class",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.debug/web/orion/debug/breakpoint.js#L91-L96
|
|
14,417
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.debug/web/orion/debug/breakpoint.js
|
function(location, functionName, description, enabled) {
this.location = location;
this.function = functionName;
this.description = description;
this.enabled = enabled;
}
|
javascript
|
function(location, functionName, description, enabled) {
this.location = location;
this.function = functionName;
this.description = description;
this.enabled = enabled;
}
|
[
"function",
"(",
"location",
",",
"functionName",
",",
"description",
",",
"enabled",
")",
"{",
"this",
".",
"location",
"=",
"location",
";",
"this",
".",
"function",
"=",
"functionName",
";",
"this",
".",
"description",
"=",
"description",
";",
"this",
".",
"enabled",
"=",
"enabled",
";",
"}"
] |
Function breakpoint class.
@class {orion.debug.FunctionBreakpoint}
@implements {orion.debug.IBreakpoint}
@param {string} location - Location of document
@param {string} functionName - function name
@param {string} description - Description HTML
@param {boolean} enabled
|
[
"Function",
"breakpoint",
"class",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.debug/web/orion/debug/breakpoint.js#L178-L183
|
|
14,418
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.debug/web/orion/debug/breakpoint.js
|
deserialize
|
function deserialize(plain) {
plain = plain || {};
plain.location = plain.location || "";
plain.description = plain.description || "";
switch (plain.type) {
case 'LineBookmark':
if (!isFinite(plain.line)) break;
return new LineBookmark(plain.location, plain.line, plain.description);
case 'LineBreakpoint':
if (!isFinite(plain.line)) break;
return new LineBreakpoint(plain.location, plain.line, plain.description, !!plain.enabled);
case 'LineConditionalBreakpoint':
if (!isFinite(plain.line)) break;
if (!plain.condition) break;
return new LineConditionalBreakpoint(plain.location, plain.line, plain.description, plain.condition, !!plain.enabled);
case 'FunctionBreakpoint':
if (!plain.function) break;
return new FunctionBreakpoint(plain.location, plain.function, plain.description, !!plain.enabled);
case 'ExceptionBreakpoint':
if (!plain.label) break;
return new ExceptionBreakpoint(plain.label, plain.description, !!plain.enabled);
}
return null;
}
|
javascript
|
function deserialize(plain) {
plain = plain || {};
plain.location = plain.location || "";
plain.description = plain.description || "";
switch (plain.type) {
case 'LineBookmark':
if (!isFinite(plain.line)) break;
return new LineBookmark(plain.location, plain.line, plain.description);
case 'LineBreakpoint':
if (!isFinite(plain.line)) break;
return new LineBreakpoint(plain.location, plain.line, plain.description, !!plain.enabled);
case 'LineConditionalBreakpoint':
if (!isFinite(plain.line)) break;
if (!plain.condition) break;
return new LineConditionalBreakpoint(plain.location, plain.line, plain.description, plain.condition, !!plain.enabled);
case 'FunctionBreakpoint':
if (!plain.function) break;
return new FunctionBreakpoint(plain.location, plain.function, plain.description, !!plain.enabled);
case 'ExceptionBreakpoint':
if (!plain.label) break;
return new ExceptionBreakpoint(plain.label, plain.description, !!plain.enabled);
}
return null;
}
|
[
"function",
"deserialize",
"(",
"plain",
")",
"{",
"plain",
"=",
"plain",
"||",
"{",
"}",
";",
"plain",
".",
"location",
"=",
"plain",
".",
"location",
"||",
"\"\"",
";",
"plain",
".",
"description",
"=",
"plain",
".",
"description",
"||",
"\"\"",
";",
"switch",
"(",
"plain",
".",
"type",
")",
"{",
"case",
"'LineBookmark'",
":",
"if",
"(",
"!",
"isFinite",
"(",
"plain",
".",
"line",
")",
")",
"break",
";",
"return",
"new",
"LineBookmark",
"(",
"plain",
".",
"location",
",",
"plain",
".",
"line",
",",
"plain",
".",
"description",
")",
";",
"case",
"'LineBreakpoint'",
":",
"if",
"(",
"!",
"isFinite",
"(",
"plain",
".",
"line",
")",
")",
"break",
";",
"return",
"new",
"LineBreakpoint",
"(",
"plain",
".",
"location",
",",
"plain",
".",
"line",
",",
"plain",
".",
"description",
",",
"!",
"!",
"plain",
".",
"enabled",
")",
";",
"case",
"'LineConditionalBreakpoint'",
":",
"if",
"(",
"!",
"isFinite",
"(",
"plain",
".",
"line",
")",
")",
"break",
";",
"if",
"(",
"!",
"plain",
".",
"condition",
")",
"break",
";",
"return",
"new",
"LineConditionalBreakpoint",
"(",
"plain",
".",
"location",
",",
"plain",
".",
"line",
",",
"plain",
".",
"description",
",",
"plain",
".",
"condition",
",",
"!",
"!",
"plain",
".",
"enabled",
")",
";",
"case",
"'FunctionBreakpoint'",
":",
"if",
"(",
"!",
"plain",
".",
"function",
")",
"break",
";",
"return",
"new",
"FunctionBreakpoint",
"(",
"plain",
".",
"location",
",",
"plain",
".",
"function",
",",
"plain",
".",
"description",
",",
"!",
"!",
"plain",
".",
"enabled",
")",
";",
"case",
"'ExceptionBreakpoint'",
":",
"if",
"(",
"!",
"plain",
".",
"label",
")",
"break",
";",
"return",
"new",
"ExceptionBreakpoint",
"(",
"plain",
".",
"label",
",",
"plain",
".",
"description",
",",
"!",
"!",
"plain",
".",
"enabled",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Deserialize a breakpoint from a plain object
@param {Object}
@return {orion.debug.IBreakpoint}
|
[
"Deserialize",
"a",
"breakpoint",
"from",
"a",
"plain",
"object"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.debug/web/orion/debug/breakpoint.js#L253-L280
|
14,419
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer.js
|
Explorer
|
function Explorer(serviceRegistry, selection, renderer, commandRegistry) {
this.registry = serviceRegistry;
this.selection = selection;
this.commandService = commandRegistry;
this.setRenderer(renderer);
this.myTree = null;
}
|
javascript
|
function Explorer(serviceRegistry, selection, renderer, commandRegistry) {
this.registry = serviceRegistry;
this.selection = selection;
this.commandService = commandRegistry;
this.setRenderer(renderer);
this.myTree = null;
}
|
[
"function",
"Explorer",
"(",
"serviceRegistry",
",",
"selection",
",",
"renderer",
",",
"commandRegistry",
")",
"{",
"this",
".",
"registry",
"=",
"serviceRegistry",
";",
"this",
".",
"selection",
"=",
"selection",
";",
"this",
".",
"commandService",
"=",
"commandRegistry",
";",
"this",
".",
"setRenderer",
"(",
"renderer",
")",
";",
"this",
".",
"myTree",
"=",
"null",
";",
"}"
] |
Creates a new explorer.
@name orion.explorer.Explorer
@class A table-based explorer component.
@param {orion.serviceregistry.ServiceRegistry} serviceRegistry The service registry to
use for any services required by the explorer
@param {orion.selection.Selection} selection The initial selection
@param renderer
@param {orion.commandregistry.CommandRegistry} commandRegistry The command registry to use for commands. Optional.
|
[
"Creates",
"a",
"new",
"explorer",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer.js#L38-L45
|
14,420
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer.js
|
function(parent, children) {
if (this.myTree) {
this.myTree.refresh.bind(this.myTree)(parent, children, true);
}
}
|
javascript
|
function(parent, children) {
if (this.myTree) {
this.myTree.refresh.bind(this.myTree)(parent, children, true);
}
}
|
[
"function",
"(",
"parent",
",",
"children",
")",
"{",
"if",
"(",
"this",
".",
"myTree",
")",
"{",
"this",
".",
"myTree",
".",
"refresh",
".",
"bind",
"(",
"this",
".",
"myTree",
")",
"(",
"parent",
",",
"children",
",",
"true",
")",
";",
"}",
"}"
] |
we have changed an item on the server at the specified parent node
|
[
"we",
"have",
"changed",
"an",
"item",
"on",
"the",
"server",
"at",
"the",
"specified",
"parent",
"node"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer.js#L92-L96
|
|
14,421
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer.js
|
function() {
var topLevelNodes = this._navHandler.getTopLevelNodes();
for (var i = 0; i < topLevelNodes.length ; i++){
this.myTree.collapse(topLevelNodes[i]);
}
}
|
javascript
|
function() {
var topLevelNodes = this._navHandler.getTopLevelNodes();
for (var i = 0; i < topLevelNodes.length ; i++){
this.myTree.collapse(topLevelNodes[i]);
}
}
|
[
"function",
"(",
")",
"{",
"var",
"topLevelNodes",
"=",
"this",
".",
"_navHandler",
".",
"getTopLevelNodes",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"topLevelNodes",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"myTree",
".",
"collapse",
"(",
"topLevelNodes",
"[",
"i",
"]",
")",
";",
"}",
"}"
] |
Collapse all the nodes in the explorer
|
[
"Collapse",
"all",
"the",
"nodes",
"in",
"the",
"explorer"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer.js#L158-L163
|
|
14,422
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer.js
|
function(nodeModel, excludes) {
if(nodeModel){
this._expandRecursively(nodeModel, excludes);
} else {
if(!this._navHandler){
return;
}
//We already know what the top level children is under the root, from the navigation handler.
var topLevelNodes = this._navHandler.getTopLevelNodes();
for (var i = 0; i < topLevelNodes.length ; i++){
this._expandRecursively(topLevelNodes[i], excludes);
}
}
}
|
javascript
|
function(nodeModel, excludes) {
if(nodeModel){
this._expandRecursively(nodeModel, excludes);
} else {
if(!this._navHandler){
return;
}
//We already know what the top level children is under the root, from the navigation handler.
var topLevelNodes = this._navHandler.getTopLevelNodes();
for (var i = 0; i < topLevelNodes.length ; i++){
this._expandRecursively(topLevelNodes[i], excludes);
}
}
}
|
[
"function",
"(",
"nodeModel",
",",
"excludes",
")",
"{",
"if",
"(",
"nodeModel",
")",
"{",
"this",
".",
"_expandRecursively",
"(",
"nodeModel",
",",
"excludes",
")",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"this",
".",
"_navHandler",
")",
"{",
"return",
";",
"}",
"//We already know what the top level children is under the root, from the navigation handler.",
"var",
"topLevelNodes",
"=",
"this",
".",
"_navHandler",
".",
"getTopLevelNodes",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"topLevelNodes",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"_expandRecursively",
"(",
"topLevelNodes",
"[",
"i",
"]",
",",
"excludes",
")",
";",
"}",
"}",
"}"
] |
Expand all the nodes under a node in the explorer
@param nodeModel {Object} the node model to be expanded. If not provided the whole tree is expanded recursively
|
[
"Expand",
"all",
"the",
"nodes",
"under",
"a",
"node",
"in",
"the",
"explorer"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer.js#L169-L182
|
|
14,423
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer.js
|
function (parentId, model, options){
parentId = typeof parentId === "string" ? parentId : (parentId.id || parentId); //$NON-NLS-0$
if(this.selection) {
this.selection.setSelections([]);
}
if(this.getNavHandler()){
this.getNavHandler().destroy();
this._navHandler = null;
}
var treeId = parentId + "innerTree"; //$NON-NLS-0$
var existing = lib.node(treeId);
if (existing) {
lib.empty(existing);
}
if (model){
model.rootId = treeId + "Root"; //$NON-NLS-0$
}
this.model = model;
this._parentId = parentId;
this.role = options && options.role;
this._treeOptions = options;
var useSelection = !options || (options && !options.noSelection);
if(useSelection){
this.selectionPolicy = options ? options.selectionPolicy : "";
this._navDict = new mNavHandler.ExplorerNavDict(this.model);
}
this.myTree = new mTreeTable.TableTree({
id: treeId,
role: options ? options.role : undefined,
name: options ? options.name : undefined,
model: model,
parent: parentId,
onComplete: function(tree) {
if(this.selectionPolicy === "cursorOnly"){ //$NON-NLS-0$
this.initNavHandler();
var navHandler = this.getNavHandler();
if (navHandler) {
navHandler.rowsChanged();
}
}
if (options.onComplete) options.onComplete(tree);
}.bind(this),
labelColumnIndex: this.renderer.getLabelColumnIndex(),
renderer: this.renderer,
showRoot: options ? !!options.showRoot : false,
indent: options ? options.indent: undefined,
preCollapse: options ? options.preCollapse: undefined,
onCollapse: options && options.onCollapse ? options.onCollapse : function(model) {
var navHandler = this.getNavHandler();
if (navHandler) {
navHandler.onCollapse(model);
}
}.bind(this),
navHandlerFactory: options ? options.navHandlerFactory: undefined,
tableElement: options ? options.tableElement : undefined,
tableBodyElement: options ? options.tableBodyElement : undefined,
tableRowElement: options ? options.tableRowElement : undefined
});
this.renderer._initializeUIState();
}
|
javascript
|
function (parentId, model, options){
parentId = typeof parentId === "string" ? parentId : (parentId.id || parentId); //$NON-NLS-0$
if(this.selection) {
this.selection.setSelections([]);
}
if(this.getNavHandler()){
this.getNavHandler().destroy();
this._navHandler = null;
}
var treeId = parentId + "innerTree"; //$NON-NLS-0$
var existing = lib.node(treeId);
if (existing) {
lib.empty(existing);
}
if (model){
model.rootId = treeId + "Root"; //$NON-NLS-0$
}
this.model = model;
this._parentId = parentId;
this.role = options && options.role;
this._treeOptions = options;
var useSelection = !options || (options && !options.noSelection);
if(useSelection){
this.selectionPolicy = options ? options.selectionPolicy : "";
this._navDict = new mNavHandler.ExplorerNavDict(this.model);
}
this.myTree = new mTreeTable.TableTree({
id: treeId,
role: options ? options.role : undefined,
name: options ? options.name : undefined,
model: model,
parent: parentId,
onComplete: function(tree) {
if(this.selectionPolicy === "cursorOnly"){ //$NON-NLS-0$
this.initNavHandler();
var navHandler = this.getNavHandler();
if (navHandler) {
navHandler.rowsChanged();
}
}
if (options.onComplete) options.onComplete(tree);
}.bind(this),
labelColumnIndex: this.renderer.getLabelColumnIndex(),
renderer: this.renderer,
showRoot: options ? !!options.showRoot : false,
indent: options ? options.indent: undefined,
preCollapse: options ? options.preCollapse: undefined,
onCollapse: options && options.onCollapse ? options.onCollapse : function(model) {
var navHandler = this.getNavHandler();
if (navHandler) {
navHandler.onCollapse(model);
}
}.bind(this),
navHandlerFactory: options ? options.navHandlerFactory: undefined,
tableElement: options ? options.tableElement : undefined,
tableBodyElement: options ? options.tableBodyElement : undefined,
tableRowElement: options ? options.tableRowElement : undefined
});
this.renderer._initializeUIState();
}
|
[
"function",
"(",
"parentId",
",",
"model",
",",
"options",
")",
"{",
"parentId",
"=",
"typeof",
"parentId",
"===",
"\"string\"",
"?",
"parentId",
":",
"(",
"parentId",
".",
"id",
"||",
"parentId",
")",
";",
"//$NON-NLS-0$",
"if",
"(",
"this",
".",
"selection",
")",
"{",
"this",
".",
"selection",
".",
"setSelections",
"(",
"[",
"]",
")",
";",
"}",
"if",
"(",
"this",
".",
"getNavHandler",
"(",
")",
")",
"{",
"this",
".",
"getNavHandler",
"(",
")",
".",
"destroy",
"(",
")",
";",
"this",
".",
"_navHandler",
"=",
"null",
";",
"}",
"var",
"treeId",
"=",
"parentId",
"+",
"\"innerTree\"",
";",
"//$NON-NLS-0$",
"var",
"existing",
"=",
"lib",
".",
"node",
"(",
"treeId",
")",
";",
"if",
"(",
"existing",
")",
"{",
"lib",
".",
"empty",
"(",
"existing",
")",
";",
"}",
"if",
"(",
"model",
")",
"{",
"model",
".",
"rootId",
"=",
"treeId",
"+",
"\"Root\"",
";",
"//$NON-NLS-0$",
"}",
"this",
".",
"model",
"=",
"model",
";",
"this",
".",
"_parentId",
"=",
"parentId",
";",
"this",
".",
"role",
"=",
"options",
"&&",
"options",
".",
"role",
";",
"this",
".",
"_treeOptions",
"=",
"options",
";",
"var",
"useSelection",
"=",
"!",
"options",
"||",
"(",
"options",
"&&",
"!",
"options",
".",
"noSelection",
")",
";",
"if",
"(",
"useSelection",
")",
"{",
"this",
".",
"selectionPolicy",
"=",
"options",
"?",
"options",
".",
"selectionPolicy",
":",
"\"\"",
";",
"this",
".",
"_navDict",
"=",
"new",
"mNavHandler",
".",
"ExplorerNavDict",
"(",
"this",
".",
"model",
")",
";",
"}",
"this",
".",
"myTree",
"=",
"new",
"mTreeTable",
".",
"TableTree",
"(",
"{",
"id",
":",
"treeId",
",",
"role",
":",
"options",
"?",
"options",
".",
"role",
":",
"undefined",
",",
"name",
":",
"options",
"?",
"options",
".",
"name",
":",
"undefined",
",",
"model",
":",
"model",
",",
"parent",
":",
"parentId",
",",
"onComplete",
":",
"function",
"(",
"tree",
")",
"{",
"if",
"(",
"this",
".",
"selectionPolicy",
"===",
"\"cursorOnly\"",
")",
"{",
"//$NON-NLS-0$",
"this",
".",
"initNavHandler",
"(",
")",
";",
"var",
"navHandler",
"=",
"this",
".",
"getNavHandler",
"(",
")",
";",
"if",
"(",
"navHandler",
")",
"{",
"navHandler",
".",
"rowsChanged",
"(",
")",
";",
"}",
"}",
"if",
"(",
"options",
".",
"onComplete",
")",
"options",
".",
"onComplete",
"(",
"tree",
")",
";",
"}",
".",
"bind",
"(",
"this",
")",
",",
"labelColumnIndex",
":",
"this",
".",
"renderer",
".",
"getLabelColumnIndex",
"(",
")",
",",
"renderer",
":",
"this",
".",
"renderer",
",",
"showRoot",
":",
"options",
"?",
"!",
"!",
"options",
".",
"showRoot",
":",
"false",
",",
"indent",
":",
"options",
"?",
"options",
".",
"indent",
":",
"undefined",
",",
"preCollapse",
":",
"options",
"?",
"options",
".",
"preCollapse",
":",
"undefined",
",",
"onCollapse",
":",
"options",
"&&",
"options",
".",
"onCollapse",
"?",
"options",
".",
"onCollapse",
":",
"function",
"(",
"model",
")",
"{",
"var",
"navHandler",
"=",
"this",
".",
"getNavHandler",
"(",
")",
";",
"if",
"(",
"navHandler",
")",
"{",
"navHandler",
".",
"onCollapse",
"(",
"model",
")",
";",
"}",
"}",
".",
"bind",
"(",
"this",
")",
",",
"navHandlerFactory",
":",
"options",
"?",
"options",
".",
"navHandlerFactory",
":",
"undefined",
",",
"tableElement",
":",
"options",
"?",
"options",
".",
"tableElement",
":",
"undefined",
",",
"tableBodyElement",
":",
"options",
"?",
"options",
".",
"tableBodyElement",
":",
"undefined",
",",
"tableRowElement",
":",
"options",
"?",
"options",
".",
"tableRowElement",
":",
"undefined",
"}",
")",
";",
"this",
".",
"renderer",
".",
"_initializeUIState",
"(",
")",
";",
"}"
] |
Displays tree table containing filled with data provided by given model
@param {String|Element} parentId id of parent dom element, or the element itself
@param {Object} model providing data to display
@param {Object} options optional parameters of the tree(custom indent, onCollapse callback)
|
[
"Displays",
"tree",
"table",
"containing",
"filled",
"with",
"data",
"provided",
"by",
"given",
"model"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer.js#L220-L279
|
|
14,424
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer.js
|
ExplorerModel
|
function ExplorerModel(rootPath, /* function returning promise */fetchItems, idPrefix) {
this.rootPath = rootPath;
this.fetchItems = fetchItems;
this.idPrefix = idPrefix || "";
}
|
javascript
|
function ExplorerModel(rootPath, /* function returning promise */fetchItems, idPrefix) {
this.rootPath = rootPath;
this.fetchItems = fetchItems;
this.idPrefix = idPrefix || "";
}
|
[
"function",
"ExplorerModel",
"(",
"rootPath",
",",
"/* function returning promise */",
"fetchItems",
",",
"idPrefix",
")",
"{",
"this",
".",
"rootPath",
"=",
"rootPath",
";",
"this",
".",
"fetchItems",
"=",
"fetchItems",
";",
"this",
".",
"idPrefix",
"=",
"idPrefix",
"||",
"\"\"",
";",
"}"
] |
Creates a new explorer model instance.
@name orion.explorer.ExplorerModel
@class Simple tree model using Children and ChildrenLocation attributes to fetch children
and calculating id based on Location attribute.
|
[
"Creates",
"a",
"new",
"explorer",
"model",
"instance",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer.js#L418-L422
|
14,425
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer.js
|
ExplorerFlatModel
|
function ExplorerFlatModel(rootPath, fetchItems, root) {
this.rootPath = rootPath;
this.fetchItems = fetchItems;
this.root = root;
}
|
javascript
|
function ExplorerFlatModel(rootPath, fetchItems, root) {
this.rootPath = rootPath;
this.fetchItems = fetchItems;
this.root = root;
}
|
[
"function",
"ExplorerFlatModel",
"(",
"rootPath",
",",
"fetchItems",
",",
"root",
")",
"{",
"this",
".",
"rootPath",
"=",
"rootPath",
";",
"this",
".",
"fetchItems",
"=",
"fetchItems",
";",
"this",
".",
"root",
"=",
"root",
";",
"}"
] |
Creates a new flat explorer model.
@name orion.explorer.ExplorerFlatModel
@class Tree model used by orion.explorer.Explorer for flat structures
@param {String} rootPath path to load tree table root, response should contain a list of items
@param {Function} fetchItems A function that returns a promise that resolves to the
items at the provided location.
|
[
"Creates",
"a",
"new",
"flat",
"explorer",
"model",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer.js#L483-L487
|
14,426
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer.js
|
function(prefPath) {
var didRestoreSelections = false;
var expanded = window.sessionStorage[prefPath+"expanded"]; //$NON-NLS-0$
if (typeof expanded=== "string") { //$NON-NLS-0$
if (expanded.length > 0) {
expanded= JSON.parse(expanded);
} else {
expanded = null;
}
}
var i;
if (expanded) {
for (i=0; i<expanded.length; i++) {
var row= lib.node(expanded[i]);
if (row) {
this._expanded.push(expanded[i]);
// restore selections after expansion in case an expanded item was selected.
var self = this;
this.tableTree.expand(expanded[i], function() {
self._restoreSelections(prefPath);
});
didRestoreSelections = true;
}
}
}
return !didRestoreSelections;
}
|
javascript
|
function(prefPath) {
var didRestoreSelections = false;
var expanded = window.sessionStorage[prefPath+"expanded"]; //$NON-NLS-0$
if (typeof expanded=== "string") { //$NON-NLS-0$
if (expanded.length > 0) {
expanded= JSON.parse(expanded);
} else {
expanded = null;
}
}
var i;
if (expanded) {
for (i=0; i<expanded.length; i++) {
var row= lib.node(expanded[i]);
if (row) {
this._expanded.push(expanded[i]);
// restore selections after expansion in case an expanded item was selected.
var self = this;
this.tableTree.expand(expanded[i], function() {
self._restoreSelections(prefPath);
});
didRestoreSelections = true;
}
}
}
return !didRestoreSelections;
}
|
[
"function",
"(",
"prefPath",
")",
"{",
"var",
"didRestoreSelections",
"=",
"false",
";",
"var",
"expanded",
"=",
"window",
".",
"sessionStorage",
"[",
"prefPath",
"+",
"\"expanded\"",
"]",
";",
"//$NON-NLS-0$",
"if",
"(",
"typeof",
"expanded",
"===",
"\"string\"",
")",
"{",
"//$NON-NLS-0$",
"if",
"(",
"expanded",
".",
"length",
">",
"0",
")",
"{",
"expanded",
"=",
"JSON",
".",
"parse",
"(",
"expanded",
")",
";",
"}",
"else",
"{",
"expanded",
"=",
"null",
";",
"}",
"}",
"var",
"i",
";",
"if",
"(",
"expanded",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"expanded",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"row",
"=",
"lib",
".",
"node",
"(",
"expanded",
"[",
"i",
"]",
")",
";",
"if",
"(",
"row",
")",
"{",
"this",
".",
"_expanded",
".",
"push",
"(",
"expanded",
"[",
"i",
"]",
")",
";",
"// restore selections after expansion in case an expanded item was selected.",
"var",
"self",
"=",
"this",
";",
"this",
".",
"tableTree",
".",
"expand",
"(",
"expanded",
"[",
"i",
"]",
",",
"function",
"(",
")",
"{",
"self",
".",
"_restoreSelections",
"(",
"prefPath",
")",
";",
"}",
")",
";",
"didRestoreSelections",
"=",
"true",
";",
"}",
"}",
"}",
"return",
"!",
"didRestoreSelections",
";",
"}"
] |
returns true if the selections also need to be restored.
|
[
"returns",
"true",
"if",
"the",
"selections",
"also",
"need",
"to",
"be",
"restored",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer.js#L743-L769
|
|
14,427
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer.js
|
SimpleFlatModel
|
function SimpleFlatModel(items, idPrefix, getKey) {
this.items = items;
this.getKey = getKey;
this.idPrefix = idPrefix;
this.root = {children: items};
}
|
javascript
|
function SimpleFlatModel(items, idPrefix, getKey) {
this.items = items;
this.getKey = getKey;
this.idPrefix = idPrefix;
this.root = {children: items};
}
|
[
"function",
"SimpleFlatModel",
"(",
"items",
",",
"idPrefix",
",",
"getKey",
")",
"{",
"this",
".",
"items",
"=",
"items",
";",
"this",
".",
"getKey",
"=",
"getKey",
";",
"this",
".",
"idPrefix",
"=",
"idPrefix",
";",
"this",
".",
"root",
"=",
"{",
"children",
":",
"items",
"}",
";",
"}"
] |
Creates a new flat model based on an array of items already known.
@name orion.explorer.SimpleFlatModel
@param {Array} items the items in the model
@param {String} idPrefix string used to prefix generated id's
@param {Function} getKey function used to get the property name used for generating an id in the model
|
[
"Creates",
"a",
"new",
"flat",
"model",
"based",
"on",
"an",
"array",
"of",
"items",
"already",
"known",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer.js#L1033-L1038
|
14,428
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.core/web/orion/fileUtils.js
|
makeRelative
|
function makeRelative(location) {
if (!location) {
return location;
}
var hostName = window.location.protocol + "//" + window.location.host; //$NON-NLS-0$
if (location.indexOf(hostName) === 0) {
return location.substring(hostName.length);
}
return location;
}
|
javascript
|
function makeRelative(location) {
if (!location) {
return location;
}
var hostName = window.location.protocol + "//" + window.location.host; //$NON-NLS-0$
if (location.indexOf(hostName) === 0) {
return location.substring(hostName.length);
}
return location;
}
|
[
"function",
"makeRelative",
"(",
"location",
")",
"{",
"if",
"(",
"!",
"location",
")",
"{",
"return",
"location",
";",
"}",
"var",
"hostName",
"=",
"window",
".",
"location",
".",
"protocol",
"+",
"\"//\"",
"+",
"window",
".",
"location",
".",
"host",
";",
"//$NON-NLS-0$",
"if",
"(",
"location",
".",
"indexOf",
"(",
"hostName",
")",
"===",
"0",
")",
"{",
"return",
"location",
".",
"substring",
"(",
"hostName",
".",
"length",
")",
";",
"}",
"return",
"location",
";",
"}"
] |
This class contains static utility methods. It is not intended to be instantiated.
@class This class contains static utility methods.
@name orion.fileUtils
|
[
"This",
"class",
"contains",
"static",
"utility",
"methods",
".",
"It",
"is",
"not",
"intended",
"to",
"be",
"instantiated",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.core/web/orion/fileUtils.js#L40-L49
|
14,429
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.core/web/orion/fileUtils.js
|
isAtRoot
|
function isAtRoot(path) {
if (!path) {
return false;
}
if (path === "/workspace") {
return true; // sad but true
}
var pathUrl = new URL(path, window.location.href);
return pathUrl.href.indexOf(_workspaceUrlHref) === 0; //$NON-NLS-0$
}
|
javascript
|
function isAtRoot(path) {
if (!path) {
return false;
}
if (path === "/workspace") {
return true; // sad but true
}
var pathUrl = new URL(path, window.location.href);
return pathUrl.href.indexOf(_workspaceUrlHref) === 0; //$NON-NLS-0$
}
|
[
"function",
"isAtRoot",
"(",
"path",
")",
"{",
"if",
"(",
"!",
"path",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"path",
"===",
"\"/workspace\"",
")",
"{",
"return",
"true",
";",
"// sad but true",
"}",
"var",
"pathUrl",
"=",
"new",
"URL",
"(",
"path",
",",
"window",
".",
"location",
".",
"href",
")",
";",
"return",
"pathUrl",
".",
"href",
".",
"indexOf",
"(",
"_workspaceUrlHref",
")",
"===",
"0",
";",
"//$NON-NLS-0$",
"}"
] |
Determines if the path represents the workspace root
@name orion.util#isAtRoot
@function
|
[
"Determines",
"if",
"the",
"path",
"represents",
"the",
"workspace",
"root"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.core/web/orion/fileUtils.js#L63-L72
|
14,430
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/fields/javascript.js
|
JavascriptField
|
function JavascriptField(type, options) {
Field.call(this, type, options);
this.onInputChange = this.onInputChange.bind(this);
this.arg = new ScriptArgument('', '{ ', ' }');
this.element = util.createElement(this.document, 'div');
this.input = util.createElement(this.document, 'input');
this.input.type = 'text';
this.input.addEventListener('keyup', this.onInputChange, false);
this.input.classList.add('gcli-field');
this.input.classList.add('gcli-field-javascript');
this.element.appendChild(this.input);
this.menu = new Menu({
document: this.document,
field: true,
type: type
});
this.element.appendChild(this.menu.element);
var initial = new Conversion(undefined, new ScriptArgument(''),
Status.INCOMPLETE, '');
this.setConversion(initial);
this.onFieldChange = util.createEvent('JavascriptField.onFieldChange');
// i.e. Register this.onItemClick as the default action for a menu click
this.menu.onItemClick.add(this.itemClicked, this);
}
|
javascript
|
function JavascriptField(type, options) {
Field.call(this, type, options);
this.onInputChange = this.onInputChange.bind(this);
this.arg = new ScriptArgument('', '{ ', ' }');
this.element = util.createElement(this.document, 'div');
this.input = util.createElement(this.document, 'input');
this.input.type = 'text';
this.input.addEventListener('keyup', this.onInputChange, false);
this.input.classList.add('gcli-field');
this.input.classList.add('gcli-field-javascript');
this.element.appendChild(this.input);
this.menu = new Menu({
document: this.document,
field: true,
type: type
});
this.element.appendChild(this.menu.element);
var initial = new Conversion(undefined, new ScriptArgument(''),
Status.INCOMPLETE, '');
this.setConversion(initial);
this.onFieldChange = util.createEvent('JavascriptField.onFieldChange');
// i.e. Register this.onItemClick as the default action for a menu click
this.menu.onItemClick.add(this.itemClicked, this);
}
|
[
"function",
"JavascriptField",
"(",
"type",
",",
"options",
")",
"{",
"Field",
".",
"call",
"(",
"this",
",",
"type",
",",
"options",
")",
";",
"this",
".",
"onInputChange",
"=",
"this",
".",
"onInputChange",
".",
"bind",
"(",
"this",
")",
";",
"this",
".",
"arg",
"=",
"new",
"ScriptArgument",
"(",
"''",
",",
"'{ '",
",",
"' }'",
")",
";",
"this",
".",
"element",
"=",
"util",
".",
"createElement",
"(",
"this",
".",
"document",
",",
"'div'",
")",
";",
"this",
".",
"input",
"=",
"util",
".",
"createElement",
"(",
"this",
".",
"document",
",",
"'input'",
")",
";",
"this",
".",
"input",
".",
"type",
"=",
"'text'",
";",
"this",
".",
"input",
".",
"addEventListener",
"(",
"'keyup'",
",",
"this",
".",
"onInputChange",
",",
"false",
")",
";",
"this",
".",
"input",
".",
"classList",
".",
"add",
"(",
"'gcli-field'",
")",
";",
"this",
".",
"input",
".",
"classList",
".",
"add",
"(",
"'gcli-field-javascript'",
")",
";",
"this",
".",
"element",
".",
"appendChild",
"(",
"this",
".",
"input",
")",
";",
"this",
".",
"menu",
"=",
"new",
"Menu",
"(",
"{",
"document",
":",
"this",
".",
"document",
",",
"field",
":",
"true",
",",
"type",
":",
"type",
"}",
")",
";",
"this",
".",
"element",
".",
"appendChild",
"(",
"this",
".",
"menu",
".",
"element",
")",
";",
"var",
"initial",
"=",
"new",
"Conversion",
"(",
"undefined",
",",
"new",
"ScriptArgument",
"(",
"''",
")",
",",
"Status",
".",
"INCOMPLETE",
",",
"''",
")",
";",
"this",
".",
"setConversion",
"(",
"initial",
")",
";",
"this",
".",
"onFieldChange",
"=",
"util",
".",
"createEvent",
"(",
"'JavascriptField.onFieldChange'",
")",
";",
"// i.e. Register this.onItemClick as the default action for a menu click",
"this",
".",
"menu",
".",
"onItemClick",
".",
"add",
"(",
"this",
".",
"itemClicked",
",",
"this",
")",
";",
"}"
] |
A field that allows editing of javascript
|
[
"A",
"field",
"that",
"allows",
"editing",
"of",
"javascript"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/fields/javascript.js#L49-L79
|
14,431
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/dynamicContent.js
|
ProgressSpinner
|
function ProgressSpinner(id, anchor){
if(id === undefined){ throw new Error("Missing reqired argument: id"); }
if(anchor === undefined){ throw new Error("Missing reqired argument: anchor"); }
this._id = id;
this._anchor = anchor;
// we add a prefix for the id label
this._prefix = "progressSpinner:";
}
|
javascript
|
function ProgressSpinner(id, anchor){
if(id === undefined){ throw new Error("Missing reqired argument: id"); }
if(anchor === undefined){ throw new Error("Missing reqired argument: anchor"); }
this._id = id;
this._anchor = anchor;
// we add a prefix for the id label
this._prefix = "progressSpinner:";
}
|
[
"function",
"ProgressSpinner",
"(",
"id",
",",
"anchor",
")",
"{",
"if",
"(",
"id",
"===",
"undefined",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Missing reqired argument: id\"",
")",
";",
"}",
"if",
"(",
"anchor",
"===",
"undefined",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Missing reqired argument: anchor\"",
")",
";",
"}",
"this",
".",
"_id",
"=",
"id",
";",
"this",
".",
"_anchor",
"=",
"anchor",
";",
"// we add a prefix for the id label\r",
"this",
".",
"_prefix",
"=",
"\"progressSpinner:\"",
";",
"}"
] |
Progress indicator in form of a simple spinner.
@param id [required] unique identifier, e.g. the row number in which the spinner is created
@param anchor [required] father DOM node for the created spinner
@returns ProgressSpinner object
|
[
"Progress",
"indicator",
"in",
"form",
"of",
"a",
"simple",
"spinner",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/dynamicContent.js#L28-L37
|
14,432
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/dynamicContent.js
|
ProgressDots
|
function ProgressDots(id, anchor){
if(id === undefined){ throw new Error("Missing reqired argument: id"); }
if(anchor === undefined){ throw new Error("Missing reqired argument: anchor"); }
this._id = id;
this._anchor = anchor;
// we add a prefix for the id label
this._prefix = "progressDots:";
}
|
javascript
|
function ProgressDots(id, anchor){
if(id === undefined){ throw new Error("Missing reqired argument: id"); }
if(anchor === undefined){ throw new Error("Missing reqired argument: anchor"); }
this._id = id;
this._anchor = anchor;
// we add a prefix for the id label
this._prefix = "progressDots:";
}
|
[
"function",
"ProgressDots",
"(",
"id",
",",
"anchor",
")",
"{",
"if",
"(",
"id",
"===",
"undefined",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Missing reqired argument: id\"",
")",
";",
"}",
"if",
"(",
"anchor",
"===",
"undefined",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Missing reqired argument: anchor\"",
")",
";",
"}",
"this",
".",
"_id",
"=",
"id",
";",
"this",
".",
"_anchor",
"=",
"anchor",
";",
"// we add a prefix for the id label\r",
"this",
".",
"_prefix",
"=",
"\"progressDots:\"",
";",
"}"
] |
Default progress indicator in form of three dots.
@param id [required] unique identifier, e.g. the row number in which the spinner is created
@param anchor [required] father DOM node for the created spinner
@returns ProgressDots object
|
[
"Default",
"progress",
"indicator",
"in",
"form",
"of",
"three",
"dots",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/dynamicContent.js#L88-L97
|
14,433
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/dynamicContent.js
|
DynamicContentModel
|
function DynamicContentModel(objects, populate){
if(!objects) { throw new Error("Missing reqired argument: objects"); }
if(!populate) { throw new Error("Missing reqired argument: populate"); }
this._objects = objects;
this._populate = populate;
}
|
javascript
|
function DynamicContentModel(objects, populate){
if(!objects) { throw new Error("Missing reqired argument: objects"); }
if(!populate) { throw new Error("Missing reqired argument: populate"); }
this._objects = objects;
this._populate = populate;
}
|
[
"function",
"DynamicContentModel",
"(",
"objects",
",",
"populate",
")",
"{",
"if",
"(",
"!",
"objects",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Missing reqired argument: objects\"",
")",
";",
"}",
"if",
"(",
"!",
"populate",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Missing reqired argument: populate\"",
")",
";",
"}",
"this",
".",
"_objects",
"=",
"objects",
";",
"this",
".",
"_populate",
"=",
"populate",
";",
"}"
] |
Dynamic content model which handles the population logic
@param objects [required] collection of objects to be populated
@param populate [required] population function (i), which populates the i-th object in the collection
@returns DynamicContentModel object
|
[
"Dynamic",
"content",
"model",
"which",
"handles",
"the",
"population",
"logic"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/dynamicContent.js#L151-L157
|
14,434
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/dynamicContent.js
|
function(i){
return function(resp){
if(that._errorHandler) { that._errorHandler(i, resp); }
else { throw new Error(resp); }
};
}
|
javascript
|
function(i){
return function(resp){
if(that._errorHandler) { that._errorHandler(i, resp); }
else { throw new Error(resp); }
};
}
|
[
"function",
"(",
"i",
")",
"{",
"return",
"function",
"(",
"resp",
")",
"{",
"if",
"(",
"that",
".",
"_errorHandler",
")",
"{",
"that",
".",
"_errorHandler",
"(",
"i",
",",
"resp",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"Error",
"(",
"resp",
")",
";",
"}",
"}",
";",
"}"
] |
called if the i-th object could not be successfully populated
|
[
"called",
"if",
"the",
"i",
"-",
"th",
"object",
"could",
"not",
"be",
"successfully",
"populated"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/dynamicContent.js#L247-L252
|
|
14,435
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/explorers/fileDetailRenderer.js
|
function(item, tableRow) {
mExplorer.SelectionRenderer.prototype.renderRow.call(this, item, tableRow);
if (item.type !== "file") { //$NON-NLS-0$
tableRow.classList.add("searchDetailRow"); //$NON-NLS-0$
}
}
|
javascript
|
function(item, tableRow) {
mExplorer.SelectionRenderer.prototype.renderRow.call(this, item, tableRow);
if (item.type !== "file") { //$NON-NLS-0$
tableRow.classList.add("searchDetailRow"); //$NON-NLS-0$
}
}
|
[
"function",
"(",
"item",
",",
"tableRow",
")",
"{",
"mExplorer",
".",
"SelectionRenderer",
".",
"prototype",
".",
"renderRow",
".",
"call",
"(",
"this",
",",
"item",
",",
"tableRow",
")",
";",
"if",
"(",
"item",
".",
"type",
"!==",
"\"file\"",
")",
"{",
"//$NON-NLS-0$\r",
"tableRow",
".",
"classList",
".",
"add",
"(",
"\"searchDetailRow\"",
")",
";",
"//$NON-NLS-0$\r",
"}",
"}"
] |
Overrides Explorer.SelectionRenderer.prototype.renderRow
|
[
"Overrides",
"Explorer",
".",
"SelectionRenderer",
".",
"prototype",
".",
"renderRow"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/fileDetailRenderer.js#L138-L143
|
|
14,436
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-native-reassign.js
|
checkReference
|
function checkReference(reference, index, references) {
var identifier = reference.identifier;
if (reference.init === false &&
reference.isWrite() &&
// Destructuring assignments can have multiple default value,
// so possibly there are multiple writeable references for the same identifier.
(index === 0 || references[index - 1].identifier !== identifier)
) {
context.report({
node: identifier,
message: ProblemMessages.noNativeReassign,
data: {name: identifier.name}
});
}
}
|
javascript
|
function checkReference(reference, index, references) {
var identifier = reference.identifier;
if (reference.init === false &&
reference.isWrite() &&
// Destructuring assignments can have multiple default value,
// so possibly there are multiple writeable references for the same identifier.
(index === 0 || references[index - 1].identifier !== identifier)
) {
context.report({
node: identifier,
message: ProblemMessages.noNativeReassign,
data: {name: identifier.name}
});
}
}
|
[
"function",
"checkReference",
"(",
"reference",
",",
"index",
",",
"references",
")",
"{",
"var",
"identifier",
"=",
"reference",
".",
"identifier",
";",
"if",
"(",
"reference",
".",
"init",
"===",
"false",
"&&",
"reference",
".",
"isWrite",
"(",
")",
"&&",
"// Destructuring assignments can have multiple default value,",
"// so possibly there are multiple writeable references for the same identifier.",
"(",
"index",
"===",
"0",
"||",
"references",
"[",
"index",
"-",
"1",
"]",
".",
"identifier",
"!==",
"identifier",
")",
")",
"{",
"context",
".",
"report",
"(",
"{",
"node",
":",
"identifier",
",",
"message",
":",
"ProblemMessages",
".",
"noNativeReassign",
",",
"data",
":",
"{",
"name",
":",
"identifier",
".",
"name",
"}",
"}",
")",
";",
"}",
"}"
] |
Reports write references.
@param {Reference} reference - A reference to check.
@param {int} index - The index of the reference in the references.
@param {Reference[]} references - The array that the reference belongs to.
@returns {void}
|
[
"Reports",
"write",
"references",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-native-reassign.js#L29-L44
|
14,437
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/compare/compareTreeExplorer.js
|
CompareTreeModel
|
function CompareTreeModel(rootPath, fetchItems, root) {
this.rootPath = rootPath;
this.fetchItems = fetchItems;
this.root = root;
}
|
javascript
|
function CompareTreeModel(rootPath, fetchItems, root) {
this.rootPath = rootPath;
this.fetchItems = fetchItems;
this.root = root;
}
|
[
"function",
"CompareTreeModel",
"(",
"rootPath",
",",
"fetchItems",
",",
"root",
")",
"{",
"this",
".",
"rootPath",
"=",
"rootPath",
";",
"this",
".",
"fetchItems",
"=",
"fetchItems",
";",
"this",
".",
"root",
"=",
"root",
";",
"}"
] |
Creates a new compare tree explorer.
@name orion.CompareTreeExplorer
|
[
"Creates",
"a",
"new",
"compare",
"tree",
"explorer",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/compare/compareTreeExplorer.js#L93-L97
|
14,438
|
eclipse/orion.client
|
modules/orionode/lib/util/cryptoUtil.js
|
generateAuthToken
|
function generateAuthToken(bytes, callback) {
crypto.randomBytes(bytes, function(err, randomBytes) {
if(err) {
return callback(err);
}
callback(null, randomBytes.toString('hex'));
});
}
|
javascript
|
function generateAuthToken(bytes, callback) {
crypto.randomBytes(bytes, function(err, randomBytes) {
if(err) {
return callback(err);
}
callback(null, randomBytes.toString('hex'));
});
}
|
[
"function",
"generateAuthToken",
"(",
"bytes",
",",
"callback",
")",
"{",
"crypto",
".",
"randomBytes",
"(",
"bytes",
",",
"function",
"(",
"err",
",",
"randomBytes",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"callback",
"(",
"err",
")",
";",
"}",
"callback",
"(",
"null",
",",
"randomBytes",
".",
"toString",
"(",
"'hex'",
")",
")",
";",
"}",
")",
";",
"}"
] |
Generates an auth token of the given number of bytes
@param {number} bytes The number of bytes in length to make the token
@param {fn} callback The callback to be called with the new auth token
@since 18.0
|
[
"Generates",
"an",
"auth",
"token",
"of",
"the",
"given",
"number",
"of",
"bytes"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/util/cryptoUtil.js#L76-L83
|
14,439
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/section.js
|
function() {
var parent;
if (this.domNode.tooltip) {
this.domNode.tooltip.destroy();
this.domNode.tooltip = null;
}
if (this.domNode) {
parent = this.domNode.parentNode;
if (parent) parent.removeChild(this.domNode);
this.domNode = null;
}
if (this._contentParent) {
parent = this._contentParent.parentNode;
if (parent) parent.removeChild(this._contentParent);
this._contentParent = null;
}
if (this._sectionContainer) {
parent = this._sectionContainer.parentNode;
if (parent) parent.removeChild(this._sectionContainer);
this._sectionContainer = null;
}
}
|
javascript
|
function() {
var parent;
if (this.domNode.tooltip) {
this.domNode.tooltip.destroy();
this.domNode.tooltip = null;
}
if (this.domNode) {
parent = this.domNode.parentNode;
if (parent) parent.removeChild(this.domNode);
this.domNode = null;
}
if (this._contentParent) {
parent = this._contentParent.parentNode;
if (parent) parent.removeChild(this._contentParent);
this._contentParent = null;
}
if (this._sectionContainer) {
parent = this._sectionContainer.parentNode;
if (parent) parent.removeChild(this._sectionContainer);
this._sectionContainer = null;
}
}
|
[
"function",
"(",
")",
"{",
"var",
"parent",
";",
"if",
"(",
"this",
".",
"domNode",
".",
"tooltip",
")",
"{",
"this",
".",
"domNode",
".",
"tooltip",
".",
"destroy",
"(",
")",
";",
"this",
".",
"domNode",
".",
"tooltip",
"=",
"null",
";",
"}",
"if",
"(",
"this",
".",
"domNode",
")",
"{",
"parent",
"=",
"this",
".",
"domNode",
".",
"parentNode",
";",
"if",
"(",
"parent",
")",
"parent",
".",
"removeChild",
"(",
"this",
".",
"domNode",
")",
";",
"this",
".",
"domNode",
"=",
"null",
";",
"}",
"if",
"(",
"this",
".",
"_contentParent",
")",
"{",
"parent",
"=",
"this",
".",
"_contentParent",
".",
"parentNode",
";",
"if",
"(",
"parent",
")",
"parent",
".",
"removeChild",
"(",
"this",
".",
"_contentParent",
")",
";",
"this",
".",
"_contentParent",
"=",
"null",
";",
"}",
"if",
"(",
"this",
".",
"_sectionContainer",
")",
"{",
"parent",
"=",
"this",
".",
"_sectionContainer",
".",
"parentNode",
";",
"if",
"(",
"parent",
")",
"parent",
".",
"removeChild",
"(",
"this",
".",
"_sectionContainer",
")",
";",
"this",
".",
"_sectionContainer",
"=",
"null",
";",
"}",
"}"
] |
Destroy the section by removing the title and content from the parent.
|
[
"Destroy",
"the",
"section",
"by",
"removing",
"the",
"title",
"and",
"content",
"from",
"the",
"parent",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/section.js#L344-L365
|
|
14,440
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/section.js
|
function(content){
if (typeof content === 'string') { //$NON-NLS-0$
this._contentParent.innerHTML = content;
} else {
this._contentParent.innerHTML = ""; //NON-NLS-0$
this._contentParent.appendChild(content);
}
}
|
javascript
|
function(content){
if (typeof content === 'string') { //$NON-NLS-0$
this._contentParent.innerHTML = content;
} else {
this._contentParent.innerHTML = ""; //NON-NLS-0$
this._contentParent.appendChild(content);
}
}
|
[
"function",
"(",
"content",
")",
"{",
"if",
"(",
"typeof",
"content",
"===",
"'string'",
")",
"{",
"//$NON-NLS-0$",
"this",
".",
"_contentParent",
".",
"innerHTML",
"=",
"content",
";",
"}",
"else",
"{",
"this",
".",
"_contentParent",
".",
"innerHTML",
"=",
"\"\"",
";",
"//NON-NLS-0$",
"this",
".",
"_contentParent",
".",
"appendChild",
"(",
"content",
")",
";",
"}",
"}"
] |
Changes the contents of the section.
@param {String|DomNode} content
|
[
"Changes",
"the",
"contents",
"of",
"the",
"section",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/section.js#L403-L410
|
|
14,441
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/gcli/util/util.js
|
withCommand
|
function withCommand(element, action) {
var command = element.getAttribute('data-command');
if (!command) {
command = element.querySelector('*[data-command]')
.getAttribute('data-command');
}
if (command) {
action(command);
}
else {
console.warn('Missing data-command for ' + util.findCssSelector(element));
}
}
|
javascript
|
function withCommand(element, action) {
var command = element.getAttribute('data-command');
if (!command) {
command = element.querySelector('*[data-command]')
.getAttribute('data-command');
}
if (command) {
action(command);
}
else {
console.warn('Missing data-command for ' + util.findCssSelector(element));
}
}
|
[
"function",
"withCommand",
"(",
"element",
",",
"action",
")",
"{",
"var",
"command",
"=",
"element",
".",
"getAttribute",
"(",
"'data-command'",
")",
";",
"if",
"(",
"!",
"command",
")",
"{",
"command",
"=",
"element",
".",
"querySelector",
"(",
"'*[data-command]'",
")",
".",
"getAttribute",
"(",
"'data-command'",
")",
";",
"}",
"if",
"(",
"command",
")",
"{",
"action",
"(",
"command",
")",
";",
"}",
"else",
"{",
"console",
".",
"warn",
"(",
"'Missing data-command for '",
"+",
"util",
".",
"findCssSelector",
"(",
"element",
")",
")",
";",
"}",
"}"
] |
Helper to find the 'data-command' attribute and call some action on it.
@see |updateCommand()| and |executeCommand()|
|
[
"Helper",
"to",
"find",
"the",
"data",
"-",
"command",
"attribute",
"and",
"call",
"some",
"action",
"on",
"it",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/util/util.js#L681-L694
|
14,442
|
eclipse/orion.client
|
modules/orionode/lib/tasks.js
|
deleteAllOperations
|
function deleteAllOperations(req, res) {
taskStore.getTasksForUser(req.user.username, function(err, tasks) {
if (err) {
return writeError(500, res, err.toString());
}
var locations = [];
var doneCount = 0;
var done = function() {
if (!tasks.length || ++doneCount === tasks.length) {
writeResponse(200, res, null, locations);
}
};
if (!tasks.length) {
done();
return;
}
tasks.forEach(function(task) {
if (task.result || task.Result) {
// task in single user case doesn't have Location, it has keep instead
taskStore.deleteTask(getTaskMeta(req, (task.Location && task.Location.substring(req.baseUrl.length)) || task.keep, task.id), done); /* task is completed */
} else {
locations.push(toJSON(task, true).Location);
done();
}
});
});
}
|
javascript
|
function deleteAllOperations(req, res) {
taskStore.getTasksForUser(req.user.username, function(err, tasks) {
if (err) {
return writeError(500, res, err.toString());
}
var locations = [];
var doneCount = 0;
var done = function() {
if (!tasks.length || ++doneCount === tasks.length) {
writeResponse(200, res, null, locations);
}
};
if (!tasks.length) {
done();
return;
}
tasks.forEach(function(task) {
if (task.result || task.Result) {
// task in single user case doesn't have Location, it has keep instead
taskStore.deleteTask(getTaskMeta(req, (task.Location && task.Location.substring(req.baseUrl.length)) || task.keep, task.id), done); /* task is completed */
} else {
locations.push(toJSON(task, true).Location);
done();
}
});
});
}
|
[
"function",
"deleteAllOperations",
"(",
"req",
",",
"res",
")",
"{",
"taskStore",
".",
"getTasksForUser",
"(",
"req",
".",
"user",
".",
"username",
",",
"function",
"(",
"err",
",",
"tasks",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"writeError",
"(",
"500",
",",
"res",
",",
"err",
".",
"toString",
"(",
")",
")",
";",
"}",
"var",
"locations",
"=",
"[",
"]",
";",
"var",
"doneCount",
"=",
"0",
";",
"var",
"done",
"=",
"function",
"(",
")",
"{",
"if",
"(",
"!",
"tasks",
".",
"length",
"||",
"++",
"doneCount",
"===",
"tasks",
".",
"length",
")",
"{",
"writeResponse",
"(",
"200",
",",
"res",
",",
"null",
",",
"locations",
")",
";",
"}",
"}",
";",
"if",
"(",
"!",
"tasks",
".",
"length",
")",
"{",
"done",
"(",
")",
";",
"return",
";",
"}",
"tasks",
".",
"forEach",
"(",
"function",
"(",
"task",
")",
"{",
"if",
"(",
"task",
".",
"result",
"||",
"task",
".",
"Result",
")",
"{",
"// task in single user case doesn't have Location, it has keep instead",
"taskStore",
".",
"deleteTask",
"(",
"getTaskMeta",
"(",
"req",
",",
"(",
"task",
".",
"Location",
"&&",
"task",
".",
"Location",
".",
"substring",
"(",
"req",
".",
"baseUrl",
".",
"length",
")",
")",
"||",
"task",
".",
"keep",
",",
"task",
".",
"id",
")",
",",
"done",
")",
";",
"/* task is completed */",
"}",
"else",
"{",
"locations",
".",
"push",
"(",
"toJSON",
"(",
"task",
",",
"true",
")",
".",
"Location",
")",
";",
"done",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
")",
";",
"}"
] |
Deletes all completed operations that the user sending the request had created.
|
[
"Deletes",
"all",
"completed",
"operations",
"that",
"the",
"user",
"sending",
"the",
"request",
"had",
"created",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/tasks.js#L249-L275
|
14,443
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/links.js
|
function(text, parent) {
//define div if one isn't provided
var result = parent || document.createElement('div'); //$NON-NLS-0$
var linkScanners = this._registry.getServiceReferences("orion.core.linkScanner"); //$NON-NLS-0$
if (linkScanners.length > 0) {
//TODO: support multiple scanners by picking the scanner with the first match
var linkScanner = linkScanners[0];
var pattern = new RegExp(linkScanner.getProperty("pattern"), "i"); //$NON-NLS-1$ //$NON-NLS-0$
var words= linkScanner.getProperty("words"); //$NON-NLS-0$
var anchor = linkScanner.getProperty("anchor"); //$NON-NLS-0$
var index = text.search(pattern);
while (index >= 0) {
text = this._replaceLink(text, result, pattern, words, anchor);
index = text.search(pattern);
}
}
//append a text node for any remaining text
if (text.length > 0) {
result.appendChild(document.createTextNode(text));
}
return result;
}
|
javascript
|
function(text, parent) {
//define div if one isn't provided
var result = parent || document.createElement('div'); //$NON-NLS-0$
var linkScanners = this._registry.getServiceReferences("orion.core.linkScanner"); //$NON-NLS-0$
if (linkScanners.length > 0) {
//TODO: support multiple scanners by picking the scanner with the first match
var linkScanner = linkScanners[0];
var pattern = new RegExp(linkScanner.getProperty("pattern"), "i"); //$NON-NLS-1$ //$NON-NLS-0$
var words= linkScanner.getProperty("words"); //$NON-NLS-0$
var anchor = linkScanner.getProperty("anchor"); //$NON-NLS-0$
var index = text.search(pattern);
while (index >= 0) {
text = this._replaceLink(text, result, pattern, words, anchor);
index = text.search(pattern);
}
}
//append a text node for any remaining text
if (text.length > 0) {
result.appendChild(document.createTextNode(text));
}
return result;
}
|
[
"function",
"(",
"text",
",",
"parent",
")",
"{",
"//define div if one isn't provided\r",
"var",
"result",
"=",
"parent",
"||",
"document",
".",
"createElement",
"(",
"'div'",
")",
";",
"//$NON-NLS-0$\r",
"var",
"linkScanners",
"=",
"this",
".",
"_registry",
".",
"getServiceReferences",
"(",
"\"orion.core.linkScanner\"",
")",
";",
"//$NON-NLS-0$\r",
"if",
"(",
"linkScanners",
".",
"length",
">",
"0",
")",
"{",
"//TODO: support multiple scanners by picking the scanner with the first match\r",
"var",
"linkScanner",
"=",
"linkScanners",
"[",
"0",
"]",
";",
"var",
"pattern",
"=",
"new",
"RegExp",
"(",
"linkScanner",
".",
"getProperty",
"(",
"\"pattern\"",
")",
",",
"\"i\"",
")",
";",
"//$NON-NLS-1$ //$NON-NLS-0$\r",
"var",
"words",
"=",
"linkScanner",
".",
"getProperty",
"(",
"\"words\"",
")",
";",
"//$NON-NLS-0$\r",
"var",
"anchor",
"=",
"linkScanner",
".",
"getProperty",
"(",
"\"anchor\"",
")",
";",
"//$NON-NLS-0$\r",
"var",
"index",
"=",
"text",
".",
"search",
"(",
"pattern",
")",
";",
"while",
"(",
"index",
">=",
"0",
")",
"{",
"text",
"=",
"this",
".",
"_replaceLink",
"(",
"text",
",",
"result",
",",
"pattern",
",",
"words",
",",
"anchor",
")",
";",
"index",
"=",
"text",
".",
"search",
"(",
"pattern",
")",
";",
"}",
"}",
"//append a text node for any remaining text\r",
"if",
"(",
"text",
".",
"length",
">",
"0",
")",
"{",
"result",
".",
"appendChild",
"(",
"document",
".",
"createTextNode",
"(",
"text",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Adds links to an input text string. The links are added to the provided node, or to a new div
node if not input node is provided.
@param {String} text The string to compute links for
@param {Object} [parent] The optional parent DOM node to place the links into
@returns {Object} A DOM node containing the provided text as a series of text and anchor child nodes
|
[
"Adds",
"links",
"to",
"an",
"input",
"text",
"string",
".",
"The",
"links",
"are",
"added",
"to",
"the",
"provided",
"node",
"or",
"to",
"a",
"new",
"div",
"node",
"if",
"not",
"input",
"node",
"is",
"provided",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/links.js#L69-L90
|
|
14,444
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/Slideout.js
|
function(slideoutViewMode) {
this._previousActiveElement = document.activeElement;
lib.trapTabs(this._wrapperNode);
// replace _contentNode's contents
if (this._currentViewMode !== slideoutViewMode) {
lib.empty(this._contentNode);
this._contentNode.appendChild(slideoutViewMode.getWrapperNode());
this._currentViewMode = slideoutViewMode;
}
if (this._visibilityTransitionTimeout) {
this._wrapperNode.classList.remove("slideoutWrapperHiding"); //$NON-NLS-0$
window.clearTimeout(this._visibilityTransitionTimeout);
this._visibilityTransitionTimeout = null;
}
this._wrapperNode.classList.add("slideoutWrapperVisible"); //$NON-NLS-0$
}
|
javascript
|
function(slideoutViewMode) {
this._previousActiveElement = document.activeElement;
lib.trapTabs(this._wrapperNode);
// replace _contentNode's contents
if (this._currentViewMode !== slideoutViewMode) {
lib.empty(this._contentNode);
this._contentNode.appendChild(slideoutViewMode.getWrapperNode());
this._currentViewMode = slideoutViewMode;
}
if (this._visibilityTransitionTimeout) {
this._wrapperNode.classList.remove("slideoutWrapperHiding"); //$NON-NLS-0$
window.clearTimeout(this._visibilityTransitionTimeout);
this._visibilityTransitionTimeout = null;
}
this._wrapperNode.classList.add("slideoutWrapperVisible"); //$NON-NLS-0$
}
|
[
"function",
"(",
"slideoutViewMode",
")",
"{",
"this",
".",
"_previousActiveElement",
"=",
"document",
".",
"activeElement",
";",
"lib",
".",
"trapTabs",
"(",
"this",
".",
"_wrapperNode",
")",
";",
"// replace _contentNode's contents\r",
"if",
"(",
"this",
".",
"_currentViewMode",
"!==",
"slideoutViewMode",
")",
"{",
"lib",
".",
"empty",
"(",
"this",
".",
"_contentNode",
")",
";",
"this",
".",
"_contentNode",
".",
"appendChild",
"(",
"slideoutViewMode",
".",
"getWrapperNode",
"(",
")",
")",
";",
"this",
".",
"_currentViewMode",
"=",
"slideoutViewMode",
";",
"}",
"if",
"(",
"this",
".",
"_visibilityTransitionTimeout",
")",
"{",
"this",
".",
"_wrapperNode",
".",
"classList",
".",
"remove",
"(",
"\"slideoutWrapperHiding\"",
")",
";",
"//$NON-NLS-0$\r",
"window",
".",
"clearTimeout",
"(",
"this",
".",
"_visibilityTransitionTimeout",
")",
";",
"this",
".",
"_visibilityTransitionTimeout",
"=",
"null",
";",
"}",
"this",
".",
"_wrapperNode",
".",
"classList",
".",
"add",
"(",
"\"slideoutWrapperVisible\"",
")",
";",
"//$NON-NLS-0$\r",
"}"
] |
Makes this slideout visible.
If the specified @ref slideoutViewMode is different from the
@ref _currentViewMode the contents of this slideout's content
are replaced with the contents of the specified @ref slideoutViewMode
first.
@param {orion.webui.SlideoutViewMode} slideoutViewMode The view mode with the contents of the slideout to be shown
|
[
"Makes",
"this",
"slideout",
"visible",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/Slideout.js#L97-L114
|
|
14,445
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/Slideout.js
|
function() {
lib.returnFocus(this._wrapperNode, this._previousActiveElement);
this._previousActiveElement = null;
this._wrapperNode.classList.remove("slideoutWrapperVisible"); //$NON-NLS-0$
this._wrapperNode.classList.add("slideoutWrapperHiding"); //$NON-NLS-0$
this._visibilityTransitionTimeout = window.setTimeout(function() {
this._visibilityTransitionTimeout = null;
this._wrapperNode.classList.remove("slideoutWrapperHiding"); //$NON-NLS-0$
}.bind(this), VISIBILITY_TRANSITION_MS);
}
|
javascript
|
function() {
lib.returnFocus(this._wrapperNode, this._previousActiveElement);
this._previousActiveElement = null;
this._wrapperNode.classList.remove("slideoutWrapperVisible"); //$NON-NLS-0$
this._wrapperNode.classList.add("slideoutWrapperHiding"); //$NON-NLS-0$
this._visibilityTransitionTimeout = window.setTimeout(function() {
this._visibilityTransitionTimeout = null;
this._wrapperNode.classList.remove("slideoutWrapperHiding"); //$NON-NLS-0$
}.bind(this), VISIBILITY_TRANSITION_MS);
}
|
[
"function",
"(",
")",
"{",
"lib",
".",
"returnFocus",
"(",
"this",
".",
"_wrapperNode",
",",
"this",
".",
"_previousActiveElement",
")",
";",
"this",
".",
"_previousActiveElement",
"=",
"null",
";",
"this",
".",
"_wrapperNode",
".",
"classList",
".",
"remove",
"(",
"\"slideoutWrapperVisible\"",
")",
";",
"//$NON-NLS-0$\r",
"this",
".",
"_wrapperNode",
".",
"classList",
".",
"add",
"(",
"\"slideoutWrapperHiding\"",
")",
";",
"//$NON-NLS-0$\r",
"this",
".",
"_visibilityTransitionTimeout",
"=",
"window",
".",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"this",
".",
"_visibilityTransitionTimeout",
"=",
"null",
";",
"this",
".",
"_wrapperNode",
".",
"classList",
".",
"remove",
"(",
"\"slideoutWrapperHiding\"",
")",
";",
"//$NON-NLS-0$\r",
"}",
".",
"bind",
"(",
"this",
")",
",",
"VISIBILITY_TRANSITION_MS",
")",
";",
"}"
] |
Hides the slideout.
|
[
"Hides",
"the",
"slideout",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/Slideout.js#L119-L130
|
|
14,446
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/SideMenu.js
|
function(relatedLinks, exclusions) {
this._categorizedRelatedLinks = {};
relatedLinks.forEach(function(info) {
var relatedLink = info.relatedLink;
var command = info.command;
var invocation = info.invocation;
if (!exclusions || exclusions.indexOf(relatedLink.id) === -1) {
var category = relatedLink.category;
this._categorizedRelatedLinks[category] = this._categorizedRelatedLinks[category] || [];
this._categorizedRelatedLinks[category].push({
title: command.name,
order: relatedLink.order || 100,
href: command.hrefCallback.call(invocation.handler, invocation)
});
}
}, this);
this._updateCategoryAnchors();
this._updateCategoryNotifications();
}
|
javascript
|
function(relatedLinks, exclusions) {
this._categorizedRelatedLinks = {};
relatedLinks.forEach(function(info) {
var relatedLink = info.relatedLink;
var command = info.command;
var invocation = info.invocation;
if (!exclusions || exclusions.indexOf(relatedLink.id) === -1) {
var category = relatedLink.category;
this._categorizedRelatedLinks[category] = this._categorizedRelatedLinks[category] || [];
this._categorizedRelatedLinks[category].push({
title: command.name,
order: relatedLink.order || 100,
href: command.hrefCallback.call(invocation.handler, invocation)
});
}
}, this);
this._updateCategoryAnchors();
this._updateCategoryNotifications();
}
|
[
"function",
"(",
"relatedLinks",
",",
"exclusions",
")",
"{",
"this",
".",
"_categorizedRelatedLinks",
"=",
"{",
"}",
";",
"relatedLinks",
".",
"forEach",
"(",
"function",
"(",
"info",
")",
"{",
"var",
"relatedLink",
"=",
"info",
".",
"relatedLink",
";",
"var",
"command",
"=",
"info",
".",
"command",
";",
"var",
"invocation",
"=",
"info",
".",
"invocation",
";",
"if",
"(",
"!",
"exclusions",
"||",
"exclusions",
".",
"indexOf",
"(",
"relatedLink",
".",
"id",
")",
"===",
"-",
"1",
")",
"{",
"var",
"category",
"=",
"relatedLink",
".",
"category",
";",
"this",
".",
"_categorizedRelatedLinks",
"[",
"category",
"]",
"=",
"this",
".",
"_categorizedRelatedLinks",
"[",
"category",
"]",
"||",
"[",
"]",
";",
"this",
".",
"_categorizedRelatedLinks",
"[",
"category",
"]",
".",
"push",
"(",
"{",
"title",
":",
"command",
".",
"name",
",",
"order",
":",
"relatedLink",
".",
"order",
"||",
"100",
",",
"href",
":",
"command",
".",
"hrefCallback",
".",
"call",
"(",
"invocation",
".",
"handler",
",",
"invocation",
")",
"}",
")",
";",
"}",
"}",
",",
"this",
")",
";",
"this",
".",
"_updateCategoryAnchors",
"(",
")",
";",
"this",
".",
"_updateCategoryNotifications",
"(",
")",
";",
"}"
] |
Called whenever the page target changes.
@param {Object} relatedLinks
@param {String[]} exclusions List of related link IDs that the page has requested to not be shown.
|
[
"Called",
"whenever",
"the",
"page",
"target",
"changes",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/SideMenu.js#L73-L91
|
|
14,447
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/PageLinks.js
|
getCategoriesInfo
|
function getCategoriesInfo(serviceRegistry) {
// Read categories.
var categoryInfos;
if (!_cachedCategories) {
categoryInfos = [];
var navLinkCategories = serviceRegistry.getServiceReferences("orion.page.link.category"); //$NON-NLS-0$
navLinkCategories.forEach(function(serviceRef) {
var info = _getPropertiesMap(serviceRef);
if (!info.id || (!info.name && !info.nameKey)) {
return;
}
info.service = serviceRegistry.getService(serviceRef);
info.textContent = info.name;
categoryInfos.push(new Deferred().resolve(info));
});
return Deferred.all(categoryInfos).then(function(infos) {
_cachedCategories = new CategoriesInfo(infos);
return _cachedCategories;
});
}
return new Deferred().resolve(_cachedCategories);
}
|
javascript
|
function getCategoriesInfo(serviceRegistry) {
// Read categories.
var categoryInfos;
if (!_cachedCategories) {
categoryInfos = [];
var navLinkCategories = serviceRegistry.getServiceReferences("orion.page.link.category"); //$NON-NLS-0$
navLinkCategories.forEach(function(serviceRef) {
var info = _getPropertiesMap(serviceRef);
if (!info.id || (!info.name && !info.nameKey)) {
return;
}
info.service = serviceRegistry.getService(serviceRef);
info.textContent = info.name;
categoryInfos.push(new Deferred().resolve(info));
});
return Deferred.all(categoryInfos).then(function(infos) {
_cachedCategories = new CategoriesInfo(infos);
return _cachedCategories;
});
}
return new Deferred().resolve(_cachedCategories);
}
|
[
"function",
"getCategoriesInfo",
"(",
"serviceRegistry",
")",
"{",
"// Read categories.",
"var",
"categoryInfos",
";",
"if",
"(",
"!",
"_cachedCategories",
")",
"{",
"categoryInfos",
"=",
"[",
"]",
";",
"var",
"navLinkCategories",
"=",
"serviceRegistry",
".",
"getServiceReferences",
"(",
"\"orion.page.link.category\"",
")",
";",
"//$NON-NLS-0$",
"navLinkCategories",
".",
"forEach",
"(",
"function",
"(",
"serviceRef",
")",
"{",
"var",
"info",
"=",
"_getPropertiesMap",
"(",
"serviceRef",
")",
";",
"if",
"(",
"!",
"info",
".",
"id",
"||",
"(",
"!",
"info",
".",
"name",
"&&",
"!",
"info",
".",
"nameKey",
")",
")",
"{",
"return",
";",
"}",
"info",
".",
"service",
"=",
"serviceRegistry",
".",
"getService",
"(",
"serviceRef",
")",
";",
"info",
".",
"textContent",
"=",
"info",
".",
"name",
";",
"categoryInfos",
".",
"push",
"(",
"new",
"Deferred",
"(",
")",
".",
"resolve",
"(",
"info",
")",
")",
";",
"}",
")",
";",
"return",
"Deferred",
".",
"all",
"(",
"categoryInfos",
")",
".",
"then",
"(",
"function",
"(",
"infos",
")",
"{",
"_cachedCategories",
"=",
"new",
"CategoriesInfo",
"(",
"infos",
")",
";",
"return",
"_cachedCategories",
";",
"}",
")",
";",
"}",
"return",
"new",
"Deferred",
"(",
")",
".",
"resolve",
"(",
"_cachedCategories",
")",
";",
"}"
] |
Reads info about page link categories.
@returns {orion.Promise} Resolving to {@link orion.PageLinks.CategoriesInfo}
|
[
"Reads",
"info",
"about",
"page",
"link",
"categories",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/PageLinks.js#L97-L118
|
14,448
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/fork-context.js
|
makeSegments
|
function makeSegments(context, begin, end, create) {
var list = context.segmentsList;
if (begin < 0) {
begin = list.length + begin;
}
if (end < 0) {
end = list.length + end;
}
var segments = [];
for (var i = 0; i < context.count; ++i) {
var allPrevSegments = [];
for (var j = begin; j <= end; ++j) {
allPrevSegments.push(list[j][i]);
}
segments.push(create(context.idGenerator.next(), allPrevSegments));
}
return segments;
}
|
javascript
|
function makeSegments(context, begin, end, create) {
var list = context.segmentsList;
if (begin < 0) {
begin = list.length + begin;
}
if (end < 0) {
end = list.length + end;
}
var segments = [];
for (var i = 0; i < context.count; ++i) {
var allPrevSegments = [];
for (var j = begin; j <= end; ++j) {
allPrevSegments.push(list[j][i]);
}
segments.push(create(context.idGenerator.next(), allPrevSegments));
}
return segments;
}
|
[
"function",
"makeSegments",
"(",
"context",
",",
"begin",
",",
"end",
",",
"create",
")",
"{",
"var",
"list",
"=",
"context",
".",
"segmentsList",
";",
"if",
"(",
"begin",
"<",
"0",
")",
"{",
"begin",
"=",
"list",
".",
"length",
"+",
"begin",
";",
"}",
"if",
"(",
"end",
"<",
"0",
")",
"{",
"end",
"=",
"list",
".",
"length",
"+",
"end",
";",
"}",
"var",
"segments",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"context",
".",
"count",
";",
"++",
"i",
")",
"{",
"var",
"allPrevSegments",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"j",
"=",
"begin",
";",
"j",
"<=",
"end",
";",
"++",
"j",
")",
"{",
"allPrevSegments",
".",
"push",
"(",
"list",
"[",
"j",
"]",
"[",
"i",
"]",
")",
";",
"}",
"segments",
".",
"push",
"(",
"create",
"(",
"context",
".",
"idGenerator",
".",
"next",
"(",
")",
",",
"allPrevSegments",
")",
")",
";",
"}",
"return",
"segments",
";",
"}"
] |
Creates new segments from the specific range of `context.segmentsList`.
When `context.segmentsList` is `[[a, b], [c, d], [e, f]]`, `begin` is `0`, and
`end` is `-1`, this creates `[g, h]`. This `g` is from `a`, `c`, and `e`.
This `h` is from `b`, `d`, and `f`.
@param {ForkContext} context - An instance.
@param {number} begin - The first index of the previous segments.
@param {number} end - The last index of the previous segments.
@param {function} create - A factory function of new segments.
@returns {CodePathSegment[]} New segments.
|
[
"Creates",
"new",
"segments",
"from",
"the",
"specific",
"range",
"of",
"context",
".",
"segmentsList",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/fork-context.js#L43-L66
|
14,449
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/fork-context.js
|
function(context) {
var source = context.segmentsList;
for (var i = 0; i < source.length; ++i) {
this.segmentsList.push(source[i]);
}
}
|
javascript
|
function(context) {
var source = context.segmentsList;
for (var i = 0; i < source.length; ++i) {
this.segmentsList.push(source[i]);
}
}
|
[
"function",
"(",
"context",
")",
"{",
"var",
"source",
"=",
"context",
".",
"segmentsList",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"source",
".",
"length",
";",
"++",
"i",
")",
"{",
"this",
".",
"segmentsList",
".",
"push",
"(",
"source",
"[",
"i",
"]",
")",
";",
"}",
"}"
] |
Adds all segments of a given fork context into this context.
@param {ForkContext} context - A fork context to add.
@returns {void}
|
[
"Adds",
"all",
"segments",
"of",
"a",
"given",
"fork",
"context",
"into",
"this",
"context",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/fork-context.js#L206-L212
|
|
14,450
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.collab/web/orion/collab/collabFileEditingAnnotation.js
|
function(location, users) {
// Remove trailing "/"
if(location.substr(-1) === '/') {
location = location.substr(0, location.length - 1);
}
this.location = location;
console.assert(Array.isArray(users));
this.users = users;
}
|
javascript
|
function(location, users) {
// Remove trailing "/"
if(location.substr(-1) === '/') {
location = location.substr(0, location.length - 1);
}
this.location = location;
console.assert(Array.isArray(users));
this.users = users;
}
|
[
"function",
"(",
"location",
",",
"users",
")",
"{",
"// Remove trailing \"/\"",
"if",
"(",
"location",
".",
"substr",
"(",
"-",
"1",
")",
"===",
"'/'",
")",
"{",
"location",
"=",
"location",
".",
"substr",
"(",
"0",
",",
"location",
".",
"length",
"-",
"1",
")",
";",
"}",
"this",
".",
"location",
"=",
"location",
";",
"console",
".",
"assert",
"(",
"Array",
".",
"isArray",
"(",
"users",
")",
")",
";",
"this",
".",
"users",
"=",
"users",
";",
"}"
] |
An annotation shows that a file is under editing
@constructor
@name {orion.collab.CollabFileEditingAnnotation}
@extends {orion.collab.CollabFileAnnotation}
@param {string} location - file location
@param {Array.<string>} users - list of users that is modifying this file
|
[
"An",
"annotation",
"shows",
"that",
"a",
"file",
"is",
"under",
"editing"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.collab/web/orion/collab/collabFileEditingAnnotation.js#L29-L37
|
|
14,451
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/javascript/orionAcorn.js
|
deepCopy
|
function deepCopy(obj) {
var ret = {}, key, val;
for (key in obj) {
if (obj.hasOwnProperty(key)) {
val = obj[key];
if (typeof val === 'object' && val !== null) {
ret[key] = deepCopy(val);
} else {
ret[key] = val;
}
}
}
return ret;
}
|
javascript
|
function deepCopy(obj) {
var ret = {}, key, val;
for (key in obj) {
if (obj.hasOwnProperty(key)) {
val = obj[key];
if (typeof val === 'object' && val !== null) {
ret[key] = deepCopy(val);
} else {
ret[key] = val;
}
}
}
return ret;
}
|
[
"function",
"deepCopy",
"(",
"obj",
")",
"{",
"var",
"ret",
"=",
"{",
"}",
",",
"key",
",",
"val",
";",
"for",
"(",
"key",
"in",
"obj",
")",
"{",
"if",
"(",
"obj",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"val",
"=",
"obj",
"[",
"key",
"]",
";",
"if",
"(",
"typeof",
"val",
"===",
"'object'",
"&&",
"val",
"!==",
"null",
")",
"{",
"ret",
"[",
"key",
"]",
"=",
"deepCopy",
"(",
"val",
")",
";",
"}",
"else",
"{",
"ret",
"[",
"key",
"]",
"=",
"val",
";",
"}",
"}",
"}",
"return",
"ret",
";",
"}"
] |
Returns a deep copy of the given obj
|
[
"Returns",
"a",
"deep",
"copy",
"of",
"the",
"given",
"obj"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/javascript/orionAcorn.js#L240-L253
|
14,452
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-extra-bind.js
|
report
|
function report(node) {
var nodeParent = node.parent; // memberexpression
context.report(
nodeParent.property,
ProblemMessages.noExtraBind);
}
|
javascript
|
function report(node) {
var nodeParent = node.parent; // memberexpression
context.report(
nodeParent.property,
ProblemMessages.noExtraBind);
}
|
[
"function",
"report",
"(",
"node",
")",
"{",
"var",
"nodeParent",
"=",
"node",
".",
"parent",
";",
"// memberexpression\r",
"context",
".",
"report",
"(",
"nodeParent",
".",
"property",
",",
"ProblemMessages",
".",
"noExtraBind",
")",
";",
"}"
] |
Reports a given function node.
@param {ASTNode} node - A node to report. This is a FunctionExpression or
an ArrowFunctionExpression.
@returns {void}
|
[
"Reports",
"a",
"given",
"function",
"node",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-extra-bind.js#L27-L32
|
14,453
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-extra-bind.js
|
getPropertyName
|
function getPropertyName(node) {
if (node.computed) {
switch (node.property.type) {
case "Literal":
return String(node.property.value);
case "TemplateLiteral":
if (node.property.expressions.length === 0) {
return node.property.quasis[0].value.cooked;
}
// fallthrough
default:
return false;
}
}
return node.property.name;
}
|
javascript
|
function getPropertyName(node) {
if (node.computed) {
switch (node.property.type) {
case "Literal":
return String(node.property.value);
case "TemplateLiteral":
if (node.property.expressions.length === 0) {
return node.property.quasis[0].value.cooked;
}
// fallthrough
default:
return false;
}
}
return node.property.name;
}
|
[
"function",
"getPropertyName",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"computed",
")",
"{",
"switch",
"(",
"node",
".",
"property",
".",
"type",
")",
"{",
"case",
"\"Literal\"",
":",
"return",
"String",
"(",
"node",
".",
"property",
".",
"value",
")",
";",
"case",
"\"TemplateLiteral\"",
":",
"if",
"(",
"node",
".",
"property",
".",
"expressions",
".",
"length",
"===",
"0",
")",
"{",
"return",
"node",
".",
"property",
".",
"quasis",
"[",
"0",
"]",
".",
"value",
".",
"cooked",
";",
"}",
"// fallthrough\r",
"default",
":",
"return",
"false",
";",
"}",
"}",
"return",
"node",
".",
"property",
".",
"name",
";",
"}"
] |
Gets the property name of a given node.
If the property name is dynamic, this returns an empty string.
@param {ASTNode} node - A node to check. This is a MemberExpression.
@returns {string} The property name of the node.
|
[
"Gets",
"the",
"property",
"name",
"of",
"a",
"given",
"node",
".",
"If",
"the",
"property",
"name",
"is",
"dynamic",
"this",
"returns",
"an",
"empty",
"string",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-extra-bind.js#L41-L56
|
14,454
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-extra-bind.js
|
enterFunction
|
function enterFunction(node) {
scopeInfo = {
isBound: isCalleeOfBindMethod(node),
thisFound: false,
upper: scopeInfo
};
}
|
javascript
|
function enterFunction(node) {
scopeInfo = {
isBound: isCalleeOfBindMethod(node),
thisFound: false,
upper: scopeInfo
};
}
|
[
"function",
"enterFunction",
"(",
"node",
")",
"{",
"scopeInfo",
"=",
"{",
"isBound",
":",
"isCalleeOfBindMethod",
"(",
"node",
")",
",",
"thisFound",
":",
"false",
",",
"upper",
":",
"scopeInfo",
"}",
";",
"}"
] |
Adds a scope information object to the stack.
@param {ASTNode} node - A node to add. This node is a FunctionExpression
or a FunctionDeclaration node.
@returns {void}
|
[
"Adds",
"a",
"scope",
"information",
"object",
"to",
"the",
"stack",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-extra-bind.js#L88-L94
|
14,455
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/config/environments.js
|
load
|
function load() {
Object.keys(envs).forEach(function(envName) {
environments[envName] = envs[envName];
});
}
|
javascript
|
function load() {
Object.keys(envs).forEach(function(envName) {
environments[envName] = envs[envName];
});
}
|
[
"function",
"load",
"(",
")",
"{",
"Object",
".",
"keys",
"(",
"envs",
")",
".",
"forEach",
"(",
"function",
"(",
"envName",
")",
"{",
"environments",
"[",
"envName",
"]",
"=",
"envs",
"[",
"envName",
"]",
";",
"}",
")",
";",
"}"
] |
Loads the default environments.
@returns {void}
@private
|
[
"Loads",
"the",
"default",
"environments",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/config/environments.js#L24-L28
|
14,456
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/config/environments.js
|
function(plugin, pluginName) {
if (plugin.environments) {
Object.keys(plugin.environments).forEach(function(envName) {
this.define(pluginName + "/" + envName, plugin.environments[envName]);
}, this);
}
}
|
javascript
|
function(plugin, pluginName) {
if (plugin.environments) {
Object.keys(plugin.environments).forEach(function(envName) {
this.define(pluginName + "/" + envName, plugin.environments[envName]);
}, this);
}
}
|
[
"function",
"(",
"plugin",
",",
"pluginName",
")",
"{",
"if",
"(",
"plugin",
".",
"environments",
")",
"{",
"Object",
".",
"keys",
"(",
"plugin",
".",
"environments",
")",
".",
"forEach",
"(",
"function",
"(",
"envName",
")",
"{",
"this",
".",
"define",
"(",
"pluginName",
"+",
"\"/\"",
"+",
"envName",
",",
"plugin",
".",
"environments",
"[",
"envName",
"]",
")",
";",
"}",
",",
"this",
")",
";",
"}",
"}"
] |
Imports all environments from a plugin.
@param {Object} plugin The plugin object.
@param {string} pluginName The name of the plugin.
@returns {void}
|
[
"Imports",
"all",
"environments",
"from",
"a",
"plugin",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/config/environments.js#L66-L72
|
|
14,457
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/plugins/samples/largeFileSearch/require.js
|
each
|
function each(ary, func) {
if (ary) {
var i;
for (i = 0; i < ary.length; i += 1) {
if (ary[i] && func(ary[i], i, ary)) {
break;
}
}
}
}
|
javascript
|
function each(ary, func) {
if (ary) {
var i;
for (i = 0; i < ary.length; i += 1) {
if (ary[i] && func(ary[i], i, ary)) {
break;
}
}
}
}
|
[
"function",
"each",
"(",
"ary",
",",
"func",
")",
"{",
"if",
"(",
"ary",
")",
"{",
"var",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"ary",
".",
"length",
";",
"i",
"+=",
"1",
")",
"{",
"if",
"(",
"ary",
"[",
"i",
"]",
"&&",
"func",
"(",
"ary",
"[",
"i",
"]",
",",
"i",
",",
"ary",
")",
")",
"{",
"break",
";",
"}",
"}",
"}",
"}"
] |
Helper function for iterating over an array. If the func returns
a true value, it will break out of the loop.
|
[
"Helper",
"function",
"for",
"iterating",
"over",
"an",
"array",
".",
"If",
"the",
"func",
"returns",
"a",
"true",
"value",
"it",
"will",
"break",
"out",
"of",
"the",
"loop",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/plugins/samples/largeFileSearch/require.js#L53-L62
|
14,458
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/plugins/samples/largeFileSearch/require.js
|
getGlobal
|
function getGlobal(value) {
if (!value) {
return value;
}
var g = global;
each(value.split('.'), function (part) {
g = g[part];
});
return g;
}
|
javascript
|
function getGlobal(value) {
if (!value) {
return value;
}
var g = global;
each(value.split('.'), function (part) {
g = g[part];
});
return g;
}
|
[
"function",
"getGlobal",
"(",
"value",
")",
"{",
"if",
"(",
"!",
"value",
")",
"{",
"return",
"value",
";",
"}",
"var",
"g",
"=",
"global",
";",
"each",
"(",
"value",
".",
"split",
"(",
"'.'",
")",
",",
"function",
"(",
"part",
")",
"{",
"g",
"=",
"g",
"[",
"part",
"]",
";",
"}",
")",
";",
"return",
"g",
";",
"}"
] |
Allow getting a global that expressed in dot notation, like 'a.b.c'.
|
[
"Allow",
"getting",
"a",
"global",
"that",
"expressed",
"in",
"dot",
"notation",
"like",
"a",
".",
"b",
".",
"c",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/plugins/samples/largeFileSearch/require.js#L139-L148
|
14,459
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/plugins/samples/largeFileSearch/require.js
|
function (depMap) {
var mod = getOwn(registry, depMap.id);
if (mod) {
getModule(depMap).enable();
}
}
|
javascript
|
function (depMap) {
var mod = getOwn(registry, depMap.id);
if (mod) {
getModule(depMap).enable();
}
}
|
[
"function",
"(",
"depMap",
")",
"{",
"var",
"mod",
"=",
"getOwn",
"(",
"registry",
",",
"depMap",
".",
"id",
")",
";",
"if",
"(",
"mod",
")",
"{",
"getModule",
"(",
"depMap",
")",
".",
"enable",
"(",
")",
";",
"}",
"}"
] |
Called to enable a module if it is still in the registry
awaiting enablement. A second arg, parent, the parent module,
is passed in for context, when this method is overriden by
the optimizer. Not shown here to keep code compact.
|
[
"Called",
"to",
"enable",
"a",
"module",
"if",
"it",
"is",
"still",
"in",
"the",
"registry",
"awaiting",
"enablement",
".",
"A",
"second",
"arg",
"parent",
"the",
"parent",
"module",
"is",
"passed",
"in",
"for",
"context",
"when",
"this",
"method",
"is",
"overriden",
"by",
"the",
"optimizer",
".",
"Not",
"shown",
"here",
"to",
"keep",
"code",
"compact",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/plugins/samples/largeFileSearch/require.js#L1473-L1478
|
|
14,460
|
eclipse/orion.client
|
modules/orionode/lib/metastore/fs/store.js
|
getUserMetadataFileName
|
function getUserMetadataFileName(options, user) {
let userId;
if(typeof user === "string") {
userId = user;
} else if(user && typeof user.username === 'string') {
userId = user.username;
} else {
return null;
}
return nodePath.join(getUserRootLocation(options, userId), FILENAME_USER_METADATA);
}
|
javascript
|
function getUserMetadataFileName(options, user) {
let userId;
if(typeof user === "string") {
userId = user;
} else if(user && typeof user.username === 'string') {
userId = user.username;
} else {
return null;
}
return nodePath.join(getUserRootLocation(options, userId), FILENAME_USER_METADATA);
}
|
[
"function",
"getUserMetadataFileName",
"(",
"options",
",",
"user",
")",
"{",
"let",
"userId",
";",
"if",
"(",
"typeof",
"user",
"===",
"\"string\"",
")",
"{",
"userId",
"=",
"user",
";",
"}",
"else",
"if",
"(",
"user",
"&&",
"typeof",
"user",
".",
"username",
"===",
"'string'",
")",
"{",
"userId",
"=",
"user",
".",
"username",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"return",
"nodePath",
".",
"join",
"(",
"getUserRootLocation",
"(",
"options",
",",
"userId",
")",
",",
"FILENAME_USER_METADATA",
")",
";",
"}"
] |
Returns the fully qualified file path of the metadata for the given user. Returns null if no user
is provided
@param {{?}} options The options map
@param {string|{?}} user The user id or map of user options
|
[
"Returns",
"the",
"fully",
"qualified",
"file",
"path",
"of",
"the",
"metadata",
"for",
"the",
"given",
"user",
".",
"Returns",
"null",
"if",
"no",
"user",
"is",
"provided"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/metastore/fs/store.js#L49-L59
|
14,461
|
eclipse/orion.client
|
modules/orionode/lib/metastore/fs/store.js
|
FsMetastore
|
function FsMetastore(options) {
this._options = options;
this._taskList = {};
this._lockMap = {};
this._isSingleUser = !!options.configParams.get('orion.single.user');
this._isFormAuthType = options.configParams.get('orion.auth.name') === 'FORM+OAuth';
}
|
javascript
|
function FsMetastore(options) {
this._options = options;
this._taskList = {};
this._lockMap = {};
this._isSingleUser = !!options.configParams.get('orion.single.user');
this._isFormAuthType = options.configParams.get('orion.auth.name') === 'FORM+OAuth';
}
|
[
"function",
"FsMetastore",
"(",
"options",
")",
"{",
"this",
".",
"_options",
"=",
"options",
";",
"this",
".",
"_taskList",
"=",
"{",
"}",
";",
"this",
".",
"_lockMap",
"=",
"{",
"}",
";",
"this",
".",
"_isSingleUser",
"=",
"!",
"!",
"options",
".",
"configParams",
".",
"get",
"(",
"'orion.single.user'",
")",
";",
"this",
".",
"_isFormAuthType",
"=",
"options",
".",
"configParams",
".",
"get",
"(",
"'orion.auth.name'",
")",
"===",
"'FORM+OAuth'",
";",
"}"
] |
Creates a new filesystem-based metastore
@param {{?}} options The map of server options
|
[
"Creates",
"a",
"new",
"filesystem",
"-",
"based",
"metastore"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/metastore/fs/store.js#L130-L136
|
14,462
|
eclipse/orion.client
|
modules/orionode/lib/metastore/fs/store.js
|
function(workspaceId, workspacedata, callback) {
var userId = metaUtil.decodeUserIdFromWorkspaceId(workspaceId);
Promise.using(this.lock(userId, false), function() {
return new Promise(function(resolve, reject) {
this._readWorkspaceMetadata(workspaceId, function(error, metadata) {
if (error) {
return reject(error);
}
if (typeof workspacedata === "function") {
workspacedata = workspacedata(this._convertWorkspace(metadata));
if (!workspacedata) {
return resolve();
}
}
//TODO other properties
metadata.Properties = workspacedata.properties;
this._updateWorkspaceMetadata(workspaceId, metadata, function(error) {
if (error) {
return reject(error);
}
resolve();
});
}.bind(this));
}.bind(this));
}.bind(this)).then(
function(result) {
callback(null, result);
},
callback /* error case */
);
}
|
javascript
|
function(workspaceId, workspacedata, callback) {
var userId = metaUtil.decodeUserIdFromWorkspaceId(workspaceId);
Promise.using(this.lock(userId, false), function() {
return new Promise(function(resolve, reject) {
this._readWorkspaceMetadata(workspaceId, function(error, metadata) {
if (error) {
return reject(error);
}
if (typeof workspacedata === "function") {
workspacedata = workspacedata(this._convertWorkspace(metadata));
if (!workspacedata) {
return resolve();
}
}
//TODO other properties
metadata.Properties = workspacedata.properties;
this._updateWorkspaceMetadata(workspaceId, metadata, function(error) {
if (error) {
return reject(error);
}
resolve();
});
}.bind(this));
}.bind(this));
}.bind(this)).then(
function(result) {
callback(null, result);
},
callback /* error case */
);
}
|
[
"function",
"(",
"workspaceId",
",",
"workspacedata",
",",
"callback",
")",
"{",
"var",
"userId",
"=",
"metaUtil",
".",
"decodeUserIdFromWorkspaceId",
"(",
"workspaceId",
")",
";",
"Promise",
".",
"using",
"(",
"this",
".",
"lock",
"(",
"userId",
",",
"false",
")",
",",
"function",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"this",
".",
"_readWorkspaceMetadata",
"(",
"workspaceId",
",",
"function",
"(",
"error",
",",
"metadata",
")",
"{",
"if",
"(",
"error",
")",
"{",
"return",
"reject",
"(",
"error",
")",
";",
"}",
"if",
"(",
"typeof",
"workspacedata",
"===",
"\"function\"",
")",
"{",
"workspacedata",
"=",
"workspacedata",
"(",
"this",
".",
"_convertWorkspace",
"(",
"metadata",
")",
")",
";",
"if",
"(",
"!",
"workspacedata",
")",
"{",
"return",
"resolve",
"(",
")",
";",
"}",
"}",
"//TODO other properties ",
"metadata",
".",
"Properties",
"=",
"workspacedata",
".",
"properties",
";",
"this",
".",
"_updateWorkspaceMetadata",
"(",
"workspaceId",
",",
"metadata",
",",
"function",
"(",
"error",
")",
"{",
"if",
"(",
"error",
")",
"{",
"return",
"reject",
"(",
"error",
")",
";",
"}",
"resolve",
"(",
")",
";",
"}",
")",
";",
"}",
".",
"bind",
"(",
"this",
")",
")",
";",
"}",
".",
"bind",
"(",
"this",
")",
")",
";",
"}",
".",
"bind",
"(",
"this",
")",
")",
".",
"then",
"(",
"function",
"(",
"result",
")",
"{",
"callback",
"(",
"null",
",",
"result",
")",
";",
"}",
",",
"callback",
"/* error case */",
")",
";",
"}"
] |
update workspace data, which is the properties of workspace metadata
|
[
"update",
"workspace",
"data",
"which",
"is",
"the",
"properties",
"of",
"workspace",
"metadata"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/metastore/fs/store.js#L407-L437
|
|
14,463
|
eclipse/orion.client
|
modules/orionode/lib/metastore/fs/store.js
|
function(id, callback) {
if(this._options.configParams.get('orion.single.user')) {
return callback(new Error("The default user cannot be deleted in single user mode"));
}
let userLocation = getUserRootLocation(this._options, id);
fs.access(userLocation, (err) => {
if(err) {
return callback(err);
}
rimraf(userLocation, (err) => {
if(err) {
return callback(err);
}
callback();
});
});
}
|
javascript
|
function(id, callback) {
if(this._options.configParams.get('orion.single.user')) {
return callback(new Error("The default user cannot be deleted in single user mode"));
}
let userLocation = getUserRootLocation(this._options, id);
fs.access(userLocation, (err) => {
if(err) {
return callback(err);
}
rimraf(userLocation, (err) => {
if(err) {
return callback(err);
}
callback();
});
});
}
|
[
"function",
"(",
"id",
",",
"callback",
")",
"{",
"if",
"(",
"this",
".",
"_options",
".",
"configParams",
".",
"get",
"(",
"'orion.single.user'",
")",
")",
"{",
"return",
"callback",
"(",
"new",
"Error",
"(",
"\"The default user cannot be deleted in single user mode\"",
")",
")",
";",
"}",
"let",
"userLocation",
"=",
"getUserRootLocation",
"(",
"this",
".",
"_options",
",",
"id",
")",
";",
"fs",
".",
"access",
"(",
"userLocation",
",",
"(",
"err",
")",
"=>",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"callback",
"(",
"err",
")",
";",
"}",
"rimraf",
"(",
"userLocation",
",",
"(",
"err",
")",
"=>",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"callback",
"(",
"err",
")",
";",
"}",
"callback",
"(",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}"
] |
Deletes the given user and calls the callback. If the server is launched in single user mode
the call immediately callsback with an error. The default single user mode user cannot delete themselves.
@param {string} id The user id to delete
@param {fn(err)} callback The function callback
@callback
|
[
"Deletes",
"the",
"given",
"user",
"and",
"calls",
"the",
"callback",
".",
"If",
"the",
"server",
"is",
"launched",
"in",
"single",
"user",
"mode",
"the",
"call",
"immediately",
"callsback",
"with",
"an",
"error",
".",
"The",
"default",
"single",
"user",
"mode",
"user",
"cannot",
"delete",
"themselves",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/metastore/fs/store.js#L632-L648
|
|
14,464
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/utils/traverser.js
|
Traverser
|
function Traverser() {
var controller = Object.create(new estraverse.Controller()),
originalTraverse = controller.traverse;
// intercept call to traverse() and add the fallback key to the visitor
controller.traverse = function(node, visitor) {
visitor.fallback = Traverser.getKeys;
return originalTraverse.call(this, node, visitor);
};
return controller;
}
|
javascript
|
function Traverser() {
var controller = Object.create(new estraverse.Controller()),
originalTraverse = controller.traverse;
// intercept call to traverse() and add the fallback key to the visitor
controller.traverse = function(node, visitor) {
visitor.fallback = Traverser.getKeys;
return originalTraverse.call(this, node, visitor);
};
return controller;
}
|
[
"function",
"Traverser",
"(",
")",
"{",
"var",
"controller",
"=",
"Object",
".",
"create",
"(",
"new",
"estraverse",
".",
"Controller",
"(",
")",
")",
",",
"originalTraverse",
"=",
"controller",
".",
"traverse",
";",
"// intercept call to traverse() and add the fallback key to the visitor",
"controller",
".",
"traverse",
"=",
"function",
"(",
"node",
",",
"visitor",
")",
"{",
"visitor",
".",
"fallback",
"=",
"Traverser",
".",
"getKeys",
";",
"return",
"originalTraverse",
".",
"call",
"(",
"this",
",",
"node",
",",
"visitor",
")",
";",
"}",
";",
"return",
"controller",
";",
"}"
] |
Wrapper around an estraverse controller that ensures the correct keys
are visited.
@constructor
|
[
"Wrapper",
"around",
"an",
"estraverse",
"controller",
"that",
"ensures",
"the",
"correct",
"keys",
"are",
"visited",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/utils/traverser.js#L25-L37
|
14,465
|
eclipse/orion.client
|
modules/orionode/lib/shared/db/userProjects.js
|
addProjectToUser
|
function addProjectToUser(user, project) {
return addUser(user)
.then(function(doc) {
return userProject.findOneAndUpdate({username: user}, {$addToSet: {'sharedProjects': project} }, {
safe: true,
w: 'majority'
}).exec();
});
}
|
javascript
|
function addProjectToUser(user, project) {
return addUser(user)
.then(function(doc) {
return userProject.findOneAndUpdate({username: user}, {$addToSet: {'sharedProjects': project} }, {
safe: true,
w: 'majority'
}).exec();
});
}
|
[
"function",
"addProjectToUser",
"(",
"user",
",",
"project",
")",
"{",
"return",
"addUser",
"(",
"user",
")",
".",
"then",
"(",
"function",
"(",
"doc",
")",
"{",
"return",
"userProject",
".",
"findOneAndUpdate",
"(",
"{",
"username",
":",
"user",
"}",
",",
"{",
"$addToSet",
":",
"{",
"'sharedProjects'",
":",
"project",
"}",
"}",
",",
"{",
"safe",
":",
"true",
",",
"w",
":",
"'majority'",
"}",
")",
".",
"exec",
"(",
")",
";",
"}",
")",
";",
"}"
] |
Adds project to user's shared projects.
|
[
"Adds",
"project",
"to",
"user",
"s",
"shared",
"projects",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/shared/db/userProjects.js#L79-L87
|
14,466
|
eclipse/orion.client
|
modules/orionode/lib/shared/db/userProjects.js
|
removeProjectFromUser
|
function removeProjectFromUser(user, project) {
return userProject.findOneAndUpdate({username: user}, {$pull: {'sharedProjects': { $in: [project]}} }, {
safe: true,
w: 'majority'
}).exec();
}
|
javascript
|
function removeProjectFromUser(user, project) {
return userProject.findOneAndUpdate({username: user}, {$pull: {'sharedProjects': { $in: [project]}} }, {
safe: true,
w: 'majority'
}).exec();
}
|
[
"function",
"removeProjectFromUser",
"(",
"user",
",",
"project",
")",
"{",
"return",
"userProject",
".",
"findOneAndUpdate",
"(",
"{",
"username",
":",
"user",
"}",
",",
"{",
"$pull",
":",
"{",
"'sharedProjects'",
":",
"{",
"$in",
":",
"[",
"project",
"]",
"}",
"}",
"}",
",",
"{",
"safe",
":",
"true",
",",
"w",
":",
"'majority'",
"}",
")",
".",
"exec",
"(",
")",
";",
"}"
] |
Removes a project from a user's shared projects.
|
[
"Removes",
"a",
"project",
"from",
"a",
"user",
"s",
"shared",
"projects",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/shared/db/userProjects.js#L92-L97
|
14,467
|
eclipse/orion.client
|
modules/orionode/lib/shared/db/userProjects.js
|
getUserSharedProjects
|
function getUserSharedProjects(user) {
return userProject.findOne({'username': user}, 'sharedProjects')
.then(function(doc) {
if (!doc) {
return undefined;
}
var projects = doc.sharedProjects;
projects = projects.map(function(project) {
var name = path.win32.basename(project);
return {'Name': name, 'Location': project};
});
return projects;
});
}
|
javascript
|
function getUserSharedProjects(user) {
return userProject.findOne({'username': user}, 'sharedProjects')
.then(function(doc) {
if (!doc) {
return undefined;
}
var projects = doc.sharedProjects;
projects = projects.map(function(project) {
var name = path.win32.basename(project);
return {'Name': name, 'Location': project};
});
return projects;
});
}
|
[
"function",
"getUserSharedProjects",
"(",
"user",
")",
"{",
"return",
"userProject",
".",
"findOne",
"(",
"{",
"'username'",
":",
"user",
"}",
",",
"'sharedProjects'",
")",
".",
"then",
"(",
"function",
"(",
"doc",
")",
"{",
"if",
"(",
"!",
"doc",
")",
"{",
"return",
"undefined",
";",
"}",
"var",
"projects",
"=",
"doc",
".",
"sharedProjects",
";",
"projects",
"=",
"projects",
".",
"map",
"(",
"function",
"(",
"project",
")",
"{",
"var",
"name",
"=",
"path",
".",
"win32",
".",
"basename",
"(",
"project",
")",
";",
"return",
"{",
"'Name'",
":",
"name",
",",
"'Location'",
":",
"project",
"}",
";",
"}",
")",
";",
"return",
"projects",
";",
"}",
")",
";",
"}"
] |
returns a list of projects shared to the user.
|
[
"returns",
"a",
"list",
"of",
"projects",
"shared",
"to",
"the",
"user",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/shared/db/userProjects.js#L114-L127
|
14,468
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
makeLooped
|
function makeLooped(state, fromSegments, toSegments) {
var end = Math.min(fromSegments.length, toSegments.length);
for (var i = 0; i < end; ++i) {
var fromSegment = fromSegments[i];
var toSegment = toSegments[i];
if (toSegment.reachable) {
fromSegment.nextSegments.push(toSegment);
}
if (fromSegment.reachable) {
toSegment.prevSegments.push(fromSegment);
}
fromSegment.allNextSegments.push(toSegment);
toSegment.allPrevSegments.push(fromSegment);
if (toSegment.allPrevSegments.length >= 2) {
CodePathSegment.markPrevSegmentAsLooped(toSegment, fromSegment);
}
state.notifyLooped(fromSegment, toSegment);
}
}
|
javascript
|
function makeLooped(state, fromSegments, toSegments) {
var end = Math.min(fromSegments.length, toSegments.length);
for (var i = 0; i < end; ++i) {
var fromSegment = fromSegments[i];
var toSegment = toSegments[i];
if (toSegment.reachable) {
fromSegment.nextSegments.push(toSegment);
}
if (fromSegment.reachable) {
toSegment.prevSegments.push(fromSegment);
}
fromSegment.allNextSegments.push(toSegment);
toSegment.allPrevSegments.push(fromSegment);
if (toSegment.allPrevSegments.length >= 2) {
CodePathSegment.markPrevSegmentAsLooped(toSegment, fromSegment);
}
state.notifyLooped(fromSegment, toSegment);
}
}
|
[
"function",
"makeLooped",
"(",
"state",
",",
"fromSegments",
",",
"toSegments",
")",
"{",
"var",
"end",
"=",
"Math",
".",
"min",
"(",
"fromSegments",
".",
"length",
",",
"toSegments",
".",
"length",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"end",
";",
"++",
"i",
")",
"{",
"var",
"fromSegment",
"=",
"fromSegments",
"[",
"i",
"]",
";",
"var",
"toSegment",
"=",
"toSegments",
"[",
"i",
"]",
";",
"if",
"(",
"toSegment",
".",
"reachable",
")",
"{",
"fromSegment",
".",
"nextSegments",
".",
"push",
"(",
"toSegment",
")",
";",
"}",
"if",
"(",
"fromSegment",
".",
"reachable",
")",
"{",
"toSegment",
".",
"prevSegments",
".",
"push",
"(",
"fromSegment",
")",
";",
"}",
"fromSegment",
".",
"allNextSegments",
".",
"push",
"(",
"toSegment",
")",
";",
"toSegment",
".",
"allPrevSegments",
".",
"push",
"(",
"fromSegment",
")",
";",
"if",
"(",
"toSegment",
".",
"allPrevSegments",
".",
"length",
">=",
"2",
")",
"{",
"CodePathSegment",
".",
"markPrevSegmentAsLooped",
"(",
"toSegment",
",",
"fromSegment",
")",
";",
"}",
"state",
".",
"notifyLooped",
"(",
"fromSegment",
",",
"toSegment",
")",
";",
"}",
"}"
] |
Creates looping path.
@param {CodePathState} state - The instance.
@param {CodePathSegment[]} fromSegments - Segments which are source.
@param {CodePathSegment[]} toSegments - Segments which are destination.
@returns {void}
|
[
"Creates",
"looping",
"path",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L168-L190
|
14,469
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function() {
var lastContext = this.forkContext;
this.forkContext = lastContext.upper;
this.forkContext.replaceHead(lastContext.makeNext(0, -1));
return lastContext;
}
|
javascript
|
function() {
var lastContext = this.forkContext;
this.forkContext = lastContext.upper;
this.forkContext.replaceHead(lastContext.makeNext(0, -1));
return lastContext;
}
|
[
"function",
"(",
")",
"{",
"var",
"lastContext",
"=",
"this",
".",
"forkContext",
";",
"this",
".",
"forkContext",
"=",
"lastContext",
".",
"upper",
";",
"this",
".",
"forkContext",
".",
"replaceHead",
"(",
"lastContext",
".",
"makeNext",
"(",
"0",
",",
"-",
"1",
")",
")",
";",
"return",
"lastContext",
";",
"}"
] |
Pops and merges the last forking context.
@returns {ForkContext} The last context.
|
[
"Pops",
"and",
"merges",
"the",
"last",
"forking",
"context",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L291-L298
|
|
14,470
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function() {
var context = this.choiceContext;
this.choiceContext = context.upper;
var forkContext = this.forkContext;
var headSegments = forkContext.head;
switch (context.kind) {
case "&&":
case "||":
/*
* If any result were not transferred from child contexts,
* this sets the head segments to both cases.
* The head segments are the path of the right-hand operand.
*/
if (!context.processed) {
context.trueForkContext.add(headSegments);
context.falseForkContext.add(headSegments);
}
/*
* Transfers results to upper context if this context is in
* test chunk.
*/
if (context.isForkingAsResult) {
var parentContext = this.choiceContext;
parentContext.trueForkContext.addAll(context.trueForkContext);
parentContext.falseForkContext.addAll(context.falseForkContext);
parentContext.processed = true;
return context;
}
break;
case "test":
if (!context.processed) {
/*
* The head segments are the path of the `if` block here.
* Updates the `true` path with the end of the `if` block.
*/
context.trueForkContext.clear();
context.trueForkContext.add(headSegments);
} else {
/*
* The head segments are the path of the `else` block here.
* Updates the `false` path with the end of the `else`
* block.
*/
context.falseForkContext.clear();
context.falseForkContext.add(headSegments);
}
break;
case "loop":
/*
* Loops are addressed in popLoopContext().
* This is called from popLoopContext().
*/
return context;
/* istanbul ignore next */
default:
throw new Error("unreachable");
}
// Merges all paths.
var prevForkContext = context.trueForkContext;
prevForkContext.addAll(context.falseForkContext);
forkContext.replaceHead(prevForkContext.makeNext(0, -1));
return context;
}
|
javascript
|
function() {
var context = this.choiceContext;
this.choiceContext = context.upper;
var forkContext = this.forkContext;
var headSegments = forkContext.head;
switch (context.kind) {
case "&&":
case "||":
/*
* If any result were not transferred from child contexts,
* this sets the head segments to both cases.
* The head segments are the path of the right-hand operand.
*/
if (!context.processed) {
context.trueForkContext.add(headSegments);
context.falseForkContext.add(headSegments);
}
/*
* Transfers results to upper context if this context is in
* test chunk.
*/
if (context.isForkingAsResult) {
var parentContext = this.choiceContext;
parentContext.trueForkContext.addAll(context.trueForkContext);
parentContext.falseForkContext.addAll(context.falseForkContext);
parentContext.processed = true;
return context;
}
break;
case "test":
if (!context.processed) {
/*
* The head segments are the path of the `if` block here.
* Updates the `true` path with the end of the `if` block.
*/
context.trueForkContext.clear();
context.trueForkContext.add(headSegments);
} else {
/*
* The head segments are the path of the `else` block here.
* Updates the `false` path with the end of the `else`
* block.
*/
context.falseForkContext.clear();
context.falseForkContext.add(headSegments);
}
break;
case "loop":
/*
* Loops are addressed in popLoopContext().
* This is called from popLoopContext().
*/
return context;
/* istanbul ignore next */
default:
throw new Error("unreachable");
}
// Merges all paths.
var prevForkContext = context.trueForkContext;
prevForkContext.addAll(context.falseForkContext);
forkContext.replaceHead(prevForkContext.makeNext(0, -1));
return context;
}
|
[
"function",
"(",
")",
"{",
"var",
"context",
"=",
"this",
".",
"choiceContext",
";",
"this",
".",
"choiceContext",
"=",
"context",
".",
"upper",
";",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"var",
"headSegments",
"=",
"forkContext",
".",
"head",
";",
"switch",
"(",
"context",
".",
"kind",
")",
"{",
"case",
"\"&&\"",
":",
"case",
"\"||\"",
":",
"/*\r\n\t\t\t\t\t * If any result were not transferred from child contexts,\r\n\t\t\t\t\t * this sets the head segments to both cases.\r\n\t\t\t\t\t * The head segments are the path of the right-hand operand.\r\n\t\t\t\t\t */",
"if",
"(",
"!",
"context",
".",
"processed",
")",
"{",
"context",
".",
"trueForkContext",
".",
"add",
"(",
"headSegments",
")",
";",
"context",
".",
"falseForkContext",
".",
"add",
"(",
"headSegments",
")",
";",
"}",
"/*\r\n\t\t\t\t\t * Transfers results to upper context if this context is in\r\n\t\t\t\t\t * test chunk.\r\n\t\t\t\t\t */",
"if",
"(",
"context",
".",
"isForkingAsResult",
")",
"{",
"var",
"parentContext",
"=",
"this",
".",
"choiceContext",
";",
"parentContext",
".",
"trueForkContext",
".",
"addAll",
"(",
"context",
".",
"trueForkContext",
")",
";",
"parentContext",
".",
"falseForkContext",
".",
"addAll",
"(",
"context",
".",
"falseForkContext",
")",
";",
"parentContext",
".",
"processed",
"=",
"true",
";",
"return",
"context",
";",
"}",
"break",
";",
"case",
"\"test\"",
":",
"if",
"(",
"!",
"context",
".",
"processed",
")",
"{",
"/*\r\n\t\t\t\t\t\t * The head segments are the path of the `if` block here.\r\n\t\t\t\t\t\t * Updates the `true` path with the end of the `if` block.\r\n\t\t\t\t\t\t */",
"context",
".",
"trueForkContext",
".",
"clear",
"(",
")",
";",
"context",
".",
"trueForkContext",
".",
"add",
"(",
"headSegments",
")",
";",
"}",
"else",
"{",
"/*\r\n\t\t\t\t\t\t * The head segments are the path of the `else` block here.\r\n\t\t\t\t\t\t * Updates the `false` path with the end of the `else`\r\n\t\t\t\t\t\t * block.\r\n\t\t\t\t\t\t */",
"context",
".",
"falseForkContext",
".",
"clear",
"(",
")",
";",
"context",
".",
"falseForkContext",
".",
"add",
"(",
"headSegments",
")",
";",
"}",
"break",
";",
"case",
"\"loop\"",
":",
"/*\r\n\t\t\t\t\t * Loops are addressed in popLoopContext().\r\n\t\t\t\t\t * This is called from popLoopContext().\r\n\t\t\t\t\t */",
"return",
"context",
";",
"/* istanbul ignore next */",
"default",
":",
"throw",
"new",
"Error",
"(",
"\"unreachable\"",
")",
";",
"}",
"// Merges all paths.",
"var",
"prevForkContext",
"=",
"context",
".",
"trueForkContext",
";",
"prevForkContext",
".",
"addAll",
"(",
"context",
".",
"falseForkContext",
")",
";",
"forkContext",
".",
"replaceHead",
"(",
"prevForkContext",
".",
"makeNext",
"(",
"0",
",",
"-",
"1",
")",
")",
";",
"return",
"context",
";",
"}"
] |
Pops the last choice context and finalizes it.
@returns {ChoiceContext} The popped context.
|
[
"Pops",
"the",
"last",
"choice",
"context",
"and",
"finalizes",
"it",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L369-L449
|
|
14,471
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function() {
var context = this.choiceContext;
var forkContext = this.forkContext;
if (context.processed) {
/*
* This got segments already from the child choice context.
* Creates the next path from own true/false fork context.
*/
var prevForkContext =
context.kind === "&&" ? context.trueForkContext :
/* kind === "||" */
context.falseForkContext;
forkContext.replaceHead(prevForkContext.makeNext(0, -1));
prevForkContext.clear();
context.processed = false;
} else {
/*
* This did not get segments from the child choice context.
* So addresses the head segments.
* The head segments are the path of the left-hand operand.
*/
if (context.kind === "&&") {
// The path does short-circuit if false.
context.falseForkContext.add(forkContext.head);
} else {
// The path does short-circuit if true.
context.trueForkContext.add(forkContext.head);
}
forkContext.replaceHead(forkContext.makeNext(-1, -1));
}
}
|
javascript
|
function() {
var context = this.choiceContext;
var forkContext = this.forkContext;
if (context.processed) {
/*
* This got segments already from the child choice context.
* Creates the next path from own true/false fork context.
*/
var prevForkContext =
context.kind === "&&" ? context.trueForkContext :
/* kind === "||" */
context.falseForkContext;
forkContext.replaceHead(prevForkContext.makeNext(0, -1));
prevForkContext.clear();
context.processed = false;
} else {
/*
* This did not get segments from the child choice context.
* So addresses the head segments.
* The head segments are the path of the left-hand operand.
*/
if (context.kind === "&&") {
// The path does short-circuit if false.
context.falseForkContext.add(forkContext.head);
} else {
// The path does short-circuit if true.
context.trueForkContext.add(forkContext.head);
}
forkContext.replaceHead(forkContext.makeNext(-1, -1));
}
}
|
[
"function",
"(",
")",
"{",
"var",
"context",
"=",
"this",
".",
"choiceContext",
";",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"if",
"(",
"context",
".",
"processed",
")",
"{",
"/*\r\n\t\t\t\t * This got segments already from the child choice context.\r\n\t\t\t\t * Creates the next path from own true/false fork context.\r\n\t\t\t\t */",
"var",
"prevForkContext",
"=",
"context",
".",
"kind",
"===",
"\"&&\"",
"?",
"context",
".",
"trueForkContext",
":",
"/* kind === \"||\" */",
"context",
".",
"falseForkContext",
";",
"forkContext",
".",
"replaceHead",
"(",
"prevForkContext",
".",
"makeNext",
"(",
"0",
",",
"-",
"1",
")",
")",
";",
"prevForkContext",
".",
"clear",
"(",
")",
";",
"context",
".",
"processed",
"=",
"false",
";",
"}",
"else",
"{",
"/*\r\n\t\t\t\t * This did not get segments from the child choice context.\r\n\t\t\t\t * So addresses the head segments.\r\n\t\t\t\t * The head segments are the path of the left-hand operand.\r\n\t\t\t\t */",
"if",
"(",
"context",
".",
"kind",
"===",
"\"&&\"",
")",
"{",
"// The path does short-circuit if false.",
"context",
".",
"falseForkContext",
".",
"add",
"(",
"forkContext",
".",
"head",
")",
";",
"}",
"else",
"{",
"// The path does short-circuit if true.",
"context",
".",
"trueForkContext",
".",
"add",
"(",
"forkContext",
".",
"head",
")",
";",
"}",
"forkContext",
".",
"replaceHead",
"(",
"forkContext",
".",
"makeNext",
"(",
"-",
"1",
",",
"-",
"1",
")",
")",
";",
"}",
"}"
] |
Makes a code path segment of the right-hand operand of a logical
expression.
@returns {void}
|
[
"Makes",
"a",
"code",
"path",
"segment",
"of",
"the",
"right",
"-",
"hand",
"operand",
"of",
"a",
"logical",
"expression",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L457-L495
|
|
14,472
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function() {
var context = this.choiceContext;
var forkContext = this.forkContext;
/*
* If any result were not transferred from child contexts,
* this sets the head segments to both cases.
* The head segments are the path of the test expression.
*/
if (!context.processed) {
context.trueForkContext.add(forkContext.head);
context.falseForkContext.add(forkContext.head);
}
context.processed = false;
// Creates new path from the `true` case.
forkContext.replaceHead(
context.trueForkContext.makeNext(0, -1)
);
}
|
javascript
|
function() {
var context = this.choiceContext;
var forkContext = this.forkContext;
/*
* If any result were not transferred from child contexts,
* this sets the head segments to both cases.
* The head segments are the path of the test expression.
*/
if (!context.processed) {
context.trueForkContext.add(forkContext.head);
context.falseForkContext.add(forkContext.head);
}
context.processed = false;
// Creates new path from the `true` case.
forkContext.replaceHead(
context.trueForkContext.makeNext(0, -1)
);
}
|
[
"function",
"(",
")",
"{",
"var",
"context",
"=",
"this",
".",
"choiceContext",
";",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"/*\r\n\t\t\t * If any result were not transferred from child contexts,\r\n\t\t\t * this sets the head segments to both cases.\r\n\t\t\t * The head segments are the path of the test expression.\r\n\t\t\t */",
"if",
"(",
"!",
"context",
".",
"processed",
")",
"{",
"context",
".",
"trueForkContext",
".",
"add",
"(",
"forkContext",
".",
"head",
")",
";",
"context",
".",
"falseForkContext",
".",
"add",
"(",
"forkContext",
".",
"head",
")",
";",
"}",
"context",
".",
"processed",
"=",
"false",
";",
"// Creates new path from the `true` case.",
"forkContext",
".",
"replaceHead",
"(",
"context",
".",
"trueForkContext",
".",
"makeNext",
"(",
"0",
",",
"-",
"1",
")",
")",
";",
"}"
] |
Makes a code path segment of the `if` block.
@returns {void}
|
[
"Makes",
"a",
"code",
"path",
"segment",
"of",
"the",
"if",
"block",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L502-L522
|
|
14,473
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function() {
var context = this.choiceContext;
var forkContext = this.forkContext;
/*
* The head segments are the path of the `if` block.
* Updates the `true` path with the end of the `if` block.
*/
context.trueForkContext.clear();
context.trueForkContext.add(forkContext.head);
context.processed = true;
// Creates new path from the `false` case.
forkContext.replaceHead(
context.falseForkContext.makeNext(0, -1)
);
}
|
javascript
|
function() {
var context = this.choiceContext;
var forkContext = this.forkContext;
/*
* The head segments are the path of the `if` block.
* Updates the `true` path with the end of the `if` block.
*/
context.trueForkContext.clear();
context.trueForkContext.add(forkContext.head);
context.processed = true;
// Creates new path from the `false` case.
forkContext.replaceHead(
context.falseForkContext.makeNext(0, -1)
);
}
|
[
"function",
"(",
")",
"{",
"var",
"context",
"=",
"this",
".",
"choiceContext",
";",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"/*\r\n\t\t\t * The head segments are the path of the `if` block.\r\n\t\t\t * Updates the `true` path with the end of the `if` block.\r\n\t\t\t */",
"context",
".",
"trueForkContext",
".",
"clear",
"(",
")",
";",
"context",
".",
"trueForkContext",
".",
"add",
"(",
"forkContext",
".",
"head",
")",
";",
"context",
".",
"processed",
"=",
"true",
";",
"// Creates new path from the `false` case.",
"forkContext",
".",
"replaceHead",
"(",
"context",
".",
"falseForkContext",
".",
"makeNext",
"(",
"0",
",",
"-",
"1",
")",
")",
";",
"}"
] |
Makes a code path segment of the `else` block.
@returns {void}
|
[
"Makes",
"a",
"code",
"path",
"segment",
"of",
"the",
"else",
"block",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L529-L545
|
|
14,474
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function() {
var context = this.switchContext;
this.switchContext = context.upper;
var forkContext = this.forkContext;
var brokenForkContext = this.popBreakContext().brokenForkContext;
if (context.countForks === 0) {
/*
* When there is only one `default` chunk and there is one or more
* `break` statements, even if forks are nothing, it needs to merge
* those.
*/
if (!brokenForkContext.empty) {
brokenForkContext.add(forkContext.makeNext(-1, -1));
forkContext.replaceHead(brokenForkContext.makeNext(0, -1));
}
return;
}
var lastSegments = forkContext.head;
this.forkBypassPath();
var lastCaseSegments = forkContext.head;
/*
* `brokenForkContext` is used to make the next segment.
* It must add the last segment into `brokenForkContext`.
*/
brokenForkContext.add(lastSegments);
/*
* A path which is failed in all case test should be connected to path
* of `default` chunk.
*/
if (!context.lastIsDefault) {
if (context.defaultBodySegments) {
/*
* Remove a link from `default` label to its chunk.
* It's false route.
*/
removeConnection(context.defaultSegments, context.defaultBodySegments);
makeLooped(this, lastCaseSegments, context.defaultBodySegments);
} else {
/*
* It handles the last case body as broken if `default` chunk
* does not exist.
*/
brokenForkContext.add(lastCaseSegments);
}
}
// Pops the segment context stack until the entry segment.
for (var i = 0; i < context.countForks; ++i) {
this.forkContext = this.forkContext.upper;
}
/*
* Creates a path from all brokenForkContext paths.
* This is a path after switch statement.
*/
this.forkContext.replaceHead(brokenForkContext.makeNext(0, -1));
}
|
javascript
|
function() {
var context = this.switchContext;
this.switchContext = context.upper;
var forkContext = this.forkContext;
var brokenForkContext = this.popBreakContext().brokenForkContext;
if (context.countForks === 0) {
/*
* When there is only one `default` chunk and there is one or more
* `break` statements, even if forks are nothing, it needs to merge
* those.
*/
if (!brokenForkContext.empty) {
brokenForkContext.add(forkContext.makeNext(-1, -1));
forkContext.replaceHead(brokenForkContext.makeNext(0, -1));
}
return;
}
var lastSegments = forkContext.head;
this.forkBypassPath();
var lastCaseSegments = forkContext.head;
/*
* `brokenForkContext` is used to make the next segment.
* It must add the last segment into `brokenForkContext`.
*/
brokenForkContext.add(lastSegments);
/*
* A path which is failed in all case test should be connected to path
* of `default` chunk.
*/
if (!context.lastIsDefault) {
if (context.defaultBodySegments) {
/*
* Remove a link from `default` label to its chunk.
* It's false route.
*/
removeConnection(context.defaultSegments, context.defaultBodySegments);
makeLooped(this, lastCaseSegments, context.defaultBodySegments);
} else {
/*
* It handles the last case body as broken if `default` chunk
* does not exist.
*/
brokenForkContext.add(lastCaseSegments);
}
}
// Pops the segment context stack until the entry segment.
for (var i = 0; i < context.countForks; ++i) {
this.forkContext = this.forkContext.upper;
}
/*
* Creates a path from all brokenForkContext paths.
* This is a path after switch statement.
*/
this.forkContext.replaceHead(brokenForkContext.makeNext(0, -1));
}
|
[
"function",
"(",
")",
"{",
"var",
"context",
"=",
"this",
".",
"switchContext",
";",
"this",
".",
"switchContext",
"=",
"context",
".",
"upper",
";",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"var",
"brokenForkContext",
"=",
"this",
".",
"popBreakContext",
"(",
")",
".",
"brokenForkContext",
";",
"if",
"(",
"context",
".",
"countForks",
"===",
"0",
")",
"{",
"/*\r\n\t\t\t\t * When there is only one `default` chunk and there is one or more\r\n\t\t\t\t * `break` statements, even if forks are nothing, it needs to merge\r\n\t\t\t\t * those.\r\n\t\t\t\t */",
"if",
"(",
"!",
"brokenForkContext",
".",
"empty",
")",
"{",
"brokenForkContext",
".",
"add",
"(",
"forkContext",
".",
"makeNext",
"(",
"-",
"1",
",",
"-",
"1",
")",
")",
";",
"forkContext",
".",
"replaceHead",
"(",
"brokenForkContext",
".",
"makeNext",
"(",
"0",
",",
"-",
"1",
")",
")",
";",
"}",
"return",
";",
"}",
"var",
"lastSegments",
"=",
"forkContext",
".",
"head",
";",
"this",
".",
"forkBypassPath",
"(",
")",
";",
"var",
"lastCaseSegments",
"=",
"forkContext",
".",
"head",
";",
"/*\r\n\t\t\t * `brokenForkContext` is used to make the next segment.\r\n\t\t\t * It must add the last segment into `brokenForkContext`.\r\n\t\t\t */",
"brokenForkContext",
".",
"add",
"(",
"lastSegments",
")",
";",
"/*\r\n\t\t\t * A path which is failed in all case test should be connected to path\r\n\t\t\t * of `default` chunk.\r\n\t\t\t */",
"if",
"(",
"!",
"context",
".",
"lastIsDefault",
")",
"{",
"if",
"(",
"context",
".",
"defaultBodySegments",
")",
"{",
"/*\r\n\t\t\t\t\t * Remove a link from `default` label to its chunk.\r\n\t\t\t\t\t * It's false route.\r\n\t\t\t\t\t */",
"removeConnection",
"(",
"context",
".",
"defaultSegments",
",",
"context",
".",
"defaultBodySegments",
")",
";",
"makeLooped",
"(",
"this",
",",
"lastCaseSegments",
",",
"context",
".",
"defaultBodySegments",
")",
";",
"}",
"else",
"{",
"/*\r\n\t\t\t\t\t * It handles the last case body as broken if `default` chunk\r\n\t\t\t\t\t * does not exist.\r\n\t\t\t\t\t */",
"brokenForkContext",
".",
"add",
"(",
"lastCaseSegments",
")",
";",
"}",
"}",
"// Pops the segment context stack until the entry segment.",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"context",
".",
"countForks",
";",
"++",
"i",
")",
"{",
"this",
".",
"forkContext",
"=",
"this",
".",
"forkContext",
".",
"upper",
";",
"}",
"/*\r\n\t\t\t * Creates a path from all brokenForkContext paths.\r\n\t\t\t * This is a path after switch statement.\r\n\t\t\t */",
"this",
".",
"forkContext",
".",
"replaceHead",
"(",
"brokenForkContext",
".",
"makeNext",
"(",
"0",
",",
"-",
"1",
")",
")",
";",
"}"
] |
Pops the last context of SwitchStatement and finalizes it.
- Disposes all forking stack for `case` and `default`.
- Creates the next code path segment from `context.brokenForkContext`.
- If the last `SwitchCase` node is not a `default` part, creates a path
to the `default` body.
@returns {void}
|
[
"Pops",
"the",
"last",
"context",
"of",
"SwitchStatement",
"and",
"finalizes",
"it",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L583-L650
|
|
14,475
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function(isEmpty, isDefault) {
var context = this.switchContext;
if (!context.hasCase) {
return;
}
/*
* Merge forks.
* The parent fork context has two segments.
* Those are from the current case and the body of the previous case.
*/
var parentForkContext = this.forkContext;
var forkContext = this.pushForkContext();
forkContext.add(parentForkContext.makeNext(0, -1));
/*
* Save `default` chunk info.
* If the `default` label is not at the last, we must make a path from
* the last `case` to the `default` chunk.
*/
if (isDefault) {
context.defaultSegments = parentForkContext.head;
if (isEmpty) {
context.foundDefault = true;
} else {
context.defaultBodySegments = forkContext.head;
}
} else {
if (!isEmpty && context.foundDefault) {
context.foundDefault = false;
context.defaultBodySegments = forkContext.head;
}
}
context.lastIsDefault = isDefault;
context.countForks += 1;
}
|
javascript
|
function(isEmpty, isDefault) {
var context = this.switchContext;
if (!context.hasCase) {
return;
}
/*
* Merge forks.
* The parent fork context has two segments.
* Those are from the current case and the body of the previous case.
*/
var parentForkContext = this.forkContext;
var forkContext = this.pushForkContext();
forkContext.add(parentForkContext.makeNext(0, -1));
/*
* Save `default` chunk info.
* If the `default` label is not at the last, we must make a path from
* the last `case` to the `default` chunk.
*/
if (isDefault) {
context.defaultSegments = parentForkContext.head;
if (isEmpty) {
context.foundDefault = true;
} else {
context.defaultBodySegments = forkContext.head;
}
} else {
if (!isEmpty && context.foundDefault) {
context.foundDefault = false;
context.defaultBodySegments = forkContext.head;
}
}
context.lastIsDefault = isDefault;
context.countForks += 1;
}
|
[
"function",
"(",
"isEmpty",
",",
"isDefault",
")",
"{",
"var",
"context",
"=",
"this",
".",
"switchContext",
";",
"if",
"(",
"!",
"context",
".",
"hasCase",
")",
"{",
"return",
";",
"}",
"/*\r\n\t\t\t * Merge forks.\r\n\t\t\t * The parent fork context has two segments.\r\n\t\t\t * Those are from the current case and the body of the previous case.\r\n\t\t\t */",
"var",
"parentForkContext",
"=",
"this",
".",
"forkContext",
";",
"var",
"forkContext",
"=",
"this",
".",
"pushForkContext",
"(",
")",
";",
"forkContext",
".",
"add",
"(",
"parentForkContext",
".",
"makeNext",
"(",
"0",
",",
"-",
"1",
")",
")",
";",
"/*\r\n\t\t\t * Save `default` chunk info.\r\n\t\t\t * If the `default` label is not at the last, we must make a path from\r\n\t\t\t * the last `case` to the `default` chunk.\r\n\t\t\t */",
"if",
"(",
"isDefault",
")",
"{",
"context",
".",
"defaultSegments",
"=",
"parentForkContext",
".",
"head",
";",
"if",
"(",
"isEmpty",
")",
"{",
"context",
".",
"foundDefault",
"=",
"true",
";",
"}",
"else",
"{",
"context",
".",
"defaultBodySegments",
"=",
"forkContext",
".",
"head",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"!",
"isEmpty",
"&&",
"context",
".",
"foundDefault",
")",
"{",
"context",
".",
"foundDefault",
"=",
"false",
";",
"context",
".",
"defaultBodySegments",
"=",
"forkContext",
".",
"head",
";",
"}",
"}",
"context",
".",
"lastIsDefault",
"=",
"isDefault",
";",
"context",
".",
"countForks",
"+=",
"1",
";",
"}"
] |
Makes a code path segment for a `SwitchCase` node.
@param {boolean} isEmpty - `true` if the body is empty.
@param {boolean} isDefault - `true` if the body is the default case.
@returns {void}
|
[
"Makes",
"a",
"code",
"path",
"segment",
"for",
"a",
"SwitchCase",
"node",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L659-L697
|
|
14,476
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function() {
var context = this.tryContext;
this.tryContext = context.upper;
if (context.position === "catch") {
// Merges two paths from the `try` block and `catch` block merely.
this.popForkContext();
return;
}
/*
* The following process is executed only when there is the `finally`
* block.
*/
var returned = context.returnedForkContext;
var thrown = context.thrownForkContext;
if (returned.empty && thrown.empty) {
return;
}
// Separate head to normal paths and leaving paths.
var headSegments = this.forkContext.head;
this.forkContext = this.forkContext.upper;
var normalSegments = headSegments.slice(0, headSegments.length / 2 | 0);
var leavingSegments = headSegments.slice(headSegments.length / 2 | 0);
// Forwards the leaving path to upper contexts.
if (!returned.empty) {
getReturnContext(this).returnedForkContext.add(leavingSegments);
}
if (!thrown.empty) {
getThrowContext(this).thrownForkContext.add(leavingSegments);
}
// Sets the normal path as the next.
this.forkContext.replaceHead(normalSegments);
// If both paths of the `try` block and the `catch` block are
// unreachable, the next path becomes unreachable as well.
if (!context.lastOfTryIsReachable && !context.lastOfCatchIsReachable) {
this.forkContext.makeUnreachable();
}
}
|
javascript
|
function() {
var context = this.tryContext;
this.tryContext = context.upper;
if (context.position === "catch") {
// Merges two paths from the `try` block and `catch` block merely.
this.popForkContext();
return;
}
/*
* The following process is executed only when there is the `finally`
* block.
*/
var returned = context.returnedForkContext;
var thrown = context.thrownForkContext;
if (returned.empty && thrown.empty) {
return;
}
// Separate head to normal paths and leaving paths.
var headSegments = this.forkContext.head;
this.forkContext = this.forkContext.upper;
var normalSegments = headSegments.slice(0, headSegments.length / 2 | 0);
var leavingSegments = headSegments.slice(headSegments.length / 2 | 0);
// Forwards the leaving path to upper contexts.
if (!returned.empty) {
getReturnContext(this).returnedForkContext.add(leavingSegments);
}
if (!thrown.empty) {
getThrowContext(this).thrownForkContext.add(leavingSegments);
}
// Sets the normal path as the next.
this.forkContext.replaceHead(normalSegments);
// If both paths of the `try` block and the `catch` block are
// unreachable, the next path becomes unreachable as well.
if (!context.lastOfTryIsReachable && !context.lastOfCatchIsReachable) {
this.forkContext.makeUnreachable();
}
}
|
[
"function",
"(",
")",
"{",
"var",
"context",
"=",
"this",
".",
"tryContext",
";",
"this",
".",
"tryContext",
"=",
"context",
".",
"upper",
";",
"if",
"(",
"context",
".",
"position",
"===",
"\"catch\"",
")",
"{",
"// Merges two paths from the `try` block and `catch` block merely.",
"this",
".",
"popForkContext",
"(",
")",
";",
"return",
";",
"}",
"/*\r\n\t\t\t * The following process is executed only when there is the `finally`\r\n\t\t\t * block.\r\n\t\t\t */",
"var",
"returned",
"=",
"context",
".",
"returnedForkContext",
";",
"var",
"thrown",
"=",
"context",
".",
"thrownForkContext",
";",
"if",
"(",
"returned",
".",
"empty",
"&&",
"thrown",
".",
"empty",
")",
"{",
"return",
";",
"}",
"// Separate head to normal paths and leaving paths.",
"var",
"headSegments",
"=",
"this",
".",
"forkContext",
".",
"head",
";",
"this",
".",
"forkContext",
"=",
"this",
".",
"forkContext",
".",
"upper",
";",
"var",
"normalSegments",
"=",
"headSegments",
".",
"slice",
"(",
"0",
",",
"headSegments",
".",
"length",
"/",
"2",
"|",
"0",
")",
";",
"var",
"leavingSegments",
"=",
"headSegments",
".",
"slice",
"(",
"headSegments",
".",
"length",
"/",
"2",
"|",
"0",
")",
";",
"// Forwards the leaving path to upper contexts.",
"if",
"(",
"!",
"returned",
".",
"empty",
")",
"{",
"getReturnContext",
"(",
"this",
")",
".",
"returnedForkContext",
".",
"add",
"(",
"leavingSegments",
")",
";",
"}",
"if",
"(",
"!",
"thrown",
".",
"empty",
")",
"{",
"getThrowContext",
"(",
"this",
")",
".",
"thrownForkContext",
".",
"add",
"(",
"leavingSegments",
")",
";",
"}",
"// Sets the normal path as the next.",
"this",
".",
"forkContext",
".",
"replaceHead",
"(",
"normalSegments",
")",
";",
"// If both paths of the `try` block and the `catch` block are",
"// unreachable, the next path becomes unreachable as well.",
"if",
"(",
"!",
"context",
".",
"lastOfTryIsReachable",
"&&",
"!",
"context",
".",
"lastOfCatchIsReachable",
")",
"{",
"this",
".",
"forkContext",
".",
"makeUnreachable",
"(",
")",
";",
"}",
"}"
] |
Pops the last context of TryStatement and finalizes it.
@returns {void}
|
[
"Pops",
"the",
"last",
"context",
"of",
"TryStatement",
"and",
"finalizes",
"it",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L731-L778
|
|
14,477
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function() {
var context = this.tryContext;
var forkContext = this.forkContext;
var thrown = context.thrownForkContext;
// Update state.
context.position = "catch";
context.thrownForkContext = ForkContext.newEmpty(forkContext);
context.lastOfTryIsReachable = forkContext.reachable;
// Merge thrown paths.
thrown.add(forkContext.head);
var thrownSegments = thrown.makeNext(0, -1);
// Fork to a bypass and the merged thrown path.
this.pushForkContext();
this.forkBypassPath();
this.forkContext.add(thrownSegments);
}
|
javascript
|
function() {
var context = this.tryContext;
var forkContext = this.forkContext;
var thrown = context.thrownForkContext;
// Update state.
context.position = "catch";
context.thrownForkContext = ForkContext.newEmpty(forkContext);
context.lastOfTryIsReachable = forkContext.reachable;
// Merge thrown paths.
thrown.add(forkContext.head);
var thrownSegments = thrown.makeNext(0, -1);
// Fork to a bypass and the merged thrown path.
this.pushForkContext();
this.forkBypassPath();
this.forkContext.add(thrownSegments);
}
|
[
"function",
"(",
")",
"{",
"var",
"context",
"=",
"this",
".",
"tryContext",
";",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"var",
"thrown",
"=",
"context",
".",
"thrownForkContext",
";",
"// Update state.",
"context",
".",
"position",
"=",
"\"catch\"",
";",
"context",
".",
"thrownForkContext",
"=",
"ForkContext",
".",
"newEmpty",
"(",
"forkContext",
")",
";",
"context",
".",
"lastOfTryIsReachable",
"=",
"forkContext",
".",
"reachable",
";",
"// Merge thrown paths.",
"thrown",
".",
"add",
"(",
"forkContext",
".",
"head",
")",
";",
"var",
"thrownSegments",
"=",
"thrown",
".",
"makeNext",
"(",
"0",
",",
"-",
"1",
")",
";",
"// Fork to a bypass and the merged thrown path.",
"this",
".",
"pushForkContext",
"(",
")",
";",
"this",
".",
"forkBypassPath",
"(",
")",
";",
"this",
".",
"forkContext",
".",
"add",
"(",
"thrownSegments",
")",
";",
"}"
] |
Makes a code path segment for a `catch` block.
@returns {void}
|
[
"Makes",
"a",
"code",
"path",
"segment",
"for",
"a",
"catch",
"block",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L785-L803
|
|
14,478
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function() {
var context = this.tryContext;
var forkContext = this.forkContext;
var returned = context.returnedForkContext;
var thrown = context.thrownForkContext;
var headOfLeavingSegments = forkContext.head;
// Update state.
if (context.position === "catch") {
// Merges two paths from the `try` block and `catch` block.
this.popForkContext();
forkContext = this.forkContext;
context.lastOfCatchIsReachable = forkContext.reachable;
} else {
context.lastOfTryIsReachable = forkContext.reachable;
}
context.position = "finally";
if (returned.empty && thrown.empty) {
// This path does not leave.
return;
}
/*
* Create a parallel segment from merging returned and thrown.
* This segment will leave at the end of this finally block.
*/
var segments = forkContext.makeNext(-1, -1);
var j;
for (var i = 0; i < forkContext.count; ++i) {
var prevSegsOfLeavingSegment = [headOfLeavingSegments[i]];
for (j = 0; j < returned.segmentsList.length; ++j) {
prevSegsOfLeavingSegment.push(returned.segmentsList[j][i]);
}
for (j = 0; j < thrown.segmentsList.length; ++j) {
prevSegsOfLeavingSegment.push(thrown.segmentsList[j][i]);
}
segments.push(CodePathSegment.newNext(
this.idGenerator.next(),
prevSegsOfLeavingSegment));
}
this.pushForkContext(true);
this.forkContext.add(segments);
}
|
javascript
|
function() {
var context = this.tryContext;
var forkContext = this.forkContext;
var returned = context.returnedForkContext;
var thrown = context.thrownForkContext;
var headOfLeavingSegments = forkContext.head;
// Update state.
if (context.position === "catch") {
// Merges two paths from the `try` block and `catch` block.
this.popForkContext();
forkContext = this.forkContext;
context.lastOfCatchIsReachable = forkContext.reachable;
} else {
context.lastOfTryIsReachable = forkContext.reachable;
}
context.position = "finally";
if (returned.empty && thrown.empty) {
// This path does not leave.
return;
}
/*
* Create a parallel segment from merging returned and thrown.
* This segment will leave at the end of this finally block.
*/
var segments = forkContext.makeNext(-1, -1);
var j;
for (var i = 0; i < forkContext.count; ++i) {
var prevSegsOfLeavingSegment = [headOfLeavingSegments[i]];
for (j = 0; j < returned.segmentsList.length; ++j) {
prevSegsOfLeavingSegment.push(returned.segmentsList[j][i]);
}
for (j = 0; j < thrown.segmentsList.length; ++j) {
prevSegsOfLeavingSegment.push(thrown.segmentsList[j][i]);
}
segments.push(CodePathSegment.newNext(
this.idGenerator.next(),
prevSegsOfLeavingSegment));
}
this.pushForkContext(true);
this.forkContext.add(segments);
}
|
[
"function",
"(",
")",
"{",
"var",
"context",
"=",
"this",
".",
"tryContext",
";",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"var",
"returned",
"=",
"context",
".",
"returnedForkContext",
";",
"var",
"thrown",
"=",
"context",
".",
"thrownForkContext",
";",
"var",
"headOfLeavingSegments",
"=",
"forkContext",
".",
"head",
";",
"// Update state.",
"if",
"(",
"context",
".",
"position",
"===",
"\"catch\"",
")",
"{",
"// Merges two paths from the `try` block and `catch` block.",
"this",
".",
"popForkContext",
"(",
")",
";",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"context",
".",
"lastOfCatchIsReachable",
"=",
"forkContext",
".",
"reachable",
";",
"}",
"else",
"{",
"context",
".",
"lastOfTryIsReachable",
"=",
"forkContext",
".",
"reachable",
";",
"}",
"context",
".",
"position",
"=",
"\"finally\"",
";",
"if",
"(",
"returned",
".",
"empty",
"&&",
"thrown",
".",
"empty",
")",
"{",
"// This path does not leave.",
"return",
";",
"}",
"/*\r\n\t\t\t * Create a parallel segment from merging returned and thrown.\r\n\t\t\t * This segment will leave at the end of this finally block.\r\n\t\t\t */",
"var",
"segments",
"=",
"forkContext",
".",
"makeNext",
"(",
"-",
"1",
",",
"-",
"1",
")",
";",
"var",
"j",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"forkContext",
".",
"count",
";",
"++",
"i",
")",
"{",
"var",
"prevSegsOfLeavingSegment",
"=",
"[",
"headOfLeavingSegments",
"[",
"i",
"]",
"]",
";",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"returned",
".",
"segmentsList",
".",
"length",
";",
"++",
"j",
")",
"{",
"prevSegsOfLeavingSegment",
".",
"push",
"(",
"returned",
".",
"segmentsList",
"[",
"j",
"]",
"[",
"i",
"]",
")",
";",
"}",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"thrown",
".",
"segmentsList",
".",
"length",
";",
"++",
"j",
")",
"{",
"prevSegsOfLeavingSegment",
".",
"push",
"(",
"thrown",
".",
"segmentsList",
"[",
"j",
"]",
"[",
"i",
"]",
")",
";",
"}",
"segments",
".",
"push",
"(",
"CodePathSegment",
".",
"newNext",
"(",
"this",
".",
"idGenerator",
".",
"next",
"(",
")",
",",
"prevSegsOfLeavingSegment",
")",
")",
";",
"}",
"this",
".",
"pushForkContext",
"(",
"true",
")",
";",
"this",
".",
"forkContext",
".",
"add",
"(",
"segments",
")",
";",
"}"
] |
Makes a code path segment for a `finally` block.
In the `finally` block, parallel paths are created. The parallel paths
are used as leaving-paths. The leaving-paths are paths from `return`
statements and `throw` statements in a `try` block or a `catch` block.
@returns {void}
|
[
"Makes",
"a",
"code",
"path",
"segment",
"for",
"a",
"finally",
"block",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L814-L864
|
|
14,479
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function() {
var forkContext = this.forkContext;
if (!forkContext.reachable) {
return;
}
var context = getThrowContext(this);
if (context === this ||
context.position !== "try" ||
!context.thrownForkContext.empty
) {
return;
}
context.thrownForkContext.add(forkContext.head);
forkContext.replaceHead(forkContext.makeNext(-1, -1));
}
|
javascript
|
function() {
var forkContext = this.forkContext;
if (!forkContext.reachable) {
return;
}
var context = getThrowContext(this);
if (context === this ||
context.position !== "try" ||
!context.thrownForkContext.empty
) {
return;
}
context.thrownForkContext.add(forkContext.head);
forkContext.replaceHead(forkContext.makeNext(-1, -1));
}
|
[
"function",
"(",
")",
"{",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"if",
"(",
"!",
"forkContext",
".",
"reachable",
")",
"{",
"return",
";",
"}",
"var",
"context",
"=",
"getThrowContext",
"(",
"this",
")",
";",
"if",
"(",
"context",
"===",
"this",
"||",
"context",
".",
"position",
"!==",
"\"try\"",
"||",
"!",
"context",
".",
"thrownForkContext",
".",
"empty",
")",
"{",
"return",
";",
"}",
"context",
".",
"thrownForkContext",
".",
"add",
"(",
"forkContext",
".",
"head",
")",
";",
"forkContext",
".",
"replaceHead",
"(",
"forkContext",
".",
"makeNext",
"(",
"-",
"1",
",",
"-",
"1",
")",
")",
";",
"}"
] |
Makes a code path segment from the first throwable node to the `catch`
block or the `finally` block.
@returns {void}
|
[
"Makes",
"a",
"code",
"path",
"segment",
"from",
"the",
"first",
"throwable",
"node",
"to",
"the",
"catch",
"block",
"or",
"the",
"finally",
"block",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L872-L890
|
|
14,480
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function() {
var context = this.loopContext;
this.loopContext = context.upper;
var forkContext = this.forkContext;
var brokenForkContext = this.popBreakContext().brokenForkContext;
var choiceContext;
// Creates a looped path.
switch (context.type) {
case "WhileStatement":
case "ForStatement":
choiceContext = this.popChoiceContext();
makeLooped(
this,
forkContext.head,
context.continueDestSegments);
break;
case "DoWhileStatement":
choiceContext = this.popChoiceContext();
if (!choiceContext.processed) {
choiceContext.trueForkContext.add(forkContext.head);
choiceContext.falseForkContext.add(forkContext.head);
}
if (context.test !== true) {
brokenForkContext.addAll(choiceContext.falseForkContext);
}
// `true` paths go to looping.
var segmentsList = choiceContext.trueForkContext.segmentsList;
for (var i = 0; i < segmentsList.length; ++i) {
makeLooped(
this,
segmentsList[i],
context.entrySegments);
}
break;
case "ForInStatement":
case "ForOfStatement":
brokenForkContext.add(forkContext.head);
makeLooped(
this,
forkContext.head,
context.leftSegments);
break;
/* istanbul ignore next */
default:
throw new Error("unreachable");
}
// Go next.
if (brokenForkContext.empty) {
forkContext.replaceHead(forkContext.makeUnreachable(-1, -1));
} else {
forkContext.replaceHead(brokenForkContext.makeNext(0, -1));
}
}
|
javascript
|
function() {
var context = this.loopContext;
this.loopContext = context.upper;
var forkContext = this.forkContext;
var brokenForkContext = this.popBreakContext().brokenForkContext;
var choiceContext;
// Creates a looped path.
switch (context.type) {
case "WhileStatement":
case "ForStatement":
choiceContext = this.popChoiceContext();
makeLooped(
this,
forkContext.head,
context.continueDestSegments);
break;
case "DoWhileStatement":
choiceContext = this.popChoiceContext();
if (!choiceContext.processed) {
choiceContext.trueForkContext.add(forkContext.head);
choiceContext.falseForkContext.add(forkContext.head);
}
if (context.test !== true) {
brokenForkContext.addAll(choiceContext.falseForkContext);
}
// `true` paths go to looping.
var segmentsList = choiceContext.trueForkContext.segmentsList;
for (var i = 0; i < segmentsList.length; ++i) {
makeLooped(
this,
segmentsList[i],
context.entrySegments);
}
break;
case "ForInStatement":
case "ForOfStatement":
brokenForkContext.add(forkContext.head);
makeLooped(
this,
forkContext.head,
context.leftSegments);
break;
/* istanbul ignore next */
default:
throw new Error("unreachable");
}
// Go next.
if (brokenForkContext.empty) {
forkContext.replaceHead(forkContext.makeUnreachable(-1, -1));
} else {
forkContext.replaceHead(brokenForkContext.makeNext(0, -1));
}
}
|
[
"function",
"(",
")",
"{",
"var",
"context",
"=",
"this",
".",
"loopContext",
";",
"this",
".",
"loopContext",
"=",
"context",
".",
"upper",
";",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"var",
"brokenForkContext",
"=",
"this",
".",
"popBreakContext",
"(",
")",
".",
"brokenForkContext",
";",
"var",
"choiceContext",
";",
"// Creates a looped path.",
"switch",
"(",
"context",
".",
"type",
")",
"{",
"case",
"\"WhileStatement\"",
":",
"case",
"\"ForStatement\"",
":",
"choiceContext",
"=",
"this",
".",
"popChoiceContext",
"(",
")",
";",
"makeLooped",
"(",
"this",
",",
"forkContext",
".",
"head",
",",
"context",
".",
"continueDestSegments",
")",
";",
"break",
";",
"case",
"\"DoWhileStatement\"",
":",
"choiceContext",
"=",
"this",
".",
"popChoiceContext",
"(",
")",
";",
"if",
"(",
"!",
"choiceContext",
".",
"processed",
")",
"{",
"choiceContext",
".",
"trueForkContext",
".",
"add",
"(",
"forkContext",
".",
"head",
")",
";",
"choiceContext",
".",
"falseForkContext",
".",
"add",
"(",
"forkContext",
".",
"head",
")",
";",
"}",
"if",
"(",
"context",
".",
"test",
"!==",
"true",
")",
"{",
"brokenForkContext",
".",
"addAll",
"(",
"choiceContext",
".",
"falseForkContext",
")",
";",
"}",
"// `true` paths go to looping.",
"var",
"segmentsList",
"=",
"choiceContext",
".",
"trueForkContext",
".",
"segmentsList",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"segmentsList",
".",
"length",
";",
"++",
"i",
")",
"{",
"makeLooped",
"(",
"this",
",",
"segmentsList",
"[",
"i",
"]",
",",
"context",
".",
"entrySegments",
")",
";",
"}",
"break",
";",
"case",
"\"ForInStatement\"",
":",
"case",
"\"ForOfStatement\"",
":",
"brokenForkContext",
".",
"add",
"(",
"forkContext",
".",
"head",
")",
";",
"makeLooped",
"(",
"this",
",",
"forkContext",
".",
"head",
",",
"context",
".",
"leftSegments",
")",
";",
"break",
";",
"/* istanbul ignore next */",
"default",
":",
"throw",
"new",
"Error",
"(",
"\"unreachable\"",
")",
";",
"}",
"// Go next.",
"if",
"(",
"brokenForkContext",
".",
"empty",
")",
"{",
"forkContext",
".",
"replaceHead",
"(",
"forkContext",
".",
"makeUnreachable",
"(",
"-",
"1",
",",
"-",
"1",
")",
")",
";",
"}",
"else",
"{",
"forkContext",
".",
"replaceHead",
"(",
"brokenForkContext",
".",
"makeNext",
"(",
"0",
",",
"-",
"1",
")",
")",
";",
"}",
"}"
] |
Pops the last context of a loop statement and finalizes it.
@returns {void}
|
[
"Pops",
"the",
"last",
"context",
"of",
"a",
"loop",
"statement",
"and",
"finalizes",
"it",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L974-L1036
|
|
14,481
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function(test) {
var context = this.loopContext;
var forkContext = this.forkContext;
var testSegments = forkContext.makeNext(0, -1);
// Update state.
context.test = test;
context.continueDestSegments = testSegments;
forkContext.replaceHead(testSegments);
}
|
javascript
|
function(test) {
var context = this.loopContext;
var forkContext = this.forkContext;
var testSegments = forkContext.makeNext(0, -1);
// Update state.
context.test = test;
context.continueDestSegments = testSegments;
forkContext.replaceHead(testSegments);
}
|
[
"function",
"(",
"test",
")",
"{",
"var",
"context",
"=",
"this",
".",
"loopContext",
";",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"var",
"testSegments",
"=",
"forkContext",
".",
"makeNext",
"(",
"0",
",",
"-",
"1",
")",
";",
"// Update state.",
"context",
".",
"test",
"=",
"test",
";",
"context",
".",
"continueDestSegments",
"=",
"testSegments",
";",
"forkContext",
".",
"replaceHead",
"(",
"testSegments",
")",
";",
"}"
] |
Makes a code path segment for the test part of a WhileStatement.
@param {boolean|} test - The test value (only when constant).
@returns {void}
|
[
"Makes",
"a",
"code",
"path",
"segment",
"for",
"the",
"test",
"part",
"of",
"a",
"WhileStatement",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L1044-L1053
|
|
14,482
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function() {
var context = this.loopContext;
var choiceContext = this.choiceContext;
var forkContext = this.forkContext;
if (!choiceContext.processed) {
choiceContext.trueForkContext.add(forkContext.head);
choiceContext.falseForkContext.add(forkContext.head);
}
// Update state.
if (context.test !== true) {
context.brokenForkContext.addAll(choiceContext.falseForkContext);
}
forkContext.replaceHead(choiceContext.trueForkContext.makeNext(0, -1));
}
|
javascript
|
function() {
var context = this.loopContext;
var choiceContext = this.choiceContext;
var forkContext = this.forkContext;
if (!choiceContext.processed) {
choiceContext.trueForkContext.add(forkContext.head);
choiceContext.falseForkContext.add(forkContext.head);
}
// Update state.
if (context.test !== true) {
context.brokenForkContext.addAll(choiceContext.falseForkContext);
}
forkContext.replaceHead(choiceContext.trueForkContext.makeNext(0, -1));
}
|
[
"function",
"(",
")",
"{",
"var",
"context",
"=",
"this",
".",
"loopContext",
";",
"var",
"choiceContext",
"=",
"this",
".",
"choiceContext",
";",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"if",
"(",
"!",
"choiceContext",
".",
"processed",
")",
"{",
"choiceContext",
".",
"trueForkContext",
".",
"add",
"(",
"forkContext",
".",
"head",
")",
";",
"choiceContext",
".",
"falseForkContext",
".",
"add",
"(",
"forkContext",
".",
"head",
")",
";",
"}",
"// Update state.",
"if",
"(",
"context",
".",
"test",
"!==",
"true",
")",
"{",
"context",
".",
"brokenForkContext",
".",
"addAll",
"(",
"choiceContext",
".",
"falseForkContext",
")",
";",
"}",
"forkContext",
".",
"replaceHead",
"(",
"choiceContext",
".",
"trueForkContext",
".",
"makeNext",
"(",
"0",
",",
"-",
"1",
")",
")",
";",
"}"
] |
Makes a code path segment for the body part of a WhileStatement.
@returns {void}
|
[
"Makes",
"a",
"code",
"path",
"segment",
"for",
"the",
"body",
"part",
"of",
"a",
"WhileStatement",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L1060-L1075
|
|
14,483
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function() {
var context = this.loopContext;
var forkContext = this.forkContext;
var bodySegments = forkContext.makeNext(-1, -1);
// Update state.
context.entrySegments = bodySegments;
forkContext.replaceHead(bodySegments);
}
|
javascript
|
function() {
var context = this.loopContext;
var forkContext = this.forkContext;
var bodySegments = forkContext.makeNext(-1, -1);
// Update state.
context.entrySegments = bodySegments;
forkContext.replaceHead(bodySegments);
}
|
[
"function",
"(",
")",
"{",
"var",
"context",
"=",
"this",
".",
"loopContext",
";",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"var",
"bodySegments",
"=",
"forkContext",
".",
"makeNext",
"(",
"-",
"1",
",",
"-",
"1",
")",
";",
"// Update state.",
"context",
".",
"entrySegments",
"=",
"bodySegments",
";",
"forkContext",
".",
"replaceHead",
"(",
"bodySegments",
")",
";",
"}"
] |
Makes a code path segment for the body part of a DoWhileStatement.
@returns {void}
|
[
"Makes",
"a",
"code",
"path",
"segment",
"for",
"the",
"body",
"part",
"of",
"a",
"DoWhileStatement",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L1082-L1090
|
|
14,484
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function(test) {
var context = this.loopContext;
var forkContext = this.forkContext;
context.test = test;
// Creates paths of `continue` statements.
if (!context.continueForkContext.empty) {
context.continueForkContext.add(forkContext.head);
var testSegments = context.continueForkContext.makeNext(0, -1);
forkContext.replaceHead(testSegments);
}
}
|
javascript
|
function(test) {
var context = this.loopContext;
var forkContext = this.forkContext;
context.test = test;
// Creates paths of `continue` statements.
if (!context.continueForkContext.empty) {
context.continueForkContext.add(forkContext.head);
var testSegments = context.continueForkContext.makeNext(0, -1);
forkContext.replaceHead(testSegments);
}
}
|
[
"function",
"(",
"test",
")",
"{",
"var",
"context",
"=",
"this",
".",
"loopContext",
";",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"context",
".",
"test",
"=",
"test",
";",
"// Creates paths of `continue` statements.",
"if",
"(",
"!",
"context",
".",
"continueForkContext",
".",
"empty",
")",
"{",
"context",
".",
"continueForkContext",
".",
"add",
"(",
"forkContext",
".",
"head",
")",
";",
"var",
"testSegments",
"=",
"context",
".",
"continueForkContext",
".",
"makeNext",
"(",
"0",
",",
"-",
"1",
")",
";",
"forkContext",
".",
"replaceHead",
"(",
"testSegments",
")",
";",
"}",
"}"
] |
Makes a code path segment for the test part of a DoWhileStatement.
@param {boolean|} test - The test value (only when constant).
@returns {void}
|
[
"Makes",
"a",
"code",
"path",
"segment",
"for",
"the",
"test",
"part",
"of",
"a",
"DoWhileStatement",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L1098-L1111
|
|
14,485
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function(test) {
var context = this.loopContext;
var forkContext = this.forkContext;
var endOfInitSegments = forkContext.head;
var testSegments = forkContext.makeNext(-1, -1);
// Update state.
context.test = test;
context.endOfInitSegments = endOfInitSegments;
context.continueDestSegments = context.testSegments = testSegments;
forkContext.replaceHead(testSegments);
}
|
javascript
|
function(test) {
var context = this.loopContext;
var forkContext = this.forkContext;
var endOfInitSegments = forkContext.head;
var testSegments = forkContext.makeNext(-1, -1);
// Update state.
context.test = test;
context.endOfInitSegments = endOfInitSegments;
context.continueDestSegments = context.testSegments = testSegments;
forkContext.replaceHead(testSegments);
}
|
[
"function",
"(",
"test",
")",
"{",
"var",
"context",
"=",
"this",
".",
"loopContext",
";",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"var",
"endOfInitSegments",
"=",
"forkContext",
".",
"head",
";",
"var",
"testSegments",
"=",
"forkContext",
".",
"makeNext",
"(",
"-",
"1",
",",
"-",
"1",
")",
";",
"// Update state.",
"context",
".",
"test",
"=",
"test",
";",
"context",
".",
"endOfInitSegments",
"=",
"endOfInitSegments",
";",
"context",
".",
"continueDestSegments",
"=",
"context",
".",
"testSegments",
"=",
"testSegments",
";",
"forkContext",
".",
"replaceHead",
"(",
"testSegments",
")",
";",
"}"
] |
Makes a code path segment for the test part of a ForStatement.
@param {boolean|} test - The test value (only when constant).
@returns {void}
|
[
"Makes",
"a",
"code",
"path",
"segment",
"for",
"the",
"test",
"part",
"of",
"a",
"ForStatement",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L1119-L1130
|
|
14,486
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function() {
var context = this.loopContext;
var choiceContext = this.choiceContext;
var forkContext = this.forkContext;
// Make the next paths of the test.
if (context.testSegments) {
finalizeTestSegmentsOfFor(
context,
choiceContext,
forkContext.head);
} else {
context.endOfInitSegments = forkContext.head;
}
// Update state.
var updateSegments = forkContext.makeDisconnected(-1, -1);
context.continueDestSegments = context.updateSegments = updateSegments;
forkContext.replaceHead(updateSegments);
}
|
javascript
|
function() {
var context = this.loopContext;
var choiceContext = this.choiceContext;
var forkContext = this.forkContext;
// Make the next paths of the test.
if (context.testSegments) {
finalizeTestSegmentsOfFor(
context,
choiceContext,
forkContext.head);
} else {
context.endOfInitSegments = forkContext.head;
}
// Update state.
var updateSegments = forkContext.makeDisconnected(-1, -1);
context.continueDestSegments = context.updateSegments = updateSegments;
forkContext.replaceHead(updateSegments);
}
|
[
"function",
"(",
")",
"{",
"var",
"context",
"=",
"this",
".",
"loopContext",
";",
"var",
"choiceContext",
"=",
"this",
".",
"choiceContext",
";",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"// Make the next paths of the test.",
"if",
"(",
"context",
".",
"testSegments",
")",
"{",
"finalizeTestSegmentsOfFor",
"(",
"context",
",",
"choiceContext",
",",
"forkContext",
".",
"head",
")",
";",
"}",
"else",
"{",
"context",
".",
"endOfInitSegments",
"=",
"forkContext",
".",
"head",
";",
"}",
"// Update state.",
"var",
"updateSegments",
"=",
"forkContext",
".",
"makeDisconnected",
"(",
"-",
"1",
",",
"-",
"1",
")",
";",
"context",
".",
"continueDestSegments",
"=",
"context",
".",
"updateSegments",
"=",
"updateSegments",
";",
"forkContext",
".",
"replaceHead",
"(",
"updateSegments",
")",
";",
"}"
] |
Makes a code path segment for the update part of a ForStatement.
@returns {void}
|
[
"Makes",
"a",
"code",
"path",
"segment",
"for",
"the",
"update",
"part",
"of",
"a",
"ForStatement",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L1137-L1157
|
|
14,487
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function() {
var context = this.loopContext;
var choiceContext = this.choiceContext;
var forkContext = this.forkContext;
// Update state.
if (context.updateSegments) {
context.endOfUpdateSegments = forkContext.head;
// `update` -> `test`
if (context.testSegments) {
makeLooped(
this,
context.endOfUpdateSegments,
context.testSegments);
}
} else if (context.testSegments) {
finalizeTestSegmentsOfFor(
context,
choiceContext,
forkContext.head);
} else {
context.endOfInitSegments = forkContext.head;
}
var bodySegments = context.endOfTestSegments;
if (!bodySegments) {
/*
* If there is not the `test` part, the `body` path comes from the
* `init` part and the `update` part.
*/
var prevForkContext = ForkContext.newEmpty(forkContext);
prevForkContext.add(context.endOfInitSegments);
if (context.endOfUpdateSegments) {
prevForkContext.add(context.endOfUpdateSegments);
}
bodySegments = prevForkContext.makeNext(0, -1);
}
context.continueDestSegments = context.continueDestSegments || bodySegments;
forkContext.replaceHead(bodySegments);
}
|
javascript
|
function() {
var context = this.loopContext;
var choiceContext = this.choiceContext;
var forkContext = this.forkContext;
// Update state.
if (context.updateSegments) {
context.endOfUpdateSegments = forkContext.head;
// `update` -> `test`
if (context.testSegments) {
makeLooped(
this,
context.endOfUpdateSegments,
context.testSegments);
}
} else if (context.testSegments) {
finalizeTestSegmentsOfFor(
context,
choiceContext,
forkContext.head);
} else {
context.endOfInitSegments = forkContext.head;
}
var bodySegments = context.endOfTestSegments;
if (!bodySegments) {
/*
* If there is not the `test` part, the `body` path comes from the
* `init` part and the `update` part.
*/
var prevForkContext = ForkContext.newEmpty(forkContext);
prevForkContext.add(context.endOfInitSegments);
if (context.endOfUpdateSegments) {
prevForkContext.add(context.endOfUpdateSegments);
}
bodySegments = prevForkContext.makeNext(0, -1);
}
context.continueDestSegments = context.continueDestSegments || bodySegments;
forkContext.replaceHead(bodySegments);
}
|
[
"function",
"(",
")",
"{",
"var",
"context",
"=",
"this",
".",
"loopContext",
";",
"var",
"choiceContext",
"=",
"this",
".",
"choiceContext",
";",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"// Update state.",
"if",
"(",
"context",
".",
"updateSegments",
")",
"{",
"context",
".",
"endOfUpdateSegments",
"=",
"forkContext",
".",
"head",
";",
"// `update` -> `test`",
"if",
"(",
"context",
".",
"testSegments",
")",
"{",
"makeLooped",
"(",
"this",
",",
"context",
".",
"endOfUpdateSegments",
",",
"context",
".",
"testSegments",
")",
";",
"}",
"}",
"else",
"if",
"(",
"context",
".",
"testSegments",
")",
"{",
"finalizeTestSegmentsOfFor",
"(",
"context",
",",
"choiceContext",
",",
"forkContext",
".",
"head",
")",
";",
"}",
"else",
"{",
"context",
".",
"endOfInitSegments",
"=",
"forkContext",
".",
"head",
";",
"}",
"var",
"bodySegments",
"=",
"context",
".",
"endOfTestSegments",
";",
"if",
"(",
"!",
"bodySegments",
")",
"{",
"/*\r\n\t\t\t\t * If there is not the `test` part, the `body` path comes from the\r\n\t\t\t\t * `init` part and the `update` part.\r\n\t\t\t\t */",
"var",
"prevForkContext",
"=",
"ForkContext",
".",
"newEmpty",
"(",
"forkContext",
")",
";",
"prevForkContext",
".",
"add",
"(",
"context",
".",
"endOfInitSegments",
")",
";",
"if",
"(",
"context",
".",
"endOfUpdateSegments",
")",
"{",
"prevForkContext",
".",
"add",
"(",
"context",
".",
"endOfUpdateSegments",
")",
";",
"}",
"bodySegments",
"=",
"prevForkContext",
".",
"makeNext",
"(",
"0",
",",
"-",
"1",
")",
";",
"}",
"context",
".",
"continueDestSegments",
"=",
"context",
".",
"continueDestSegments",
"||",
"bodySegments",
";",
"forkContext",
".",
"replaceHead",
"(",
"bodySegments",
")",
";",
"}"
] |
Makes a code path segment for the body part of a ForStatement.
@returns {void}
|
[
"Makes",
"a",
"code",
"path",
"segment",
"for",
"the",
"body",
"part",
"of",
"a",
"ForStatement",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L1164-L1208
|
|
14,488
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function() {
var context = this.loopContext;
var forkContext = this.forkContext;
var leftSegments = forkContext.makeDisconnected(-1, -1);
// Update state.
context.prevSegments = forkContext.head;
context.leftSegments = context.continueDestSegments = leftSegments;
forkContext.replaceHead(leftSegments);
}
|
javascript
|
function() {
var context = this.loopContext;
var forkContext = this.forkContext;
var leftSegments = forkContext.makeDisconnected(-1, -1);
// Update state.
context.prevSegments = forkContext.head;
context.leftSegments = context.continueDestSegments = leftSegments;
forkContext.replaceHead(leftSegments);
}
|
[
"function",
"(",
")",
"{",
"var",
"context",
"=",
"this",
".",
"loopContext",
";",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"var",
"leftSegments",
"=",
"forkContext",
".",
"makeDisconnected",
"(",
"-",
"1",
",",
"-",
"1",
")",
";",
"// Update state.",
"context",
".",
"prevSegments",
"=",
"forkContext",
".",
"head",
";",
"context",
".",
"leftSegments",
"=",
"context",
".",
"continueDestSegments",
"=",
"leftSegments",
";",
"forkContext",
".",
"replaceHead",
"(",
"leftSegments",
")",
";",
"}"
] |
Makes a code path segment for the left part of a ForInStatement and a
ForOfStatement.
@returns {void}
|
[
"Makes",
"a",
"code",
"path",
"segment",
"for",
"the",
"left",
"part",
"of",
"a",
"ForInStatement",
"and",
"a",
"ForOfStatement",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L1216-L1225
|
|
14,489
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function() {
var context = this.loopContext;
var forkContext = this.forkContext;
var temp = ForkContext.newEmpty(forkContext);
temp.add(context.prevSegments);
var rightSegments = temp.makeNext(-1, -1);
// Update state.
context.endOfLeftSegments = forkContext.head;
forkContext.replaceHead(rightSegments);
}
|
javascript
|
function() {
var context = this.loopContext;
var forkContext = this.forkContext;
var temp = ForkContext.newEmpty(forkContext);
temp.add(context.prevSegments);
var rightSegments = temp.makeNext(-1, -1);
// Update state.
context.endOfLeftSegments = forkContext.head;
forkContext.replaceHead(rightSegments);
}
|
[
"function",
"(",
")",
"{",
"var",
"context",
"=",
"this",
".",
"loopContext",
";",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"var",
"temp",
"=",
"ForkContext",
".",
"newEmpty",
"(",
"forkContext",
")",
";",
"temp",
".",
"add",
"(",
"context",
".",
"prevSegments",
")",
";",
"var",
"rightSegments",
"=",
"temp",
".",
"makeNext",
"(",
"-",
"1",
",",
"-",
"1",
")",
";",
"// Update state.",
"context",
".",
"endOfLeftSegments",
"=",
"forkContext",
".",
"head",
";",
"forkContext",
".",
"replaceHead",
"(",
"rightSegments",
")",
";",
"}"
] |
Makes a code path segment for the right part of a ForInStatement and a
ForOfStatement.
@returns {void}
|
[
"Makes",
"a",
"code",
"path",
"segment",
"for",
"the",
"right",
"part",
"of",
"a",
"ForInStatement",
"and",
"a",
"ForOfStatement",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L1233-L1244
|
|
14,490
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function() {
var context = this.loopContext;
var forkContext = this.forkContext;
var temp = ForkContext.newEmpty(forkContext);
temp.add(context.endOfLeftSegments);
var bodySegments = temp.makeNext(-1, -1);
// Make a path: `right` -> `left`.
makeLooped(this, forkContext.head, context.leftSegments);
// Update state.
context.brokenForkContext.add(forkContext.head);
forkContext.replaceHead(bodySegments);
}
|
javascript
|
function() {
var context = this.loopContext;
var forkContext = this.forkContext;
var temp = ForkContext.newEmpty(forkContext);
temp.add(context.endOfLeftSegments);
var bodySegments = temp.makeNext(-1, -1);
// Make a path: `right` -> `left`.
makeLooped(this, forkContext.head, context.leftSegments);
// Update state.
context.brokenForkContext.add(forkContext.head);
forkContext.replaceHead(bodySegments);
}
|
[
"function",
"(",
")",
"{",
"var",
"context",
"=",
"this",
".",
"loopContext",
";",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"var",
"temp",
"=",
"ForkContext",
".",
"newEmpty",
"(",
"forkContext",
")",
";",
"temp",
".",
"add",
"(",
"context",
".",
"endOfLeftSegments",
")",
";",
"var",
"bodySegments",
"=",
"temp",
".",
"makeNext",
"(",
"-",
"1",
",",
"-",
"1",
")",
";",
"// Make a path: `right` -> `left`.",
"makeLooped",
"(",
"this",
",",
"forkContext",
".",
"head",
",",
"context",
".",
"leftSegments",
")",
";",
"// Update state.",
"context",
".",
"brokenForkContext",
".",
"add",
"(",
"forkContext",
".",
"head",
")",
";",
"forkContext",
".",
"replaceHead",
"(",
"bodySegments",
")",
";",
"}"
] |
Makes a code path segment for the body part of a ForInStatement and a
ForOfStatement.
@returns {void}
|
[
"Makes",
"a",
"code",
"path",
"segment",
"for",
"the",
"body",
"part",
"of",
"a",
"ForInStatement",
"and",
"a",
"ForOfStatement",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L1252-L1266
|
|
14,491
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function() {
var context = this.breakContext;
var forkContext = this.forkContext;
this.breakContext = context.upper;
// Process this context here for other than switches and loops.
if (!context.breakable) {
var brokenForkContext = context.brokenForkContext;
if (!brokenForkContext.empty) {
brokenForkContext.add(forkContext.head);
forkContext.replaceHead(brokenForkContext.makeNext(0, -1));
}
}
return context;
}
|
javascript
|
function() {
var context = this.breakContext;
var forkContext = this.forkContext;
this.breakContext = context.upper;
// Process this context here for other than switches and loops.
if (!context.breakable) {
var brokenForkContext = context.brokenForkContext;
if (!brokenForkContext.empty) {
brokenForkContext.add(forkContext.head);
forkContext.replaceHead(brokenForkContext.makeNext(0, -1));
}
}
return context;
}
|
[
"function",
"(",
")",
"{",
"var",
"context",
"=",
"this",
".",
"breakContext",
";",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"this",
".",
"breakContext",
"=",
"context",
".",
"upper",
";",
"// Process this context here for other than switches and loops.",
"if",
"(",
"!",
"context",
".",
"breakable",
")",
"{",
"var",
"brokenForkContext",
"=",
"context",
".",
"brokenForkContext",
";",
"if",
"(",
"!",
"brokenForkContext",
".",
"empty",
")",
"{",
"brokenForkContext",
".",
"add",
"(",
"forkContext",
".",
"head",
")",
";",
"forkContext",
".",
"replaceHead",
"(",
"brokenForkContext",
".",
"makeNext",
"(",
"0",
",",
"-",
"1",
")",
")",
";",
"}",
"}",
"return",
"context",
";",
"}"
] |
Removes the top item of the break context stack.
@returns {object} The removed context.
|
[
"Removes",
"the",
"top",
"item",
"of",
"the",
"break",
"context",
"stack",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L1295-L1312
|
|
14,492
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function(label) {
var forkContext = this.forkContext;
if (!forkContext.reachable) {
return;
}
var context = getBreakContext(this, label);
/* istanbul ignore else: foolproof (syntax error) */
if (context) {
context.brokenForkContext.add(forkContext.head);
}
forkContext.replaceHead(forkContext.makeUnreachable(-1, -1));
}
|
javascript
|
function(label) {
var forkContext = this.forkContext;
if (!forkContext.reachable) {
return;
}
var context = getBreakContext(this, label);
/* istanbul ignore else: foolproof (syntax error) */
if (context) {
context.brokenForkContext.add(forkContext.head);
}
forkContext.replaceHead(forkContext.makeUnreachable(-1, -1));
}
|
[
"function",
"(",
"label",
")",
"{",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"if",
"(",
"!",
"forkContext",
".",
"reachable",
")",
"{",
"return",
";",
"}",
"var",
"context",
"=",
"getBreakContext",
"(",
"this",
",",
"label",
")",
";",
"/* istanbul ignore else: foolproof (syntax error) */",
"if",
"(",
"context",
")",
"{",
"context",
".",
"brokenForkContext",
".",
"add",
"(",
"forkContext",
".",
"head",
")",
";",
"}",
"forkContext",
".",
"replaceHead",
"(",
"forkContext",
".",
"makeUnreachable",
"(",
"-",
"1",
",",
"-",
"1",
")",
")",
";",
"}"
] |
Makes a path for a `break` statement.
It registers the head segment to a context of `break`.
It makes new unreachable segment, then it set the head with the segment.
@param {string} label - A label of the break statement.
@returns {void}
|
[
"Makes",
"a",
"path",
"for",
"a",
"break",
"statement",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L1323-L1338
|
|
14,493
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function(label) {
var forkContext = this.forkContext;
if (!forkContext.reachable) {
return;
}
var context = getContinueContext(this, label);
/* istanbul ignore else: foolproof (syntax error) */
if (context) {
if (context.continueDestSegments) {
makeLooped(this, forkContext.head, context.continueDestSegments);
// If the context is a for-in/of loop, this effects a break also.
if (context.type === "ForInStatement" ||
context.type === "ForOfStatement"
) {
context.brokenForkContext.add(forkContext.head);
}
} else {
context.continueForkContext.add(forkContext.head);
}
}
forkContext.replaceHead(forkContext.makeUnreachable(-1, -1));
}
|
javascript
|
function(label) {
var forkContext = this.forkContext;
if (!forkContext.reachable) {
return;
}
var context = getContinueContext(this, label);
/* istanbul ignore else: foolproof (syntax error) */
if (context) {
if (context.continueDestSegments) {
makeLooped(this, forkContext.head, context.continueDestSegments);
// If the context is a for-in/of loop, this effects a break also.
if (context.type === "ForInStatement" ||
context.type === "ForOfStatement"
) {
context.brokenForkContext.add(forkContext.head);
}
} else {
context.continueForkContext.add(forkContext.head);
}
}
forkContext.replaceHead(forkContext.makeUnreachable(-1, -1));
}
|
[
"function",
"(",
"label",
")",
"{",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"if",
"(",
"!",
"forkContext",
".",
"reachable",
")",
"{",
"return",
";",
"}",
"var",
"context",
"=",
"getContinueContext",
"(",
"this",
",",
"label",
")",
";",
"/* istanbul ignore else: foolproof (syntax error) */",
"if",
"(",
"context",
")",
"{",
"if",
"(",
"context",
".",
"continueDestSegments",
")",
"{",
"makeLooped",
"(",
"this",
",",
"forkContext",
".",
"head",
",",
"context",
".",
"continueDestSegments",
")",
";",
"// If the context is a for-in/of loop, this effects a break also.",
"if",
"(",
"context",
".",
"type",
"===",
"\"ForInStatement\"",
"||",
"context",
".",
"type",
"===",
"\"ForOfStatement\"",
")",
"{",
"context",
".",
"brokenForkContext",
".",
"add",
"(",
"forkContext",
".",
"head",
")",
";",
"}",
"}",
"else",
"{",
"context",
".",
"continueForkContext",
".",
"add",
"(",
"forkContext",
".",
"head",
")",
";",
"}",
"}",
"forkContext",
".",
"replaceHead",
"(",
"forkContext",
".",
"makeUnreachable",
"(",
"-",
"1",
",",
"-",
"1",
")",
")",
";",
"}"
] |
Makes a path for a `continue` statement.
It makes a looping path.
It makes new unreachable segment, then it set the head with the segment.
@param {string} label - A label of the continue statement.
@returns {void}
|
[
"Makes",
"a",
"path",
"for",
"a",
"continue",
"statement",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L1349-L1374
|
|
14,494
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function() {
var forkContext = this.forkContext;
if (forkContext.reachable) {
getReturnContext(this).returnedForkContext.add(forkContext.head);
forkContext.replaceHead(forkContext.makeUnreachable(-1, -1));
}
}
|
javascript
|
function() {
var forkContext = this.forkContext;
if (forkContext.reachable) {
getReturnContext(this).returnedForkContext.add(forkContext.head);
forkContext.replaceHead(forkContext.makeUnreachable(-1, -1));
}
}
|
[
"function",
"(",
")",
"{",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"if",
"(",
"forkContext",
".",
"reachable",
")",
"{",
"getReturnContext",
"(",
"this",
")",
".",
"returnedForkContext",
".",
"add",
"(",
"forkContext",
".",
"head",
")",
";",
"forkContext",
".",
"replaceHead",
"(",
"forkContext",
".",
"makeUnreachable",
"(",
"-",
"1",
",",
"-",
"1",
")",
")",
";",
"}",
"}"
] |
Makes a path for a `return` statement.
It registers the head segment to a context of `return`.
It makes new unreachable segment, then it set the head with the segment.
@returns {void}
|
[
"Makes",
"a",
"path",
"for",
"a",
"return",
"statement",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L1384-L1391
|
|
14,495
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js
|
function() {
var forkContext = this.forkContext;
if (forkContext.reachable) {
getThrowContext(this).thrownForkContext.add(forkContext.head);
forkContext.replaceHead(forkContext.makeUnreachable(-1, -1));
}
}
|
javascript
|
function() {
var forkContext = this.forkContext;
if (forkContext.reachable) {
getThrowContext(this).thrownForkContext.add(forkContext.head);
forkContext.replaceHead(forkContext.makeUnreachable(-1, -1));
}
}
|
[
"function",
"(",
")",
"{",
"var",
"forkContext",
"=",
"this",
".",
"forkContext",
";",
"if",
"(",
"forkContext",
".",
"reachable",
")",
"{",
"getThrowContext",
"(",
"this",
")",
".",
"thrownForkContext",
".",
"add",
"(",
"forkContext",
".",
"head",
")",
";",
"forkContext",
".",
"replaceHead",
"(",
"forkContext",
".",
"makeUnreachable",
"(",
"-",
"1",
",",
"-",
"1",
")",
")",
";",
"}",
"}"
] |
Makes a path for a `throw` statement.
It registers the head segment to a context of `throw`.
It makes new unreachable segment, then it set the head with the segment.
@returns {void}
|
[
"Makes",
"a",
"path",
"for",
"a",
"throw",
"statement",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-state.js#L1401-L1408
|
|
14,496
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/fileCommands.js
|
function(children) {
var attempt = 0;
var uniqueName = prefix;
// find a unique name for the new artifact
var possiblyCollidingNames = children.filter(function(child){
return 0 === child.Name.indexOf(prefix);
}).map(function(child){
return child.Name;
});
while (-1 !== possiblyCollidingNames.indexOf(uniqueName)){
attempt++;
uniqueName = prefix.concat(" (").concat(attempt).concat(")"); //$NON-NLS-1$ //$NON-NLS-0$
}
return uniqueName;
}
|
javascript
|
function(children) {
var attempt = 0;
var uniqueName = prefix;
// find a unique name for the new artifact
var possiblyCollidingNames = children.filter(function(child){
return 0 === child.Name.indexOf(prefix);
}).map(function(child){
return child.Name;
});
while (-1 !== possiblyCollidingNames.indexOf(uniqueName)){
attempt++;
uniqueName = prefix.concat(" (").concat(attempt).concat(")"); //$NON-NLS-1$ //$NON-NLS-0$
}
return uniqueName;
}
|
[
"function",
"(",
"children",
")",
"{",
"var",
"attempt",
"=",
"0",
";",
"var",
"uniqueName",
"=",
"prefix",
";",
"// find a unique name for the new artifact",
"var",
"possiblyCollidingNames",
"=",
"children",
".",
"filter",
"(",
"function",
"(",
"child",
")",
"{",
"return",
"0",
"===",
"child",
".",
"Name",
".",
"indexOf",
"(",
"prefix",
")",
";",
"}",
")",
".",
"map",
"(",
"function",
"(",
"child",
")",
"{",
"return",
"child",
".",
"Name",
";",
"}",
")",
";",
"while",
"(",
"-",
"1",
"!==",
"possiblyCollidingNames",
".",
"indexOf",
"(",
"uniqueName",
")",
")",
"{",
"attempt",
"++",
";",
"uniqueName",
"=",
"prefix",
".",
"concat",
"(",
"\" (\"",
")",
".",
"concat",
"(",
"attempt",
")",
".",
"concat",
"(",
"\")\"",
")",
";",
"//$NON-NLS-1$ //$NON-NLS-0$",
"}",
"return",
"uniqueName",
";",
"}"
] |
get the list of files that already exists in the selected directory and ensure that the new file's initial name is unique within that directory
|
[
"get",
"the",
"list",
"of",
"files",
"that",
"already",
"exists",
"in",
"the",
"selected",
"directory",
"and",
"ensure",
"that",
"the",
"new",
"file",
"s",
"initial",
"name",
"is",
"unique",
"within",
"that",
"directory"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/fileCommands.js#L866-L883
|
|
14,497
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/fileCommands.js
|
createNewArtifact
|
function createNewArtifact(namePrefix, parentItem, isDirectory) {
var createFunction = function(name) {
if (name) {
var location = parentItem.Location;
var functionName = isDirectory ? "createFolder" : "createFile";
var deferred = fileClient[functionName](location, name, {select: true});
progressService.showWhile(deferred, i18nUtil.formatMessage(messages["Creating ${0}"], name)).then(
function(newArtifact) {
},
function(error) {
if (error.status === 400 || error.status === 412) {
var resp = error.responseText;
if (typeof resp === "string") {
try {
resp = JSON.parse(resp);
resp.Message = i18nUtil.formatMessage(messages["FailedToCreateFile"], name);
error = resp;
} catch(error) {}
}
}
errorHandler(error);
}
);
}
};
createUniqueNameArtifact(parentItem, namePrefix, function(uniqueName){
getNewItemName(explorer, parentItem, explorer.getRow(parentItem), uniqueName, function(name) {
createFunction(name);
});
});
}
|
javascript
|
function createNewArtifact(namePrefix, parentItem, isDirectory) {
var createFunction = function(name) {
if (name) {
var location = parentItem.Location;
var functionName = isDirectory ? "createFolder" : "createFile";
var deferred = fileClient[functionName](location, name, {select: true});
progressService.showWhile(deferred, i18nUtil.formatMessage(messages["Creating ${0}"], name)).then(
function(newArtifact) {
},
function(error) {
if (error.status === 400 || error.status === 412) {
var resp = error.responseText;
if (typeof resp === "string") {
try {
resp = JSON.parse(resp);
resp.Message = i18nUtil.formatMessage(messages["FailedToCreateFile"], name);
error = resp;
} catch(error) {}
}
}
errorHandler(error);
}
);
}
};
createUniqueNameArtifact(parentItem, namePrefix, function(uniqueName){
getNewItemName(explorer, parentItem, explorer.getRow(parentItem), uniqueName, function(name) {
createFunction(name);
});
});
}
|
[
"function",
"createNewArtifact",
"(",
"namePrefix",
",",
"parentItem",
",",
"isDirectory",
")",
"{",
"var",
"createFunction",
"=",
"function",
"(",
"name",
")",
"{",
"if",
"(",
"name",
")",
"{",
"var",
"location",
"=",
"parentItem",
".",
"Location",
";",
"var",
"functionName",
"=",
"isDirectory",
"?",
"\"createFolder\"",
":",
"\"createFile\"",
";",
"var",
"deferred",
"=",
"fileClient",
"[",
"functionName",
"]",
"(",
"location",
",",
"name",
",",
"{",
"select",
":",
"true",
"}",
")",
";",
"progressService",
".",
"showWhile",
"(",
"deferred",
",",
"i18nUtil",
".",
"formatMessage",
"(",
"messages",
"[",
"\"Creating ${0}\"",
"]",
",",
"name",
")",
")",
".",
"then",
"(",
"function",
"(",
"newArtifact",
")",
"{",
"}",
",",
"function",
"(",
"error",
")",
"{",
"if",
"(",
"error",
".",
"status",
"===",
"400",
"||",
"error",
".",
"status",
"===",
"412",
")",
"{",
"var",
"resp",
"=",
"error",
".",
"responseText",
";",
"if",
"(",
"typeof",
"resp",
"===",
"\"string\"",
")",
"{",
"try",
"{",
"resp",
"=",
"JSON",
".",
"parse",
"(",
"resp",
")",
";",
"resp",
".",
"Message",
"=",
"i18nUtil",
".",
"formatMessage",
"(",
"messages",
"[",
"\"FailedToCreateFile\"",
"]",
",",
"name",
")",
";",
"error",
"=",
"resp",
";",
"}",
"catch",
"(",
"error",
")",
"{",
"}",
"}",
"}",
"errorHandler",
"(",
"error",
")",
";",
"}",
")",
";",
"}",
"}",
";",
"createUniqueNameArtifact",
"(",
"parentItem",
",",
"namePrefix",
",",
"function",
"(",
"uniqueName",
")",
"{",
"getNewItemName",
"(",
"explorer",
",",
"parentItem",
",",
"explorer",
".",
"getRow",
"(",
"parentItem",
")",
",",
"uniqueName",
",",
"function",
"(",
"name",
")",
"{",
"createFunction",
"(",
"name",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}"
] |
Creates a new file or folder as a child of the specified parentItem.
|
[
"Creates",
"a",
"new",
"file",
"or",
"folder",
"as",
"a",
"child",
"of",
"the",
"specified",
"parentItem",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/fileCommands.js#L939-L970
|
14,498
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/rulers.js
|
function (annotationModel) {
if (this._annotationModel) {
this._annotationModel.removeEventListener("Changed", this._listener.onAnnotationModelChanged); //$NON-NLS-0$
}
this._annotationModel = annotationModel;
if (this._annotationModel) {
this._annotationModel.addEventListener("Changed", this._listener.onAnnotationModelChanged); //$NON-NLS-0$
}
}
|
javascript
|
function (annotationModel) {
if (this._annotationModel) {
this._annotationModel.removeEventListener("Changed", this._listener.onAnnotationModelChanged); //$NON-NLS-0$
}
this._annotationModel = annotationModel;
if (this._annotationModel) {
this._annotationModel.addEventListener("Changed", this._listener.onAnnotationModelChanged); //$NON-NLS-0$
}
}
|
[
"function",
"(",
"annotationModel",
")",
"{",
"if",
"(",
"this",
".",
"_annotationModel",
")",
"{",
"this",
".",
"_annotationModel",
".",
"removeEventListener",
"(",
"\"Changed\"",
",",
"this",
".",
"_listener",
".",
"onAnnotationModelChanged",
")",
";",
"//$NON-NLS-0$",
"}",
"this",
".",
"_annotationModel",
"=",
"annotationModel",
";",
"if",
"(",
"this",
".",
"_annotationModel",
")",
"{",
"this",
".",
"_annotationModel",
".",
"addEventListener",
"(",
"\"Changed\"",
",",
"this",
".",
"_listener",
".",
"onAnnotationModelChanged",
")",
";",
"//$NON-NLS-0$",
"}",
"}"
] |
Sets the annotation model for the ruler.
@param {orion.editor.AnnotationModel} annotationModel the annotation model.
@see orion.editor.Ruler#getAnnotationModel
|
[
"Sets",
"the",
"annotation",
"model",
"for",
"the",
"ruler",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/rulers.js#L228-L236
|
|
14,499
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/rulers.js
|
function(lineIndex, e) {
var tooltip = mTooltip.Tooltip.getTooltip(this._view);
if (!tooltip) { return; }
if (tooltip.isVisible() && this._tooltipLineIndex === lineIndex) { return; }
this._tooltipLineIndex = lineIndex;
// Prevent spurious mouse event (e.g. on a scroll)
if (e.clientX === this._lastMouseX
&& e.clientY === this._lastMouseY) {
return;
}
this._lastMouseX = e.clientX;
this._lastMouseY = e.clientY;
if (this._hoverTimeout) {
window.clearTimeout(this._hoverTimeout);
this._hoverTimeout = null;
}
var target = e.target ? e.target : e.srcElement;
var bounds = target.getBoundingClientRect();
this._curElementBounds = Object.create(null);
this._curElementBounds.top = bounds.top;
this._curElementBounds.left = bounds.left;
this._curElementBounds.height = bounds.height;
this._curElementBounds.width = bounds.width;
// If we have the entire ruler selected, just use a 1 pixel high area in the ruler (Bug 463486)
if (target === this.node){
this._curElementBounds.top = e.clientY;
this._curElementBounds.height = 1;
}
var self = this;
self._hoverTimeout = window.setTimeout(function() {
self._hoverTimeout = null;
tooltip.onHover({
getTooltipInfo: function() {
var annotations = self._getAnnotationsAtLineIndex(self._tooltipLineIndex);
var content = self._getTooltipContents(self._tooltipLineIndex, annotations);
return self._getTooltipInfo(content, e.clientY, {source: "ruler", rulerLocation: self.getLocation()}); //$NON-NLS-0$
}
}, e.clientX, e.clientY);
}, 175);
}
|
javascript
|
function(lineIndex, e) {
var tooltip = mTooltip.Tooltip.getTooltip(this._view);
if (!tooltip) { return; }
if (tooltip.isVisible() && this._tooltipLineIndex === lineIndex) { return; }
this._tooltipLineIndex = lineIndex;
// Prevent spurious mouse event (e.g. on a scroll)
if (e.clientX === this._lastMouseX
&& e.clientY === this._lastMouseY) {
return;
}
this._lastMouseX = e.clientX;
this._lastMouseY = e.clientY;
if (this._hoverTimeout) {
window.clearTimeout(this._hoverTimeout);
this._hoverTimeout = null;
}
var target = e.target ? e.target : e.srcElement;
var bounds = target.getBoundingClientRect();
this._curElementBounds = Object.create(null);
this._curElementBounds.top = bounds.top;
this._curElementBounds.left = bounds.left;
this._curElementBounds.height = bounds.height;
this._curElementBounds.width = bounds.width;
// If we have the entire ruler selected, just use a 1 pixel high area in the ruler (Bug 463486)
if (target === this.node){
this._curElementBounds.top = e.clientY;
this._curElementBounds.height = 1;
}
var self = this;
self._hoverTimeout = window.setTimeout(function() {
self._hoverTimeout = null;
tooltip.onHover({
getTooltipInfo: function() {
var annotations = self._getAnnotationsAtLineIndex(self._tooltipLineIndex);
var content = self._getTooltipContents(self._tooltipLineIndex, annotations);
return self._getTooltipInfo(content, e.clientY, {source: "ruler", rulerLocation: self.getLocation()}); //$NON-NLS-0$
}
}, e.clientX, e.clientY);
}, 175);
}
|
[
"function",
"(",
"lineIndex",
",",
"e",
")",
"{",
"var",
"tooltip",
"=",
"mTooltip",
".",
"Tooltip",
".",
"getTooltip",
"(",
"this",
".",
"_view",
")",
";",
"if",
"(",
"!",
"tooltip",
")",
"{",
"return",
";",
"}",
"if",
"(",
"tooltip",
".",
"isVisible",
"(",
")",
"&&",
"this",
".",
"_tooltipLineIndex",
"===",
"lineIndex",
")",
"{",
"return",
";",
"}",
"this",
".",
"_tooltipLineIndex",
"=",
"lineIndex",
";",
"// Prevent spurious mouse event (e.g. on a scroll)\t\t\t\t\t",
"if",
"(",
"e",
".",
"clientX",
"===",
"this",
".",
"_lastMouseX",
"&&",
"e",
".",
"clientY",
"===",
"this",
".",
"_lastMouseY",
")",
"{",
"return",
";",
"}",
"this",
".",
"_lastMouseX",
"=",
"e",
".",
"clientX",
";",
"this",
".",
"_lastMouseY",
"=",
"e",
".",
"clientY",
";",
"if",
"(",
"this",
".",
"_hoverTimeout",
")",
"{",
"window",
".",
"clearTimeout",
"(",
"this",
".",
"_hoverTimeout",
")",
";",
"this",
".",
"_hoverTimeout",
"=",
"null",
";",
"}",
"var",
"target",
"=",
"e",
".",
"target",
"?",
"e",
".",
"target",
":",
"e",
".",
"srcElement",
";",
"var",
"bounds",
"=",
"target",
".",
"getBoundingClientRect",
"(",
")",
";",
"this",
".",
"_curElementBounds",
"=",
"Object",
".",
"create",
"(",
"null",
")",
";",
"this",
".",
"_curElementBounds",
".",
"top",
"=",
"bounds",
".",
"top",
";",
"this",
".",
"_curElementBounds",
".",
"left",
"=",
"bounds",
".",
"left",
";",
"this",
".",
"_curElementBounds",
".",
"height",
"=",
"bounds",
".",
"height",
";",
"this",
".",
"_curElementBounds",
".",
"width",
"=",
"bounds",
".",
"width",
";",
"// If we have the entire ruler selected, just use a 1 pixel high area in the ruler (Bug 463486)",
"if",
"(",
"target",
"===",
"this",
".",
"node",
")",
"{",
"this",
".",
"_curElementBounds",
".",
"top",
"=",
"e",
".",
"clientY",
";",
"this",
".",
"_curElementBounds",
".",
"height",
"=",
"1",
";",
"}",
"var",
"self",
"=",
"this",
";",
"self",
".",
"_hoverTimeout",
"=",
"window",
".",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"self",
".",
"_hoverTimeout",
"=",
"null",
";",
"tooltip",
".",
"onHover",
"(",
"{",
"getTooltipInfo",
":",
"function",
"(",
")",
"{",
"var",
"annotations",
"=",
"self",
".",
"_getAnnotationsAtLineIndex",
"(",
"self",
".",
"_tooltipLineIndex",
")",
";",
"var",
"content",
"=",
"self",
".",
"_getTooltipContents",
"(",
"self",
".",
"_tooltipLineIndex",
",",
"annotations",
")",
";",
"return",
"self",
".",
"_getTooltipInfo",
"(",
"content",
",",
"e",
".",
"clientY",
",",
"{",
"source",
":",
"\"ruler\"",
",",
"rulerLocation",
":",
"self",
".",
"getLocation",
"(",
")",
"}",
")",
";",
"//$NON-NLS-0$",
"}",
"}",
",",
"e",
".",
"clientX",
",",
"e",
".",
"clientY",
")",
";",
"}",
",",
"175",
")",
";",
"}"
] |
This event is sent when the user moves the mouse over a line annotation.
@event
@param {Number} lineIndex the line index of the annotation under the pointer.
@param {DOMEvent} e the mouse move event.
|
[
"This",
"event",
"is",
"sent",
"when",
"the",
"user",
"moves",
"the",
"mouse",
"over",
"a",
"line",
"annotation",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/rulers.js#L370-L415
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.