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,500
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/rulers.js
|
function(lineIndex, e) {
if (!this._currentClickGroup) {
this._setCurrentGroup(-1);
}
if (this._hoverTimeout) {
window.clearTimeout(this._hoverTimeout);
this._hoverTimeout = null;
}
}
|
javascript
|
function(lineIndex, e) {
if (!this._currentClickGroup) {
this._setCurrentGroup(-1);
}
if (this._hoverTimeout) {
window.clearTimeout(this._hoverTimeout);
this._hoverTimeout = null;
}
}
|
[
"function",
"(",
"lineIndex",
",",
"e",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_currentClickGroup",
")",
"{",
"this",
".",
"_setCurrentGroup",
"(",
"-",
"1",
")",
";",
"}",
"if",
"(",
"this",
".",
"_hoverTimeout",
")",
"{",
"window",
".",
"clearTimeout",
"(",
"this",
".",
"_hoverTimeout",
")",
";",
"this",
".",
"_hoverTimeout",
"=",
"null",
";",
"}",
"}"
] |
This event is sent when the mouse pointer exits a line annotation.
@event
@param {Number} lineIndex the line index of the annotation under the pointer.
@param {DOMEvent} e the mouse out event.
@callback
|
[
"This",
"event",
"is",
"sent",
"when",
"the",
"mouse",
"pointer",
"exits",
"a",
"line",
"annotation",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/rulers.js#L437-L446
|
|
14,501
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/rulers.js
|
LineNumberRuler
|
function LineNumberRuler (annotationModel, rulerLocation, rulerStyle, oddStyle, evenStyle) {
Ruler.call(this, annotationModel, rulerLocation, "page", rulerStyle); //$NON-NLS-0$
this._oddStyle = oddStyle || {style: {backgroundColor: "white"}}; //$NON-NLS-0$
this._evenStyle = evenStyle || {style: {backgroundColor: "white"}}; //$NON-NLS-0$
this._numOfDigits = 0;
this._firstLine = 1;
}
|
javascript
|
function LineNumberRuler (annotationModel, rulerLocation, rulerStyle, oddStyle, evenStyle) {
Ruler.call(this, annotationModel, rulerLocation, "page", rulerStyle); //$NON-NLS-0$
this._oddStyle = oddStyle || {style: {backgroundColor: "white"}}; //$NON-NLS-0$
this._evenStyle = evenStyle || {style: {backgroundColor: "white"}}; //$NON-NLS-0$
this._numOfDigits = 0;
this._firstLine = 1;
}
|
[
"function",
"LineNumberRuler",
"(",
"annotationModel",
",",
"rulerLocation",
",",
"rulerStyle",
",",
"oddStyle",
",",
"evenStyle",
")",
"{",
"Ruler",
".",
"call",
"(",
"this",
",",
"annotationModel",
",",
"rulerLocation",
",",
"\"page\"",
",",
"rulerStyle",
")",
";",
"//$NON-NLS-0$",
"this",
".",
"_oddStyle",
"=",
"oddStyle",
"||",
"{",
"style",
":",
"{",
"backgroundColor",
":",
"\"white\"",
"}",
"}",
";",
"//$NON-NLS-0$",
"this",
".",
"_evenStyle",
"=",
"evenStyle",
"||",
"{",
"style",
":",
"{",
"backgroundColor",
":",
"\"white\"",
"}",
"}",
";",
"//$NON-NLS-0$",
"this",
".",
"_numOfDigits",
"=",
"0",
";",
"this",
".",
"_firstLine",
"=",
"1",
";",
"}"
] |
Constructs a new line numbering ruler.
@param {orion.editor.AnnotationModel} annotationModel the annotation model for the ruler.
@param {String} [rulerLocation="left"] the location for the ruler.
@param {orion.editor.Style} [rulerStyle=undefined] the style for the ruler.
@param {orion.editor.Style} [oddStyle={style: {backgroundColor: "white"}] the style for lines with odd line index.
@param {orion.editor.Style} [evenStyle={backgroundColor: "white"}] the style for lines with even line index.
@augments orion.editor.Ruler
@class This objects implements a line numbering ruler.
<p><b>See:</b><br/>
{@link orion.editor.Ruler}
</p>
@name orion.editor.LineNumberRuler
|
[
"Constructs",
"a",
"new",
"line",
"numbering",
"ruler",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/rulers.js#L782-L788
|
14,502
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.core/web/orion/URITemplate.js
|
function(params) {
var result = [];
for (var i = 0; i < this._templateComponents.length; i++) {
result.push(this._templateComponents[i].expand(params));
}
return result.join("");
}
|
javascript
|
function(params) {
var result = [];
for (var i = 0; i < this._templateComponents.length; i++) {
result.push(this._templateComponents[i].expand(params));
}
return result.join("");
}
|
[
"function",
"(",
"params",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"_templateComponents",
".",
"length",
";",
"i",
"++",
")",
"{",
"result",
".",
"push",
"(",
"this",
".",
"_templateComponents",
"[",
"i",
"]",
".",
"expand",
"(",
"params",
")",
")",
";",
"}",
"return",
"result",
".",
"join",
"(",
"\"\"",
")",
";",
"}"
] |
Expands this URITemplate to a URI.
@param {Object} params The parameters to use for expansion. This object is a map of keys (variable names) to values (the variable's
value in the <a href="http://tools.ietf.org/html/rfc6570#section-3.2.1">expansion algorithm</a>).
@returns {String} The resulting URI.
|
[
"Expands",
"this",
"URITemplate",
"to",
"a",
"URI",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.core/web/orion/URITemplate.js#L215-L221
|
|
14,503
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/sites/SiteEditor.js
|
function(items, userData) {
var selfHostingConfig = this._siteClient.getSelfHostingConfig();
var self = this;
var dialog = new ConvertToSelfHostingDialog({
serviceRegistry: this.serviceRegistry,
fileClient: this.fileClient,
siteClient: this._siteClient,
selfHostingConfig: selfHostingConfig,
func: function(folderInfos) {
var folderLocations = folderInfos.map(function(folderInfo) {
return folderInfo.folder.Location;
});
self._siteClient.convertToSelfHosting(self.getSiteConfiguration(), folderLocations).then(
function(updatedSite) {
self.mappings.deleteAllMappings();
self.mappings.addMappings(updatedSite.Mappings);
self.save();
});
}
});
dialog.show();
}
|
javascript
|
function(items, userData) {
var selfHostingConfig = this._siteClient.getSelfHostingConfig();
var self = this;
var dialog = new ConvertToSelfHostingDialog({
serviceRegistry: this.serviceRegistry,
fileClient: this.fileClient,
siteClient: this._siteClient,
selfHostingConfig: selfHostingConfig,
func: function(folderInfos) {
var folderLocations = folderInfos.map(function(folderInfo) {
return folderInfo.folder.Location;
});
self._siteClient.convertToSelfHosting(self.getSiteConfiguration(), folderLocations).then(
function(updatedSite) {
self.mappings.deleteAllMappings();
self.mappings.addMappings(updatedSite.Mappings);
self.save();
});
}
});
dialog.show();
}
|
[
"function",
"(",
"items",
",",
"userData",
")",
"{",
"var",
"selfHostingConfig",
"=",
"this",
".",
"_siteClient",
".",
"getSelfHostingConfig",
"(",
")",
";",
"var",
"self",
"=",
"this",
";",
"var",
"dialog",
"=",
"new",
"ConvertToSelfHostingDialog",
"(",
"{",
"serviceRegistry",
":",
"this",
".",
"serviceRegistry",
",",
"fileClient",
":",
"this",
".",
"fileClient",
",",
"siteClient",
":",
"this",
".",
"_siteClient",
",",
"selfHostingConfig",
":",
"selfHostingConfig",
",",
"func",
":",
"function",
"(",
"folderInfos",
")",
"{",
"var",
"folderLocations",
"=",
"folderInfos",
".",
"map",
"(",
"function",
"(",
"folderInfo",
")",
"{",
"return",
"folderInfo",
".",
"folder",
".",
"Location",
";",
"}",
")",
";",
"self",
".",
"_siteClient",
".",
"convertToSelfHosting",
"(",
"self",
".",
"getSiteConfiguration",
"(",
")",
",",
"folderLocations",
")",
".",
"then",
"(",
"function",
"(",
"updatedSite",
")",
"{",
"self",
".",
"mappings",
".",
"deleteAllMappings",
"(",
")",
";",
"self",
".",
"mappings",
".",
"addMappings",
"(",
"updatedSite",
".",
"Mappings",
")",
";",
"self",
".",
"save",
"(",
")",
";",
"}",
")",
";",
"}",
"}",
")",
";",
"dialog",
".",
"show",
"(",
")",
";",
"}"
] |
Special feature for setting up self-hosting
|
[
"Special",
"feature",
"for",
"setting",
"up",
"self",
"-",
"hosting"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/sites/SiteEditor.js#L344-L367
|
|
14,504
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/sites/SiteEditor.js
|
function(location) {
var deferred = new Deferred();
this._busyWhile(deferred, messages["Loading..."]);
this._siteClient.loadSiteConfiguration(location).then(
function(siteConfig) {
this._setSiteConfiguration(siteConfig);
this.setDirty(false);
deferred.resolve(siteConfig);
}.bind(this),
function(error) {
deferred.reject(error);
});
return deferred;
}
|
javascript
|
function(location) {
var deferred = new Deferred();
this._busyWhile(deferred, messages["Loading..."]);
this._siteClient.loadSiteConfiguration(location).then(
function(siteConfig) {
this._setSiteConfiguration(siteConfig);
this.setDirty(false);
deferred.resolve(siteConfig);
}.bind(this),
function(error) {
deferred.reject(error);
});
return deferred;
}
|
[
"function",
"(",
"location",
")",
"{",
"var",
"deferred",
"=",
"new",
"Deferred",
"(",
")",
";",
"this",
".",
"_busyWhile",
"(",
"deferred",
",",
"messages",
"[",
"\"Loading...\"",
"]",
")",
";",
"this",
".",
"_siteClient",
".",
"loadSiteConfiguration",
"(",
"location",
")",
".",
"then",
"(",
"function",
"(",
"siteConfig",
")",
"{",
"this",
".",
"_setSiteConfiguration",
"(",
"siteConfig",
")",
";",
"this",
".",
"setDirty",
"(",
"false",
")",
";",
"deferred",
".",
"resolve",
"(",
"siteConfig",
")",
";",
"}",
".",
"bind",
"(",
"this",
")",
",",
"function",
"(",
"error",
")",
"{",
"deferred",
".",
"reject",
"(",
"error",
")",
";",
"}",
")",
";",
"return",
"deferred",
";",
"}"
] |
Loads site configuration from a URL into the editor.
@param {String} location URL of the site configuration to load.
@returns {orion.Promise} A promise, resolved when the editor has loaded & refreshed itself.
|
[
"Loads",
"site",
"configuration",
"from",
"a",
"URL",
"into",
"the",
"editor",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/sites/SiteEditor.js#L374-L387
|
|
14,505
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/sites/SiteEditor.js
|
function(site) {
this._detachListeners();
this._modelListeners = this._modelListeners || [];
var editor = this;
function bindText(widget, modelField) {
function commitWidgetValue(event) {
var value = widget.value; //$NON-NLS-0$
var oldValue = site[modelField];
site[modelField] = value;
var isChanged = oldValue !== value;
editor.setDirty(isChanged || editor.isDirty());
}
widget.addEventListener("input", commitWidgetValue); //$NON-NLS-0$
editor._modelListeners.push({target: widget, type: "input", listener: commitWidgetValue}); //$NON-NLS-0$
}
bindText(this.name, messages["Name"]);
bindText(this.hostHint, messages["HostHint"]);
var dirtyListener = function(dirtyEvent) {
editor.setDirty(dirtyEvent.value);
};
this.mappings.addEventListener("dirty", dirtyListener); //$NON-NLS-0$
this._modelListeners.push({target: this.mappings, type: "dirty", listener: dirtyListener}); //$NON-NLS-0$
}
|
javascript
|
function(site) {
this._detachListeners();
this._modelListeners = this._modelListeners || [];
var editor = this;
function bindText(widget, modelField) {
function commitWidgetValue(event) {
var value = widget.value; //$NON-NLS-0$
var oldValue = site[modelField];
site[modelField] = value;
var isChanged = oldValue !== value;
editor.setDirty(isChanged || editor.isDirty());
}
widget.addEventListener("input", commitWidgetValue); //$NON-NLS-0$
editor._modelListeners.push({target: widget, type: "input", listener: commitWidgetValue}); //$NON-NLS-0$
}
bindText(this.name, messages["Name"]);
bindText(this.hostHint, messages["HostHint"]);
var dirtyListener = function(dirtyEvent) {
editor.setDirty(dirtyEvent.value);
};
this.mappings.addEventListener("dirty", dirtyListener); //$NON-NLS-0$
this._modelListeners.push({target: this.mappings, type: "dirty", listener: dirtyListener}); //$NON-NLS-0$
}
|
[
"function",
"(",
"site",
")",
"{",
"this",
".",
"_detachListeners",
"(",
")",
";",
"this",
".",
"_modelListeners",
"=",
"this",
".",
"_modelListeners",
"||",
"[",
"]",
";",
"var",
"editor",
"=",
"this",
";",
"function",
"bindText",
"(",
"widget",
",",
"modelField",
")",
"{",
"function",
"commitWidgetValue",
"(",
"event",
")",
"{",
"var",
"value",
"=",
"widget",
".",
"value",
";",
"//$NON-NLS-0$",
"var",
"oldValue",
"=",
"site",
"[",
"modelField",
"]",
";",
"site",
"[",
"modelField",
"]",
"=",
"value",
";",
"var",
"isChanged",
"=",
"oldValue",
"!==",
"value",
";",
"editor",
".",
"setDirty",
"(",
"isChanged",
"||",
"editor",
".",
"isDirty",
"(",
")",
")",
";",
"}",
"widget",
".",
"addEventListener",
"(",
"\"input\"",
",",
"commitWidgetValue",
")",
";",
"//$NON-NLS-0$",
"editor",
".",
"_modelListeners",
".",
"push",
"(",
"{",
"target",
":",
"widget",
",",
"type",
":",
"\"input\"",
",",
"listener",
":",
"commitWidgetValue",
"}",
")",
";",
"//$NON-NLS-0$",
"}",
"bindText",
"(",
"this",
".",
"name",
",",
"messages",
"[",
"\"Name\"",
"]",
")",
";",
"bindText",
"(",
"this",
".",
"hostHint",
",",
"messages",
"[",
"\"HostHint\"",
"]",
")",
";",
"var",
"dirtyListener",
"=",
"function",
"(",
"dirtyEvent",
")",
"{",
"editor",
".",
"setDirty",
"(",
"dirtyEvent",
".",
"value",
")",
";",
"}",
";",
"this",
".",
"mappings",
".",
"addEventListener",
"(",
"\"dirty\"",
",",
"dirtyListener",
")",
";",
"//$NON-NLS-0$",
"this",
".",
"_modelListeners",
".",
"push",
"(",
"{",
"target",
":",
"this",
".",
"mappings",
",",
"type",
":",
"\"dirty\"",
",",
"listener",
":",
"dirtyListener",
"}",
")",
";",
"//$NON-NLS-0$",
"}"
] |
Hook up listeners that perform form widget -> model updates.
@param site {SiteConfiguration}
|
[
"Hook",
"up",
"listeners",
"that",
"perform",
"form",
"widget",
"-",
">",
"model",
"updates",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/sites/SiteEditor.js#L497-L522
|
|
14,506
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/sites/SiteEditor.js
|
function(refreshUI) {
refreshUI = typeof refreshUI === "undefined" ? true : refreshUI; //$NON-NLS-0$
var siteConfig = this._siteConfiguration;
// Omit the HostingStatus field from the object we send since it's likely to be updated from the
// sites page, and we don't want to overwrite
var status = siteConfig.HostingStatus;
delete siteConfig.HostingStatus;
var self = this;
var deferred = this._siteClient.updateSiteConfiguration(siteConfig.Location, siteConfig).then(
function(updatedSiteConfig) {
self.setDirty(false);
if (refreshUI) {
self._setSiteConfiguration(updatedSiteConfig);
return updatedSiteConfig;
} else {
siteConfig.HostingStatus = status;
self._refreshCommands();
return siteConfig;
}
});
this._busyWhile(deferred);
return true;
}
|
javascript
|
function(refreshUI) {
refreshUI = typeof refreshUI === "undefined" ? true : refreshUI; //$NON-NLS-0$
var siteConfig = this._siteConfiguration;
// Omit the HostingStatus field from the object we send since it's likely to be updated from the
// sites page, and we don't want to overwrite
var status = siteConfig.HostingStatus;
delete siteConfig.HostingStatus;
var self = this;
var deferred = this._siteClient.updateSiteConfiguration(siteConfig.Location, siteConfig).then(
function(updatedSiteConfig) {
self.setDirty(false);
if (refreshUI) {
self._setSiteConfiguration(updatedSiteConfig);
return updatedSiteConfig;
} else {
siteConfig.HostingStatus = status;
self._refreshCommands();
return siteConfig;
}
});
this._busyWhile(deferred);
return true;
}
|
[
"function",
"(",
"refreshUI",
")",
"{",
"refreshUI",
"=",
"typeof",
"refreshUI",
"===",
"\"undefined\"",
"?",
"true",
":",
"refreshUI",
";",
"//$NON-NLS-0$",
"var",
"siteConfig",
"=",
"this",
".",
"_siteConfiguration",
";",
"// Omit the HostingStatus field from the object we send since it's likely to be updated from the",
"// sites page, and we don't want to overwrite",
"var",
"status",
"=",
"siteConfig",
".",
"HostingStatus",
";",
"delete",
"siteConfig",
".",
"HostingStatus",
";",
"var",
"self",
"=",
"this",
";",
"var",
"deferred",
"=",
"this",
".",
"_siteClient",
".",
"updateSiteConfiguration",
"(",
"siteConfig",
".",
"Location",
",",
"siteConfig",
")",
".",
"then",
"(",
"function",
"(",
"updatedSiteConfig",
")",
"{",
"self",
".",
"setDirty",
"(",
"false",
")",
";",
"if",
"(",
"refreshUI",
")",
"{",
"self",
".",
"_setSiteConfiguration",
"(",
"updatedSiteConfig",
")",
";",
"return",
"updatedSiteConfig",
";",
"}",
"else",
"{",
"siteConfig",
".",
"HostingStatus",
"=",
"status",
";",
"self",
".",
"_refreshCommands",
"(",
")",
";",
"return",
"siteConfig",
";",
"}",
"}",
")",
";",
"this",
".",
"_busyWhile",
"(",
"deferred",
")",
";",
"return",
"true",
";",
"}"
] |
Callback when 'save' is clicked.
@Override
@returns True to allow save to proceed, false to prevent it.
|
[
"Callback",
"when",
"save",
"is",
"clicked",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/sites/SiteEditor.js#L550-L572
|
|
14,507
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/RichDropdown.js
|
RichDropdown
|
function RichDropdown(options) {
this._parentNode = options.parentNode;
this._buttonName = options.buttonName;
this._id = options.id || "dropDown";
this._buttonDecorator = options.buttonDecorator;
this._populateFunction = options.populateFunction;
this._noDropdownArrow = options.noDropdownArrow;
this._initialize();
}
|
javascript
|
function RichDropdown(options) {
this._parentNode = options.parentNode;
this._buttonName = options.buttonName;
this._id = options.id || "dropDown";
this._buttonDecorator = options.buttonDecorator;
this._populateFunction = options.populateFunction;
this._noDropdownArrow = options.noDropdownArrow;
this._initialize();
}
|
[
"function",
"RichDropdown",
"(",
"options",
")",
"{",
"this",
".",
"_parentNode",
"=",
"options",
".",
"parentNode",
";",
"this",
".",
"_buttonName",
"=",
"options",
".",
"buttonName",
";",
"this",
".",
"_id",
"=",
"options",
".",
"id",
"||",
"\"dropDown\"",
";",
"this",
".",
"_buttonDecorator",
"=",
"options",
".",
"buttonDecorator",
";",
"this",
".",
"_populateFunction",
"=",
"options",
".",
"populateFunction",
";",
"this",
".",
"_noDropdownArrow",
"=",
"options",
".",
"noDropdownArrow",
";",
"this",
".",
"_initialize",
"(",
")",
";",
"}"
] |
Creates a generic RichDropdown which can be appended to any dom node.
@param {DOMNode} options.parentNode The DOM node which this rich dropdown will be appended to
@param {Function} options.populateFunction The function which will populate the dropdown when it is opened (see @ref orion.webui.dropdown)
@param {String} options.buttonName Optional. A string to display on the dropdown trigger button.
@param {DOMNode} options.buttonDecorator Optional. A DOM node will be inserted into the dropdown trigger button as a decorator.
@param {Boolean} options.noDropdownArrow Optional. A boolean indicating that the dropdown arrow should be omitted from the dropdown trigger button.
|
[
"Creates",
"a",
"generic",
"RichDropdown",
"which",
"can",
"be",
"appended",
"to",
"any",
"dom",
"node",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/RichDropdown.js#L29-L37
|
14,508
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/RichDropdown.js
|
function(name, decorator, title) {
var titleText = title || ""; //$NON-NLS-0$
lib.empty(this._dropdownTriggerButtonLabel);
if (decorator) {
this._dropdownTriggerButtonLabel.appendChild(decorator);
}
var nameNode = document.createTextNode(name);
this._dropdownTriggerButtonLabel.appendChild(nameNode);
this._dropdownTriggerButton.title = titleText;
}
|
javascript
|
function(name, decorator, title) {
var titleText = title || ""; //$NON-NLS-0$
lib.empty(this._dropdownTriggerButtonLabel);
if (decorator) {
this._dropdownTriggerButtonLabel.appendChild(decorator);
}
var nameNode = document.createTextNode(name);
this._dropdownTriggerButtonLabel.appendChild(nameNode);
this._dropdownTriggerButton.title = titleText;
}
|
[
"function",
"(",
"name",
",",
"decorator",
",",
"title",
")",
"{",
"var",
"titleText",
"=",
"title",
"||",
"\"\"",
";",
"//$NON-NLS-0$\r",
"lib",
".",
"empty",
"(",
"this",
".",
"_dropdownTriggerButtonLabel",
")",
";",
"if",
"(",
"decorator",
")",
"{",
"this",
".",
"_dropdownTriggerButtonLabel",
".",
"appendChild",
"(",
"decorator",
")",
";",
"}",
"var",
"nameNode",
"=",
"document",
".",
"createTextNode",
"(",
"name",
")",
";",
"this",
".",
"_dropdownTriggerButtonLabel",
".",
"appendChild",
"(",
"nameNode",
")",
";",
"this",
".",
"_dropdownTriggerButton",
".",
"title",
"=",
"titleText",
";",
"}"
] |
Sets the text label displayed in this dropdown's trigger button
@param {String} name The string to display on the dropdown trigger button.
@param {DOMNode} decorator Optional. A dom node which will be placed in front of the button name.
@param {String} title Optional. A string to display as the dropdown trigger button's title.
|
[
"Sets",
"the",
"text",
"label",
"displayed",
"in",
"this",
"dropdown",
"s",
"trigger",
"button"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/RichDropdown.js#L92-L104
|
|
14,509
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/RichDropdown.js
|
function(labelNode) {
labelNode.id = this._dropdownTriggerButtonLabel.id;
this._dropdownTriggerButton.replaceChild(labelNode, this._dropdownTriggerButtonLabel);
this._dropdownTriggerButtonLabel = labelNode;
}
|
javascript
|
function(labelNode) {
labelNode.id = this._dropdownTriggerButtonLabel.id;
this._dropdownTriggerButton.replaceChild(labelNode, this._dropdownTriggerButtonLabel);
this._dropdownTriggerButtonLabel = labelNode;
}
|
[
"function",
"(",
"labelNode",
")",
"{",
"labelNode",
".",
"id",
"=",
"this",
".",
"_dropdownTriggerButtonLabel",
".",
"id",
";",
"this",
".",
"_dropdownTriggerButton",
".",
"replaceChild",
"(",
"labelNode",
",",
"this",
".",
"_dropdownTriggerButtonLabel",
")",
";",
"this",
".",
"_dropdownTriggerButtonLabel",
"=",
"labelNode",
";",
"}"
] |
Replaces this dropdown's default trigger button label node with the one specified.
@param {DOMNode} labelNode A dom node which will replace the dropdownTriggerButtonLabel
|
[
"Replaces",
"this",
"dropdown",
"s",
"default",
"trigger",
"button",
"label",
"node",
"with",
"the",
"one",
"specified",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/RichDropdown.js#L111-L115
|
|
14,510
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/RichDropdown.js
|
function() {
if (this._dropdownTriggerButton) {
if (this._dropdownTriggerButton.dropdown) {
this._dropdownTriggerButton.dropdown.destroy();
this._dropdownTriggerButton.dropdown = null;
}
this._dropdownTriggerButton = null;
}
}
|
javascript
|
function() {
if (this._dropdownTriggerButton) {
if (this._dropdownTriggerButton.dropdown) {
this._dropdownTriggerButton.dropdown.destroy();
this._dropdownTriggerButton.dropdown = null;
}
this._dropdownTriggerButton = null;
}
}
|
[
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_dropdownTriggerButton",
")",
"{",
"if",
"(",
"this",
".",
"_dropdownTriggerButton",
".",
"dropdown",
")",
"{",
"this",
".",
"_dropdownTriggerButton",
".",
"dropdown",
".",
"destroy",
"(",
")",
";",
"this",
".",
"_dropdownTriggerButton",
".",
"dropdown",
"=",
"null",
";",
"}",
"this",
".",
"_dropdownTriggerButton",
"=",
"null",
";",
"}",
"}"
] |
Destroys this dropdown and cleans up its resources.
|
[
"Destroys",
"this",
"dropdown",
"and",
"cleans",
"up",
"its",
"resources",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/RichDropdown.js#L127-L135
|
|
14,511
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/dialogs.js
|
function(msg, onDone, node, title) {
if(node){
this._commandRegistry.confirmWithButtons(node, msg,[{label:"OK",callback:function(){
onDone(true);
},type:"ok"},{label:"Cancel",callback:function(){
onDone(false);
},type:"cancel"}]);
}else{
var dialog = new mConfirmDialog.ConfirmDialog({
confirmMessage: msg,
title: title || messages.Confirm
});
dialog.show();
var _self = this;
dialog.addEventListener("dismiss", function(event) {
if (event.value === true) {
onDone(true);
}else if(event.value === false){
onDone(false);
}
});
}
}
|
javascript
|
function(msg, onDone, node, title) {
if(node){
this._commandRegistry.confirmWithButtons(node, msg,[{label:"OK",callback:function(){
onDone(true);
},type:"ok"},{label:"Cancel",callback:function(){
onDone(false);
},type:"cancel"}]);
}else{
var dialog = new mConfirmDialog.ConfirmDialog({
confirmMessage: msg,
title: title || messages.Confirm
});
dialog.show();
var _self = this;
dialog.addEventListener("dismiss", function(event) {
if (event.value === true) {
onDone(true);
}else if(event.value === false){
onDone(false);
}
});
}
}
|
[
"function",
"(",
"msg",
",",
"onDone",
",",
"node",
",",
"title",
")",
"{",
"if",
"(",
"node",
")",
"{",
"this",
".",
"_commandRegistry",
".",
"confirmWithButtons",
"(",
"node",
",",
"msg",
",",
"[",
"{",
"label",
":",
"\"OK\"",
",",
"callback",
":",
"function",
"(",
")",
"{",
"onDone",
"(",
"true",
")",
";",
"}",
",",
"type",
":",
"\"ok\"",
"}",
",",
"{",
"label",
":",
"\"Cancel\"",
",",
"callback",
":",
"function",
"(",
")",
"{",
"onDone",
"(",
"false",
")",
";",
"}",
",",
"type",
":",
"\"cancel\"",
"}",
"]",
")",
";",
"}",
"else",
"{",
"var",
"dialog",
"=",
"new",
"mConfirmDialog",
".",
"ConfirmDialog",
"(",
"{",
"confirmMessage",
":",
"msg",
",",
"title",
":",
"title",
"||",
"messages",
".",
"Confirm",
"}",
")",
";",
"dialog",
".",
"show",
"(",
")",
";",
"var",
"_self",
"=",
"this",
";",
"dialog",
".",
"addEventListener",
"(",
"\"dismiss\"",
",",
"function",
"(",
"event",
")",
"{",
"if",
"(",
"event",
".",
"value",
"===",
"true",
")",
"{",
"onDone",
"(",
"true",
")",
";",
"}",
"else",
"if",
"(",
"event",
".",
"value",
"===",
"false",
")",
"{",
"onDone",
"(",
"false",
")",
";",
"}",
"}",
")",
";",
"}",
"}"
] |
Prompts the user for configuration, and executes the provided function when done.
@param {String} message The confirmation message
@param {Function} onDone The function to invoke upon confirmation.
|
[
"Prompts",
"the",
"user",
"for",
"configuration",
"and",
"executes",
"the",
"provided",
"function",
"when",
"done",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/dialogs.js#L35-L57
|
|
14,512
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.collab/web/orion/collab/collabClient.js
|
CollabClient
|
function CollabClient(editor, inputManager, fileClient, serviceRegistry, commandRegistry, preferences) {
mCollabFileCommands.createFileCommands(serviceRegistry, commandRegistry, fileClient);
this.editor = editor;
this.inputManager = inputManager;
this.fileClient = fileClient;
this.preferences = preferences;
this.textView = this.editor.getTextView();
var self = this;
this.collabMode = false;
this.clientId = '';
this.clientDisplayedName = '';
this.fileClient.addEventListener('Changed', self.sendFileOperation.bind(self));
this.serviceRegistry = serviceRegistry;
this.editor.addEventListener('InputContentsSet', function(event) {self.viewInstalled.call(self, event);});
this.editor.addEventListener('TextViewUninstalled', function(event) {self.viewUninstalled.call(self, event);});
this.projectSessionID = '';
this.inputManager.addEventListener('InputChanged', function(e) {
self.onInputChanged(e)
});
this.ot = null;
this.otOrionAdapter = null;
this.otSocketAdapter = null;
this.socketReconnectAttempt = 0;
this.socketIntentionalyClosing = false;
this.socketPingTimeout = 0;
this.awaitingClients = false;
this.collabFileAnnotations = {};
// Timeout id to indicate whether a delayed update has already been assigned
this.collabFileAnnotationsUpdateTimeoutId = 0;
/**
* A map of clientid -> peer
* @type {Object.<string, CollabPeer>}
*/
this.peers = {};
this.editing = false;
this.guid = guid;
// Initialize current project
var file = this.inputManager.getInput();
var metadata = this.inputManager.getFileMetadata();
if (metadata) {
this.onInputChanged({
metadata: metadata,
input: {
resource: file
}
});
}
}
|
javascript
|
function CollabClient(editor, inputManager, fileClient, serviceRegistry, commandRegistry, preferences) {
mCollabFileCommands.createFileCommands(serviceRegistry, commandRegistry, fileClient);
this.editor = editor;
this.inputManager = inputManager;
this.fileClient = fileClient;
this.preferences = preferences;
this.textView = this.editor.getTextView();
var self = this;
this.collabMode = false;
this.clientId = '';
this.clientDisplayedName = '';
this.fileClient.addEventListener('Changed', self.sendFileOperation.bind(self));
this.serviceRegistry = serviceRegistry;
this.editor.addEventListener('InputContentsSet', function(event) {self.viewInstalled.call(self, event);});
this.editor.addEventListener('TextViewUninstalled', function(event) {self.viewUninstalled.call(self, event);});
this.projectSessionID = '';
this.inputManager.addEventListener('InputChanged', function(e) {
self.onInputChanged(e)
});
this.ot = null;
this.otOrionAdapter = null;
this.otSocketAdapter = null;
this.socketReconnectAttempt = 0;
this.socketIntentionalyClosing = false;
this.socketPingTimeout = 0;
this.awaitingClients = false;
this.collabFileAnnotations = {};
// Timeout id to indicate whether a delayed update has already been assigned
this.collabFileAnnotationsUpdateTimeoutId = 0;
/**
* A map of clientid -> peer
* @type {Object.<string, CollabPeer>}
*/
this.peers = {};
this.editing = false;
this.guid = guid;
// Initialize current project
var file = this.inputManager.getInput();
var metadata = this.inputManager.getFileMetadata();
if (metadata) {
this.onInputChanged({
metadata: metadata,
input: {
resource: file
}
});
}
}
|
[
"function",
"CollabClient",
"(",
"editor",
",",
"inputManager",
",",
"fileClient",
",",
"serviceRegistry",
",",
"commandRegistry",
",",
"preferences",
")",
"{",
"mCollabFileCommands",
".",
"createFileCommands",
"(",
"serviceRegistry",
",",
"commandRegistry",
",",
"fileClient",
")",
";",
"this",
".",
"editor",
"=",
"editor",
";",
"this",
".",
"inputManager",
"=",
"inputManager",
";",
"this",
".",
"fileClient",
"=",
"fileClient",
";",
"this",
".",
"preferences",
"=",
"preferences",
";",
"this",
".",
"textView",
"=",
"this",
".",
"editor",
".",
"getTextView",
"(",
")",
";",
"var",
"self",
"=",
"this",
";",
"this",
".",
"collabMode",
"=",
"false",
";",
"this",
".",
"clientId",
"=",
"''",
";",
"this",
".",
"clientDisplayedName",
"=",
"''",
";",
"this",
".",
"fileClient",
".",
"addEventListener",
"(",
"'Changed'",
",",
"self",
".",
"sendFileOperation",
".",
"bind",
"(",
"self",
")",
")",
";",
"this",
".",
"serviceRegistry",
"=",
"serviceRegistry",
";",
"this",
".",
"editor",
".",
"addEventListener",
"(",
"'InputContentsSet'",
",",
"function",
"(",
"event",
")",
"{",
"self",
".",
"viewInstalled",
".",
"call",
"(",
"self",
",",
"event",
")",
";",
"}",
")",
";",
"this",
".",
"editor",
".",
"addEventListener",
"(",
"'TextViewUninstalled'",
",",
"function",
"(",
"event",
")",
"{",
"self",
".",
"viewUninstalled",
".",
"call",
"(",
"self",
",",
"event",
")",
";",
"}",
")",
";",
"this",
".",
"projectSessionID",
"=",
"''",
";",
"this",
".",
"inputManager",
".",
"addEventListener",
"(",
"'InputChanged'",
",",
"function",
"(",
"e",
")",
"{",
"self",
".",
"onInputChanged",
"(",
"e",
")",
"}",
")",
";",
"this",
".",
"ot",
"=",
"null",
";",
"this",
".",
"otOrionAdapter",
"=",
"null",
";",
"this",
".",
"otSocketAdapter",
"=",
"null",
";",
"this",
".",
"socketReconnectAttempt",
"=",
"0",
";",
"this",
".",
"socketIntentionalyClosing",
"=",
"false",
";",
"this",
".",
"socketPingTimeout",
"=",
"0",
";",
"this",
".",
"awaitingClients",
"=",
"false",
";",
"this",
".",
"collabFileAnnotations",
"=",
"{",
"}",
";",
"// Timeout id to indicate whether a delayed update has already been assigned",
"this",
".",
"collabFileAnnotationsUpdateTimeoutId",
"=",
"0",
";",
"/**\n\t\t * A map of clientid -> peer\n\t\t * @type {Object.<string, CollabPeer>}\n\t\t */",
"this",
".",
"peers",
"=",
"{",
"}",
";",
"this",
".",
"editing",
"=",
"false",
";",
"this",
".",
"guid",
"=",
"guid",
";",
"// Initialize current project",
"var",
"file",
"=",
"this",
".",
"inputManager",
".",
"getInput",
"(",
")",
";",
"var",
"metadata",
"=",
"this",
".",
"inputManager",
".",
"getFileMetadata",
"(",
")",
";",
"if",
"(",
"metadata",
")",
"{",
"this",
".",
"onInputChanged",
"(",
"{",
"metadata",
":",
"metadata",
",",
"input",
":",
"{",
"resource",
":",
"file",
"}",
"}",
")",
";",
"}",
"}"
] |
Creates a new collaboration client.
@class
@name orion.collabClient.CollabClient
|
[
"Creates",
"a",
"new",
"collaboration",
"client",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.collab/web/orion/collab/collabClient.js#L61-L108
|
14,513
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.collab/web/orion/collab/collabClient.js
|
function(callback) {
var self = this;
var userService = this.serviceRegistry.getService("orion.core.user");
var authServices = this.serviceRegistry.getServiceReferences("orion.core.auth");
var authService = this.serviceRegistry.getService(authServices[0]);
authService.getUser().then(function(jsonData) {
userService.getUserInfo(contextPath + jsonData.Location).then(function(accountData) {
var username = accountData.UserName;
self.clientDisplayedName = accountData.FullName || username;
var MASK = 0xFFFFFF + 1;
var MAGIC = 161803398 / 2 % MASK;
self.clientId = username + '.' + guid.substr(0, 4);
callback();
}, function(err) {
console.error(err);
});
});
}
|
javascript
|
function(callback) {
var self = this;
var userService = this.serviceRegistry.getService("orion.core.user");
var authServices = this.serviceRegistry.getServiceReferences("orion.core.auth");
var authService = this.serviceRegistry.getService(authServices[0]);
authService.getUser().then(function(jsonData) {
userService.getUserInfo(contextPath + jsonData.Location).then(function(accountData) {
var username = accountData.UserName;
self.clientDisplayedName = accountData.FullName || username;
var MASK = 0xFFFFFF + 1;
var MAGIC = 161803398 / 2 % MASK;
self.clientId = username + '.' + guid.substr(0, 4);
callback();
}, function(err) {
console.error(err);
});
});
}
|
[
"function",
"(",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"userService",
"=",
"this",
".",
"serviceRegistry",
".",
"getService",
"(",
"\"orion.core.user\"",
")",
";",
"var",
"authServices",
"=",
"this",
".",
"serviceRegistry",
".",
"getServiceReferences",
"(",
"\"orion.core.auth\"",
")",
";",
"var",
"authService",
"=",
"this",
".",
"serviceRegistry",
".",
"getService",
"(",
"authServices",
"[",
"0",
"]",
")",
";",
"authService",
".",
"getUser",
"(",
")",
".",
"then",
"(",
"function",
"(",
"jsonData",
")",
"{",
"userService",
".",
"getUserInfo",
"(",
"contextPath",
"+",
"jsonData",
".",
"Location",
")",
".",
"then",
"(",
"function",
"(",
"accountData",
")",
"{",
"var",
"username",
"=",
"accountData",
".",
"UserName",
";",
"self",
".",
"clientDisplayedName",
"=",
"accountData",
".",
"FullName",
"||",
"username",
";",
"var",
"MASK",
"=",
"0xFFFFFF",
"+",
"1",
";",
"var",
"MAGIC",
"=",
"161803398",
"/",
"2",
"%",
"MASK",
";",
"self",
".",
"clientId",
"=",
"username",
"+",
"'.'",
"+",
"guid",
".",
"substr",
"(",
"0",
",",
"4",
")",
";",
"callback",
"(",
")",
";",
"}",
",",
"function",
"(",
"err",
")",
"{",
"console",
".",
"error",
"(",
"err",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}"
] |
Initialize client name and id
@param {function} callback
|
[
"Initialize",
"client",
"name",
"and",
"id"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.collab/web/orion/collab/collabClient.js#L132-L149
|
|
14,514
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.collab/web/orion/collab/collabClient.js
|
function(e) {
this.location = e.input.resource;
this.updateSelfFileAnnotation();
this.destroyOT();
this.sendCurrentLocation();
if (e.metadata.Attributes) {
var projectSessionID = e.metadata.Attributes.hubID;
if (this.projectSessionID !== projectSessionID) {
this.projectSessionID = projectSessionID;
this.projectChanged(projectSessionID);
}
}
}
|
javascript
|
function(e) {
this.location = e.input.resource;
this.updateSelfFileAnnotation();
this.destroyOT();
this.sendCurrentLocation();
if (e.metadata.Attributes) {
var projectSessionID = e.metadata.Attributes.hubID;
if (this.projectSessionID !== projectSessionID) {
this.projectSessionID = projectSessionID;
this.projectChanged(projectSessionID);
}
}
}
|
[
"function",
"(",
"e",
")",
"{",
"this",
".",
"location",
"=",
"e",
".",
"input",
".",
"resource",
";",
"this",
".",
"updateSelfFileAnnotation",
"(",
")",
";",
"this",
".",
"destroyOT",
"(",
")",
";",
"this",
".",
"sendCurrentLocation",
"(",
")",
";",
"if",
"(",
"e",
".",
"metadata",
".",
"Attributes",
")",
"{",
"var",
"projectSessionID",
"=",
"e",
".",
"metadata",
".",
"Attributes",
".",
"hubID",
";",
"if",
"(",
"this",
".",
"projectSessionID",
"!==",
"projectSessionID",
")",
"{",
"this",
".",
"projectSessionID",
"=",
"projectSessionID",
";",
"this",
".",
"projectChanged",
"(",
"projectSessionID",
")",
";",
"}",
"}",
"}"
] |
Input changed handler
|
[
"Input",
"changed",
"handler"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.collab/web/orion/collab/collabClient.js#L154-L166
|
|
14,515
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.collab/web/orion/collab/collabClient.js
|
function(clientId, contextP, url, editing) {
var peer = this.getPeer(clientId);
// Peer might be loading. Once it is loaded, this annotation will be automatically updated,
// so we can safely leave it blank.
var name = (peer && peer.name) ? peer.name : 'Unknown';
var color = (peer && peer.color) ? peer.color : '#000000';
if (url) {
url = contextP + this.getFileSystemPrefix() + url;
}
this.collabFileAnnotations[clientId] = new CollabFileAnnotation(name, color, url, this.projectRelativeLocation(url), editing);
this._requestFileAnnotationUpdate();
}
|
javascript
|
function(clientId, contextP, url, editing) {
var peer = this.getPeer(clientId);
// Peer might be loading. Once it is loaded, this annotation will be automatically updated,
// so we can safely leave it blank.
var name = (peer && peer.name) ? peer.name : 'Unknown';
var color = (peer && peer.color) ? peer.color : '#000000';
if (url) {
url = contextP + this.getFileSystemPrefix() + url;
}
this.collabFileAnnotations[clientId] = new CollabFileAnnotation(name, color, url, this.projectRelativeLocation(url), editing);
this._requestFileAnnotationUpdate();
}
|
[
"function",
"(",
"clientId",
",",
"contextP",
",",
"url",
",",
"editing",
")",
"{",
"var",
"peer",
"=",
"this",
".",
"getPeer",
"(",
"clientId",
")",
";",
"// Peer might be loading. Once it is loaded, this annotation will be automatically updated,",
"// so we can safely leave it blank.",
"var",
"name",
"=",
"(",
"peer",
"&&",
"peer",
".",
"name",
")",
"?",
"peer",
".",
"name",
":",
"'Unknown'",
";",
"var",
"color",
"=",
"(",
"peer",
"&&",
"peer",
".",
"color",
")",
"?",
"peer",
".",
"color",
":",
"'#000000'",
";",
"if",
"(",
"url",
")",
"{",
"url",
"=",
"contextP",
"+",
"this",
".",
"getFileSystemPrefix",
"(",
")",
"+",
"url",
";",
"}",
"this",
".",
"collabFileAnnotations",
"[",
"clientId",
"]",
"=",
"new",
"CollabFileAnnotation",
"(",
"name",
",",
"color",
",",
"url",
",",
"this",
".",
"projectRelativeLocation",
"(",
"url",
")",
",",
"editing",
")",
";",
"this",
".",
"_requestFileAnnotationUpdate",
"(",
")",
";",
"}"
] |
Add or update a record of collaborator file annotation and request to update UI
@param {string} clientId
@param {string} url
@param {boolean} editing
|
[
"Add",
"or",
"update",
"a",
"record",
"of",
"collaborator",
"file",
"annotation",
"and",
"request",
"to",
"update",
"UI"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.collab/web/orion/collab/collabClient.js#L192-L203
|
|
14,516
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.collab/web/orion/collab/collabClient.js
|
function() {
var self = this;
if (!this.collabFileAnnotationsUpdateTimeoutId) {
// No delayed update is assigned. Assign one.
// This is necessary because we don't want duplicate UI action within a short period.
this.collabFileAnnotationsUpdateTimeoutId = setTimeout(function() {
self.collabFileAnnotationsUpdateTimeoutId = 0;
var annotations = [];
var editingFileUsers = {}; // map from location to list of usernames indicating all users that are typing on this file
for (var key in self.collabFileAnnotations) {
if (self.collabFileAnnotations.hasOwnProperty(key)) {
var annotation = self.collabFileAnnotations[key];
annotations.push(annotation);
if (annotation.editing) {
if (!editingFileUsers[annotation.location]) {
editingFileUsers[annotation.location] = [];
}
editingFileUsers[annotation.location].push(annotation.name);
}
}
}
// Add editing annotations
for (var location in editingFileUsers) {
if (editingFileUsers.hasOwnProperty(location)) {
annotations.push(new CollabFileEditingAnnotation(location, editingFileUsers[location]));
}
}
self.fileClient.dispatchEvent({
type: 'AnnotationChanged',
removeTypes: [CollabFileAnnotation],
annotations: annotations
});
}, COLLABORATOR_ANNOTATION_UPDATE_DELAY);
}
}
|
javascript
|
function() {
var self = this;
if (!this.collabFileAnnotationsUpdateTimeoutId) {
// No delayed update is assigned. Assign one.
// This is necessary because we don't want duplicate UI action within a short period.
this.collabFileAnnotationsUpdateTimeoutId = setTimeout(function() {
self.collabFileAnnotationsUpdateTimeoutId = 0;
var annotations = [];
var editingFileUsers = {}; // map from location to list of usernames indicating all users that are typing on this file
for (var key in self.collabFileAnnotations) {
if (self.collabFileAnnotations.hasOwnProperty(key)) {
var annotation = self.collabFileAnnotations[key];
annotations.push(annotation);
if (annotation.editing) {
if (!editingFileUsers[annotation.location]) {
editingFileUsers[annotation.location] = [];
}
editingFileUsers[annotation.location].push(annotation.name);
}
}
}
// Add editing annotations
for (var location in editingFileUsers) {
if (editingFileUsers.hasOwnProperty(location)) {
annotations.push(new CollabFileEditingAnnotation(location, editingFileUsers[location]));
}
}
self.fileClient.dispatchEvent({
type: 'AnnotationChanged',
removeTypes: [CollabFileAnnotation],
annotations: annotations
});
}, COLLABORATOR_ANNOTATION_UPDATE_DELAY);
}
}
|
[
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"!",
"this",
".",
"collabFileAnnotationsUpdateTimeoutId",
")",
"{",
"// No delayed update is assigned. Assign one.",
"// This is necessary because we don't want duplicate UI action within a short period.",
"this",
".",
"collabFileAnnotationsUpdateTimeoutId",
"=",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"self",
".",
"collabFileAnnotationsUpdateTimeoutId",
"=",
"0",
";",
"var",
"annotations",
"=",
"[",
"]",
";",
"var",
"editingFileUsers",
"=",
"{",
"}",
";",
"// map from location to list of usernames indicating all users that are typing on this file",
"for",
"(",
"var",
"key",
"in",
"self",
".",
"collabFileAnnotations",
")",
"{",
"if",
"(",
"self",
".",
"collabFileAnnotations",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"var",
"annotation",
"=",
"self",
".",
"collabFileAnnotations",
"[",
"key",
"]",
";",
"annotations",
".",
"push",
"(",
"annotation",
")",
";",
"if",
"(",
"annotation",
".",
"editing",
")",
"{",
"if",
"(",
"!",
"editingFileUsers",
"[",
"annotation",
".",
"location",
"]",
")",
"{",
"editingFileUsers",
"[",
"annotation",
".",
"location",
"]",
"=",
"[",
"]",
";",
"}",
"editingFileUsers",
"[",
"annotation",
".",
"location",
"]",
".",
"push",
"(",
"annotation",
".",
"name",
")",
";",
"}",
"}",
"}",
"// Add editing annotations",
"for",
"(",
"var",
"location",
"in",
"editingFileUsers",
")",
"{",
"if",
"(",
"editingFileUsers",
".",
"hasOwnProperty",
"(",
"location",
")",
")",
"{",
"annotations",
".",
"push",
"(",
"new",
"CollabFileEditingAnnotation",
"(",
"location",
",",
"editingFileUsers",
"[",
"location",
"]",
")",
")",
";",
"}",
"}",
"self",
".",
"fileClient",
".",
"dispatchEvent",
"(",
"{",
"type",
":",
"'AnnotationChanged'",
",",
"removeTypes",
":",
"[",
"CollabFileAnnotation",
"]",
",",
"annotations",
":",
"annotations",
"}",
")",
";",
"}",
",",
"COLLABORATOR_ANNOTATION_UPDATE_DELAY",
")",
";",
"}",
"}"
] |
Request a file annotation UI update
|
[
"Request",
"a",
"file",
"annotation",
"UI",
"update"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.collab/web/orion/collab/collabClient.js#L220-L254
|
|
14,517
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.collab/web/orion/collab/collabClient.js
|
function(peer) {
if (this.peers[peer.id]) {
// Update
this.peers[peer.id] = peer;
} else {
// Add
this.peers[peer.id] = peer;
}
if (this.collabHasFileAnnotation(peer.id)) {
var annotation = this.getCollabFileAnnotation(peer.id);
this.addOrUpdateCollabFileAnnotation(peer.id, contextPath, annotation.location);
}
if (this.otOrionAdapter && this.textView) {
// Make sure we have view installed
this.otOrionAdapter.updateLineAnnotationStyle(peer.id);
}
}
|
javascript
|
function(peer) {
if (this.peers[peer.id]) {
// Update
this.peers[peer.id] = peer;
} else {
// Add
this.peers[peer.id] = peer;
}
if (this.collabHasFileAnnotation(peer.id)) {
var annotation = this.getCollabFileAnnotation(peer.id);
this.addOrUpdateCollabFileAnnotation(peer.id, contextPath, annotation.location);
}
if (this.otOrionAdapter && this.textView) {
// Make sure we have view installed
this.otOrionAdapter.updateLineAnnotationStyle(peer.id);
}
}
|
[
"function",
"(",
"peer",
")",
"{",
"if",
"(",
"this",
".",
"peers",
"[",
"peer",
".",
"id",
"]",
")",
"{",
"// Update",
"this",
".",
"peers",
"[",
"peer",
".",
"id",
"]",
"=",
"peer",
";",
"}",
"else",
"{",
"// Add",
"this",
".",
"peers",
"[",
"peer",
".",
"id",
"]",
"=",
"peer",
";",
"}",
"if",
"(",
"this",
".",
"collabHasFileAnnotation",
"(",
"peer",
".",
"id",
")",
")",
"{",
"var",
"annotation",
"=",
"this",
".",
"getCollabFileAnnotation",
"(",
"peer",
".",
"id",
")",
";",
"this",
".",
"addOrUpdateCollabFileAnnotation",
"(",
"peer",
".",
"id",
",",
"contextPath",
",",
"annotation",
".",
"location",
")",
";",
"}",
"if",
"(",
"this",
".",
"otOrionAdapter",
"&&",
"this",
".",
"textView",
")",
"{",
"// Make sure we have view installed",
"this",
".",
"otOrionAdapter",
".",
"updateLineAnnotationStyle",
"(",
"peer",
".",
"id",
")",
";",
"}",
"}"
] |
Add or update peer record
@param {CollabPeer} peer -
|
[
"Add",
"or",
"update",
"peer",
"record"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.collab/web/orion/collab/collabClient.js#L288-L304
|
|
14,518
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/inputManager.js
|
function(syntaxChecker, timeout) {
var time = timeout;
if (!syntaxChecker){
time = -1;
}
this._autoSyntaxEnabled = time !== -1;
this._autoSyntaxActive = false;
if (!this._idle2) {
var options = {
document: document,
timeout: time
};
this._idle2 = new Idle(options);
this._idle2.addEventListener("Idle", function () { //$NON-NLS-0$
if (this.editor){
this._autoSyntaxActive = true;
if (this.editor._isSyntaxCheckRequired()){
syntaxChecker();
this.editor._setSyntaxCheckRequired(false);
this._autoSyntaxActive = false;
}
}
}.bind(this));
} else {
this._idle2.setTimeout(time);
}
}
|
javascript
|
function(syntaxChecker, timeout) {
var time = timeout;
if (!syntaxChecker){
time = -1;
}
this._autoSyntaxEnabled = time !== -1;
this._autoSyntaxActive = false;
if (!this._idle2) {
var options = {
document: document,
timeout: time
};
this._idle2 = new Idle(options);
this._idle2.addEventListener("Idle", function () { //$NON-NLS-0$
if (this.editor){
this._autoSyntaxActive = true;
if (this.editor._isSyntaxCheckRequired()){
syntaxChecker();
this.editor._setSyntaxCheckRequired(false);
this._autoSyntaxActive = false;
}
}
}.bind(this));
} else {
this._idle2.setTimeout(time);
}
}
|
[
"function",
"(",
"syntaxChecker",
",",
"timeout",
")",
"{",
"var",
"time",
"=",
"timeout",
";",
"if",
"(",
"!",
"syntaxChecker",
")",
"{",
"time",
"=",
"-",
"1",
";",
"}",
"this",
".",
"_autoSyntaxEnabled",
"=",
"time",
"!==",
"-",
"1",
";",
"this",
".",
"_autoSyntaxActive",
"=",
"false",
";",
"if",
"(",
"!",
"this",
".",
"_idle2",
")",
"{",
"var",
"options",
"=",
"{",
"document",
":",
"document",
",",
"timeout",
":",
"time",
"}",
";",
"this",
".",
"_idle2",
"=",
"new",
"Idle",
"(",
"options",
")",
";",
"this",
".",
"_idle2",
".",
"addEventListener",
"(",
"\"Idle\"",
",",
"function",
"(",
")",
"{",
"//$NON-NLS-0$\r",
"if",
"(",
"this",
".",
"editor",
")",
"{",
"this",
".",
"_autoSyntaxActive",
"=",
"true",
";",
"if",
"(",
"this",
".",
"editor",
".",
"_isSyntaxCheckRequired",
"(",
")",
")",
"{",
"syntaxChecker",
"(",
")",
";",
"this",
".",
"editor",
".",
"_setSyntaxCheckRequired",
"(",
"false",
")",
";",
"this",
".",
"_autoSyntaxActive",
"=",
"false",
";",
"}",
"}",
"}",
".",
"bind",
"(",
"this",
")",
")",
";",
"}",
"else",
"{",
"this",
".",
"_idle2",
".",
"setTimeout",
"(",
"time",
")",
";",
"}",
"}"
] |
Set the auto syntax check timeout. Recommended this is only set when autosave is turned off
because save operations will already run the syntax checker.
@param syntaxChecker {Function} Function that will execute the syntax check
@param timeout {Number} How long to idle before syntax checking in milliseconds, -1 to disable
|
[
"Set",
"the",
"auto",
"syntax",
"check",
"timeout",
".",
"Recommended",
"this",
"is",
"only",
"set",
"when",
"autosave",
"is",
"turned",
"off",
"because",
"save",
"operations",
"will",
"already",
"run",
"the",
"syntax",
"checker",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/inputManager.js#L543-L569
|
|
14,519
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.core/web/orion/bidiUtils.js
|
getBidiLayout
|
function getBidiLayout() {
var _bidiLayout = localStorage.getItem(bidiLayoutStorage);
if (_bidiLayout && (_bidiLayout === "rtl" || _bidiLayout === "ltr" || _bidiLayout === "auto")) { //$NON-NLS-0$ //$NON-NLS-1$ //$NON-NLS-2$
return _bidiLayout;
}
return "ltr"; //$NON-NLS-0$
}
|
javascript
|
function getBidiLayout() {
var _bidiLayout = localStorage.getItem(bidiLayoutStorage);
if (_bidiLayout && (_bidiLayout === "rtl" || _bidiLayout === "ltr" || _bidiLayout === "auto")) { //$NON-NLS-0$ //$NON-NLS-1$ //$NON-NLS-2$
return _bidiLayout;
}
return "ltr"; //$NON-NLS-0$
}
|
[
"function",
"getBidiLayout",
"(",
")",
"{",
"var",
"_bidiLayout",
"=",
"localStorage",
".",
"getItem",
"(",
"bidiLayoutStorage",
")",
";",
"if",
"(",
"_bidiLayout",
"&&",
"(",
"_bidiLayout",
"===",
"\"rtl\"",
"||",
"_bidiLayout",
"===",
"\"ltr\"",
"||",
"_bidiLayout",
"===",
"\"auto\"",
")",
")",
"{",
"//$NON-NLS-0$ //$NON-NLS-1$ //$NON-NLS-2$",
"return",
"_bidiLayout",
";",
"}",
"return",
"\"ltr\"",
";",
"//$NON-NLS-0$",
"}"
] |
returns bidiLayout value set in globalization settings.
@returns {String} text direction.
|
[
"returns",
"bidiLayout",
"value",
"set",
"in",
"globalization",
"settings",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.core/web/orion/bidiUtils.js#L61-L67
|
14,520
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.core/web/orion/bidiUtils.js
|
getTextDirection
|
function getTextDirection(text) {
bidiLayout = getBidiLayout();
if (!isBidiEnabled()) {
return "";
}
if (bidiLayout === "auto" && util.isIE) { //$NON-NLS-0$
return checkContextual(text);
}
return bidiLayout;
}
|
javascript
|
function getTextDirection(text) {
bidiLayout = getBidiLayout();
if (!isBidiEnabled()) {
return "";
}
if (bidiLayout === "auto" && util.isIE) { //$NON-NLS-0$
return checkContextual(text);
}
return bidiLayout;
}
|
[
"function",
"getTextDirection",
"(",
"text",
")",
"{",
"bidiLayout",
"=",
"getBidiLayout",
"(",
")",
";",
"if",
"(",
"!",
"isBidiEnabled",
"(",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"if",
"(",
"bidiLayout",
"===",
"\"auto\"",
"&&",
"util",
".",
"isIE",
")",
"{",
"//$NON-NLS-0$",
"return",
"checkContextual",
"(",
"text",
")",
";",
"}",
"return",
"bidiLayout",
";",
"}"
] |
returns text direction.
this method is used for handling direction by adding a dir attribute in an HTML element.
if bidiLayout is set to ltr > return ltr
if bidiLayout is set to rtl > return rtl
if bidiLayout is set to auto > check for first strong character in text and return ltr or rtl accordingly.
@param {String} the text on which to set directionality
@returns {String} text direction. rtl or ltr.
|
[
"returns",
"text",
"direction",
".",
"this",
"method",
"is",
"used",
"for",
"handling",
"direction",
"by",
"adding",
"a",
"dir",
"attribute",
"in",
"an",
"HTML",
"element",
".",
"if",
"bidiLayout",
"is",
"set",
"to",
"ltr",
">",
"return",
"ltr",
"if",
"bidiLayout",
"is",
"set",
"to",
"rtl",
">",
"return",
"rtl",
"if",
"bidiLayout",
"is",
"set",
"to",
"auto",
">",
"check",
"for",
"first",
"strong",
"character",
"in",
"text",
"and",
"return",
"ltr",
"or",
"rtl",
"accordingly",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.core/web/orion/bidiUtils.js#L78-L87
|
14,521
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/beautifier/lib/beautify-css.js
|
foundNestedPseudoClass
|
function foundNestedPseudoClass() {
var openParen = 0;
for (var i = pos + 1; i < source_text.length; i++) {
var ch = source_text.charAt(i);
if (ch === "{") {
return true;
} else if (ch === '(') {
// pseudoclasses can contain ()
openParen += 1;
} else if (ch === ')') {
if (openParen === 0) {
return false;
}
openParen -= 1;
} else if (ch === ";" || ch === "}") {
return false;
}
}
return false;
}
|
javascript
|
function foundNestedPseudoClass() {
var openParen = 0;
for (var i = pos + 1; i < source_text.length; i++) {
var ch = source_text.charAt(i);
if (ch === "{") {
return true;
} else if (ch === '(') {
// pseudoclasses can contain ()
openParen += 1;
} else if (ch === ')') {
if (openParen === 0) {
return false;
}
openParen -= 1;
} else if (ch === ";" || ch === "}") {
return false;
}
}
return false;
}
|
[
"function",
"foundNestedPseudoClass",
"(",
")",
"{",
"var",
"openParen",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"pos",
"+",
"1",
";",
"i",
"<",
"source_text",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"ch",
"=",
"source_text",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"ch",
"===",
"\"{\"",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"ch",
"===",
"'('",
")",
"{",
"// pseudoclasses can contain ()",
"openParen",
"+=",
"1",
";",
"}",
"else",
"if",
"(",
"ch",
"===",
"')'",
")",
"{",
"if",
"(",
"openParen",
"===",
"0",
")",
"{",
"return",
"false",
";",
"}",
"openParen",
"-=",
"1",
";",
"}",
"else",
"if",
"(",
"ch",
"===",
"\";\"",
"||",
"ch",
"===",
"\"}\"",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Nested pseudo-class if we are insideRule and the next special character found opens a new block
|
[
"Nested",
"pseudo",
"-",
"class",
"if",
"we",
"are",
"insideRule",
"and",
"the",
"next",
"special",
"character",
"found",
"opens",
"a",
"new",
"block"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/beautifier/lib/beautify-css.js#L184-L203
|
14,522
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/urlUtils.js
|
processURLSegments
|
function processURLSegments(parentNode, segments) {
segments.forEach(function(segment) {
if (segment.urlStr){
var link = document.createElement("a"); //$NON-NLS-0$
link.href = segment.urlStr;
link.appendChild(document.createTextNode(segment.segmentStr));
link.dir = bidiUtils.getTextDirection(segment.segmentStr);
parentNode.appendChild(link);
} else {
var plainText = document.createElement("span"); //$NON-NLS-0$
plainText.textContent = segment.segmentStr;
plainText.dir = bidiUtils.getTextDirection(segment.segmentStr);
parentNode.appendChild(plainText);
}
});
}
|
javascript
|
function processURLSegments(parentNode, segments) {
segments.forEach(function(segment) {
if (segment.urlStr){
var link = document.createElement("a"); //$NON-NLS-0$
link.href = segment.urlStr;
link.appendChild(document.createTextNode(segment.segmentStr));
link.dir = bidiUtils.getTextDirection(segment.segmentStr);
parentNode.appendChild(link);
} else {
var plainText = document.createElement("span"); //$NON-NLS-0$
plainText.textContent = segment.segmentStr;
plainText.dir = bidiUtils.getTextDirection(segment.segmentStr);
parentNode.appendChild(plainText);
}
});
}
|
[
"function",
"processURLSegments",
"(",
"parentNode",
",",
"segments",
")",
"{",
"segments",
".",
"forEach",
"(",
"function",
"(",
"segment",
")",
"{",
"if",
"(",
"segment",
".",
"urlStr",
")",
"{",
"var",
"link",
"=",
"document",
".",
"createElement",
"(",
"\"a\"",
")",
";",
"//$NON-NLS-0$",
"link",
".",
"href",
"=",
"segment",
".",
"urlStr",
";",
"link",
".",
"appendChild",
"(",
"document",
".",
"createTextNode",
"(",
"segment",
".",
"segmentStr",
")",
")",
";",
"link",
".",
"dir",
"=",
"bidiUtils",
".",
"getTextDirection",
"(",
"segment",
".",
"segmentStr",
")",
";",
"parentNode",
".",
"appendChild",
"(",
"link",
")",
";",
"}",
"else",
"{",
"var",
"plainText",
"=",
"document",
".",
"createElement",
"(",
"\"span\"",
")",
";",
"//$NON-NLS-0$",
"plainText",
".",
"textContent",
"=",
"segment",
".",
"segmentStr",
";",
"plainText",
".",
"dir",
"=",
"bidiUtils",
".",
"getTextDirection",
"(",
"segment",
".",
"segmentStr",
")",
";",
"parentNode",
".",
"appendChild",
"(",
"plainText",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Render an array of string segments.
@param {dom node} parentNode The given parent dom node where the segments will be rendered.
@param {orion.urlUtils.Segment[]} segments The given array containing all the segments.
|
[
"Render",
"an",
"array",
"of",
"string",
"segments",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/urlUtils.js#L63-L78
|
14,523
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/littlelib.js
|
empty
|
function empty(node) {
while (node && node.hasChildNodes()) {
var child = node.firstChild;
node.removeChild(child);
}
}
|
javascript
|
function empty(node) {
while (node && node.hasChildNodes()) {
var child = node.firstChild;
node.removeChild(child);
}
}
|
[
"function",
"empty",
"(",
"node",
")",
"{",
"while",
"(",
"node",
"&&",
"node",
".",
"hasChildNodes",
"(",
")",
")",
"{",
"var",
"child",
"=",
"node",
".",
"firstChild",
";",
"node",
".",
"removeChild",
"(",
"child",
")",
";",
"}",
"}"
] |
Removes all children of the given node.
@name orion.webui.littlelib.empty
@function
@static
@param {Node} node
|
[
"Removes",
"all",
"children",
"of",
"the",
"given",
"node",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/littlelib.js#L143-L148
|
14,524
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/littlelib.js
|
onclick
|
function onclick(event) {
autoDismissNodes.forEach(function(autoDismissNode) {
var excludeNodeInDocument = false;
var excluded = autoDismissNode.excludeNodes.some(function(excludeNode) {
if(document.body.contains(excludeNode)) {
excludeNodeInDocument = true;
return excludeNode.contains(event.target);
}
return false;
});
if (excludeNodeInDocument && !excluded) {
try {
autoDismissNode.dismiss(event);
} catch (e) {
if (typeof console !== "undefined" && console) { //$NON-NLS-0$
console.error(e && e.message);
}
}
}
});
autoDismissNodes = autoDismissNodes.filter(function(autoDismissNode) {
// true if at least one excludeNode is in document.body
return autoDismissNode.excludeNodes.some(function(excludeNode) {
return document.body.contains(excludeNode);
});
});
}
|
javascript
|
function onclick(event) {
autoDismissNodes.forEach(function(autoDismissNode) {
var excludeNodeInDocument = false;
var excluded = autoDismissNode.excludeNodes.some(function(excludeNode) {
if(document.body.contains(excludeNode)) {
excludeNodeInDocument = true;
return excludeNode.contains(event.target);
}
return false;
});
if (excludeNodeInDocument && !excluded) {
try {
autoDismissNode.dismiss(event);
} catch (e) {
if (typeof console !== "undefined" && console) { //$NON-NLS-0$
console.error(e && e.message);
}
}
}
});
autoDismissNodes = autoDismissNodes.filter(function(autoDismissNode) {
// true if at least one excludeNode is in document.body
return autoDismissNode.excludeNodes.some(function(excludeNode) {
return document.body.contains(excludeNode);
});
});
}
|
[
"function",
"onclick",
"(",
"event",
")",
"{",
"autoDismissNodes",
".",
"forEach",
"(",
"function",
"(",
"autoDismissNode",
")",
"{",
"var",
"excludeNodeInDocument",
"=",
"false",
";",
"var",
"excluded",
"=",
"autoDismissNode",
".",
"excludeNodes",
".",
"some",
"(",
"function",
"(",
"excludeNode",
")",
"{",
"if",
"(",
"document",
".",
"body",
".",
"contains",
"(",
"excludeNode",
")",
")",
"{",
"excludeNodeInDocument",
"=",
"true",
";",
"return",
"excludeNode",
".",
"contains",
"(",
"event",
".",
"target",
")",
";",
"}",
"return",
"false",
";",
"}",
")",
";",
"if",
"(",
"excludeNodeInDocument",
"&&",
"!",
"excluded",
")",
"{",
"try",
"{",
"autoDismissNode",
".",
"dismiss",
"(",
"event",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"if",
"(",
"typeof",
"console",
"!==",
"\"undefined\"",
"&&",
"console",
")",
"{",
"//$NON-NLS-0$\r",
"console",
".",
"error",
"(",
"e",
"&&",
"e",
".",
"message",
")",
";",
"}",
"}",
"}",
"}",
")",
";",
"autoDismissNodes",
"=",
"autoDismissNodes",
".",
"filter",
"(",
"function",
"(",
"autoDismissNode",
")",
"{",
"// true if at least one excludeNode is in document.body\r",
"return",
"autoDismissNode",
".",
"excludeNodes",
".",
"some",
"(",
"function",
"(",
"excludeNode",
")",
"{",
"return",
"document",
".",
"body",
".",
"contains",
"(",
"excludeNode",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}"
] |
auto dismissal. Click anywhere else means close.
|
[
"auto",
"dismissal",
".",
"Click",
"anywhere",
"else",
"means",
"close",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/littlelib.js#L396-L422
|
14,525
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/littlelib.js
|
getOffsetParent
|
function getOffsetParent(node) {
var offsetParent = node.parentNode, documentElement = document.documentElement;
while (offsetParent && offsetParent !== documentElement) {
var style = window.getComputedStyle(offsetParent, null);
if (!style) { break; }
var overflow = style.getPropertyValue("overflow-y"); //$NON-NLS-0$
if (overflow === "auto" || overflow === "scroll") { break; } //$NON-NLS-1$ //$NON-NLS-0$
offsetParent = offsetParent.parentNode;
}
return offsetParent;
}
|
javascript
|
function getOffsetParent(node) {
var offsetParent = node.parentNode, documentElement = document.documentElement;
while (offsetParent && offsetParent !== documentElement) {
var style = window.getComputedStyle(offsetParent, null);
if (!style) { break; }
var overflow = style.getPropertyValue("overflow-y"); //$NON-NLS-0$
if (overflow === "auto" || overflow === "scroll") { break; } //$NON-NLS-1$ //$NON-NLS-0$
offsetParent = offsetParent.parentNode;
}
return offsetParent;
}
|
[
"function",
"getOffsetParent",
"(",
"node",
")",
"{",
"var",
"offsetParent",
"=",
"node",
".",
"parentNode",
",",
"documentElement",
"=",
"document",
".",
"documentElement",
";",
"while",
"(",
"offsetParent",
"&&",
"offsetParent",
"!==",
"documentElement",
")",
"{",
"var",
"style",
"=",
"window",
".",
"getComputedStyle",
"(",
"offsetParent",
",",
"null",
")",
";",
"if",
"(",
"!",
"style",
")",
"{",
"break",
";",
"}",
"var",
"overflow",
"=",
"style",
".",
"getPropertyValue",
"(",
"\"overflow-y\"",
")",
";",
"//$NON-NLS-0$\r",
"if",
"(",
"overflow",
"===",
"\"auto\"",
"||",
"overflow",
"===",
"\"scroll\"",
")",
"{",
"break",
";",
"}",
"//$NON-NLS-1$ //$NON-NLS-0$\r",
"offsetParent",
"=",
"offsetParent",
".",
"parentNode",
";",
"}",
"return",
"offsetParent",
";",
"}"
] |
Returns the parent of the node that has the vertical scroll bar.
@name orion.webui.littlelib.getOffsetParent
@function
@static
@param {Element} node The node to lookup the offset parent
|
[
"Returns",
"the",
"parent",
"of",
"the",
"node",
"that",
"has",
"the",
"vertical",
"scroll",
"bar",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/littlelib.js#L466-L476
|
14,526
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/littlelib.js
|
stop
|
function stop(event) {
if (window.document.all) {
event.keyCode = 0;
}
if (event.preventDefault) {
event.preventDefault();
event.stopPropagation();
}
}
|
javascript
|
function stop(event) {
if (window.document.all) {
event.keyCode = 0;
}
if (event.preventDefault) {
event.preventDefault();
event.stopPropagation();
}
}
|
[
"function",
"stop",
"(",
"event",
")",
"{",
"if",
"(",
"window",
".",
"document",
".",
"all",
")",
"{",
"event",
".",
"keyCode",
"=",
"0",
";",
"}",
"if",
"(",
"event",
".",
"preventDefault",
")",
"{",
"event",
".",
"preventDefault",
"(",
")",
";",
"event",
".",
"stopPropagation",
"(",
")",
";",
"}",
"}"
] |
Cancels the default behavior of an event and stops its propagation.
@name orion.webui.littlelib.stop
@function
@static
@param {Event} event
|
[
"Cancels",
"the",
"default",
"behavior",
"of",
"an",
"event",
"and",
"stops",
"its",
"propagation",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/littlelib.js#L529-L537
|
14,527
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/littlelib.js
|
createNodes
|
function createNodes(templateString, parentNode) {
var parent = parentNode;
var newNodes = null;
if (undefined === parent) {
parent = document.createElement("div"); //$NON-NLS-0$
}
parent.innerHTML = templateString;
if (parent.children.length > 1) {
newNodes = parent.children;
} else {
newNodes = parent.firstChild;
}
return newNodes;
}
|
javascript
|
function createNodes(templateString, parentNode) {
var parent = parentNode;
var newNodes = null;
if (undefined === parent) {
parent = document.createElement("div"); //$NON-NLS-0$
}
parent.innerHTML = templateString;
if (parent.children.length > 1) {
newNodes = parent.children;
} else {
newNodes = parent.firstChild;
}
return newNodes;
}
|
[
"function",
"createNodes",
"(",
"templateString",
",",
"parentNode",
")",
"{",
"var",
"parent",
"=",
"parentNode",
";",
"var",
"newNodes",
"=",
"null",
";",
"if",
"(",
"undefined",
"===",
"parent",
")",
"{",
"parent",
"=",
"document",
".",
"createElement",
"(",
"\"div\"",
")",
";",
"//$NON-NLS-0$\r",
"}",
"parent",
".",
"innerHTML",
"=",
"templateString",
";",
"if",
"(",
"parent",
".",
"children",
".",
"length",
">",
"1",
")",
"{",
"newNodes",
"=",
"parent",
".",
"children",
";",
"}",
"else",
"{",
"newNodes",
"=",
"parent",
".",
"firstChild",
";",
"}",
"return",
"newNodes",
";",
"}"
] |
Creates DOM nodes from the specified template string.
@param {String} templateString A string containing the HTML template to use
@param {Node} parentNode Optional. The parent node to insert the new nodes into.
The parent's contents will be completely replaced.
@returns If the template string contains a single node or a wrapper node which
wraps all the other nodes that single DOM node will be returned.
Otherwise if the template string contains multiple top-level nodes an
{HTMLCollection} object containing all the top-level nodes will be returned.
|
[
"Creates",
"DOM",
"nodes",
"from",
"the",
"specified",
"template",
"string",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/littlelib.js#L588-L604
|
14,528
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/shell/Shell.js
|
function() {
var outputDiv = document.getElementsByClassName("gcli-output")[0]; //$NON-NLS-0$
while (outputDiv.hasChildNodes()) {
outputDiv.removeChild(outputDiv.lastChild);
}
this.output(i18nUtil.formatMessage(messages["AvailableCmdsType"], "<b>help</b>")); //$NON-NLS-0$
}
|
javascript
|
function() {
var outputDiv = document.getElementsByClassName("gcli-output")[0]; //$NON-NLS-0$
while (outputDiv.hasChildNodes()) {
outputDiv.removeChild(outputDiv.lastChild);
}
this.output(i18nUtil.formatMessage(messages["AvailableCmdsType"], "<b>help</b>")); //$NON-NLS-0$
}
|
[
"function",
"(",
")",
"{",
"var",
"outputDiv",
"=",
"document",
".",
"getElementsByClassName",
"(",
"\"gcli-output\"",
")",
"[",
"0",
"]",
";",
"//$NON-NLS-0$",
"while",
"(",
"outputDiv",
".",
"hasChildNodes",
"(",
")",
")",
"{",
"outputDiv",
".",
"removeChild",
"(",
"outputDiv",
".",
"lastChild",
")",
";",
"}",
"this",
".",
"output",
"(",
"i18nUtil",
".",
"formatMessage",
"(",
"messages",
"[",
"\"AvailableCmdsType\"",
"]",
",",
"\"<b>help</b>\"",
")",
")",
";",
"//$NON-NLS-0$",
"}"
] |
Clears the Shell's output area.
|
[
"Clears",
"the",
"Shell",
"s",
"output",
"area",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/shell/Shell.js#L64-L70
|
|
14,529
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/shell/Shell.js
|
function(content) {
var output = new mCli.Output();
this.commandOutputManager.onOutput({output: output});
output.complete(content);
}
|
javascript
|
function(content) {
var output = new mCli.Output();
this.commandOutputManager.onOutput({output: output});
output.complete(content);
}
|
[
"function",
"(",
"content",
")",
"{",
"var",
"output",
"=",
"new",
"mCli",
".",
"Output",
"(",
")",
";",
"this",
".",
"commandOutputManager",
".",
"onOutput",
"(",
"{",
"output",
":",
"output",
"}",
")",
";",
"output",
".",
"complete",
"(",
"content",
")",
";",
"}"
] |
Renders HTML content in the Shell's output area.
@param {String} content the HTML content to output
|
[
"Renders",
"HTML",
"content",
"in",
"the",
"Shell",
"s",
"output",
"area",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/shell/Shell.js#L76-L80
|
|
14,530
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/utils/comment-event-generator.js
|
enterNode
|
function enterNode(node) {
var comments = this.sourceCode.getComments(node);
emitCommentsEnter(this, comments.leading);
this.original.enterNode(node);
emitCommentsEnter(this, comments.trailing);
}
|
javascript
|
function enterNode(node) {
var comments = this.sourceCode.getComments(node);
emitCommentsEnter(this, comments.leading);
this.original.enterNode(node);
emitCommentsEnter(this, comments.trailing);
}
|
[
"function",
"enterNode",
"(",
"node",
")",
"{",
"var",
"comments",
"=",
"this",
".",
"sourceCode",
".",
"getComments",
"(",
"node",
")",
";",
"emitCommentsEnter",
"(",
"this",
",",
"comments",
".",
"leading",
")",
";",
"this",
".",
"original",
".",
"enterNode",
"(",
"node",
")",
";",
"emitCommentsEnter",
"(",
"this",
",",
"comments",
".",
"trailing",
")",
";",
"}"
] |
Emits an event of entering comments.
@param {ASTNode} node - A node which was entered.
@returns {void}
|
[
"Emits",
"an",
"event",
"of",
"entering",
"comments",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/utils/comment-event-generator.js#L96-L102
|
14,531
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/utils/comment-event-generator.js
|
leaveNode
|
function leaveNode(node) {
var comments = this.sourceCode.getComments(node);
emitCommentsExit(this, comments.trailing);
this.original.leaveNode(node);
emitCommentsExit(this, comments.leading);
}
|
javascript
|
function leaveNode(node) {
var comments = this.sourceCode.getComments(node);
emitCommentsExit(this, comments.trailing);
this.original.leaveNode(node);
emitCommentsExit(this, comments.leading);
}
|
[
"function",
"leaveNode",
"(",
"node",
")",
"{",
"var",
"comments",
"=",
"this",
".",
"sourceCode",
".",
"getComments",
"(",
"node",
")",
";",
"emitCommentsExit",
"(",
"this",
",",
"comments",
".",
"trailing",
")",
";",
"this",
".",
"original",
".",
"leaveNode",
"(",
"node",
")",
";",
"emitCommentsExit",
"(",
"this",
",",
"comments",
".",
"leading",
")",
";",
"}"
] |
Emits an event of leaving comments.
@param {ASTNode} node - A node which was left.
@returns {void}
|
[
"Emits",
"an",
"event",
"of",
"leaving",
"comments",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/utils/comment-event-generator.js#L109-L115
|
14,532
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/contentAssist.js
|
function(proposal) {
if (!proposal) {
return false;
}
// now handle prefixes
// if there is a non-empty selection, then replace it,
// if overwrite is truthy, then also replace the prefix
var view = this.textView;
var sel = view.getSelection();
var start = this._initialCaretOffset;
var mapStart = start;
var end = Math.max(sel.start, sel.end), mapEnd = end;
var model = view.getModel();
if (model.getBaseModel) {
mapStart = model.mapOffset(mapStart);
mapEnd = model.mapOffset(mapEnd);
model = model.getBaseModel();
}
if (proposal.overwrite) {
if(typeof proposal.prefix === 'string') {
start = mapStart-proposal.prefix.length;
} else {
start = this.getPrefixStart(model, mapStart);
}
}
var data = {
proposal: proposal,
start: mapStart,
end: mapEnd
};
this.setState(State.INACTIVE);
var proposalText = typeof proposal === "string" ? proposal : proposal.proposal;
view.setText(proposalText, start, end);
if (proposal.additionalEdits) {
var edit;
for (var i = 0; i < proposal.additionalEdits.length; i++) {
edit = proposal.additionalEdits[i];
view.setText(edit.text, edit.offset, edit.offset + edit.length);
}
}
this.dispatchEvent({type: "ProposalApplied", data: data}); //$NON-NLS-0$
mMetrics.logEvent("contentAssist", "apply"); //$NON-NLS-1$ //$NON-NLS-0$
return true;
}
|
javascript
|
function(proposal) {
if (!proposal) {
return false;
}
// now handle prefixes
// if there is a non-empty selection, then replace it,
// if overwrite is truthy, then also replace the prefix
var view = this.textView;
var sel = view.getSelection();
var start = this._initialCaretOffset;
var mapStart = start;
var end = Math.max(sel.start, sel.end), mapEnd = end;
var model = view.getModel();
if (model.getBaseModel) {
mapStart = model.mapOffset(mapStart);
mapEnd = model.mapOffset(mapEnd);
model = model.getBaseModel();
}
if (proposal.overwrite) {
if(typeof proposal.prefix === 'string') {
start = mapStart-proposal.prefix.length;
} else {
start = this.getPrefixStart(model, mapStart);
}
}
var data = {
proposal: proposal,
start: mapStart,
end: mapEnd
};
this.setState(State.INACTIVE);
var proposalText = typeof proposal === "string" ? proposal : proposal.proposal;
view.setText(proposalText, start, end);
if (proposal.additionalEdits) {
var edit;
for (var i = 0; i < proposal.additionalEdits.length; i++) {
edit = proposal.additionalEdits[i];
view.setText(edit.text, edit.offset, edit.offset + edit.length);
}
}
this.dispatchEvent({type: "ProposalApplied", data: data}); //$NON-NLS-0$
mMetrics.logEvent("contentAssist", "apply"); //$NON-NLS-1$ //$NON-NLS-0$
return true;
}
|
[
"function",
"(",
"proposal",
")",
"{",
"if",
"(",
"!",
"proposal",
")",
"{",
"return",
"false",
";",
"}",
"// now handle prefixes\r",
"// if there is a non-empty selection, then replace it,\r",
"// if overwrite is truthy, then also replace the prefix\r",
"var",
"view",
"=",
"this",
".",
"textView",
";",
"var",
"sel",
"=",
"view",
".",
"getSelection",
"(",
")",
";",
"var",
"start",
"=",
"this",
".",
"_initialCaretOffset",
";",
"var",
"mapStart",
"=",
"start",
";",
"var",
"end",
"=",
"Math",
".",
"max",
"(",
"sel",
".",
"start",
",",
"sel",
".",
"end",
")",
",",
"mapEnd",
"=",
"end",
";",
"var",
"model",
"=",
"view",
".",
"getModel",
"(",
")",
";",
"if",
"(",
"model",
".",
"getBaseModel",
")",
"{",
"mapStart",
"=",
"model",
".",
"mapOffset",
"(",
"mapStart",
")",
";",
"mapEnd",
"=",
"model",
".",
"mapOffset",
"(",
"mapEnd",
")",
";",
"model",
"=",
"model",
".",
"getBaseModel",
"(",
")",
";",
"}",
"if",
"(",
"proposal",
".",
"overwrite",
")",
"{",
"if",
"(",
"typeof",
"proposal",
".",
"prefix",
"===",
"'string'",
")",
"{",
"start",
"=",
"mapStart",
"-",
"proposal",
".",
"prefix",
".",
"length",
";",
"}",
"else",
"{",
"start",
"=",
"this",
".",
"getPrefixStart",
"(",
"model",
",",
"mapStart",
")",
";",
"}",
"}",
"var",
"data",
"=",
"{",
"proposal",
":",
"proposal",
",",
"start",
":",
"mapStart",
",",
"end",
":",
"mapEnd",
"}",
";",
"this",
".",
"setState",
"(",
"State",
".",
"INACTIVE",
")",
";",
"var",
"proposalText",
"=",
"typeof",
"proposal",
"===",
"\"string\"",
"?",
"proposal",
":",
"proposal",
".",
"proposal",
";",
"view",
".",
"setText",
"(",
"proposalText",
",",
"start",
",",
"end",
")",
";",
"if",
"(",
"proposal",
".",
"additionalEdits",
")",
"{",
"var",
"edit",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"proposal",
".",
"additionalEdits",
".",
"length",
";",
"i",
"++",
")",
"{",
"edit",
"=",
"proposal",
".",
"additionalEdits",
"[",
"i",
"]",
";",
"view",
".",
"setText",
"(",
"edit",
".",
"text",
",",
"edit",
".",
"offset",
",",
"edit",
".",
"offset",
"+",
"edit",
".",
"length",
")",
";",
"}",
"}",
"this",
".",
"dispatchEvent",
"(",
"{",
"type",
":",
"\"ProposalApplied\"",
",",
"data",
":",
"data",
"}",
")",
";",
"//$NON-NLS-0$\r",
"mMetrics",
".",
"logEvent",
"(",
"\"contentAssist\"",
",",
"\"apply\"",
")",
";",
"//$NON-NLS-1$ //$NON-NLS-0$\r",
"return",
"true",
";",
"}"
] |
Applies the given proposal to the TextView.
@param {Object} [proposal]
@returns {Boolean} <code>true</code> if the proposal was applied; <code>false</code> if no proposal was provided.
|
[
"Applies",
"the",
"given",
"proposal",
"to",
"the",
"TextView",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/contentAssist.js#L161-L207
|
|
14,533
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/contentAssist.js
|
function() {
// figure out initial offset, it should be the minimum between
// the beginning of the selection and the current caret offset
var offset = this.textView.getCaretOffset();
var sel = this.textView.getSelection();
var selectionStart = Math.min(sel.start, sel.end);
this._initialCaretOffset = Math.min(offset, selectionStart);
this._computedProposals = null;
delete this._autoApply;
this._computeProposals(this._initialCaretOffset).then(function(proposals) {
if (this.isActive()) {
var flatProposalArray = this._flatten(proposals);
//check if flattened proposals form a valid array with at least one entry
if (flatProposalArray && Array.isArray(flatProposalArray) && (0 < flatProposalArray.length)) {
this._computedProposals = proposals;
}
var autoApply = typeof this._autoApply === 'boolean' ? this._autoApply : !this._autoTriggerEnabled;
this.dispatchEvent({type: "ProposalsComputed", data: {proposals: flatProposalArray}, autoApply: autoApply}); //$NON-NLS-0$
if (this._computedProposals && this._filterText) {
// force filtering here because user entered text after
// computeProposals() was called but before the plugins
// returned the computed proposals
this.filterProposals(true);
}
}
}.bind(this));
}
|
javascript
|
function() {
// figure out initial offset, it should be the minimum between
// the beginning of the selection and the current caret offset
var offset = this.textView.getCaretOffset();
var sel = this.textView.getSelection();
var selectionStart = Math.min(sel.start, sel.end);
this._initialCaretOffset = Math.min(offset, selectionStart);
this._computedProposals = null;
delete this._autoApply;
this._computeProposals(this._initialCaretOffset).then(function(proposals) {
if (this.isActive()) {
var flatProposalArray = this._flatten(proposals);
//check if flattened proposals form a valid array with at least one entry
if (flatProposalArray && Array.isArray(flatProposalArray) && (0 < flatProposalArray.length)) {
this._computedProposals = proposals;
}
var autoApply = typeof this._autoApply === 'boolean' ? this._autoApply : !this._autoTriggerEnabled;
this.dispatchEvent({type: "ProposalsComputed", data: {proposals: flatProposalArray}, autoApply: autoApply}); //$NON-NLS-0$
if (this._computedProposals && this._filterText) {
// force filtering here because user entered text after
// computeProposals() was called but before the plugins
// returned the computed proposals
this.filterProposals(true);
}
}
}.bind(this));
}
|
[
"function",
"(",
")",
"{",
"// figure out initial offset, it should be the minimum between \r",
"// the beginning of the selection and the current caret offset\r",
"var",
"offset",
"=",
"this",
".",
"textView",
".",
"getCaretOffset",
"(",
")",
";",
"var",
"sel",
"=",
"this",
".",
"textView",
".",
"getSelection",
"(",
")",
";",
"var",
"selectionStart",
"=",
"Math",
".",
"min",
"(",
"sel",
".",
"start",
",",
"sel",
".",
"end",
")",
";",
"this",
".",
"_initialCaretOffset",
"=",
"Math",
".",
"min",
"(",
"offset",
",",
"selectionStart",
")",
";",
"this",
".",
"_computedProposals",
"=",
"null",
";",
"delete",
"this",
".",
"_autoApply",
";",
"this",
".",
"_computeProposals",
"(",
"this",
".",
"_initialCaretOffset",
")",
".",
"then",
"(",
"function",
"(",
"proposals",
")",
"{",
"if",
"(",
"this",
".",
"isActive",
"(",
")",
")",
"{",
"var",
"flatProposalArray",
"=",
"this",
".",
"_flatten",
"(",
"proposals",
")",
";",
"//check if flattened proposals form a valid array with at least one entry\r",
"if",
"(",
"flatProposalArray",
"&&",
"Array",
".",
"isArray",
"(",
"flatProposalArray",
")",
"&&",
"(",
"0",
"<",
"flatProposalArray",
".",
"length",
")",
")",
"{",
"this",
".",
"_computedProposals",
"=",
"proposals",
";",
"}",
"var",
"autoApply",
"=",
"typeof",
"this",
".",
"_autoApply",
"===",
"'boolean'",
"?",
"this",
".",
"_autoApply",
":",
"!",
"this",
".",
"_autoTriggerEnabled",
";",
"this",
".",
"dispatchEvent",
"(",
"{",
"type",
":",
"\"ProposalsComputed\"",
",",
"data",
":",
"{",
"proposals",
":",
"flatProposalArray",
"}",
",",
"autoApply",
":",
"autoApply",
"}",
")",
";",
"//$NON-NLS-0$\r",
"if",
"(",
"this",
".",
"_computedProposals",
"&&",
"this",
".",
"_filterText",
")",
"{",
"// force filtering here because user entered text after\r",
"// computeProposals() was called but before the plugins\r",
"// returned the computed proposals\r",
"this",
".",
"filterProposals",
"(",
"true",
")",
";",
"}",
"}",
"}",
".",
"bind",
"(",
"this",
")",
")",
";",
"}"
] |
Computes the proposals at the TextView's current caret offset.
|
[
"Computes",
"the",
"proposals",
"at",
"the",
"TextView",
"s",
"current",
"caret",
"offset",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/contentAssist.js#L276-L302
|
|
14,534
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/contentAssist.js
|
function(proposals) {
// get rid of extra separators and titles
var mappedProposals = proposals.map(function(proposalArray) {
var element = proposalArray.filter(function(proposal, index) {
var keepElement = true;
if (STYLES[proposal.style] === STYLES.hr) {
if ((0 === index) || ((proposalArray.length - 1) === index)) {
keepElement = false; // remove separators at first or last element
} else if (STYLES.hr === STYLES[proposalArray[index - 1].style]) {
keepElement = false; // remove separator preceeded by another separator
}
} else if (STYLES[proposal.style] === STYLES.noemphasis_title) {
var nextProposal = proposalArray[index + 1];
if (nextProposal) {
// remove titles that preceed other titles, all of their subelements have already been filtered out
if (STYLES[nextProposal.style] === STYLES.noemphasis_title) {
keepElement = false;
}
} else {
keepElement = false; //remove titles that are at the end of the array
}
}
return keepElement;
});
return element;
});
return mappedProposals;
}
|
javascript
|
function(proposals) {
// get rid of extra separators and titles
var mappedProposals = proposals.map(function(proposalArray) {
var element = proposalArray.filter(function(proposal, index) {
var keepElement = true;
if (STYLES[proposal.style] === STYLES.hr) {
if ((0 === index) || ((proposalArray.length - 1) === index)) {
keepElement = false; // remove separators at first or last element
} else if (STYLES.hr === STYLES[proposalArray[index - 1].style]) {
keepElement = false; // remove separator preceeded by another separator
}
} else if (STYLES[proposal.style] === STYLES.noemphasis_title) {
var nextProposal = proposalArray[index + 1];
if (nextProposal) {
// remove titles that preceed other titles, all of their subelements have already been filtered out
if (STYLES[nextProposal.style] === STYLES.noemphasis_title) {
keepElement = false;
}
} else {
keepElement = false; //remove titles that are at the end of the array
}
}
return keepElement;
});
return element;
});
return mappedProposals;
}
|
[
"function",
"(",
"proposals",
")",
"{",
"// get rid of extra separators and titles\r",
"var",
"mappedProposals",
"=",
"proposals",
".",
"map",
"(",
"function",
"(",
"proposalArray",
")",
"{",
"var",
"element",
"=",
"proposalArray",
".",
"filter",
"(",
"function",
"(",
"proposal",
",",
"index",
")",
"{",
"var",
"keepElement",
"=",
"true",
";",
"if",
"(",
"STYLES",
"[",
"proposal",
".",
"style",
"]",
"===",
"STYLES",
".",
"hr",
")",
"{",
"if",
"(",
"(",
"0",
"===",
"index",
")",
"||",
"(",
"(",
"proposalArray",
".",
"length",
"-",
"1",
")",
"===",
"index",
")",
")",
"{",
"keepElement",
"=",
"false",
";",
"// remove separators at first or last element\r",
"}",
"else",
"if",
"(",
"STYLES",
".",
"hr",
"===",
"STYLES",
"[",
"proposalArray",
"[",
"index",
"-",
"1",
"]",
".",
"style",
"]",
")",
"{",
"keepElement",
"=",
"false",
";",
"// remove separator preceeded by another separator\r",
"}",
"}",
"else",
"if",
"(",
"STYLES",
"[",
"proposal",
".",
"style",
"]",
"===",
"STYLES",
".",
"noemphasis_title",
")",
"{",
"var",
"nextProposal",
"=",
"proposalArray",
"[",
"index",
"+",
"1",
"]",
";",
"if",
"(",
"nextProposal",
")",
"{",
"// remove titles that preceed other titles, all of their subelements have already been filtered out\r",
"if",
"(",
"STYLES",
"[",
"nextProposal",
".",
"style",
"]",
"===",
"STYLES",
".",
"noemphasis_title",
")",
"{",
"keepElement",
"=",
"false",
";",
"}",
"}",
"else",
"{",
"keepElement",
"=",
"false",
";",
"//remove titles that are at the end of the array\r",
"}",
"}",
"return",
"keepElement",
";",
"}",
")",
";",
"return",
"element",
";",
"}",
")",
";",
"return",
"mappedProposals",
";",
"}"
] |
Helper method which removes extra separators and titles from
an array containing arrays of proposals from the various providers.
@param{Array[]} proposals An array with each element containing an array of proposals
@returns {Array} An array without the extra unselectable elements
|
[
"Helper",
"method",
"which",
"removes",
"extra",
"separators",
"and",
"titles",
"from",
"an",
"array",
"containing",
"arrays",
"of",
"proposals",
"from",
"the",
"various",
"providers",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/contentAssist.js#L547-L575
|
|
14,535
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/contentAssist.js
|
function(arrayOrObjectArray) {
return arrayOrObjectArray.reduce(function(prev, curr) {
var returnValue = prev;
var filteredArray = null;
if (curr && Array.isArray(curr)) {
filteredArray = curr.filter(function(element){
return element; //filter out falsy elements
});
}
// add current proposal array to flattened array
// skip current elements that are not arrays
if (filteredArray && Array.isArray(filteredArray) && (filteredArray.length > 0)) {
var first = filteredArray;
var last = prev;
var filteredArrayStyle = filteredArray[0].style;
if (filteredArrayStyle && STYLES[filteredArrayStyle] && (0 === STYLES[filteredArrayStyle].indexOf(STYLES.noemphasis))) {
// the style of the first element starts with noemphasis
// add these proposals to the end of the array
first = prev;
last = filteredArray;
}
if (first.length > 0) {
var firstArrayStyle = first[first.length - 1].style;
if (firstArrayStyle && (STYLES.hr !== STYLES[firstArrayStyle])) {
// add separator between proposals from different providers
// if the previous array didn't already end with a separator
first = first.concat({
proposal: '',
name: '',
description: '---------------------------------', //$NON-NLS-0$
style: 'hr', //$NON-NLS-0$
unselectable: true
});
}
}
returnValue = first.concat(last);
}
return returnValue;
}, []);
}
|
javascript
|
function(arrayOrObjectArray) {
return arrayOrObjectArray.reduce(function(prev, curr) {
var returnValue = prev;
var filteredArray = null;
if (curr && Array.isArray(curr)) {
filteredArray = curr.filter(function(element){
return element; //filter out falsy elements
});
}
// add current proposal array to flattened array
// skip current elements that are not arrays
if (filteredArray && Array.isArray(filteredArray) && (filteredArray.length > 0)) {
var first = filteredArray;
var last = prev;
var filteredArrayStyle = filteredArray[0].style;
if (filteredArrayStyle && STYLES[filteredArrayStyle] && (0 === STYLES[filteredArrayStyle].indexOf(STYLES.noemphasis))) {
// the style of the first element starts with noemphasis
// add these proposals to the end of the array
first = prev;
last = filteredArray;
}
if (first.length > 0) {
var firstArrayStyle = first[first.length - 1].style;
if (firstArrayStyle && (STYLES.hr !== STYLES[firstArrayStyle])) {
// add separator between proposals from different providers
// if the previous array didn't already end with a separator
first = first.concat({
proposal: '',
name: '',
description: '---------------------------------', //$NON-NLS-0$
style: 'hr', //$NON-NLS-0$
unselectable: true
});
}
}
returnValue = first.concat(last);
}
return returnValue;
}, []);
}
|
[
"function",
"(",
"arrayOrObjectArray",
")",
"{",
"return",
"arrayOrObjectArray",
".",
"reduce",
"(",
"function",
"(",
"prev",
",",
"curr",
")",
"{",
"var",
"returnValue",
"=",
"prev",
";",
"var",
"filteredArray",
"=",
"null",
";",
"if",
"(",
"curr",
"&&",
"Array",
".",
"isArray",
"(",
"curr",
")",
")",
"{",
"filteredArray",
"=",
"curr",
".",
"filter",
"(",
"function",
"(",
"element",
")",
"{",
"return",
"element",
";",
"//filter out falsy elements\r",
"}",
")",
";",
"}",
"// add current proposal array to flattened array\r",
"// skip current elements that are not arrays\r",
"if",
"(",
"filteredArray",
"&&",
"Array",
".",
"isArray",
"(",
"filteredArray",
")",
"&&",
"(",
"filteredArray",
".",
"length",
">",
"0",
")",
")",
"{",
"var",
"first",
"=",
"filteredArray",
";",
"var",
"last",
"=",
"prev",
";",
"var",
"filteredArrayStyle",
"=",
"filteredArray",
"[",
"0",
"]",
".",
"style",
";",
"if",
"(",
"filteredArrayStyle",
"&&",
"STYLES",
"[",
"filteredArrayStyle",
"]",
"&&",
"(",
"0",
"===",
"STYLES",
"[",
"filteredArrayStyle",
"]",
".",
"indexOf",
"(",
"STYLES",
".",
"noemphasis",
")",
")",
")",
"{",
"// the style of the first element starts with noemphasis\r",
"// add these proposals to the end of the array\r",
"first",
"=",
"prev",
";",
"last",
"=",
"filteredArray",
";",
"}",
"if",
"(",
"first",
".",
"length",
">",
"0",
")",
"{",
"var",
"firstArrayStyle",
"=",
"first",
"[",
"first",
".",
"length",
"-",
"1",
"]",
".",
"style",
";",
"if",
"(",
"firstArrayStyle",
"&&",
"(",
"STYLES",
".",
"hr",
"!==",
"STYLES",
"[",
"firstArrayStyle",
"]",
")",
")",
"{",
"// add separator between proposals from different providers \r",
"// if the previous array didn't already end with a separator\r",
"first",
"=",
"first",
".",
"concat",
"(",
"{",
"proposal",
":",
"''",
",",
"name",
":",
"''",
",",
"description",
":",
"'---------------------------------'",
",",
"//$NON-NLS-0$\r",
"style",
":",
"'hr'",
",",
"//$NON-NLS-0$\r",
"unselectable",
":",
"true",
"}",
")",
";",
"}",
"}",
"returnValue",
"=",
"first",
".",
"concat",
"(",
"last",
")",
";",
"}",
"return",
"returnValue",
";",
"}",
",",
"[",
"]",
")",
";",
"}"
] |
Flattens an array of arrays into a one-dimensional array.
@param {Array[]} array
@returns {Array}
|
[
"Flattens",
"an",
"array",
"of",
"arrays",
"into",
"a",
"one",
"-",
"dimensional",
"array",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/contentAssist.js#L681-L727
|
|
14,536
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/contentAssist.js
|
function(update, noContent) {
var tooltip = mTooltip.Tooltip.getTooltip(this.contentAssist.textView);
var self = this;
var target = {
getTooltipInfo: function() {
var bounds = self.widget.parentNode.getBoundingClientRect();
var tipArea = {width: 350, height: bounds.height, top: bounds.top};
if ((bounds.left + bounds.width) >= document.documentElement.clientWidth){
tipArea.left = bounds.left - tipArea.width;
tipArea.left -= 10;
} else {
tipArea.left = bounds.left + bounds.width;
tipArea.left += 10;
}
var info = {
context: {proposal: self.proposals[self.selectedIndex]},
anchorArea: bounds,
tooltipArea: tipArea
};
return info;
}
};
if (update) {
tooltip.update(target, noContent);
} else {
tooltip.show(target, true, false);
}
}
|
javascript
|
function(update, noContent) {
var tooltip = mTooltip.Tooltip.getTooltip(this.contentAssist.textView);
var self = this;
var target = {
getTooltipInfo: function() {
var bounds = self.widget.parentNode.getBoundingClientRect();
var tipArea = {width: 350, height: bounds.height, top: bounds.top};
if ((bounds.left + bounds.width) >= document.documentElement.clientWidth){
tipArea.left = bounds.left - tipArea.width;
tipArea.left -= 10;
} else {
tipArea.left = bounds.left + bounds.width;
tipArea.left += 10;
}
var info = {
context: {proposal: self.proposals[self.selectedIndex]},
anchorArea: bounds,
tooltipArea: tipArea
};
return info;
}
};
if (update) {
tooltip.update(target, noContent);
} else {
tooltip.show(target, true, false);
}
}
|
[
"function",
"(",
"update",
",",
"noContent",
")",
"{",
"var",
"tooltip",
"=",
"mTooltip",
".",
"Tooltip",
".",
"getTooltip",
"(",
"this",
".",
"contentAssist",
".",
"textView",
")",
";",
"var",
"self",
"=",
"this",
";",
"var",
"target",
"=",
"{",
"getTooltipInfo",
":",
"function",
"(",
")",
"{",
"var",
"bounds",
"=",
"self",
".",
"widget",
".",
"parentNode",
".",
"getBoundingClientRect",
"(",
")",
";",
"var",
"tipArea",
"=",
"{",
"width",
":",
"350",
",",
"height",
":",
"bounds",
".",
"height",
",",
"top",
":",
"bounds",
".",
"top",
"}",
";",
"if",
"(",
"(",
"bounds",
".",
"left",
"+",
"bounds",
".",
"width",
")",
">=",
"document",
".",
"documentElement",
".",
"clientWidth",
")",
"{",
"tipArea",
".",
"left",
"=",
"bounds",
".",
"left",
"-",
"tipArea",
".",
"width",
";",
"tipArea",
".",
"left",
"-=",
"10",
";",
"}",
"else",
"{",
"tipArea",
".",
"left",
"=",
"bounds",
".",
"left",
"+",
"bounds",
".",
"width",
";",
"tipArea",
".",
"left",
"+=",
"10",
";",
"}",
"var",
"info",
"=",
"{",
"context",
":",
"{",
"proposal",
":",
"self",
".",
"proposals",
"[",
"self",
".",
"selectedIndex",
"]",
"}",
",",
"anchorArea",
":",
"bounds",
",",
"tooltipArea",
":",
"tipArea",
"}",
";",
"return",
"info",
";",
"}",
"}",
";",
"if",
"(",
"update",
")",
"{",
"tooltip",
".",
"update",
"(",
"target",
",",
"noContent",
")",
";",
"}",
"else",
"{",
"tooltip",
".",
"show",
"(",
"target",
",",
"true",
",",
"false",
")",
";",
"}",
"}"
] |
Opens the tooltip for the selected proposal beside the content assist window
@param update if false, the tooltip will be hidden then reopened with the new contents
@param noContent if true the current tooltip contents will not be replaced, just size and position updated
|
[
"Opens",
"the",
"tooltip",
"for",
"the",
"selected",
"proposal",
"beside",
"the",
"content",
"assist",
"window"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/contentAssist.js#L1062-L1090
|
|
14,537
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/contentAssist.js
|
function(cloneNode){
cloneNode.contentAssistProposalIndex = node.contentAssistProposalIndex;
if (cloneNode.hasChildNodes()) {
for (var i = 0 ; i < cloneNode.childNodes.length ; i++){
recursiveSetIndex(cloneNode.childNodes[i]);
}
}
}
|
javascript
|
function(cloneNode){
cloneNode.contentAssistProposalIndex = node.contentAssistProposalIndex;
if (cloneNode.hasChildNodes()) {
for (var i = 0 ; i < cloneNode.childNodes.length ; i++){
recursiveSetIndex(cloneNode.childNodes[i]);
}
}
}
|
[
"function",
"(",
"cloneNode",
")",
"{",
"cloneNode",
".",
"contentAssistProposalIndex",
"=",
"node",
".",
"contentAssistProposalIndex",
";",
"if",
"(",
"cloneNode",
".",
"hasChildNodes",
"(",
")",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"cloneNode",
".",
"childNodes",
".",
"length",
";",
"i",
"++",
")",
"{",
"recursiveSetIndex",
"(",
"cloneNode",
".",
"childNodes",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}"
] |
make all the cloned nodes clickable by setting their contentAssistProposalIndex
|
[
"make",
"all",
"the",
"cloned",
"nodes",
"clickable",
"by",
"setting",
"their",
"contentAssistProposalIndex"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/contentAssist.js#L1483-L1490
|
|
14,538
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/mirror.js
|
function() {
if (this.model) {
this.model.removeEventListener("Changing", this.listener.onModelChanging);
this.model.removeEventListener("Changed", this.listener.onModelChanged);
this.model.removeEventListener("Destroy", this.listener.onDestroy);
}
this.model = null;
this.codeMirror = null;
this.mode = null;
this.lines = null;
this.dirtyLines = null;
clearTimeout(this.timer);
this.timer = null;
}
|
javascript
|
function() {
if (this.model) {
this.model.removeEventListener("Changing", this.listener.onModelChanging);
this.model.removeEventListener("Changed", this.listener.onModelChanged);
this.model.removeEventListener("Destroy", this.listener.onDestroy);
}
this.model = null;
this.codeMirror = null;
this.mode = null;
this.lines = null;
this.dirtyLines = null;
clearTimeout(this.timer);
this.timer = null;
}
|
[
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"model",
")",
"{",
"this",
".",
"model",
".",
"removeEventListener",
"(",
"\"Changing\"",
",",
"this",
".",
"listener",
".",
"onModelChanging",
")",
";",
"this",
".",
"model",
".",
"removeEventListener",
"(",
"\"Changed\"",
",",
"this",
".",
"listener",
".",
"onModelChanged",
")",
";",
"this",
".",
"model",
".",
"removeEventListener",
"(",
"\"Destroy\"",
",",
"this",
".",
"listener",
".",
"onDestroy",
")",
";",
"}",
"this",
".",
"model",
"=",
"null",
";",
"this",
".",
"codeMirror",
"=",
"null",
";",
"this",
".",
"mode",
"=",
"null",
";",
"this",
".",
"lines",
"=",
"null",
";",
"this",
".",
"dirtyLines",
"=",
"null",
";",
"clearTimeout",
"(",
"this",
".",
"timer",
")",
";",
"this",
".",
"timer",
"=",
"null",
";",
"}"
] |
Deactivates this ModeApplier and removes its listeners.
|
[
"Deactivates",
"this",
"ModeApplier",
"and",
"removes",
"its",
"listeners",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/mirror.js#L334-L347
|
|
14,539
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/mirror.js
|
function(startLine, endLine, partial) {
if (!this.mode) {
return;
}
var lineCount = this.model.getLineCount();
startLine = typeof startLine === "undefined" ? 0 : startLine;
endLine = typeof endLine === "undefined" ? lineCount - 1 : Math.min(endLine, lineCount - 1);
var mode = this.mode;
var state = this.getState(startLine);
for (var i = startLine; i <= endLine; i++) {
var line = this.lines[i];
this.highlightLine(i, line, state);
line.eolState = this.codeMirror.copyState(mode, state);
}
// console.debug("Highlighted " + startLine + " to " + endLine);
this._expandRange(startLine, endLine);
if (!partial) {
this.onHighlightDone();
}
}
|
javascript
|
function(startLine, endLine, partial) {
if (!this.mode) {
return;
}
var lineCount = this.model.getLineCount();
startLine = typeof startLine === "undefined" ? 0 : startLine;
endLine = typeof endLine === "undefined" ? lineCount - 1 : Math.min(endLine, lineCount - 1);
var mode = this.mode;
var state = this.getState(startLine);
for (var i = startLine; i <= endLine; i++) {
var line = this.lines[i];
this.highlightLine(i, line, state);
line.eolState = this.codeMirror.copyState(mode, state);
}
// console.debug("Highlighted " + startLine + " to " + endLine);
this._expandRange(startLine, endLine);
if (!partial) {
this.onHighlightDone();
}
}
|
[
"function",
"(",
"startLine",
",",
"endLine",
",",
"partial",
")",
"{",
"if",
"(",
"!",
"this",
".",
"mode",
")",
"{",
"return",
";",
"}",
"var",
"lineCount",
"=",
"this",
".",
"model",
".",
"getLineCount",
"(",
")",
";",
"startLine",
"=",
"typeof",
"startLine",
"===",
"\"undefined\"",
"?",
"0",
":",
"startLine",
";",
"endLine",
"=",
"typeof",
"endLine",
"===",
"\"undefined\"",
"?",
"lineCount",
"-",
"1",
":",
"Math",
".",
"min",
"(",
"endLine",
",",
"lineCount",
"-",
"1",
")",
";",
"var",
"mode",
"=",
"this",
".",
"mode",
";",
"var",
"state",
"=",
"this",
".",
"getState",
"(",
"startLine",
")",
";",
"for",
"(",
"var",
"i",
"=",
"startLine",
";",
"i",
"<=",
"endLine",
";",
"i",
"++",
")",
"{",
"var",
"line",
"=",
"this",
".",
"lines",
"[",
"i",
"]",
";",
"this",
".",
"highlightLine",
"(",
"i",
",",
"line",
",",
"state",
")",
";",
"line",
".",
"eolState",
"=",
"this",
".",
"codeMirror",
".",
"copyState",
"(",
"mode",
",",
"state",
")",
";",
"}",
"//\t\t\tconsole.debug(\"Highlighted \" + startLine + \" to \" + endLine);",
"this",
".",
"_expandRange",
"(",
"startLine",
",",
"endLine",
")",
";",
"if",
"(",
"!",
"partial",
")",
"{",
"this",
".",
"onHighlightDone",
"(",
")",
";",
"}",
"}"
] |
Highlights the given range of lines.
@param {Number} [startLine]
@param {Number} [endLine]
@param {Boolean} [partial=false] If <code>true</code>, this function is assumed to be running as part of a larger
operation, and will not dispatch a {@link #event:HighlightEvent}.
|
[
"Highlights",
"the",
"given",
"range",
"of",
"lines",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/mirror.js#L429-L448
|
|
14,540
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/mirror.js
|
function(lineIndex, line, state) {
if (!this.mode) {
return;
}
var model = this.model;
if (model.getLineStart(lineIndex) === model.getLineEnd(lineIndex) && this.mode.blankLine) {
this.mode.blankLine(state);
}
var style = line.style || [];
var text = model.getLine(lineIndex);
var stream = new Stream(text);
var isChanged = !line.style;
var newStyle = [], ws;
for (var i=0; !stream.eol(); i++) {
var tok = this.mode.token(stream, state) || null;
var tokStr = stream.current();
ws = this._whitespaceStyle(tok, tokStr, stream.tokenStart);
if (ws) {
// TODO Replace this (null) token with whitespace tokens. Do something smart
// to figure out isChanged, I guess
}
var newS = [stream.tokenStart, stream.pos, tok]; // shape is [start, end, token]
var oldS = style[i];
newStyle.push(newS);
isChanged = isChanged || !oldS || oldS[0] !== newS[0] || oldS[1] !== newS[1] || oldS[2] !== newS[2];
stream.advance();
}
isChanged = isChanged || (newStyle.length !== style.length);
if (isChanged) { line.style = newStyle.length ? newStyle : null; }
return isChanged;
}
|
javascript
|
function(lineIndex, line, state) {
if (!this.mode) {
return;
}
var model = this.model;
if (model.getLineStart(lineIndex) === model.getLineEnd(lineIndex) && this.mode.blankLine) {
this.mode.blankLine(state);
}
var style = line.style || [];
var text = model.getLine(lineIndex);
var stream = new Stream(text);
var isChanged = !line.style;
var newStyle = [], ws;
for (var i=0; !stream.eol(); i++) {
var tok = this.mode.token(stream, state) || null;
var tokStr = stream.current();
ws = this._whitespaceStyle(tok, tokStr, stream.tokenStart);
if (ws) {
// TODO Replace this (null) token with whitespace tokens. Do something smart
// to figure out isChanged, I guess
}
var newS = [stream.tokenStart, stream.pos, tok]; // shape is [start, end, token]
var oldS = style[i];
newStyle.push(newS);
isChanged = isChanged || !oldS || oldS[0] !== newS[0] || oldS[1] !== newS[1] || oldS[2] !== newS[2];
stream.advance();
}
isChanged = isChanged || (newStyle.length !== style.length);
if (isChanged) { line.style = newStyle.length ? newStyle : null; }
return isChanged;
}
|
[
"function",
"(",
"lineIndex",
",",
"line",
",",
"state",
")",
"{",
"if",
"(",
"!",
"this",
".",
"mode",
")",
"{",
"return",
";",
"}",
"var",
"model",
"=",
"this",
".",
"model",
";",
"if",
"(",
"model",
".",
"getLineStart",
"(",
"lineIndex",
")",
"===",
"model",
".",
"getLineEnd",
"(",
"lineIndex",
")",
"&&",
"this",
".",
"mode",
".",
"blankLine",
")",
"{",
"this",
".",
"mode",
".",
"blankLine",
"(",
"state",
")",
";",
"}",
"var",
"style",
"=",
"line",
".",
"style",
"||",
"[",
"]",
";",
"var",
"text",
"=",
"model",
".",
"getLine",
"(",
"lineIndex",
")",
";",
"var",
"stream",
"=",
"new",
"Stream",
"(",
"text",
")",
";",
"var",
"isChanged",
"=",
"!",
"line",
".",
"style",
";",
"var",
"newStyle",
"=",
"[",
"]",
",",
"ws",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"!",
"stream",
".",
"eol",
"(",
")",
";",
"i",
"++",
")",
"{",
"var",
"tok",
"=",
"this",
".",
"mode",
".",
"token",
"(",
"stream",
",",
"state",
")",
"||",
"null",
";",
"var",
"tokStr",
"=",
"stream",
".",
"current",
"(",
")",
";",
"ws",
"=",
"this",
".",
"_whitespaceStyle",
"(",
"tok",
",",
"tokStr",
",",
"stream",
".",
"tokenStart",
")",
";",
"if",
"(",
"ws",
")",
"{",
"// TODO Replace this (null) token with whitespace tokens. Do something smart",
"// to figure out isChanged, I guess",
"}",
"var",
"newS",
"=",
"[",
"stream",
".",
"tokenStart",
",",
"stream",
".",
"pos",
",",
"tok",
"]",
";",
"// shape is [start, end, token]",
"var",
"oldS",
"=",
"style",
"[",
"i",
"]",
";",
"newStyle",
".",
"push",
"(",
"newS",
")",
";",
"isChanged",
"=",
"isChanged",
"||",
"!",
"oldS",
"||",
"oldS",
"[",
"0",
"]",
"!==",
"newS",
"[",
"0",
"]",
"||",
"oldS",
"[",
"1",
"]",
"!==",
"newS",
"[",
"1",
"]",
"||",
"oldS",
"[",
"2",
"]",
"!==",
"newS",
"[",
"2",
"]",
";",
"stream",
".",
"advance",
"(",
")",
";",
"}",
"isChanged",
"=",
"isChanged",
"||",
"(",
"newStyle",
".",
"length",
"!==",
"style",
".",
"length",
")",
";",
"if",
"(",
"isChanged",
")",
"{",
"line",
".",
"style",
"=",
"newStyle",
".",
"length",
"?",
"newStyle",
":",
"null",
";",
"}",
"return",
"isChanged",
";",
"}"
] |
Highlights a single line.
@param {Number} lineIndex
@param {Object} line
@param {Object} state The state to use for parsing from the start of the line.
|
[
"Highlights",
"a",
"single",
"line",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/mirror.js#L569-L599
|
|
14,541
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/mirror.js
|
function(token, str, pos) {
if (!token && this.isWhitespaceVisible && /\s+/.test(str)) {
var whitespaceStyles = [], start, type;
for (var i=0; i < str.length; i++) {
var chr = str[i];
if (chr !== type) {
if (type) {
whitespaceStyles.push([pos + start, pos + i, (type === "\t" ? TAB : SPACE)]);
}
start = i;
type = chr;
}
}
whitespaceStyles.push([pos + start, pos + i, (type === "\t" ? TAB : SPACE)]);
return whitespaceStyles;
}
return null;
}
|
javascript
|
function(token, str, pos) {
if (!token && this.isWhitespaceVisible && /\s+/.test(str)) {
var whitespaceStyles = [], start, type;
for (var i=0; i < str.length; i++) {
var chr = str[i];
if (chr !== type) {
if (type) {
whitespaceStyles.push([pos + start, pos + i, (type === "\t" ? TAB : SPACE)]);
}
start = i;
type = chr;
}
}
whitespaceStyles.push([pos + start, pos + i, (type === "\t" ? TAB : SPACE)]);
return whitespaceStyles;
}
return null;
}
|
[
"function",
"(",
"token",
",",
"str",
",",
"pos",
")",
"{",
"if",
"(",
"!",
"token",
"&&",
"this",
".",
"isWhitespaceVisible",
"&&",
"/",
"\\s+",
"/",
".",
"test",
"(",
"str",
")",
")",
"{",
"var",
"whitespaceStyles",
"=",
"[",
"]",
",",
"start",
",",
"type",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"str",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"chr",
"=",
"str",
"[",
"i",
"]",
";",
"if",
"(",
"chr",
"!==",
"type",
")",
"{",
"if",
"(",
"type",
")",
"{",
"whitespaceStyles",
".",
"push",
"(",
"[",
"pos",
"+",
"start",
",",
"pos",
"+",
"i",
",",
"(",
"type",
"===",
"\"\\t\"",
"?",
"TAB",
":",
"SPACE",
")",
"]",
")",
";",
"}",
"start",
"=",
"i",
";",
"type",
"=",
"chr",
";",
"}",
"}",
"whitespaceStyles",
".",
"push",
"(",
"[",
"pos",
"+",
"start",
",",
"pos",
"+",
"i",
",",
"(",
"type",
"===",
"\"\\t\"",
"?",
"TAB",
":",
"SPACE",
")",
"]",
")",
";",
"return",
"whitespaceStyles",
";",
"}",
"return",
"null",
";",
"}"
] |
If given an un-token'd chunk of whitespace, returns whitespace style tokens for it.
@returns {Array} The whitespace styles for the token, or null.
|
[
"If",
"given",
"an",
"un",
"-",
"token",
"d",
"chunk",
"of",
"whitespace",
"returns",
"whitespace",
"style",
"tokens",
"for",
"it",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/mirror.js#L604-L621
|
|
14,542
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/mirror.js
|
function() {
if (this.modeApplier) {
this.modeApplier.removeEventListener("Highlight", this.listener.onHighlight);
this.modeApplier.destroy();
}
if (this.annotationModel) {
// remove annotation listeners
}
if (this.textView) {
this.textView.removeEventListener("LineStyle", this.listener.onLineStyle);
this.textView.removeEventListener("Destroy", this.listener.onDestroy);
}
this.textView = null;
this.annotationModel = null;
this.modeApplier = null;
this.listener = null;
}
|
javascript
|
function() {
if (this.modeApplier) {
this.modeApplier.removeEventListener("Highlight", this.listener.onHighlight);
this.modeApplier.destroy();
}
if (this.annotationModel) {
// remove annotation listeners
}
if (this.textView) {
this.textView.removeEventListener("LineStyle", this.listener.onLineStyle);
this.textView.removeEventListener("Destroy", this.listener.onDestroy);
}
this.textView = null;
this.annotationModel = null;
this.modeApplier = null;
this.listener = null;
}
|
[
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"modeApplier",
")",
"{",
"this",
".",
"modeApplier",
".",
"removeEventListener",
"(",
"\"Highlight\"",
",",
"this",
".",
"listener",
".",
"onHighlight",
")",
";",
"this",
".",
"modeApplier",
".",
"destroy",
"(",
")",
";",
"}",
"if",
"(",
"this",
".",
"annotationModel",
")",
"{",
"// remove annotation listeners",
"}",
"if",
"(",
"this",
".",
"textView",
")",
"{",
"this",
".",
"textView",
".",
"removeEventListener",
"(",
"\"LineStyle\"",
",",
"this",
".",
"listener",
".",
"onLineStyle",
")",
";",
"this",
".",
"textView",
".",
"removeEventListener",
"(",
"\"Destroy\"",
",",
"this",
".",
"listener",
".",
"onDestroy",
")",
";",
"}",
"this",
".",
"textView",
"=",
"null",
";",
"this",
".",
"annotationModel",
"=",
"null",
";",
"this",
".",
"modeApplier",
"=",
"null",
";",
"this",
".",
"listener",
"=",
"null",
";",
"}"
] |
Deactivates this styler and removes its listeners.
|
[
"Deactivates",
"this",
"styler",
"and",
"removes",
"its",
"listeners",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/mirror.js#L730-L746
|
|
14,543
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/compare/diffProvider.js
|
DiffProvider
|
function DiffProvider(serviceRegistry, filter) {
var allReferences = serviceRegistry.getServiceReferences("orion.core.diff"); //$NON-NLS-0$
var i, _references = allReferences;
if (filter) {
_references = [];
for(i = 0; i < allReferences.length; ++i) {
if (filter(allReferences[i])) {
_references.push(allReferences[i]);
}
}
}
var _patterns = [];
var _services = [];
for(i = 0; i < _references.length; ++i) {
_patterns[i] = new RegExp(_references[i].getProperty("pattern") || ".*");//$NON-NLS-1$ //$NON-NLS-0$
_services[i] = serviceRegistry.getService(_references[i]);
}
this._getService = function(location) {
location = _normalizeURL(location);
for(var i = 0; i < _patterns.length; ++i) {
if (_patterns[i].test(location)) {
return _services[i];
}
}
throw messages["NoDiffServiceLocationMatched"] + location;
};
}
|
javascript
|
function DiffProvider(serviceRegistry, filter) {
var allReferences = serviceRegistry.getServiceReferences("orion.core.diff"); //$NON-NLS-0$
var i, _references = allReferences;
if (filter) {
_references = [];
for(i = 0; i < allReferences.length; ++i) {
if (filter(allReferences[i])) {
_references.push(allReferences[i]);
}
}
}
var _patterns = [];
var _services = [];
for(i = 0; i < _references.length; ++i) {
_patterns[i] = new RegExp(_references[i].getProperty("pattern") || ".*");//$NON-NLS-1$ //$NON-NLS-0$
_services[i] = serviceRegistry.getService(_references[i]);
}
this._getService = function(location) {
location = _normalizeURL(location);
for(var i = 0; i < _patterns.length; ++i) {
if (_patterns[i].test(location)) {
return _services[i];
}
}
throw messages["NoDiffServiceLocationMatched"] + location;
};
}
|
[
"function",
"DiffProvider",
"(",
"serviceRegistry",
",",
"filter",
")",
"{",
"var",
"allReferences",
"=",
"serviceRegistry",
".",
"getServiceReferences",
"(",
"\"orion.core.diff\"",
")",
";",
"//$NON-NLS-0$",
"var",
"i",
",",
"_references",
"=",
"allReferences",
";",
"if",
"(",
"filter",
")",
"{",
"_references",
"=",
"[",
"]",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"allReferences",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"filter",
"(",
"allReferences",
"[",
"i",
"]",
")",
")",
"{",
"_references",
".",
"push",
"(",
"allReferences",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}",
"var",
"_patterns",
"=",
"[",
"]",
";",
"var",
"_services",
"=",
"[",
"]",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"_references",
".",
"length",
";",
"++",
"i",
")",
"{",
"_patterns",
"[",
"i",
"]",
"=",
"new",
"RegExp",
"(",
"_references",
"[",
"i",
"]",
".",
"getProperty",
"(",
"\"pattern\"",
")",
"||",
"\".*\"",
")",
";",
"//$NON-NLS-1$ //$NON-NLS-0$",
"_services",
"[",
"i",
"]",
"=",
"serviceRegistry",
".",
"getService",
"(",
"_references",
"[",
"i",
"]",
")",
";",
"}",
"this",
".",
"_getService",
"=",
"function",
"(",
"location",
")",
"{",
"location",
"=",
"_normalizeURL",
"(",
"location",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"_patterns",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"_patterns",
"[",
"i",
"]",
".",
"test",
"(",
"location",
")",
")",
"{",
"return",
"_services",
"[",
"i",
"]",
";",
"}",
"}",
"throw",
"messages",
"[",
"\"NoDiffServiceLocationMatched\"",
"]",
"+",
"location",
";",
"}",
";",
"}"
] |
Creates a new diff provider.
@class Provides operations on Diff in a compare editor
@name orion.compare.DiffProvider
|
[
"Creates",
"a",
"new",
"diff",
"provider",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/compare/diffProvider.js#L47-L75
|
14,544
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/webtools/util.js
|
function(ast, offset) {
var found = null;
CssVisitor.visit(ast, {
visitNode: function(node) {
if(node.range[0] <= offset) {
if (node.range[1] === -1 || node.range[1] >= offset) {
found = node;
} else {
return Visitor.SKIP;
}
} else {
return Visitor.BREAK;
}
},
endVisitNode: function(node) {
}
});
return found;
}
|
javascript
|
function(ast, offset) {
var found = null;
CssVisitor.visit(ast, {
visitNode: function(node) {
if(node.range[0] <= offset) {
if (node.range[1] === -1 || node.range[1] >= offset) {
found = node;
} else {
return Visitor.SKIP;
}
} else {
return Visitor.BREAK;
}
},
endVisitNode: function(node) {
}
});
return found;
}
|
[
"function",
"(",
"ast",
",",
"offset",
")",
"{",
"var",
"found",
"=",
"null",
";",
"CssVisitor",
".",
"visit",
"(",
"ast",
",",
"{",
"visitNode",
":",
"function",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"range",
"[",
"0",
"]",
"<=",
"offset",
")",
"{",
"if",
"(",
"node",
".",
"range",
"[",
"1",
"]",
"===",
"-",
"1",
"||",
"node",
".",
"range",
"[",
"1",
"]",
">=",
"offset",
")",
"{",
"found",
"=",
"node",
";",
"}",
"else",
"{",
"return",
"Visitor",
".",
"SKIP",
";",
"}",
"}",
"else",
"{",
"return",
"Visitor",
".",
"BREAK",
";",
"}",
"}",
",",
"endVisitNode",
":",
"function",
"(",
"node",
")",
"{",
"}",
"}",
")",
";",
"return",
"found",
";",
"}"
] |
Returns the ast node at the given offset or the parent node enclosing it for a CSS ast
@param {Object} ast The AST to inspect
@param {Number} offset The offset into the source
@returns {Object} The AST node at the given offset or null
@since 10.0
|
[
"Returns",
"the",
"ast",
"node",
"at",
"the",
"given",
"offset",
"or",
"the",
"parent",
"node",
"enclosing",
"it",
"for",
"a",
"CSS",
"ast"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/webtools/util.js#L65-L83
|
|
14,545
|
eclipse/orion.client
|
modules/orionode/languages/jdt/index.js
|
getJavaHome
|
function getJavaHome() {
if(!java_home) {
if(typeof process.env.JAVA_HOME === 'string' && process.env.JAVA_HOME) {
java_home = process.env.JAVA_HOME;
} else if(process.platform === 'darwin') {
java_home = cp.execSync("/usr/libexec/java_home").toString().trim();
} else if(process.platform === 'linux') {
//TODO anything magical we can do here to compute the 'default' Java?
} else if(process.platform === 'win32') {
//TODO not sure Windows has any way to know where Java is installed
}
}
return java_home;
}
|
javascript
|
function getJavaHome() {
if(!java_home) {
if(typeof process.env.JAVA_HOME === 'string' && process.env.JAVA_HOME) {
java_home = process.env.JAVA_HOME;
} else if(process.platform === 'darwin') {
java_home = cp.execSync("/usr/libexec/java_home").toString().trim();
} else if(process.platform === 'linux') {
//TODO anything magical we can do here to compute the 'default' Java?
} else if(process.platform === 'win32') {
//TODO not sure Windows has any way to know where Java is installed
}
}
return java_home;
}
|
[
"function",
"getJavaHome",
"(",
")",
"{",
"if",
"(",
"!",
"java_home",
")",
"{",
"if",
"(",
"typeof",
"process",
".",
"env",
".",
"JAVA_HOME",
"===",
"'string'",
"&&",
"process",
".",
"env",
".",
"JAVA_HOME",
")",
"{",
"java_home",
"=",
"process",
".",
"env",
".",
"JAVA_HOME",
";",
"}",
"else",
"if",
"(",
"process",
".",
"platform",
"===",
"'darwin'",
")",
"{",
"java_home",
"=",
"cp",
".",
"execSync",
"(",
"\"/usr/libexec/java_home\"",
")",
".",
"toString",
"(",
")",
".",
"trim",
"(",
")",
";",
"}",
"else",
"if",
"(",
"process",
".",
"platform",
"===",
"'linux'",
")",
"{",
"//TODO anything magical we can do here to compute the 'default' Java?",
"}",
"else",
"if",
"(",
"process",
".",
"platform",
"===",
"'win32'",
")",
"{",
"//TODO not sure Windows has any way to know where Java is installed",
"}",
"}",
"return",
"java_home",
";",
"}"
] |
Gets the Java home location from the backing process environment, or tries to compute it.
@returns {string} The Java home location or `null`
@since 18.0
|
[
"Gets",
"the",
"Java",
"home",
"location",
"from",
"the",
"backing",
"process",
"environment",
"or",
"tries",
"to",
"compute",
"it",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/languages/jdt/index.js#L124-L137
|
14,546
|
eclipse/orion.client
|
modules/orionode/languages/jdt/index.js
|
runJavaServer
|
function runJavaServer(javaHome, options) {
return new Promise(function(resolve, reject) {
const child = path.join(javaHome, '/jre/bin/java'),
params = [];
if (DEBUG) {
params.push('-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044');
}
params.push("-Dlog.level=ALL");
params.push('-Declipse.application=org.eclipse.jdt.ls.core.id1');
params.push('-Dosgi.bundles.defaultStartLevel=4');
params.push('-Declipse.product=org.eclipse.jdt.ls.core.product');
if (DEBUG) {
params.push('-Dlog.protocol=true');
}
var pluginsFolder = path.resolve(__dirname, './plugins');
return fs.readdirAsync(pluginsFolder).then(function(files) {
if (Array.isArray(files) && files.length !== 0) {
for (var i = 0, length = files.length; i < length; i++) {
var file = files[i];
var indexOf = file.indexOf('org.eclipse.equinox.launcher_');
if (indexOf !== -1) {
params.push('-jar');
params.push(path.resolve(__dirname, './plugins/' + file));
//select configuration directory according to OS
var configDir = 'config_win';
if (process.platform === 'darwin') {
configDir = 'config_mac';
} else if (process.platform === 'linux') {
configDir = 'config_linux';
}
params.push('-configuration');
params.push(path.resolve(__dirname, configDir));
params.push('-data');
params.push(options.workspaceDir);
}
}
return fork(child, params, options).then((childProcess) => {
resolve(childProcess);
}, (err) => {
reject(err);
});
}
});
});
}
|
javascript
|
function runJavaServer(javaHome, options) {
return new Promise(function(resolve, reject) {
const child = path.join(javaHome, '/jre/bin/java'),
params = [];
if (DEBUG) {
params.push('-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044');
}
params.push("-Dlog.level=ALL");
params.push('-Declipse.application=org.eclipse.jdt.ls.core.id1');
params.push('-Dosgi.bundles.defaultStartLevel=4');
params.push('-Declipse.product=org.eclipse.jdt.ls.core.product');
if (DEBUG) {
params.push('-Dlog.protocol=true');
}
var pluginsFolder = path.resolve(__dirname, './plugins');
return fs.readdirAsync(pluginsFolder).then(function(files) {
if (Array.isArray(files) && files.length !== 0) {
for (var i = 0, length = files.length; i < length; i++) {
var file = files[i];
var indexOf = file.indexOf('org.eclipse.equinox.launcher_');
if (indexOf !== -1) {
params.push('-jar');
params.push(path.resolve(__dirname, './plugins/' + file));
//select configuration directory according to OS
var configDir = 'config_win';
if (process.platform === 'darwin') {
configDir = 'config_mac';
} else if (process.platform === 'linux') {
configDir = 'config_linux';
}
params.push('-configuration');
params.push(path.resolve(__dirname, configDir));
params.push('-data');
params.push(options.workspaceDir);
}
}
return fork(child, params, options).then((childProcess) => {
resolve(childProcess);
}, (err) => {
reject(err);
});
}
});
});
}
|
[
"function",
"runJavaServer",
"(",
"javaHome",
",",
"options",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"const",
"child",
"=",
"path",
".",
"join",
"(",
"javaHome",
",",
"'/jre/bin/java'",
")",
",",
"params",
"=",
"[",
"]",
";",
"if",
"(",
"DEBUG",
")",
"{",
"params",
".",
"push",
"(",
"'-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044'",
")",
";",
"}",
"params",
".",
"push",
"(",
"\"-Dlog.level=ALL\"",
")",
";",
"params",
".",
"push",
"(",
"'-Declipse.application=org.eclipse.jdt.ls.core.id1'",
")",
";",
"params",
".",
"push",
"(",
"'-Dosgi.bundles.defaultStartLevel=4'",
")",
";",
"params",
".",
"push",
"(",
"'-Declipse.product=org.eclipse.jdt.ls.core.product'",
")",
";",
"if",
"(",
"DEBUG",
")",
"{",
"params",
".",
"push",
"(",
"'-Dlog.protocol=true'",
")",
";",
"}",
"var",
"pluginsFolder",
"=",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'./plugins'",
")",
";",
"return",
"fs",
".",
"readdirAsync",
"(",
"pluginsFolder",
")",
".",
"then",
"(",
"function",
"(",
"files",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"files",
")",
"&&",
"files",
".",
"length",
"!==",
"0",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"length",
"=",
"files",
".",
"length",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"var",
"file",
"=",
"files",
"[",
"i",
"]",
";",
"var",
"indexOf",
"=",
"file",
".",
"indexOf",
"(",
"'org.eclipse.equinox.launcher_'",
")",
";",
"if",
"(",
"indexOf",
"!==",
"-",
"1",
")",
"{",
"params",
".",
"push",
"(",
"'-jar'",
")",
";",
"params",
".",
"push",
"(",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"'./plugins/'",
"+",
"file",
")",
")",
";",
"//select configuration directory according to OS",
"var",
"configDir",
"=",
"'config_win'",
";",
"if",
"(",
"process",
".",
"platform",
"===",
"'darwin'",
")",
"{",
"configDir",
"=",
"'config_mac'",
";",
"}",
"else",
"if",
"(",
"process",
".",
"platform",
"===",
"'linux'",
")",
"{",
"configDir",
"=",
"'config_linux'",
";",
"}",
"params",
".",
"push",
"(",
"'-configuration'",
")",
";",
"params",
".",
"push",
"(",
"path",
".",
"resolve",
"(",
"__dirname",
",",
"configDir",
")",
")",
";",
"params",
".",
"push",
"(",
"'-data'",
")",
";",
"params",
".",
"push",
"(",
"options",
".",
"workspaceDir",
")",
";",
"}",
"}",
"return",
"fork",
"(",
"child",
",",
"params",
",",
"options",
")",
".",
"then",
"(",
"(",
"childProcess",
")",
"=>",
"{",
"resolve",
"(",
"childProcess",
")",
";",
"}",
",",
"(",
"err",
")",
"=>",
"{",
"reject",
"(",
"err",
")",
";",
"}",
")",
";",
"}",
"}",
")",
";",
"}",
")",
";",
"}"
] |
Run the Java language server
@param {string} javaHome The absolute path to the Java home directory
@param {{?}} options The map of options
@returns {Promise} A promise to load the Java language server
|
[
"Run",
"the",
"Java",
"language",
"server"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/languages/jdt/index.js#L230-L275
|
14,547
|
eclipse/orion.client
|
modules/orionode/languages/jdt/index.js
|
fork
|
function fork(modulePath, args, options) {
return new Promise((resolve, reject) => {
const newEnv = generatePatchedEnv(process.env, options.IN_PORT, options.OUT_PORT),
childProcess = cp.spawn(modulePath, args, {
silent: true,
cwd: options.cwd,
env: newEnv,
execArgv: options.execArgv
});
childProcess.once('error', function(err) {
logger.error("Java process error event");
logger.error(err);
reject(err);
});
childProcess.once('exit', function(err) {
logger.error("Java process exit event");
logger.error(err);
reject(err);
});
resolve(childProcess);
});
}
|
javascript
|
function fork(modulePath, args, options) {
return new Promise((resolve, reject) => {
const newEnv = generatePatchedEnv(process.env, options.IN_PORT, options.OUT_PORT),
childProcess = cp.spawn(modulePath, args, {
silent: true,
cwd: options.cwd,
env: newEnv,
execArgv: options.execArgv
});
childProcess.once('error', function(err) {
logger.error("Java process error event");
logger.error(err);
reject(err);
});
childProcess.once('exit', function(err) {
logger.error("Java process exit event");
logger.error(err);
reject(err);
});
resolve(childProcess);
});
}
|
[
"function",
"fork",
"(",
"modulePath",
",",
"args",
",",
"options",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"const",
"newEnv",
"=",
"generatePatchedEnv",
"(",
"process",
".",
"env",
",",
"options",
".",
"IN_PORT",
",",
"options",
".",
"OUT_PORT",
")",
",",
"childProcess",
"=",
"cp",
".",
"spawn",
"(",
"modulePath",
",",
"args",
",",
"{",
"silent",
":",
"true",
",",
"cwd",
":",
"options",
".",
"cwd",
",",
"env",
":",
"newEnv",
",",
"execArgv",
":",
"options",
".",
"execArgv",
"}",
")",
";",
"childProcess",
".",
"once",
"(",
"'error'",
",",
"function",
"(",
"err",
")",
"{",
"logger",
".",
"error",
"(",
"\"Java process error event\"",
")",
";",
"logger",
".",
"error",
"(",
"err",
")",
";",
"reject",
"(",
"err",
")",
";",
"}",
")",
";",
"childProcess",
".",
"once",
"(",
"'exit'",
",",
"function",
"(",
"err",
")",
"{",
"logger",
".",
"error",
"(",
"\"Java process exit event\"",
")",
";",
"logger",
".",
"error",
"(",
"err",
")",
";",
"reject",
"(",
"err",
")",
";",
"}",
")",
";",
"resolve",
"(",
"childProcess",
")",
";",
"}",
")",
";",
"}"
] |
Create a new child process
@param {string} modulePath The module path to spawn
@param {{?}} args The arguments array
@param {{?}} options The map of options
@returns {Promise} A promise to spawn the child process
|
[
"Create",
"a",
"new",
"child",
"process"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/languages/jdt/index.js#L283-L304
|
14,548
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/widgets/themes/ThemeBuilder.js
|
populateThemes
|
function populateThemes(){
this.preferences.getTheme(function(themeStyles) {
var selectElement = document.getElementById('editorTheme');//$NON-NLS-0$
while (selectElement.hasChildNodes() ){
selectElement.removeChild(selectElement.lastChild);
}
for (var i =0; i < themeStyles.styles.length; i++) {
var option = document.createElement('option');
option.setAttribute('value', themeStyles.styles[i].name);
//checks if a theme is the current theme
if (themeStyles.styles[i].name === themeStyles.style.name){
option.setAttribute('selected', 'true');
}
option.appendChild(document.createTextNode(themeStyles.styles[i].name));
selectElement.appendChild(option);
}
this.selectTheme(themeStyles.style.name);
}.bind(this));
}
|
javascript
|
function populateThemes(){
this.preferences.getTheme(function(themeStyles) {
var selectElement = document.getElementById('editorTheme');//$NON-NLS-0$
while (selectElement.hasChildNodes() ){
selectElement.removeChild(selectElement.lastChild);
}
for (var i =0; i < themeStyles.styles.length; i++) {
var option = document.createElement('option');
option.setAttribute('value', themeStyles.styles[i].name);
//checks if a theme is the current theme
if (themeStyles.styles[i].name === themeStyles.style.name){
option.setAttribute('selected', 'true');
}
option.appendChild(document.createTextNode(themeStyles.styles[i].name));
selectElement.appendChild(option);
}
this.selectTheme(themeStyles.style.name);
}.bind(this));
}
|
[
"function",
"populateThemes",
"(",
")",
"{",
"this",
".",
"preferences",
".",
"getTheme",
"(",
"function",
"(",
"themeStyles",
")",
"{",
"var",
"selectElement",
"=",
"document",
".",
"getElementById",
"(",
"'editorTheme'",
")",
";",
"//$NON-NLS-0$",
"while",
"(",
"selectElement",
".",
"hasChildNodes",
"(",
")",
")",
"{",
"selectElement",
".",
"removeChild",
"(",
"selectElement",
".",
"lastChild",
")",
";",
"}",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"themeStyles",
".",
"styles",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"option",
"=",
"document",
".",
"createElement",
"(",
"'option'",
")",
";",
"option",
".",
"setAttribute",
"(",
"'value'",
",",
"themeStyles",
".",
"styles",
"[",
"i",
"]",
".",
"name",
")",
";",
"//checks if a theme is the current theme ",
"if",
"(",
"themeStyles",
".",
"styles",
"[",
"i",
"]",
".",
"name",
"===",
"themeStyles",
".",
"style",
".",
"name",
")",
"{",
"option",
".",
"setAttribute",
"(",
"'selected'",
",",
"'true'",
")",
";",
"}",
"option",
".",
"appendChild",
"(",
"document",
".",
"createTextNode",
"(",
"themeStyles",
".",
"styles",
"[",
"i",
"]",
".",
"name",
")",
")",
";",
"selectElement",
".",
"appendChild",
"(",
"option",
")",
";",
"}",
"this",
".",
"selectTheme",
"(",
"themeStyles",
".",
"style",
".",
"name",
")",
";",
"}",
".",
"bind",
"(",
"this",
")",
")",
";",
"}"
] |
populates theme selections
|
[
"populates",
"theme",
"selections"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/widgets/themes/ThemeBuilder.js#L131-L149
|
14,549
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/widgets/themes/ThemeBuilder.js
|
checkForChanges
|
function checkForChanges(){
var changed = false;
for (var i = 0; i < scopeList.length; i++){
// if a scope is modified
if (getValueFromPath(currentTheme, scopeList[i].objPath[0]) !== getValueFromPath(originalTheme, scopeList[i].objPath[0])){
document.getElementById("scopeList").childNodes[i].classList.add('modified');//$NON-NLS-1$ //$NON-NLS-0$
changed = true;
}
else {
document.getElementById("scopeList").childNodes[i].classList.remove('modified');//$NON-NLS-1$ //$NON-NLS-0$
}
}
//when there is a changed value, theme is now deletable/revertable/renamable
if (changed){
document.getElementById("scopeChanged").classList.remove('hide');//$NON-NLS-1$ //$NON-NLS-0$
document.getElementById("scopeOriginal").classList.add('hide');//$NON-NLS-1$ //$NON-NLS-0$
}
else {
document.getElementById("scopeChanged").classList.add('hide');//$NON-NLS-1$ //$NON-NLS-0$
document.getElementById("scopeOriginal").classList.remove('hide');//$NON-NLS-1$ //$NON-NLS-0$
}
}
|
javascript
|
function checkForChanges(){
var changed = false;
for (var i = 0; i < scopeList.length; i++){
// if a scope is modified
if (getValueFromPath(currentTheme, scopeList[i].objPath[0]) !== getValueFromPath(originalTheme, scopeList[i].objPath[0])){
document.getElementById("scopeList").childNodes[i].classList.add('modified');//$NON-NLS-1$ //$NON-NLS-0$
changed = true;
}
else {
document.getElementById("scopeList").childNodes[i].classList.remove('modified');//$NON-NLS-1$ //$NON-NLS-0$
}
}
//when there is a changed value, theme is now deletable/revertable/renamable
if (changed){
document.getElementById("scopeChanged").classList.remove('hide');//$NON-NLS-1$ //$NON-NLS-0$
document.getElementById("scopeOriginal").classList.add('hide');//$NON-NLS-1$ //$NON-NLS-0$
}
else {
document.getElementById("scopeChanged").classList.add('hide');//$NON-NLS-1$ //$NON-NLS-0$
document.getElementById("scopeOriginal").classList.remove('hide');//$NON-NLS-1$ //$NON-NLS-0$
}
}
|
[
"function",
"checkForChanges",
"(",
")",
"{",
"var",
"changed",
"=",
"false",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"scopeList",
".",
"length",
";",
"i",
"++",
")",
"{",
"// if a scope is modified",
"if",
"(",
"getValueFromPath",
"(",
"currentTheme",
",",
"scopeList",
"[",
"i",
"]",
".",
"objPath",
"[",
"0",
"]",
")",
"!==",
"getValueFromPath",
"(",
"originalTheme",
",",
"scopeList",
"[",
"i",
"]",
".",
"objPath",
"[",
"0",
"]",
")",
")",
"{",
"document",
".",
"getElementById",
"(",
"\"scopeList\"",
")",
".",
"childNodes",
"[",
"i",
"]",
".",
"classList",
".",
"add",
"(",
"'modified'",
")",
";",
"//$NON-NLS-1$ //$NON-NLS-0$",
"changed",
"=",
"true",
";",
"}",
"else",
"{",
"document",
".",
"getElementById",
"(",
"\"scopeList\"",
")",
".",
"childNodes",
"[",
"i",
"]",
".",
"classList",
".",
"remove",
"(",
"'modified'",
")",
";",
"//$NON-NLS-1$ //$NON-NLS-0$",
"}",
"}",
"//when there is a changed value, theme is now deletable/revertable/renamable",
"if",
"(",
"changed",
")",
"{",
"document",
".",
"getElementById",
"(",
"\"scopeChanged\"",
")",
".",
"classList",
".",
"remove",
"(",
"'hide'",
")",
";",
"//$NON-NLS-1$ //$NON-NLS-0$",
"document",
".",
"getElementById",
"(",
"\"scopeOriginal\"",
")",
".",
"classList",
".",
"add",
"(",
"'hide'",
")",
";",
"//$NON-NLS-1$ //$NON-NLS-0$",
"}",
"else",
"{",
"document",
".",
"getElementById",
"(",
"\"scopeChanged\"",
")",
".",
"classList",
".",
"add",
"(",
"'hide'",
")",
";",
"//$NON-NLS-1$ //$NON-NLS-0$",
"document",
".",
"getElementById",
"(",
"\"scopeOriginal\"",
")",
".",
"classList",
".",
"remove",
"(",
"'hide'",
")",
";",
"//$NON-NLS-1$ //$NON-NLS-0$",
"}",
"}"
] |
adds status class to scopes
|
[
"adds",
"status",
"class",
"to",
"scopes"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/widgets/themes/ThemeBuilder.js#L153-L174
|
14,550
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/widgets/themes/ThemeBuilder.js
|
apply
|
function apply() {
document.getElementById("editorThemeName").value = currentTheme.name; //$NON-NLS-0$
for (var i = 0; i < scopeList.length; i++){
scopeList[i].value = defaultColor; // scopes with no value will have defaultColor showing
for (var l = 0; l < scopeList[i].objPath.length; l++){
var temp = getValueFromPath(currentTheme,scopeList[i].objPath[l]);
if (temp){
scopeList[i].value = temp;
break;
}
}
}
for (i = 0; i < scopeList.length; i++){
var element = document.getElementById(scopeList[i].id);
element.value = scopeList[i].value; // updates the select or input[type=color] with correct value
if (element.type === "color") { //$NON-NLS-0$
// make the color value available in a tooltip and aria-label
makeTooltip(element, scopeList[i]);
}
}
checkForChanges(); // checks if any value is changed
}
|
javascript
|
function apply() {
document.getElementById("editorThemeName").value = currentTheme.name; //$NON-NLS-0$
for (var i = 0; i < scopeList.length; i++){
scopeList[i].value = defaultColor; // scopes with no value will have defaultColor showing
for (var l = 0; l < scopeList[i].objPath.length; l++){
var temp = getValueFromPath(currentTheme,scopeList[i].objPath[l]);
if (temp){
scopeList[i].value = temp;
break;
}
}
}
for (i = 0; i < scopeList.length; i++){
var element = document.getElementById(scopeList[i].id);
element.value = scopeList[i].value; // updates the select or input[type=color] with correct value
if (element.type === "color") { //$NON-NLS-0$
// make the color value available in a tooltip and aria-label
makeTooltip(element, scopeList[i]);
}
}
checkForChanges(); // checks if any value is changed
}
|
[
"function",
"apply",
"(",
")",
"{",
"document",
".",
"getElementById",
"(",
"\"editorThemeName\"",
")",
".",
"value",
"=",
"currentTheme",
".",
"name",
";",
"//$NON-NLS-0$",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"scopeList",
".",
"length",
";",
"i",
"++",
")",
"{",
"scopeList",
"[",
"i",
"]",
".",
"value",
"=",
"defaultColor",
";",
"// scopes with no value will have defaultColor showing",
"for",
"(",
"var",
"l",
"=",
"0",
";",
"l",
"<",
"scopeList",
"[",
"i",
"]",
".",
"objPath",
".",
"length",
";",
"l",
"++",
")",
"{",
"var",
"temp",
"=",
"getValueFromPath",
"(",
"currentTheme",
",",
"scopeList",
"[",
"i",
"]",
".",
"objPath",
"[",
"l",
"]",
")",
";",
"if",
"(",
"temp",
")",
"{",
"scopeList",
"[",
"i",
"]",
".",
"value",
"=",
"temp",
";",
"break",
";",
"}",
"}",
"}",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"scopeList",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"element",
"=",
"document",
".",
"getElementById",
"(",
"scopeList",
"[",
"i",
"]",
".",
"id",
")",
";",
"element",
".",
"value",
"=",
"scopeList",
"[",
"i",
"]",
".",
"value",
";",
"// updates the select or input[type=color] with correct value",
"if",
"(",
"element",
".",
"type",
"===",
"\"color\"",
")",
"{",
"//$NON-NLS-0$",
"// make the color value available in a tooltip and aria-label",
"makeTooltip",
"(",
"element",
",",
"scopeList",
"[",
"i",
"]",
")",
";",
"}",
"}",
"checkForChanges",
"(",
")",
";",
"// checks if any value is changed",
"}"
] |
updates the theme object with right values
|
[
"updates",
"the",
"theme",
"object",
"with",
"right",
"values"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/widgets/themes/ThemeBuilder.js#L300-L321
|
14,551
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/widgets/themes/ThemeBuilder.js
|
generateScopeList
|
function generateScopeList(hiddenValues){
hiddenValues = hiddenValues || [];
var htmlString = "";
var ieClass = util.isIE ? "-ie" : ""; //$NON-NLS-0$
for (var i = 0; i < scopeList.length; i++){
if (scopeList[i].id === "editorThemeFontSize"){
htmlString = htmlString + "<li><label for='editorThemeFontSize'>" + scopeList[i].display + "</label><select id='editorThemeFontSize'>";
for (var l = 8; l < 19; l++){
htmlString = htmlString + "<option value='" + l+"px'>"+l+"px</option>";
}
for(l = 8; l < 19; l++){
htmlString = htmlString + "<option value='" + l+"pt'>"+l+"pt</option>";
}
htmlString += "</select></li>";//$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
}
else {
var hideValueCSS = hiddenValues.indexOf(scopeList[i].id) >= 0 ? "style='display: none'" : ""; //$NON-NLS-0$
htmlString = htmlString + "<li " + hideValueCSS + "><label for='"+scopeList[i].id+"' id='"+scopeList[i].id+"Label'>" + scopeList[i].display + "</label><input id='"+scopeList[i].id+"' aria-labelledby='" + scopeList[i].id + "Label " + scopeList[i].id + "' class='colorpicker-input" + ieClass + "' type='color' value='" + scopeList[i].value + "'></li>";//$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
}
}
return htmlString;
}
|
javascript
|
function generateScopeList(hiddenValues){
hiddenValues = hiddenValues || [];
var htmlString = "";
var ieClass = util.isIE ? "-ie" : ""; //$NON-NLS-0$
for (var i = 0; i < scopeList.length; i++){
if (scopeList[i].id === "editorThemeFontSize"){
htmlString = htmlString + "<li><label for='editorThemeFontSize'>" + scopeList[i].display + "</label><select id='editorThemeFontSize'>";
for (var l = 8; l < 19; l++){
htmlString = htmlString + "<option value='" + l+"px'>"+l+"px</option>";
}
for(l = 8; l < 19; l++){
htmlString = htmlString + "<option value='" + l+"pt'>"+l+"pt</option>";
}
htmlString += "</select></li>";//$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
}
else {
var hideValueCSS = hiddenValues.indexOf(scopeList[i].id) >= 0 ? "style='display: none'" : ""; //$NON-NLS-0$
htmlString = htmlString + "<li " + hideValueCSS + "><label for='"+scopeList[i].id+"' id='"+scopeList[i].id+"Label'>" + scopeList[i].display + "</label><input id='"+scopeList[i].id+"' aria-labelledby='" + scopeList[i].id + "Label " + scopeList[i].id + "' class='colorpicker-input" + ieClass + "' type='color' value='" + scopeList[i].value + "'></li>";//$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
}
}
return htmlString;
}
|
[
"function",
"generateScopeList",
"(",
"hiddenValues",
")",
"{",
"hiddenValues",
"=",
"hiddenValues",
"||",
"[",
"]",
";",
"var",
"htmlString",
"=",
"\"\"",
";",
"var",
"ieClass",
"=",
"util",
".",
"isIE",
"?",
"\"-ie\"",
":",
"\"\"",
";",
"//$NON-NLS-0$",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"scopeList",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"scopeList",
"[",
"i",
"]",
".",
"id",
"===",
"\"editorThemeFontSize\"",
")",
"{",
"htmlString",
"=",
"htmlString",
"+",
"\"<li><label for='editorThemeFontSize'>\"",
"+",
"scopeList",
"[",
"i",
"]",
".",
"display",
"+",
"\"</label><select id='editorThemeFontSize'>\"",
";",
"for",
"(",
"var",
"l",
"=",
"8",
";",
"l",
"<",
"19",
";",
"l",
"++",
")",
"{",
"htmlString",
"=",
"htmlString",
"+",
"\"<option value='\"",
"+",
"l",
"+",
"\"px'>\"",
"+",
"l",
"+",
"\"px</option>\"",
";",
"}",
"for",
"(",
"l",
"=",
"8",
";",
"l",
"<",
"19",
";",
"l",
"++",
")",
"{",
"htmlString",
"=",
"htmlString",
"+",
"\"<option value='\"",
"+",
"l",
"+",
"\"pt'>\"",
"+",
"l",
"+",
"\"pt</option>\"",
";",
"}",
"htmlString",
"+=",
"\"</select></li>\"",
";",
"//$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$",
"}",
"else",
"{",
"var",
"hideValueCSS",
"=",
"hiddenValues",
".",
"indexOf",
"(",
"scopeList",
"[",
"i",
"]",
".",
"id",
")",
">=",
"0",
"?",
"\"style='display: none'\"",
":",
"\"\"",
";",
"//$NON-NLS-0$",
"htmlString",
"=",
"htmlString",
"+",
"\"<li \"",
"+",
"hideValueCSS",
"+",
"\"><label for='\"",
"+",
"scopeList",
"[",
"i",
"]",
".",
"id",
"+",
"\"' id='\"",
"+",
"scopeList",
"[",
"i",
"]",
".",
"id",
"+",
"\"Label'>\"",
"+",
"scopeList",
"[",
"i",
"]",
".",
"display",
"+",
"\"</label><input id='\"",
"+",
"scopeList",
"[",
"i",
"]",
".",
"id",
"+",
"\"' aria-labelledby='\"",
"+",
"scopeList",
"[",
"i",
"]",
".",
"id",
"+",
"\"Label \"",
"+",
"scopeList",
"[",
"i",
"]",
".",
"id",
"+",
"\"' class='colorpicker-input\"",
"+",
"ieClass",
"+",
"\"' type='color' value='\"",
"+",
"scopeList",
"[",
"i",
"]",
".",
"value",
"+",
"\"'></li>\"",
";",
"//$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$",
"}",
"}",
"return",
"htmlString",
";",
"}"
] |
generates the html structure for list of scopes
|
[
"generates",
"the",
"html",
"structure",
"for",
"list",
"of",
"scopes"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/widgets/themes/ThemeBuilder.js#L325-L347
|
14,552
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-extra-parens.js
|
containsAssignment
|
function containsAssignment(node) {
if (node.type === "AssignmentExpression") {
return true;
} else if (node.type === "ConditionalExpression" &&
(node.consequent.type === "AssignmentExpression" || node.alternate.type === "AssignmentExpression")) {
return true;
} else if ((node.left && node.left.type === "AssignmentExpression") ||
(node.right && node.right.type === "AssignmentExpression")) {
return true;
}
return false;
}
|
javascript
|
function containsAssignment(node) {
if (node.type === "AssignmentExpression") {
return true;
} else if (node.type === "ConditionalExpression" &&
(node.consequent.type === "AssignmentExpression" || node.alternate.type === "AssignmentExpression")) {
return true;
} else if ((node.left && node.left.type === "AssignmentExpression") ||
(node.right && node.right.type === "AssignmentExpression")) {
return true;
}
return false;
}
|
[
"function",
"containsAssignment",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"type",
"===",
"\"AssignmentExpression\"",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"node",
".",
"type",
"===",
"\"ConditionalExpression\"",
"&&",
"(",
"node",
".",
"consequent",
".",
"type",
"===",
"\"AssignmentExpression\"",
"||",
"node",
".",
"alternate",
".",
"type",
"===",
"\"AssignmentExpression\"",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"(",
"node",
".",
"left",
"&&",
"node",
".",
"left",
".",
"type",
"===",
"\"AssignmentExpression\"",
")",
"||",
"(",
"node",
".",
"right",
"&&",
"node",
".",
"right",
".",
"type",
"===",
"\"AssignmentExpression\"",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Determines if a node is or contains an assignment expression
@param {ASTNode} node - The node to be checked.
@returns {boolean} True if the node is or contains an assignment expression.
@private
|
[
"Determines",
"if",
"a",
"node",
"is",
"or",
"contains",
"an",
"assignment",
"expression"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-extra-parens.js#L206-L218
|
14,553
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-extra-parens.js
|
isReturnAssignException
|
function isReturnAssignException(node) {
if (!EXCEPT_RETURN_ASSIGN || !isInReturnStatement(node)) {
return false;
}
if (node.type === "ReturnStatement") {
return node.argument && containsAssignment(node.argument);
} else if (node.type === "ArrowFunctionExpression" && node.body.type !== "BlockStatement") {
return containsAssignment(node.body);
}
return containsAssignment(node);
}
|
javascript
|
function isReturnAssignException(node) {
if (!EXCEPT_RETURN_ASSIGN || !isInReturnStatement(node)) {
return false;
}
if (node.type === "ReturnStatement") {
return node.argument && containsAssignment(node.argument);
} else if (node.type === "ArrowFunctionExpression" && node.body.type !== "BlockStatement") {
return containsAssignment(node.body);
}
return containsAssignment(node);
}
|
[
"function",
"isReturnAssignException",
"(",
"node",
")",
"{",
"if",
"(",
"!",
"EXCEPT_RETURN_ASSIGN",
"||",
"!",
"isInReturnStatement",
"(",
"node",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"node",
".",
"type",
"===",
"\"ReturnStatement\"",
")",
"{",
"return",
"node",
".",
"argument",
"&&",
"containsAssignment",
"(",
"node",
".",
"argument",
")",
";",
"}",
"else",
"if",
"(",
"node",
".",
"type",
"===",
"\"ArrowFunctionExpression\"",
"&&",
"node",
".",
"body",
".",
"type",
"!==",
"\"BlockStatement\"",
")",
"{",
"return",
"containsAssignment",
"(",
"node",
".",
"body",
")",
";",
"}",
"return",
"containsAssignment",
"(",
"node",
")",
";",
"}"
] |
Determines if a node is contained by or is itself a return statement and is allowed to have a parenthesised assignment
@param {ASTNode} node - The node to be checked.
@returns {boolean} True if the assignment can be parenthesised.
@private
|
[
"Determines",
"if",
"a",
"node",
"is",
"contained",
"by",
"or",
"is",
"itself",
"a",
"return",
"statement",
"and",
"is",
"allowed",
"to",
"have",
"a",
"parenthesised",
"assignment"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-extra-parens.js#L226-L237
|
14,554
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-extra-parens.js
|
isHeadOfExpressionStatement
|
function isHeadOfExpressionStatement(node) {
var parent = node.parent;
while (parent) {
switch (parent.type) {
case "SequenceExpression":
if (parent.expressions[0] !== node || isParenthesised(node)) {
return false;
}
break;
case "UnaryExpression":
case "UpdateExpression":
if (parent.prefix || isParenthesised(node)) {
return false;
}
break;
case "BinaryExpression":
case "LogicalExpression":
if (parent.left !== node || isParenthesised(node)) {
return false;
}
break;
case "ConditionalExpression":
if (parent.test !== node || isParenthesised(node)) {
return false;
}
break;
case "CallExpression":
if (parent.callee !== node || isParenthesised(node)) {
return false;
}
break;
case "MemberExpression":
if (parent.object !== node || isParenthesised(node)) {
return false;
}
break;
case "ExpressionStatement":
return true;
default:
return false;
}
node = parent;
parent = parent.parent;
}
/* istanbul ignore next */
throw new Error("unreachable");
}
|
javascript
|
function isHeadOfExpressionStatement(node) {
var parent = node.parent;
while (parent) {
switch (parent.type) {
case "SequenceExpression":
if (parent.expressions[0] !== node || isParenthesised(node)) {
return false;
}
break;
case "UnaryExpression":
case "UpdateExpression":
if (parent.prefix || isParenthesised(node)) {
return false;
}
break;
case "BinaryExpression":
case "LogicalExpression":
if (parent.left !== node || isParenthesised(node)) {
return false;
}
break;
case "ConditionalExpression":
if (parent.test !== node || isParenthesised(node)) {
return false;
}
break;
case "CallExpression":
if (parent.callee !== node || isParenthesised(node)) {
return false;
}
break;
case "MemberExpression":
if (parent.object !== node || isParenthesised(node)) {
return false;
}
break;
case "ExpressionStatement":
return true;
default:
return false;
}
node = parent;
parent = parent.parent;
}
/* istanbul ignore next */
throw new Error("unreachable");
}
|
[
"function",
"isHeadOfExpressionStatement",
"(",
"node",
")",
"{",
"var",
"parent",
"=",
"node",
".",
"parent",
";",
"while",
"(",
"parent",
")",
"{",
"switch",
"(",
"parent",
".",
"type",
")",
"{",
"case",
"\"SequenceExpression\"",
":",
"if",
"(",
"parent",
".",
"expressions",
"[",
"0",
"]",
"!==",
"node",
"||",
"isParenthesised",
"(",
"node",
")",
")",
"{",
"return",
"false",
";",
"}",
"break",
";",
"case",
"\"UnaryExpression\"",
":",
"case",
"\"UpdateExpression\"",
":",
"if",
"(",
"parent",
".",
"prefix",
"||",
"isParenthesised",
"(",
"node",
")",
")",
"{",
"return",
"false",
";",
"}",
"break",
";",
"case",
"\"BinaryExpression\"",
":",
"case",
"\"LogicalExpression\"",
":",
"if",
"(",
"parent",
".",
"left",
"!==",
"node",
"||",
"isParenthesised",
"(",
"node",
")",
")",
"{",
"return",
"false",
";",
"}",
"break",
";",
"case",
"\"ConditionalExpression\"",
":",
"if",
"(",
"parent",
".",
"test",
"!==",
"node",
"||",
"isParenthesised",
"(",
"node",
")",
")",
"{",
"return",
"false",
";",
"}",
"break",
";",
"case",
"\"CallExpression\"",
":",
"if",
"(",
"parent",
".",
"callee",
"!==",
"node",
"||",
"isParenthesised",
"(",
"node",
")",
")",
"{",
"return",
"false",
";",
"}",
"break",
";",
"case",
"\"MemberExpression\"",
":",
"if",
"(",
"parent",
".",
"object",
"!==",
"node",
"||",
"isParenthesised",
"(",
"node",
")",
")",
"{",
"return",
"false",
";",
"}",
"break",
";",
"case",
"\"ExpressionStatement\"",
":",
"return",
"true",
";",
"default",
":",
"return",
"false",
";",
"}",
"node",
"=",
"parent",
";",
"parent",
"=",
"parent",
".",
"parent",
";",
"}",
"/* istanbul ignore next */",
"throw",
"new",
"Error",
"(",
"\"unreachable\"",
")",
";",
"}"
] |
Checks whether or not a given node is located at the head of ExpressionStatement.
@param {ASTNode} node - A node to check.
@returns {boolean} `true` if the node is located at the head of ExpressionStatement.
|
[
"Checks",
"whether",
"or",
"not",
"a",
"given",
"node",
"is",
"located",
"at",
"the",
"head",
"of",
"ExpressionStatement",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-extra-parens.js#L260-L316
|
14,555
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/compare/compareRulers.js
|
CompareRuler
|
function CompareRuler (annoModel, rulerLocation, rulerOverview, rulerStyle) {
mRulers.Ruler.call(this, annoModel, rulerLocation, rulerOverview, rulerStyle);
}
|
javascript
|
function CompareRuler (annoModel, rulerLocation, rulerOverview, rulerStyle) {
mRulers.Ruler.call(this, annoModel, rulerLocation, rulerOverview, rulerStyle);
}
|
[
"function",
"CompareRuler",
"(",
"annoModel",
",",
"rulerLocation",
",",
"rulerOverview",
",",
"rulerStyle",
")",
"{",
"mRulers",
".",
"Ruler",
".",
"call",
"(",
"this",
",",
"annoModel",
",",
"rulerLocation",
",",
"rulerOverview",
",",
"rulerStyle",
")",
";",
"}"
] |
Creates a new ruler for the compare editor.
@class The compare ruler is used by the compare editor to render trim around the editor.
@name orion.compare.rulers.CompareRuler
|
[
"Creates",
"a",
"new",
"ruler",
"for",
"the",
"compare",
"editor",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/compare/compareRulers.js#L22-L24
|
14,556
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/compare/compareRulers.js
|
LineNumberCompareRuler
|
function LineNumberCompareRuler (diffNavigator, mapperColumnIndex , annoModel, rulerLocation, rulerStyle, oddStyle, evenStyle) {
orion.CompareRuler.call(this, annoModel, rulerLocation, "page", rulerStyle); //$NON-NLS-0$
this._diffNavigator = diffNavigator;
this._oddStyle = oddStyle || {style: {backgroundColor: "white"}}; //$NON-NLS-0$
this._evenStyle = evenStyle || {style: {backgroundColor: "white"}}; //$NON-NLS-0$
this._numOfDigits = 0;
this._mapperColumnIndex = mapperColumnIndex;
}
|
javascript
|
function LineNumberCompareRuler (diffNavigator, mapperColumnIndex , annoModel, rulerLocation, rulerStyle, oddStyle, evenStyle) {
orion.CompareRuler.call(this, annoModel, rulerLocation, "page", rulerStyle); //$NON-NLS-0$
this._diffNavigator = diffNavigator;
this._oddStyle = oddStyle || {style: {backgroundColor: "white"}}; //$NON-NLS-0$
this._evenStyle = evenStyle || {style: {backgroundColor: "white"}}; //$NON-NLS-0$
this._numOfDigits = 0;
this._mapperColumnIndex = mapperColumnIndex;
}
|
[
"function",
"LineNumberCompareRuler",
"(",
"diffNavigator",
",",
"mapperColumnIndex",
",",
"annoModel",
",",
"rulerLocation",
",",
"rulerStyle",
",",
"oddStyle",
",",
"evenStyle",
")",
"{",
"orion",
".",
"CompareRuler",
".",
"call",
"(",
"this",
",",
"annoModel",
",",
"rulerLocation",
",",
"\"page\"",
",",
"rulerStyle",
")",
";",
"//$NON-NLS-0$",
"this",
".",
"_diffNavigator",
"=",
"diffNavigator",
";",
"this",
".",
"_oddStyle",
"=",
"oddStyle",
"||",
"{",
"style",
":",
"{",
"backgroundColor",
":",
"\"white\"",
"}",
"}",
";",
"//$NON-NLS-0$",
"this",
".",
"_evenStyle",
"=",
"evenStyle",
"||",
"{",
"style",
":",
"{",
"backgroundColor",
":",
"\"white\"",
"}",
"}",
";",
"//$NON-NLS-0$",
"this",
".",
"_numOfDigits",
"=",
"0",
";",
"this",
".",
"_mapperColumnIndex",
"=",
"mapperColumnIndex",
";",
"}"
] |
Creates a new line number ruler for the compare editor.
@class The line number ruler is used by the compare editor to render line numbers next to the editor
@name orion.compare.rulers.LineNumberCompareRuler
|
[
"Creates",
"a",
"new",
"line",
"number",
"ruler",
"for",
"the",
"compare",
"editor",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/compare/compareRulers.js#L55-L62
|
14,557
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/undoStack.js
|
UndoStack
|
function UndoStack (view, size) {
this.size = size !== undefined ? size : 100;
this.reset();
var self = this;
this._listener = {
onChanging: function(e) {
self._onChanging(e);
},
onDestroy: function(e) {
self._onDestroy(e);
}
};
if (view.getModel) {
var model = view.getModel();
if (model.getBaseModel) {
model = model.getBaseModel();
}
this.model = model;
this.setView(view);
} else {
this.shared = true;
this.model = view;
}
this.model.addEventListener("Changing", this._listener.onChanging); //$NON-NLS-0$
}
|
javascript
|
function UndoStack (view, size) {
this.size = size !== undefined ? size : 100;
this.reset();
var self = this;
this._listener = {
onChanging: function(e) {
self._onChanging(e);
},
onDestroy: function(e) {
self._onDestroy(e);
}
};
if (view.getModel) {
var model = view.getModel();
if (model.getBaseModel) {
model = model.getBaseModel();
}
this.model = model;
this.setView(view);
} else {
this.shared = true;
this.model = view;
}
this.model.addEventListener("Changing", this._listener.onChanging); //$NON-NLS-0$
}
|
[
"function",
"UndoStack",
"(",
"view",
",",
"size",
")",
"{",
"this",
".",
"size",
"=",
"size",
"!==",
"undefined",
"?",
"size",
":",
"100",
";",
"this",
".",
"reset",
"(",
")",
";",
"var",
"self",
"=",
"this",
";",
"this",
".",
"_listener",
"=",
"{",
"onChanging",
":",
"function",
"(",
"e",
")",
"{",
"self",
".",
"_onChanging",
"(",
"e",
")",
";",
"}",
",",
"onDestroy",
":",
"function",
"(",
"e",
")",
"{",
"self",
".",
"_onDestroy",
"(",
"e",
")",
";",
"}",
"}",
";",
"if",
"(",
"view",
".",
"getModel",
")",
"{",
"var",
"model",
"=",
"view",
".",
"getModel",
"(",
")",
";",
"if",
"(",
"model",
".",
"getBaseModel",
")",
"{",
"model",
"=",
"model",
".",
"getBaseModel",
"(",
")",
";",
"}",
"this",
".",
"model",
"=",
"model",
";",
"this",
".",
"setView",
"(",
"view",
")",
";",
"}",
"else",
"{",
"this",
".",
"shared",
"=",
"true",
";",
"this",
".",
"model",
"=",
"view",
";",
"}",
"this",
".",
"model",
".",
"addEventListener",
"(",
"\"Changing\"",
",",
"this",
".",
"_listener",
".",
"onChanging",
")",
";",
"//$NON-NLS-0$",
"}"
] |
Constructs a new UndoStack on a text view.
@param {orion.editor.TextView} view the text view for the undo stack.
@param {Number} [size=100] the size for the undo stack.
@name orion.editor.UndoStack
@class The UndoStack is used to record the history of a text model associated to an view. Every
change to the model is added to stack, allowing the application to undo and redo these changes.
<p>
<b>See:</b><br/>
{@link orion.editor.TextView}<br/>
</p>
|
[
"Constructs",
"a",
"new",
"UndoStack",
"on",
"a",
"text",
"view",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/undoStack.js#L194-L218
|
14,558
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/undoStack.js
|
function (change) {
if (this.compoundChange) {
this.compoundChange.add(change);
} else {
var length = this.stack.length;
this.stack.splice(this.index, length-this.index, change);
this.index++;
if (this.stack.length > this.size) {
this.stack.shift();
this.index--;
}
}
}
|
javascript
|
function (change) {
if (this.compoundChange) {
this.compoundChange.add(change);
} else {
var length = this.stack.length;
this.stack.splice(this.index, length-this.index, change);
this.index++;
if (this.stack.length > this.size) {
this.stack.shift();
this.index--;
}
}
}
|
[
"function",
"(",
"change",
")",
"{",
"if",
"(",
"this",
".",
"compoundChange",
")",
"{",
"this",
".",
"compoundChange",
".",
"add",
"(",
"change",
")",
";",
"}",
"else",
"{",
"var",
"length",
"=",
"this",
".",
"stack",
".",
"length",
";",
"this",
".",
"stack",
".",
"splice",
"(",
"this",
".",
"index",
",",
"length",
"-",
"this",
".",
"index",
",",
"change",
")",
";",
"this",
".",
"index",
"++",
";",
"if",
"(",
"this",
".",
"stack",
".",
"length",
">",
"this",
".",
"size",
")",
"{",
"this",
".",
"stack",
".",
"shift",
"(",
")",
";",
"this",
".",
"index",
"--",
";",
"}",
"}",
"}"
] |
Adds a change to the stack.
@param change the change to add.
|
[
"Adds",
"a",
"change",
"to",
"the",
"stack",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/undoStack.js#L231-L243
|
|
14,559
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/undoStack.js
|
function() {
this._commitUndo();
var changes = [];
for (var i=this.index; i >= 0; i--) {
changes = changes.concat(this.stack[i].getUndoChanges());
}
return changes;
}
|
javascript
|
function() {
this._commitUndo();
var changes = [];
for (var i=this.index; i >= 0; i--) {
changes = changes.concat(this.stack[i].getUndoChanges());
}
return changes;
}
|
[
"function",
"(",
")",
"{",
"this",
".",
"_commitUndo",
"(",
")",
";",
"var",
"changes",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"this",
".",
"index",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"changes",
"=",
"changes",
".",
"concat",
"(",
"this",
".",
"stack",
"[",
"i",
"]",
".",
"getUndoChanges",
"(",
")",
")",
";",
"}",
"return",
"changes",
";",
"}"
] |
Returns the undo changes.
@return {orion.editor.TextChange[]} an array of TextChanges that are returned in the reverse order
that they occurred (most recent change first).
@see orion.editor.UndoStack#getRedoChanges
|
[
"Returns",
"the",
"undo",
"changes",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/undoStack.js#L366-L373
|
|
14,560
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/undoStack.js
|
function() {
this._commitUndo();
var change, result = false;
this._ignoreUndo = true;
do {
if (this.index <= 0) {
break;
}
change = this.stack[--this.index];
} while (!(result = change.undo(this.view, true)));
this._ignoreUndo = false;
return result;
}
|
javascript
|
function() {
this._commitUndo();
var change, result = false;
this._ignoreUndo = true;
do {
if (this.index <= 0) {
break;
}
change = this.stack[--this.index];
} while (!(result = change.undo(this.view, true)));
this._ignoreUndo = false;
return result;
}
|
[
"function",
"(",
")",
"{",
"this",
".",
"_commitUndo",
"(",
")",
";",
"var",
"change",
",",
"result",
"=",
"false",
";",
"this",
".",
"_ignoreUndo",
"=",
"true",
";",
"do",
"{",
"if",
"(",
"this",
".",
"index",
"<=",
"0",
")",
"{",
"break",
";",
"}",
"change",
"=",
"this",
".",
"stack",
"[",
"--",
"this",
".",
"index",
"]",
";",
"}",
"while",
"(",
"!",
"(",
"result",
"=",
"change",
".",
"undo",
"(",
"this",
".",
"view",
",",
"true",
")",
")",
")",
";",
"this",
".",
"_ignoreUndo",
"=",
"false",
";",
"return",
"result",
";",
"}"
] |
Undo the last change in the stack.
@return {Boolean} returns true if a change was un-done.
@see orion.editor.UndoStack#redo
@see orion.editor.UndoStack#canUndo
|
[
"Undo",
"the",
"last",
"change",
"in",
"the",
"stack",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/undoStack.js#L382-L394
|
|
14,561
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/undoStack.js
|
function() {
this._commitUndo();
var change, result = false;
this._ignoreUndo = true;
do {
if (this.index >= this.stack.length) {
break;
}
change = this.stack[this.index++];
} while (!(result = change.redo(this.view, true)));
this._ignoreUndo = false;
return result;
}
|
javascript
|
function() {
this._commitUndo();
var change, result = false;
this._ignoreUndo = true;
do {
if (this.index >= this.stack.length) {
break;
}
change = this.stack[this.index++];
} while (!(result = change.redo(this.view, true)));
this._ignoreUndo = false;
return result;
}
|
[
"function",
"(",
")",
"{",
"this",
".",
"_commitUndo",
"(",
")",
";",
"var",
"change",
",",
"result",
"=",
"false",
";",
"this",
".",
"_ignoreUndo",
"=",
"true",
";",
"do",
"{",
"if",
"(",
"this",
".",
"index",
">=",
"this",
".",
"stack",
".",
"length",
")",
"{",
"break",
";",
"}",
"change",
"=",
"this",
".",
"stack",
"[",
"this",
".",
"index",
"++",
"]",
";",
"}",
"while",
"(",
"!",
"(",
"result",
"=",
"change",
".",
"redo",
"(",
"this",
".",
"view",
",",
"true",
")",
")",
")",
";",
"this",
".",
"_ignoreUndo",
"=",
"false",
";",
"return",
"result",
";",
"}"
] |
Redo the last change in the stack.
@return {Boolean} returns true if a change was re-done.
@see orion.editor.UndoStack#undo
@see orion.editor.UndoStack#canRedo
|
[
"Redo",
"the",
"last",
"change",
"in",
"the",
"stack",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/undoStack.js#L403-L415
|
|
14,562
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/completer.js
|
Completer
|
function Completer(options, components) {
this.requisition = components.requisition;
this.scratchpad = options.scratchpad;
this.input = { typed: '', cursor: { start: 0, end: 0 } };
this.choice = 0;
this.element = components.element;
this.element.classList.add('gcli-in-complete');
this.element.setAttribute('tabindex', '-1');
this.element.setAttribute('aria-live', 'polite');
this.document = this.element.ownerDocument;
this.inputter = components.inputter;
this.inputter.onInputChange.add(this.update, this);
this.inputter.onAssignmentChange.add(this.update, this);
this.inputter.onChoiceChange.add(this.update, this);
this.autoResize = components.autoResize;
if (this.autoResize) {
this.inputter.onResize.add(this.resized, this);
var dimensions = this.inputter.getDimensions();
if (dimensions) {
this.resized(dimensions);
}
}
this.template = util.toDom(this.document, completerHtml);
// We want the spans to line up without the spaces in the template
util.removeWhitespace(this.template, true);
this.update();
}
|
javascript
|
function Completer(options, components) {
this.requisition = components.requisition;
this.scratchpad = options.scratchpad;
this.input = { typed: '', cursor: { start: 0, end: 0 } };
this.choice = 0;
this.element = components.element;
this.element.classList.add('gcli-in-complete');
this.element.setAttribute('tabindex', '-1');
this.element.setAttribute('aria-live', 'polite');
this.document = this.element.ownerDocument;
this.inputter = components.inputter;
this.inputter.onInputChange.add(this.update, this);
this.inputter.onAssignmentChange.add(this.update, this);
this.inputter.onChoiceChange.add(this.update, this);
this.autoResize = components.autoResize;
if (this.autoResize) {
this.inputter.onResize.add(this.resized, this);
var dimensions = this.inputter.getDimensions();
if (dimensions) {
this.resized(dimensions);
}
}
this.template = util.toDom(this.document, completerHtml);
// We want the spans to line up without the spaces in the template
util.removeWhitespace(this.template, true);
this.update();
}
|
[
"function",
"Completer",
"(",
"options",
",",
"components",
")",
"{",
"this",
".",
"requisition",
"=",
"components",
".",
"requisition",
";",
"this",
".",
"scratchpad",
"=",
"options",
".",
"scratchpad",
";",
"this",
".",
"input",
"=",
"{",
"typed",
":",
"''",
",",
"cursor",
":",
"{",
"start",
":",
"0",
",",
"end",
":",
"0",
"}",
"}",
";",
"this",
".",
"choice",
"=",
"0",
";",
"this",
".",
"element",
"=",
"components",
".",
"element",
";",
"this",
".",
"element",
".",
"classList",
".",
"add",
"(",
"'gcli-in-complete'",
")",
";",
"this",
".",
"element",
".",
"setAttribute",
"(",
"'tabindex'",
",",
"'-1'",
")",
";",
"this",
".",
"element",
".",
"setAttribute",
"(",
"'aria-live'",
",",
"'polite'",
")",
";",
"this",
".",
"document",
"=",
"this",
".",
"element",
".",
"ownerDocument",
";",
"this",
".",
"inputter",
"=",
"components",
".",
"inputter",
";",
"this",
".",
"inputter",
".",
"onInputChange",
".",
"add",
"(",
"this",
".",
"update",
",",
"this",
")",
";",
"this",
".",
"inputter",
".",
"onAssignmentChange",
".",
"add",
"(",
"this",
".",
"update",
",",
"this",
")",
";",
"this",
".",
"inputter",
".",
"onChoiceChange",
".",
"add",
"(",
"this",
".",
"update",
",",
"this",
")",
";",
"this",
".",
"autoResize",
"=",
"components",
".",
"autoResize",
";",
"if",
"(",
"this",
".",
"autoResize",
")",
"{",
"this",
".",
"inputter",
".",
"onResize",
".",
"add",
"(",
"this",
".",
"resized",
",",
"this",
")",
";",
"var",
"dimensions",
"=",
"this",
".",
"inputter",
".",
"getDimensions",
"(",
")",
";",
"if",
"(",
"dimensions",
")",
"{",
"this",
".",
"resized",
"(",
"dimensions",
")",
";",
"}",
"}",
"this",
".",
"template",
"=",
"util",
".",
"toDom",
"(",
"this",
".",
"document",
",",
"completerHtml",
")",
";",
"// We want the spans to line up without the spaces in the template",
"util",
".",
"removeWhitespace",
"(",
"this",
".",
"template",
",",
"true",
")",
";",
"this",
".",
"update",
"(",
")",
";",
"}"
] |
Completer is an 'input-like' element that sits an input element annotating
it with visual goodness.
@param options Object containing user customization properties, including:
- scratchpad (default=none) A way to move JS content to custom JS editor
@param components Object that links to other UI components. GCLI provided:
- requisition: A GCLI Requisition object whose state is monitored
- element: Element to use as root
- autoResize: (default=false): Should we attempt to sync the dimensions of
the complete element with the input element.
|
[
"Completer",
"is",
"an",
"input",
"-",
"like",
"element",
"that",
"sits",
"an",
"input",
"element",
"annotating",
"it",
"with",
"visual",
"goodness",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/completer.js#L38-L72
|
14,563
|
eclipse/orion.client
|
modules/orionode/index.js
|
checkAuthenticated
|
function checkAuthenticated(req, res, next) {
if (!req.user) {
api.writeError(401, res, "Not authenticated");
} else {
req.user.workspaceDir = workspaceDir + (req.user.workspace ? "/" + req.user.workspace : "");
req.user.checkRights = checkRights;
next();
}
}
|
javascript
|
function checkAuthenticated(req, res, next) {
if (!req.user) {
api.writeError(401, res, "Not authenticated");
} else {
req.user.workspaceDir = workspaceDir + (req.user.workspace ? "/" + req.user.workspace : "");
req.user.checkRights = checkRights;
next();
}
}
|
[
"function",
"checkAuthenticated",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"if",
"(",
"!",
"req",
".",
"user",
")",
"{",
"api",
".",
"writeError",
"(",
"401",
",",
"res",
",",
"\"Not authenticated\"",
")",
";",
"}",
"else",
"{",
"req",
".",
"user",
".",
"workspaceDir",
"=",
"workspaceDir",
"+",
"(",
"req",
".",
"user",
".",
"workspace",
"?",
"\"/\"",
"+",
"req",
".",
"user",
".",
"workspace",
":",
"\"\"",
")",
";",
"req",
".",
"user",
".",
"checkRights",
"=",
"checkRights",
";",
"next",
"(",
")",
";",
"}",
"}"
] |
Check if the request is authenticated
@param {XmlHttpRequest} req The original request
@param {XmlHttpResponse} res The orginal response
@param {fn} next The function to advance the Express queue
|
[
"Check",
"if",
"the",
"request",
"is",
"authenticated"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/index.js#L69-L77
|
14,564
|
eclipse/orion.client
|
modules/orionode/index.js
|
checkAccessRights
|
function checkAccessRights(req, res, next) {
const uri = (typeof req.contextPath === "string" && req.baseUrl.substring(req.contextPath.length)) || req.baseUrl;
req.user.checkRights(req.user.username, uri, req, res, next);
}
|
javascript
|
function checkAccessRights(req, res, next) {
const uri = (typeof req.contextPath === "string" && req.baseUrl.substring(req.contextPath.length)) || req.baseUrl;
req.user.checkRights(req.user.username, uri, req, res, next);
}
|
[
"function",
"checkAccessRights",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"const",
"uri",
"=",
"(",
"typeof",
"req",
".",
"contextPath",
"===",
"\"string\"",
"&&",
"req",
".",
"baseUrl",
".",
"substring",
"(",
"req",
".",
"contextPath",
".",
"length",
")",
")",
"||",
"req",
".",
"baseUrl",
";",
"req",
".",
"user",
".",
"checkRights",
"(",
"req",
".",
"user",
".",
"username",
",",
"uri",
",",
"req",
",",
"res",
",",
"next",
")",
";",
"}"
] |
Check the access rights of the request against the requested resource
@param {XmlHttpRequest} req The original request
@param {XmlHttpResponse} res The orginal response
@param {fn} next The function to advance the Express queue
|
[
"Check",
"the",
"access",
"rights",
"of",
"the",
"request",
"against",
"the",
"requested",
"resource"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/index.js#L85-L88
|
14,565
|
eclipse/orion.client
|
modules/orionode/index.js
|
tryLoadRouter
|
function tryLoadRouter(endpoint, options) {
const args = [];
var isEndpoint = typeof endpoint.endpoint === 'string';
if (isEndpoint) {
args.push(endpoint.endpoint);
args.push(responseTime({digits: 2, header: "X-Total-Response-Time", suffix: true}));
}
if (endpoint.authenticated) {
args.push(options.authenticate);
if (endpoint.checkAuthenticated === undefined || endpoint.checkAuthenticated) {
args.push(checkAuthenticated);
}
}
if (isEndpoint) {
args.push(options.basicMiddleware);
}
if (isEndpoint && csrf && (endpoint.checkCSRF === undefined || endpoint.checkCSRF)) { // perform CSRF by default
args.push(csrf);
args.push(function(req, res, next) {
var preamble = options.configParams.get("orion_cookies_name_premable") || "";
var tokenCookie = preamble + 'x-csrf-token';
if (!req.cookies[tokenCookie]) {
var cookieOptions;
var cookiesPath = options.configParams.get("orion_cookies_path");
if (cookiesPath) {
cookieOptions = {path: cookiesPath};
}
res.cookie(tokenCookie, req.csrfToken(), cookieOptions);
}
next();
});
}
if (endpoint.checkAccess) {
args.push(checkAccessRights);
}
try {
const mod = require(endpoint.module);
let fn = null;
if (typeof mod.router === 'function') {
fn = mod.router;
} else if(typeof mod === 'function') {
fn = mod;
} else {
logger.log("Endpoint did not provide the API 'router' function: " + JSON.stringify(endpoint, null, '\t'));
return;
}
if(fn) {
const router = fn(options);
if (!router) {
return; //endpoint does not want to take part in routing, quit
}
args.push(router);
options.app.use.apply(options.app, args);
}
} catch (err) {
logger.error("Failed to load module: " + err.message + "..." + err.stack);
}
}
|
javascript
|
function tryLoadRouter(endpoint, options) {
const args = [];
var isEndpoint = typeof endpoint.endpoint === 'string';
if (isEndpoint) {
args.push(endpoint.endpoint);
args.push(responseTime({digits: 2, header: "X-Total-Response-Time", suffix: true}));
}
if (endpoint.authenticated) {
args.push(options.authenticate);
if (endpoint.checkAuthenticated === undefined || endpoint.checkAuthenticated) {
args.push(checkAuthenticated);
}
}
if (isEndpoint) {
args.push(options.basicMiddleware);
}
if (isEndpoint && csrf && (endpoint.checkCSRF === undefined || endpoint.checkCSRF)) { // perform CSRF by default
args.push(csrf);
args.push(function(req, res, next) {
var preamble = options.configParams.get("orion_cookies_name_premable") || "";
var tokenCookie = preamble + 'x-csrf-token';
if (!req.cookies[tokenCookie]) {
var cookieOptions;
var cookiesPath = options.configParams.get("orion_cookies_path");
if (cookiesPath) {
cookieOptions = {path: cookiesPath};
}
res.cookie(tokenCookie, req.csrfToken(), cookieOptions);
}
next();
});
}
if (endpoint.checkAccess) {
args.push(checkAccessRights);
}
try {
const mod = require(endpoint.module);
let fn = null;
if (typeof mod.router === 'function') {
fn = mod.router;
} else if(typeof mod === 'function') {
fn = mod;
} else {
logger.log("Endpoint did not provide the API 'router' function: " + JSON.stringify(endpoint, null, '\t'));
return;
}
if(fn) {
const router = fn(options);
if (!router) {
return; //endpoint does not want to take part in routing, quit
}
args.push(router);
options.app.use.apply(options.app, args);
}
} catch (err) {
logger.error("Failed to load module: " + err.message + "..." + err.stack);
}
}
|
[
"function",
"tryLoadRouter",
"(",
"endpoint",
",",
"options",
")",
"{",
"const",
"args",
"=",
"[",
"]",
";",
"var",
"isEndpoint",
"=",
"typeof",
"endpoint",
".",
"endpoint",
"===",
"'string'",
";",
"if",
"(",
"isEndpoint",
")",
"{",
"args",
".",
"push",
"(",
"endpoint",
".",
"endpoint",
")",
";",
"args",
".",
"push",
"(",
"responseTime",
"(",
"{",
"digits",
":",
"2",
",",
"header",
":",
"\"X-Total-Response-Time\"",
",",
"suffix",
":",
"true",
"}",
")",
")",
";",
"}",
"if",
"(",
"endpoint",
".",
"authenticated",
")",
"{",
"args",
".",
"push",
"(",
"options",
".",
"authenticate",
")",
";",
"if",
"(",
"endpoint",
".",
"checkAuthenticated",
"===",
"undefined",
"||",
"endpoint",
".",
"checkAuthenticated",
")",
"{",
"args",
".",
"push",
"(",
"checkAuthenticated",
")",
";",
"}",
"}",
"if",
"(",
"isEndpoint",
")",
"{",
"args",
".",
"push",
"(",
"options",
".",
"basicMiddleware",
")",
";",
"}",
"if",
"(",
"isEndpoint",
"&&",
"csrf",
"&&",
"(",
"endpoint",
".",
"checkCSRF",
"===",
"undefined",
"||",
"endpoint",
".",
"checkCSRF",
")",
")",
"{",
"// perform CSRF by default",
"args",
".",
"push",
"(",
"csrf",
")",
";",
"args",
".",
"push",
"(",
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"preamble",
"=",
"options",
".",
"configParams",
".",
"get",
"(",
"\"orion_cookies_name_premable\"",
")",
"||",
"\"\"",
";",
"var",
"tokenCookie",
"=",
"preamble",
"+",
"'x-csrf-token'",
";",
"if",
"(",
"!",
"req",
".",
"cookies",
"[",
"tokenCookie",
"]",
")",
"{",
"var",
"cookieOptions",
";",
"var",
"cookiesPath",
"=",
"options",
".",
"configParams",
".",
"get",
"(",
"\"orion_cookies_path\"",
")",
";",
"if",
"(",
"cookiesPath",
")",
"{",
"cookieOptions",
"=",
"{",
"path",
":",
"cookiesPath",
"}",
";",
"}",
"res",
".",
"cookie",
"(",
"tokenCookie",
",",
"req",
".",
"csrfToken",
"(",
")",
",",
"cookieOptions",
")",
";",
"}",
"next",
"(",
")",
";",
"}",
")",
";",
"}",
"if",
"(",
"endpoint",
".",
"checkAccess",
")",
"{",
"args",
".",
"push",
"(",
"checkAccessRights",
")",
";",
"}",
"try",
"{",
"const",
"mod",
"=",
"require",
"(",
"endpoint",
".",
"module",
")",
";",
"let",
"fn",
"=",
"null",
";",
"if",
"(",
"typeof",
"mod",
".",
"router",
"===",
"'function'",
")",
"{",
"fn",
"=",
"mod",
".",
"router",
";",
"}",
"else",
"if",
"(",
"typeof",
"mod",
"===",
"'function'",
")",
"{",
"fn",
"=",
"mod",
";",
"}",
"else",
"{",
"logger",
".",
"log",
"(",
"\"Endpoint did not provide the API 'router' function: \"",
"+",
"JSON",
".",
"stringify",
"(",
"endpoint",
",",
"null",
",",
"'\\t'",
")",
")",
";",
"return",
";",
"}",
"if",
"(",
"fn",
")",
"{",
"const",
"router",
"=",
"fn",
"(",
"options",
")",
";",
"if",
"(",
"!",
"router",
")",
"{",
"return",
";",
"//endpoint does not want to take part in routing, quit",
"}",
"args",
".",
"push",
"(",
"router",
")",
";",
"options",
".",
"app",
".",
"use",
".",
"apply",
"(",
"options",
".",
"app",
",",
"args",
")",
";",
"}",
"}",
"catch",
"(",
"err",
")",
"{",
"logger",
".",
"error",
"(",
"\"Failed to load module: \"",
"+",
"err",
".",
"message",
"+",
"\"...\"",
"+",
"err",
".",
"stack",
")",
";",
"}",
"}"
] |
Tries to load the router from an endpoint
@param {{?}} endpoint The metadata for the endpoint to load
@param {{?}} options The map of options from the server load
|
[
"Tries",
"to",
"load",
"the",
"router",
"from",
"an",
"endpoint"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/index.js#L95-L152
|
14,566
|
eclipse/orion.client
|
modules/orionode/index.js
|
loadEndpoints
|
function loadEndpoints(endpoints, options, auth) {
if (Array.isArray(endpoints)) {
endpoints.forEach(function(endpoint) {
if (auth !== Boolean(endpoint.authenticated)) {
//after endpoints refactored, remove this check
return;
}
const conditional = endpoint.hasOwnProperty("ifProp");
if (conditional && options.configParams.get(endpoint.ifProp) || !conditional) {
tryLoadRouter(endpoint, options);
}
});
}
}
|
javascript
|
function loadEndpoints(endpoints, options, auth) {
if (Array.isArray(endpoints)) {
endpoints.forEach(function(endpoint) {
if (auth !== Boolean(endpoint.authenticated)) {
//after endpoints refactored, remove this check
return;
}
const conditional = endpoint.hasOwnProperty("ifProp");
if (conditional && options.configParams.get(endpoint.ifProp) || !conditional) {
tryLoadRouter(endpoint, options);
}
});
}
}
|
[
"function",
"loadEndpoints",
"(",
"endpoints",
",",
"options",
",",
"auth",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"endpoints",
")",
")",
"{",
"endpoints",
".",
"forEach",
"(",
"function",
"(",
"endpoint",
")",
"{",
"if",
"(",
"auth",
"!==",
"Boolean",
"(",
"endpoint",
".",
"authenticated",
")",
")",
"{",
"//after endpoints refactored, remove this check",
"return",
";",
"}",
"const",
"conditional",
"=",
"endpoint",
".",
"hasOwnProperty",
"(",
"\"ifProp\"",
")",
";",
"if",
"(",
"conditional",
"&&",
"options",
".",
"configParams",
".",
"get",
"(",
"endpoint",
".",
"ifProp",
")",
"||",
"!",
"conditional",
")",
"{",
"tryLoadRouter",
"(",
"endpoint",
",",
"options",
")",
";",
"}",
"}",
")",
";",
"}",
"}"
] |
Function that loads endpoints from the configuration file
@param {{?}[]} endpoints The array of endpoints
@param {{?}} options The map of options
@param {bool} auth If we should be loading endpoints that require authentication
|
[
"Function",
"that",
"loads",
"endpoints",
"from",
"the",
"configuration",
"file"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/index.js#L160-L173
|
14,567
|
eclipse/orion.client
|
modules/orionode/index.js
|
loadLanguageServers
|
function loadLanguageServers(servers, io, options) {
if (Array.isArray(servers) && options.configParams.get('orion.single.user')) {
const rootPath = path.join(__dirname, "languages");
if (!fs.existsSync(rootPath)) {
logger.log("'languages' folder does not exist. Stopped loading language servers.");
return;
}
addModulePath.addPath(rootPath);
servers.forEach(function(ls) {
if (typeof ls.module !== "string") {
logger.log("Language server metadata is missing 'module' property: " + JSON.stringify(ls, null, '\t'));
return;
}
const lsPath = path.join(rootPath, ls.module);
if (!fs.existsSync(lsPath)) {
logger.log("Language server folder does not exist: " + lsPath);
return;
}
addModulePath.addPath(lsPath);
try {
const server = require(lsPath);
if (server) {
lsregistry.installServer(new server(options), {
io: io,
workspaceDir: workspaceDir,
IN_PORT: 8123,
OUT_PORT: 8124
});
} else {
logger.log("Tried to install language server '" + lsPath + "' but could not instantiate it");
}
} catch (err) {
logger.log("Failed to load language server: " + err);
}
});
}
}
|
javascript
|
function loadLanguageServers(servers, io, options) {
if (Array.isArray(servers) && options.configParams.get('orion.single.user')) {
const rootPath = path.join(__dirname, "languages");
if (!fs.existsSync(rootPath)) {
logger.log("'languages' folder does not exist. Stopped loading language servers.");
return;
}
addModulePath.addPath(rootPath);
servers.forEach(function(ls) {
if (typeof ls.module !== "string") {
logger.log("Language server metadata is missing 'module' property: " + JSON.stringify(ls, null, '\t'));
return;
}
const lsPath = path.join(rootPath, ls.module);
if (!fs.existsSync(lsPath)) {
logger.log("Language server folder does not exist: " + lsPath);
return;
}
addModulePath.addPath(lsPath);
try {
const server = require(lsPath);
if (server) {
lsregistry.installServer(new server(options), {
io: io,
workspaceDir: workspaceDir,
IN_PORT: 8123,
OUT_PORT: 8124
});
} else {
logger.log("Tried to install language server '" + lsPath + "' but could not instantiate it");
}
} catch (err) {
logger.log("Failed to load language server: " + err);
}
});
}
}
|
[
"function",
"loadLanguageServers",
"(",
"servers",
",",
"io",
",",
"options",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"servers",
")",
"&&",
"options",
".",
"configParams",
".",
"get",
"(",
"'orion.single.user'",
")",
")",
"{",
"const",
"rootPath",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"\"languages\"",
")",
";",
"if",
"(",
"!",
"fs",
".",
"existsSync",
"(",
"rootPath",
")",
")",
"{",
"logger",
".",
"log",
"(",
"\"'languages' folder does not exist. Stopped loading language servers.\"",
")",
";",
"return",
";",
"}",
"addModulePath",
".",
"addPath",
"(",
"rootPath",
")",
";",
"servers",
".",
"forEach",
"(",
"function",
"(",
"ls",
")",
"{",
"if",
"(",
"typeof",
"ls",
".",
"module",
"!==",
"\"string\"",
")",
"{",
"logger",
".",
"log",
"(",
"\"Language server metadata is missing 'module' property: \"",
"+",
"JSON",
".",
"stringify",
"(",
"ls",
",",
"null",
",",
"'\\t'",
")",
")",
";",
"return",
";",
"}",
"const",
"lsPath",
"=",
"path",
".",
"join",
"(",
"rootPath",
",",
"ls",
".",
"module",
")",
";",
"if",
"(",
"!",
"fs",
".",
"existsSync",
"(",
"lsPath",
")",
")",
"{",
"logger",
".",
"log",
"(",
"\"Language server folder does not exist: \"",
"+",
"lsPath",
")",
";",
"return",
";",
"}",
"addModulePath",
".",
"addPath",
"(",
"lsPath",
")",
";",
"try",
"{",
"const",
"server",
"=",
"require",
"(",
"lsPath",
")",
";",
"if",
"(",
"server",
")",
"{",
"lsregistry",
".",
"installServer",
"(",
"new",
"server",
"(",
"options",
")",
",",
"{",
"io",
":",
"io",
",",
"workspaceDir",
":",
"workspaceDir",
",",
"IN_PORT",
":",
"8123",
",",
"OUT_PORT",
":",
"8124",
"}",
")",
";",
"}",
"else",
"{",
"logger",
".",
"log",
"(",
"\"Tried to install language server '\"",
"+",
"lsPath",
"+",
"\"' but could not instantiate it\"",
")",
";",
"}",
"}",
"catch",
"(",
"err",
")",
"{",
"logger",
".",
"log",
"(",
"\"Failed to load language server: \"",
"+",
"err",
")",
";",
"}",
"}",
")",
";",
"}",
"}"
] |
Load any language servers mapped to the server config
@param {{?}[]} servers The array of language server metadata
@param {socketio} io The backing socket.IO library
@param {{?}} options The map of server configuration options
@since 18.0
|
[
"Load",
"any",
"language",
"servers",
"mapped",
"to",
"the",
"server",
"config"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/index.js#L182-L218
|
14,568
|
eclipse/orion.client
|
modules/orionode/lib/shared/sharedUtil.js
|
treeJSON
|
function treeJSON(name, location, timestamp, dir, length, addNameToLoc) {
location = api.toURLPath(location);
if (typeof addNameToLoc == 'undefined' || addNameToLoc) {
location += "/" + name;
}
var result = {
Name: name,
LocalTimeStamp: timestamp,
Directory: dir,
Length: length,
Location: location ? contextPath +"/sharedWorkspace/tree/file" + location : contextPath +"/sharedWorkspace/tree",
ChildrenLocation: dir ? (location ? contextPath +"/sharedWorkspace/tree/file" + location + "?depth=1": contextPath +"/sharedWorkspace/tree" + "?depth=1") : undefined,
Parents: fileUtil.getParents(contextPath +'/sharedWorkspace/tree/file' + location.split('/').splice(0, 2).join('/'), location.split('/').splice(2).join('/')),
Attributes: {
ReadOnly: false
}
};
result.ImportLocation = result.Location.replace(/\/sharedWorkspace\/tree\/file/, "/sharedWorkspace/tree/xfer/import").replace(/\/$/, "");
result.ExportLocation = result.Location.replace(/\/sharedWorkspace\/tree\/file/, "/sharedWorkspace/tree/xfer/export").replace(/\/$/, "") + ".zip";
return result;
}
|
javascript
|
function treeJSON(name, location, timestamp, dir, length, addNameToLoc) {
location = api.toURLPath(location);
if (typeof addNameToLoc == 'undefined' || addNameToLoc) {
location += "/" + name;
}
var result = {
Name: name,
LocalTimeStamp: timestamp,
Directory: dir,
Length: length,
Location: location ? contextPath +"/sharedWorkspace/tree/file" + location : contextPath +"/sharedWorkspace/tree",
ChildrenLocation: dir ? (location ? contextPath +"/sharedWorkspace/tree/file" + location + "?depth=1": contextPath +"/sharedWorkspace/tree" + "?depth=1") : undefined,
Parents: fileUtil.getParents(contextPath +'/sharedWorkspace/tree/file' + location.split('/').splice(0, 2).join('/'), location.split('/').splice(2).join('/')),
Attributes: {
ReadOnly: false
}
};
result.ImportLocation = result.Location.replace(/\/sharedWorkspace\/tree\/file/, "/sharedWorkspace/tree/xfer/import").replace(/\/$/, "");
result.ExportLocation = result.Location.replace(/\/sharedWorkspace\/tree\/file/, "/sharedWorkspace/tree/xfer/export").replace(/\/$/, "") + ".zip";
return result;
}
|
[
"function",
"treeJSON",
"(",
"name",
",",
"location",
",",
"timestamp",
",",
"dir",
",",
"length",
",",
"addNameToLoc",
")",
"{",
"location",
"=",
"api",
".",
"toURLPath",
"(",
"location",
")",
";",
"if",
"(",
"typeof",
"addNameToLoc",
"==",
"'undefined'",
"||",
"addNameToLoc",
")",
"{",
"location",
"+=",
"\"/\"",
"+",
"name",
";",
"}",
"var",
"result",
"=",
"{",
"Name",
":",
"name",
",",
"LocalTimeStamp",
":",
"timestamp",
",",
"Directory",
":",
"dir",
",",
"Length",
":",
"length",
",",
"Location",
":",
"location",
"?",
"contextPath",
"+",
"\"/sharedWorkspace/tree/file\"",
"+",
"location",
":",
"contextPath",
"+",
"\"/sharedWorkspace/tree\"",
",",
"ChildrenLocation",
":",
"dir",
"?",
"(",
"location",
"?",
"contextPath",
"+",
"\"/sharedWorkspace/tree/file\"",
"+",
"location",
"+",
"\"?depth=1\"",
":",
"contextPath",
"+",
"\"/sharedWorkspace/tree\"",
"+",
"\"?depth=1\"",
")",
":",
"undefined",
",",
"Parents",
":",
"fileUtil",
".",
"getParents",
"(",
"contextPath",
"+",
"'/sharedWorkspace/tree/file'",
"+",
"location",
".",
"split",
"(",
"'/'",
")",
".",
"splice",
"(",
"0",
",",
"2",
")",
".",
"join",
"(",
"'/'",
")",
",",
"location",
".",
"split",
"(",
"'/'",
")",
".",
"splice",
"(",
"2",
")",
".",
"join",
"(",
"'/'",
")",
")",
",",
"Attributes",
":",
"{",
"ReadOnly",
":",
"false",
"}",
"}",
";",
"result",
".",
"ImportLocation",
"=",
"result",
".",
"Location",
".",
"replace",
"(",
"/",
"\\/sharedWorkspace\\/tree\\/file",
"/",
",",
"\"/sharedWorkspace/tree/xfer/import\"",
")",
".",
"replace",
"(",
"/",
"\\/$",
"/",
",",
"\"\"",
")",
";",
"result",
".",
"ExportLocation",
"=",
"result",
".",
"Location",
".",
"replace",
"(",
"/",
"\\/sharedWorkspace\\/tree\\/file",
"/",
",",
"\"/sharedWorkspace/tree/xfer/export\"",
")",
".",
"replace",
"(",
"/",
"\\/$",
"/",
",",
"\"\"",
")",
"+",
"\".zip\"",
";",
"return",
"result",
";",
"}"
] |
if opening a file, we don't want to add the name to the location so addNameToLoc needs to be false
else undefined
|
[
"if",
"opening",
"a",
"file",
"we",
"don",
"t",
"want",
"to",
"add",
"the",
"name",
"to",
"the",
"location",
"so",
"addNameToLoc",
"needs",
"to",
"be",
"false",
"else",
"undefined"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/shared/sharedUtil.js#L75-L95
|
14,569
|
eclipse/orion.client
|
modules/orionode/lib/shared/sharedUtil.js
|
getChildren
|
function getChildren(fileRoot, directory, depth, excludes) {
return fs.readdirAsync(directory)
.then(function(files) {
return Promise.map(files, function(file) {
if (Array.isArray(excludes) && excludes.indexOf(file) !== -1) {
return null; // omit
}
var filepath = path.join(directory, file);
return fs.statAsync(filepath)
.then(function(stats) {
var isDir = stats.isDirectory();
return treeJSON(file, fileRoot, 0, isDir, depth ? depth - 1 : 0);
})
.catch(function() {
return null; // suppress rejection
});
});
})
.then(function(results) {
return results.filter(function(r) { return r; });
});
}
|
javascript
|
function getChildren(fileRoot, directory, depth, excludes) {
return fs.readdirAsync(directory)
.then(function(files) {
return Promise.map(files, function(file) {
if (Array.isArray(excludes) && excludes.indexOf(file) !== -1) {
return null; // omit
}
var filepath = path.join(directory, file);
return fs.statAsync(filepath)
.then(function(stats) {
var isDir = stats.isDirectory();
return treeJSON(file, fileRoot, 0, isDir, depth ? depth - 1 : 0);
})
.catch(function() {
return null; // suppress rejection
});
});
})
.then(function(results) {
return results.filter(function(r) { return r; });
});
}
|
[
"function",
"getChildren",
"(",
"fileRoot",
",",
"directory",
",",
"depth",
",",
"excludes",
")",
"{",
"return",
"fs",
".",
"readdirAsync",
"(",
"directory",
")",
".",
"then",
"(",
"function",
"(",
"files",
")",
"{",
"return",
"Promise",
".",
"map",
"(",
"files",
",",
"function",
"(",
"file",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"excludes",
")",
"&&",
"excludes",
".",
"indexOf",
"(",
"file",
")",
"!==",
"-",
"1",
")",
"{",
"return",
"null",
";",
"// omit",
"}",
"var",
"filepath",
"=",
"path",
".",
"join",
"(",
"directory",
",",
"file",
")",
";",
"return",
"fs",
".",
"statAsync",
"(",
"filepath",
")",
".",
"then",
"(",
"function",
"(",
"stats",
")",
"{",
"var",
"isDir",
"=",
"stats",
".",
"isDirectory",
"(",
")",
";",
"return",
"treeJSON",
"(",
"file",
",",
"fileRoot",
",",
"0",
",",
"isDir",
",",
"depth",
"?",
"depth",
"-",
"1",
":",
"0",
")",
";",
"}",
")",
".",
"catch",
"(",
"function",
"(",
")",
"{",
"return",
"null",
";",
"// suppress rejection",
"}",
")",
";",
"}",
")",
";",
"}",
")",
".",
"then",
"(",
"function",
"(",
"results",
")",
"{",
"return",
"results",
".",
"filter",
"(",
"function",
"(",
"r",
")",
"{",
"return",
"r",
";",
"}",
")",
";",
"}",
")",
";",
"}"
] |
Returns a list of children of the given directory.
|
[
"Returns",
"a",
"list",
"of",
"children",
"of",
"the",
"given",
"directory",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/shared/sharedUtil.js#L100-L121
|
14,570
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.git/web/orion/git/widgets/gitChangeList.js
|
function() {
if(!this.model.root) {
return new Deferred().resolve(true);
}
var modelList = this.model.root.children || this.model.root.Children;
if(!modelList) {
return new Deferred().resolve(true);
}
var isDirty = modelList.some( function(child) {
if(child.children && child.children.length === 1 && child.children[0].resourceComparer && child.children[0].resourceComparer.isDirty()) {
return true;
}
});
if(isDirty) {
var dialog = this.registry.getService("orion.page.dialog");
var d = new Deferred();
dialog.confirm(messages.confirmUnsavedChanges, function(result){
if(result){
var promises = [];
modelList.forEach( function(child) {
if(child.children && child.children.length === 1 && child.children[0].resourceComparer && child.children[0].resourceComparer.isDirty() && child.children[0].resourceComparer.save) {
promises.push(child.children[0].resourceComparer.save(true));
}
});
return d.resolve(Deferred.all(promises));
}else{
return d.resolve();
}
});
return d;
} else {
return new Deferred().resolve(true);
}
}
|
javascript
|
function() {
if(!this.model.root) {
return new Deferred().resolve(true);
}
var modelList = this.model.root.children || this.model.root.Children;
if(!modelList) {
return new Deferred().resolve(true);
}
var isDirty = modelList.some( function(child) {
if(child.children && child.children.length === 1 && child.children[0].resourceComparer && child.children[0].resourceComparer.isDirty()) {
return true;
}
});
if(isDirty) {
var dialog = this.registry.getService("orion.page.dialog");
var d = new Deferred();
dialog.confirm(messages.confirmUnsavedChanges, function(result){
if(result){
var promises = [];
modelList.forEach( function(child) {
if(child.children && child.children.length === 1 && child.children[0].resourceComparer && child.children[0].resourceComparer.isDirty() && child.children[0].resourceComparer.save) {
promises.push(child.children[0].resourceComparer.save(true));
}
});
return d.resolve(Deferred.all(promises));
}else{
return d.resolve();
}
});
return d;
} else {
return new Deferred().resolve(true);
}
}
|
[
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"model",
".",
"root",
")",
"{",
"return",
"new",
"Deferred",
"(",
")",
".",
"resolve",
"(",
"true",
")",
";",
"}",
"var",
"modelList",
"=",
"this",
".",
"model",
".",
"root",
".",
"children",
"||",
"this",
".",
"model",
".",
"root",
".",
"Children",
";",
"if",
"(",
"!",
"modelList",
")",
"{",
"return",
"new",
"Deferred",
"(",
")",
".",
"resolve",
"(",
"true",
")",
";",
"}",
"var",
"isDirty",
"=",
"modelList",
".",
"some",
"(",
"function",
"(",
"child",
")",
"{",
"if",
"(",
"child",
".",
"children",
"&&",
"child",
".",
"children",
".",
"length",
"===",
"1",
"&&",
"child",
".",
"children",
"[",
"0",
"]",
".",
"resourceComparer",
"&&",
"child",
".",
"children",
"[",
"0",
"]",
".",
"resourceComparer",
".",
"isDirty",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
")",
";",
"if",
"(",
"isDirty",
")",
"{",
"var",
"dialog",
"=",
"this",
".",
"registry",
".",
"getService",
"(",
"\"orion.page.dialog\"",
")",
";",
"var",
"d",
"=",
"new",
"Deferred",
"(",
")",
";",
"dialog",
".",
"confirm",
"(",
"messages",
".",
"confirmUnsavedChanges",
",",
"function",
"(",
"result",
")",
"{",
"if",
"(",
"result",
")",
"{",
"var",
"promises",
"=",
"[",
"]",
";",
"modelList",
".",
"forEach",
"(",
"function",
"(",
"child",
")",
"{",
"if",
"(",
"child",
".",
"children",
"&&",
"child",
".",
"children",
".",
"length",
"===",
"1",
"&&",
"child",
".",
"children",
"[",
"0",
"]",
".",
"resourceComparer",
"&&",
"child",
".",
"children",
"[",
"0",
"]",
".",
"resourceComparer",
".",
"isDirty",
"(",
")",
"&&",
"child",
".",
"children",
"[",
"0",
"]",
".",
"resourceComparer",
".",
"save",
")",
"{",
"promises",
".",
"push",
"(",
"child",
".",
"children",
"[",
"0",
"]",
".",
"resourceComparer",
".",
"save",
"(",
"true",
")",
")",
";",
"}",
"}",
")",
";",
"return",
"d",
".",
"resolve",
"(",
"Deferred",
".",
"all",
"(",
"promises",
")",
")",
";",
"}",
"else",
"{",
"return",
"d",
".",
"resolve",
"(",
")",
";",
"}",
"}",
")",
";",
"return",
"d",
";",
"}",
"else",
"{",
"return",
"new",
"Deferred",
"(",
")",
".",
"resolve",
"(",
"true",
")",
";",
"}",
"}"
] |
This function is called when any of the compare widgets in the explorer are hooked up and need to be unhooked
|
[
"This",
"function",
"is",
"called",
"when",
"any",
"of",
"the",
"compare",
"widgets",
"in",
"the",
"explorer",
"are",
"hooked",
"up",
"and",
"need",
"to",
"be",
"unhooked"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.git/web/orion/git/widgets/gitChangeList.js#L483-L516
|
|
14,571
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/webtools/htmlContentAssist.js
|
function(node, offset, source) {
if (node){
if (node.type === 'tag'){
var name = node.name ? node.name.toLowerCase() : '';
if (name === 'script' || name === 'style') {
if (node.openrange && node.endrange){
// If we are in the tag itself we are not actually in the script block
if (offset < node.openrange[1] || offset > node.endrange[0]){
return false;
}
}
return true;
}
}
}
return false;
}
|
javascript
|
function(node, offset, source) {
if (node){
if (node.type === 'tag'){
var name = node.name ? node.name.toLowerCase() : '';
if (name === 'script' || name === 'style') {
if (node.openrange && node.endrange){
// If we are in the tag itself we are not actually in the script block
if (offset < node.openrange[1] || offset > node.endrange[0]){
return false;
}
}
return true;
}
}
}
return false;
}
|
[
"function",
"(",
"node",
",",
"offset",
",",
"source",
")",
"{",
"if",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"type",
"===",
"'tag'",
")",
"{",
"var",
"name",
"=",
"node",
".",
"name",
"?",
"node",
".",
"name",
".",
"toLowerCase",
"(",
")",
":",
"''",
";",
"if",
"(",
"name",
"===",
"'script'",
"||",
"name",
"===",
"'style'",
")",
"{",
"if",
"(",
"node",
".",
"openrange",
"&&",
"node",
".",
"endrange",
")",
"{",
"// If we are in the tag itself we are not actually in the script block",
"if",
"(",
"offset",
"<",
"node",
".",
"openrange",
"[",
"1",
"]",
"||",
"offset",
">",
"node",
".",
"endrange",
"[",
"0",
"]",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] |
Returns if the tag block that we are in is a style of script block
@param {Object} node The node
@returns {Boolean} True if the current node context is style or script
@since 10.0
|
[
"Returns",
"if",
"the",
"tag",
"block",
"that",
"we",
"are",
"in",
"is",
"a",
"style",
"of",
"script",
"block"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/webtools/htmlContentAssist.js#L239-L255
|
|
14,572
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/webtools/htmlContentAssist.js
|
function(node, offset, source) {
if(node && source) {
switch(node.type) {
case 'tag': {
// Smarter way now that we have end ranges
if (node.endrange){
return offset > node.endrange[0] && offset < node.endrange[1];
}
// TODO Delete the old way
var _s = source.slice(node.range[0], node.range[1]);
var _r = new RegExp("<\\s*\/\\s*"+node.name+"\\s*>$"); //$NON-NLS-1$ //$NON-NLS-2$
var _m = _r.exec(_s);
if(_m) {
return offset > (_m.index+node.range[0]) && offset < node.range[1];
}
break;
}
default: {
var _p = node.parent;
if(_p && _p.type === 'tag') {
return Array.isArray(_p.children) && _p.children.length > 0 && (offset > _p.children[_p.children.length-1].range[1]) && offset <= _p.range[1];
}
break;
}
}
}
return false;
}
|
javascript
|
function(node, offset, source) {
if(node && source) {
switch(node.type) {
case 'tag': {
// Smarter way now that we have end ranges
if (node.endrange){
return offset > node.endrange[0] && offset < node.endrange[1];
}
// TODO Delete the old way
var _s = source.slice(node.range[0], node.range[1]);
var _r = new RegExp("<\\s*\/\\s*"+node.name+"\\s*>$"); //$NON-NLS-1$ //$NON-NLS-2$
var _m = _r.exec(_s);
if(_m) {
return offset > (_m.index+node.range[0]) && offset < node.range[1];
}
break;
}
default: {
var _p = node.parent;
if(_p && _p.type === 'tag') {
return Array.isArray(_p.children) && _p.children.length > 0 && (offset > _p.children[_p.children.length-1].range[1]) && offset <= _p.range[1];
}
break;
}
}
}
return false;
}
|
[
"function",
"(",
"node",
",",
"offset",
",",
"source",
")",
"{",
"if",
"(",
"node",
"&&",
"source",
")",
"{",
"switch",
"(",
"node",
".",
"type",
")",
"{",
"case",
"'tag'",
":",
"{",
"// Smarter way now that we have end ranges",
"if",
"(",
"node",
".",
"endrange",
")",
"{",
"return",
"offset",
">",
"node",
".",
"endrange",
"[",
"0",
"]",
"&&",
"offset",
"<",
"node",
".",
"endrange",
"[",
"1",
"]",
";",
"}",
"// TODO Delete the old way",
"var",
"_s",
"=",
"source",
".",
"slice",
"(",
"node",
".",
"range",
"[",
"0",
"]",
",",
"node",
".",
"range",
"[",
"1",
"]",
")",
";",
"var",
"_r",
"=",
"new",
"RegExp",
"(",
"\"<\\\\s*\\/\\\\s*\"",
"+",
"node",
".",
"name",
"+",
"\"\\\\s*>$\"",
")",
";",
"//$NON-NLS-1$ //$NON-NLS-2$",
"var",
"_m",
"=",
"_r",
".",
"exec",
"(",
"_s",
")",
";",
"if",
"(",
"_m",
")",
"{",
"return",
"offset",
">",
"(",
"_m",
".",
"index",
"+",
"node",
".",
"range",
"[",
"0",
"]",
")",
"&&",
"offset",
"<",
"node",
".",
"range",
"[",
"1",
"]",
";",
"}",
"break",
";",
"}",
"default",
":",
"{",
"var",
"_p",
"=",
"node",
".",
"parent",
";",
"if",
"(",
"_p",
"&&",
"_p",
".",
"type",
"===",
"'tag'",
")",
"{",
"return",
"Array",
".",
"isArray",
"(",
"_p",
".",
"children",
")",
"&&",
"_p",
".",
"children",
".",
"length",
">",
"0",
"&&",
"(",
"offset",
">",
"_p",
".",
"children",
"[",
"_p",
".",
"children",
".",
"length",
"-",
"1",
"]",
".",
"range",
"[",
"1",
"]",
")",
"&&",
"offset",
"<=",
"_p",
".",
"range",
"[",
"1",
"]",
";",
"}",
"break",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] |
Returns if the offset is in a closing tag. A closing tag is determined as an
offset past the last child but before the closing range of the tag itself
@param {Object} node The AST not context
@param {Number} offset The curren offset
@param {String} source The source
|
[
"Returns",
"if",
"the",
"offset",
"is",
"in",
"a",
"closing",
"tag",
".",
"A",
"closing",
"tag",
"is",
"determined",
"as",
"an",
"offset",
"past",
"the",
"last",
"child",
"but",
"before",
"the",
"closing",
"range",
"of",
"the",
"tag",
"itself"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/webtools/htmlContentAssist.js#L264-L291
|
|
14,573
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/webtools/htmlContentAssist.js
|
function(node, offset) {
return node && node.type === 'comment' && offset >= node.range[0] && offset <= node.range[1];
}
|
javascript
|
function(node, offset) {
return node && node.type === 'comment' && offset >= node.range[0] && offset <= node.range[1];
}
|
[
"function",
"(",
"node",
",",
"offset",
")",
"{",
"return",
"node",
"&&",
"node",
".",
"type",
"===",
"'comment'",
"&&",
"offset",
">=",
"node",
".",
"range",
"[",
"0",
"]",
"&&",
"offset",
"<=",
"node",
".",
"range",
"[",
"1",
"]",
";",
"}"
] |
Computes if we are trying to complete a comment start or end
@param {Object} node The AST node to check with the offset
@returns {Boolean} True if we are completing a comment, false otherwise
@since 10.0
|
[
"Computes",
"if",
"we",
"are",
"trying",
"to",
"complete",
"a",
"comment",
"start",
"or",
"end"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/webtools/htmlContentAssist.js#L299-L301
|
|
14,574
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/webtools/htmlContentAssist.js
|
function(node, source, params) {
if(node) {
var offset = params.offset;
if(node.type === 'tag') {
var tagNameEnd = node.range[0] + 1 + node.name.length;
if(tagNameEnd < offset) {
if (node.openrange){
return offset < node.openrange[1] || (offset === node.openrange[1] && source[offset-1] !== '>' && source[offset-1] !== '<');
}
// TODO openrange from htmlparser2 is more accurate, consider removing this legacy range check
var idx = offset;
while(idx < node.range[1]) {
var char = source[idx];
if(char === '<') {
return false;
} else if(char === '>') {
return true;
}
idx++;
}
}
} else if(node.type === 'attr') {
return offset >= node.range[0] || offset <= node.range[1];
}
}
return false;
}
|
javascript
|
function(node, source, params) {
if(node) {
var offset = params.offset;
if(node.type === 'tag') {
var tagNameEnd = node.range[0] + 1 + node.name.length;
if(tagNameEnd < offset) {
if (node.openrange){
return offset < node.openrange[1] || (offset === node.openrange[1] && source[offset-1] !== '>' && source[offset-1] !== '<');
}
// TODO openrange from htmlparser2 is more accurate, consider removing this legacy range check
var idx = offset;
while(idx < node.range[1]) {
var char = source[idx];
if(char === '<') {
return false;
} else if(char === '>') {
return true;
}
idx++;
}
}
} else if(node.type === 'attr') {
return offset >= node.range[0] || offset <= node.range[1];
}
}
return false;
}
|
[
"function",
"(",
"node",
",",
"source",
",",
"params",
")",
"{",
"if",
"(",
"node",
")",
"{",
"var",
"offset",
"=",
"params",
".",
"offset",
";",
"if",
"(",
"node",
".",
"type",
"===",
"'tag'",
")",
"{",
"var",
"tagNameEnd",
"=",
"node",
".",
"range",
"[",
"0",
"]",
"+",
"1",
"+",
"node",
".",
"name",
".",
"length",
";",
"if",
"(",
"tagNameEnd",
"<",
"offset",
")",
"{",
"if",
"(",
"node",
".",
"openrange",
")",
"{",
"return",
"offset",
"<",
"node",
".",
"openrange",
"[",
"1",
"]",
"||",
"(",
"offset",
"===",
"node",
".",
"openrange",
"[",
"1",
"]",
"&&",
"source",
"[",
"offset",
"-",
"1",
"]",
"!==",
"'>'",
"&&",
"source",
"[",
"offset",
"-",
"1",
"]",
"!==",
"'<'",
")",
";",
"}",
"// TODO openrange from htmlparser2 is more accurate, consider removing this legacy range check",
"var",
"idx",
"=",
"offset",
";",
"while",
"(",
"idx",
"<",
"node",
".",
"range",
"[",
"1",
"]",
")",
"{",
"var",
"char",
"=",
"source",
"[",
"idx",
"]",
";",
"if",
"(",
"char",
"===",
"'<'",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"char",
"===",
"'>'",
")",
"{",
"return",
"true",
";",
"}",
"idx",
"++",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"node",
".",
"type",
"===",
"'attr'",
")",
"{",
"return",
"offset",
">=",
"node",
".",
"range",
"[",
"0",
"]",
"||",
"offset",
"<=",
"node",
".",
"range",
"[",
"1",
"]",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Computes if we are trying to complete tag attributes
@param {Object} node The AST node to check with the offset
@param {String} source The backing source
@param {Object} params The parameters
@returns {Boolean} True if we are completing the attributes of a tag, false otherwise
@since 10.0
|
[
"Computes",
"if",
"we",
"are",
"trying",
"to",
"complete",
"tag",
"attributes"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/webtools/htmlContentAssist.js#L324-L350
|
|
14,575
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/webtools/htmlContentAssist.js
|
function(node, params) {
if(node) {
var offset = params.offset;
if(node.type === 'tag') {
if (node.openrange){
if (offset >= node.openrange[0] && offset <= node.openrange[1]){
return true;
}
} else if (offset >= node.range[0] && offset <= node.range[1]){
return true;
}
}
}
return false;
}
|
javascript
|
function(node, params) {
if(node) {
var offset = params.offset;
if(node.type === 'tag') {
if (node.openrange){
if (offset >= node.openrange[0] && offset <= node.openrange[1]){
return true;
}
} else if (offset >= node.range[0] && offset <= node.range[1]){
return true;
}
}
}
return false;
}
|
[
"function",
"(",
"node",
",",
"params",
")",
"{",
"if",
"(",
"node",
")",
"{",
"var",
"offset",
"=",
"params",
".",
"offset",
";",
"if",
"(",
"node",
".",
"type",
"===",
"'tag'",
")",
"{",
"if",
"(",
"node",
".",
"openrange",
")",
"{",
"if",
"(",
"offset",
">=",
"node",
".",
"openrange",
"[",
"0",
"]",
"&&",
"offset",
"<=",
"node",
".",
"openrange",
"[",
"1",
"]",
")",
"{",
"return",
"true",
";",
"}",
"}",
"else",
"if",
"(",
"offset",
">=",
"node",
".",
"range",
"[",
"0",
"]",
"&&",
"offset",
"<=",
"node",
".",
"range",
"[",
"1",
"]",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] |
Computes if we are trying to complete a tag
@param {Object} node The AST node to check with the offset
@param {Object} params The parameters
@returns {Boolean} True if we are completing a tag, false otherwise
@since 10.0
|
[
"Computes",
"if",
"we",
"are",
"trying",
"to",
"complete",
"a",
"tag"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/webtools/htmlContentAssist.js#L359-L373
|
|
14,576
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/webtools/htmlContentAssist.js
|
function(node, source) {
if(node && node.type === 'tag' && node.name) {
if (node.endrange && node.endrange.length === 2){
// If the HTML is incomplete, the parser recovery sometimes uses the end range of the parent element
return node.name === source.substring(node.endrange[0]+2, node.endrange[1]-1);
}
}
}
|
javascript
|
function(node, source) {
if(node && node.type === 'tag' && node.name) {
if (node.endrange && node.endrange.length === 2){
// If the HTML is incomplete, the parser recovery sometimes uses the end range of the parent element
return node.name === source.substring(node.endrange[0]+2, node.endrange[1]-1);
}
}
}
|
[
"function",
"(",
"node",
",",
"source",
")",
"{",
"if",
"(",
"node",
"&&",
"node",
".",
"type",
"===",
"'tag'",
"&&",
"node",
".",
"name",
")",
"{",
"if",
"(",
"node",
".",
"endrange",
"&&",
"node",
".",
"endrange",
".",
"length",
"===",
"2",
")",
"{",
"// If the HTML is incomplete, the parser recovery sometimes uses the end range of the parent element",
"return",
"node",
".",
"name",
"===",
"source",
".",
"substring",
"(",
"node",
".",
"endrange",
"[",
"0",
"]",
"+",
"2",
",",
"node",
".",
"endrange",
"[",
"1",
"]",
"-",
"1",
")",
";",
"}",
"}",
"}"
] |
Computes if we are completing a tag that already has a matching close tag
@param {Object} node The AST node to check with the offset
@param {String} source The source of the file
@returns {Boolean} True if we are completing a tag with a matching close tag, false otherwise
@since 11.0
|
[
"Computes",
"if",
"we",
"are",
"completing",
"a",
"tag",
"that",
"already",
"has",
"a",
"matching",
"close",
"tag"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/webtools/htmlContentAssist.js#L382-L389
|
|
14,577
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/webtools/htmlContentAssist.js
|
function(node, source, params) {
var proposals = [];
var prefix = params.prefix ? params.prefix : "";
// we need to check if we need to rebuild the prefix for completion that contains a '-'
var index = params.offset - prefix.length - 1;
if (index > 0 && index < source.length) {
var precedingChar = source.charAt(index);
if (precedingChar === '=' && prefix.length === 0 && (index - 1) > 0) {
precedingChar = source.charAt(index - 1);
if (/[A-Za-z0-9_]/.test(precedingChar)) {
proposals.push(this.makeComputedProposal("\"\"", Messages['addQuotesToAttributes'], " - \"\"", null, prefix)); //$NON-NLS-1$ //$NON-NLS-2$
return proposals;
}
}
}
var attrs = Attributes.getAttributesForNode(node);
if(Array.isArray(attrs.global)) {
proposals = proposals.concat(this.addProposals(node, attrs.global, params));
}
if(Array.isArray(attrs.formevents)) {
var arr = this.addProposals(node, attrs.formevents, params);
if(arr.length > 0) {
proposals.push({
proposal: '',
description: Messages['formeventsHeader'],
style: 'noemphasis_title', //$NON-NLS-1$
unselectable: true,
kind: 'html' //$NON-NLS-1$
});
proposals = proposals.concat(arr);
}
}
if(Array.isArray(attrs.keyboardevents)) {
arr = this.addProposals(node, attrs.keyboardevents, params);
if(arr.length > 0) {
proposals.push({
proposal: '',
description: Messages['keyboardeventsHeader'],
style: 'noemphasis_title', //$NON-NLS-1$
unselectable: true,
kind: 'html' //$NON-NLS-1$
});
proposals = proposals.concat(arr);
}
}
if(Array.isArray(attrs.mouseevents)) {
arr = this.addProposals(node, attrs.mouseevents, params);
if(arr.length > 0) {
proposals.push({
proposal: '',
description: Messages['mouseeventsHeader'],
style: 'noemphasis_title', //$NON-NLS-1$
unselectable: true,
kind: 'html' //$NON-NLS-1$
});
proposals = proposals.concat(arr);
}
}
if(Array.isArray(attrs.windowevents) && attrs.windowevents.length > 0) {
arr = this.addProposals(node, attrs.windowevents, params);
if(arr.length > 0) {
proposals.push({
proposal: '',
description: Messages['windoweventsHeader'],
style: 'noemphasis_title', //$NON-NLS-1$
unselectable: true,
kind: 'html' //$NON-NLS-1$
});
proposals = proposals.concat(arr);
}
}
if(Array.isArray(attrs.aria)) {
arr = this.addProposals(node, attrs.aria, params);
if(arr.length > 0) {
proposals.push({
proposal: '',
description: 'ARIA', //$NON-NLS-1$
style: 'noemphasis_title', //$NON-NLS-1$
unselectable: true,
kind: 'html' //$NON-NLS-1$
});
proposals = proposals.concat(arr);
}
}
return proposals;
}
|
javascript
|
function(node, source, params) {
var proposals = [];
var prefix = params.prefix ? params.prefix : "";
// we need to check if we need to rebuild the prefix for completion that contains a '-'
var index = params.offset - prefix.length - 1;
if (index > 0 && index < source.length) {
var precedingChar = source.charAt(index);
if (precedingChar === '=' && prefix.length === 0 && (index - 1) > 0) {
precedingChar = source.charAt(index - 1);
if (/[A-Za-z0-9_]/.test(precedingChar)) {
proposals.push(this.makeComputedProposal("\"\"", Messages['addQuotesToAttributes'], " - \"\"", null, prefix)); //$NON-NLS-1$ //$NON-NLS-2$
return proposals;
}
}
}
var attrs = Attributes.getAttributesForNode(node);
if(Array.isArray(attrs.global)) {
proposals = proposals.concat(this.addProposals(node, attrs.global, params));
}
if(Array.isArray(attrs.formevents)) {
var arr = this.addProposals(node, attrs.formevents, params);
if(arr.length > 0) {
proposals.push({
proposal: '',
description: Messages['formeventsHeader'],
style: 'noemphasis_title', //$NON-NLS-1$
unselectable: true,
kind: 'html' //$NON-NLS-1$
});
proposals = proposals.concat(arr);
}
}
if(Array.isArray(attrs.keyboardevents)) {
arr = this.addProposals(node, attrs.keyboardevents, params);
if(arr.length > 0) {
proposals.push({
proposal: '',
description: Messages['keyboardeventsHeader'],
style: 'noemphasis_title', //$NON-NLS-1$
unselectable: true,
kind: 'html' //$NON-NLS-1$
});
proposals = proposals.concat(arr);
}
}
if(Array.isArray(attrs.mouseevents)) {
arr = this.addProposals(node, attrs.mouseevents, params);
if(arr.length > 0) {
proposals.push({
proposal: '',
description: Messages['mouseeventsHeader'],
style: 'noemphasis_title', //$NON-NLS-1$
unselectable: true,
kind: 'html' //$NON-NLS-1$
});
proposals = proposals.concat(arr);
}
}
if(Array.isArray(attrs.windowevents) && attrs.windowevents.length > 0) {
arr = this.addProposals(node, attrs.windowevents, params);
if(arr.length > 0) {
proposals.push({
proposal: '',
description: Messages['windoweventsHeader'],
style: 'noemphasis_title', //$NON-NLS-1$
unselectable: true,
kind: 'html' //$NON-NLS-1$
});
proposals = proposals.concat(arr);
}
}
if(Array.isArray(attrs.aria)) {
arr = this.addProposals(node, attrs.aria, params);
if(arr.length > 0) {
proposals.push({
proposal: '',
description: 'ARIA', //$NON-NLS-1$
style: 'noemphasis_title', //$NON-NLS-1$
unselectable: true,
kind: 'html' //$NON-NLS-1$
});
proposals = proposals.concat(arr);
}
}
return proposals;
}
|
[
"function",
"(",
"node",
",",
"source",
",",
"params",
")",
"{",
"var",
"proposals",
"=",
"[",
"]",
";",
"var",
"prefix",
"=",
"params",
".",
"prefix",
"?",
"params",
".",
"prefix",
":",
"\"\"",
";",
"// we need to check if we need to rebuild the prefix for completion that contains a '-'",
"var",
"index",
"=",
"params",
".",
"offset",
"-",
"prefix",
".",
"length",
"-",
"1",
";",
"if",
"(",
"index",
">",
"0",
"&&",
"index",
"<",
"source",
".",
"length",
")",
"{",
"var",
"precedingChar",
"=",
"source",
".",
"charAt",
"(",
"index",
")",
";",
"if",
"(",
"precedingChar",
"===",
"'='",
"&&",
"prefix",
".",
"length",
"===",
"0",
"&&",
"(",
"index",
"-",
"1",
")",
">",
"0",
")",
"{",
"precedingChar",
"=",
"source",
".",
"charAt",
"(",
"index",
"-",
"1",
")",
";",
"if",
"(",
"/",
"[A-Za-z0-9_]",
"/",
".",
"test",
"(",
"precedingChar",
")",
")",
"{",
"proposals",
".",
"push",
"(",
"this",
".",
"makeComputedProposal",
"(",
"\"\\\"\\\"\"",
",",
"Messages",
"[",
"'addQuotesToAttributes'",
"]",
",",
"\" - \\\"\\\"\"",
",",
"null",
",",
"prefix",
")",
")",
";",
"//$NON-NLS-1$ //$NON-NLS-2$",
"return",
"proposals",
";",
"}",
"}",
"}",
"var",
"attrs",
"=",
"Attributes",
".",
"getAttributesForNode",
"(",
"node",
")",
";",
"if",
"(",
"Array",
".",
"isArray",
"(",
"attrs",
".",
"global",
")",
")",
"{",
"proposals",
"=",
"proposals",
".",
"concat",
"(",
"this",
".",
"addProposals",
"(",
"node",
",",
"attrs",
".",
"global",
",",
"params",
")",
")",
";",
"}",
"if",
"(",
"Array",
".",
"isArray",
"(",
"attrs",
".",
"formevents",
")",
")",
"{",
"var",
"arr",
"=",
"this",
".",
"addProposals",
"(",
"node",
",",
"attrs",
".",
"formevents",
",",
"params",
")",
";",
"if",
"(",
"arr",
".",
"length",
">",
"0",
")",
"{",
"proposals",
".",
"push",
"(",
"{",
"proposal",
":",
"''",
",",
"description",
":",
"Messages",
"[",
"'formeventsHeader'",
"]",
",",
"style",
":",
"'noemphasis_title'",
",",
"//$NON-NLS-1$",
"unselectable",
":",
"true",
",",
"kind",
":",
"'html'",
"//$NON-NLS-1$",
"}",
")",
";",
"proposals",
"=",
"proposals",
".",
"concat",
"(",
"arr",
")",
";",
"}",
"}",
"if",
"(",
"Array",
".",
"isArray",
"(",
"attrs",
".",
"keyboardevents",
")",
")",
"{",
"arr",
"=",
"this",
".",
"addProposals",
"(",
"node",
",",
"attrs",
".",
"keyboardevents",
",",
"params",
")",
";",
"if",
"(",
"arr",
".",
"length",
">",
"0",
")",
"{",
"proposals",
".",
"push",
"(",
"{",
"proposal",
":",
"''",
",",
"description",
":",
"Messages",
"[",
"'keyboardeventsHeader'",
"]",
",",
"style",
":",
"'noemphasis_title'",
",",
"//$NON-NLS-1$",
"unselectable",
":",
"true",
",",
"kind",
":",
"'html'",
"//$NON-NLS-1$",
"}",
")",
";",
"proposals",
"=",
"proposals",
".",
"concat",
"(",
"arr",
")",
";",
"}",
"}",
"if",
"(",
"Array",
".",
"isArray",
"(",
"attrs",
".",
"mouseevents",
")",
")",
"{",
"arr",
"=",
"this",
".",
"addProposals",
"(",
"node",
",",
"attrs",
".",
"mouseevents",
",",
"params",
")",
";",
"if",
"(",
"arr",
".",
"length",
">",
"0",
")",
"{",
"proposals",
".",
"push",
"(",
"{",
"proposal",
":",
"''",
",",
"description",
":",
"Messages",
"[",
"'mouseeventsHeader'",
"]",
",",
"style",
":",
"'noemphasis_title'",
",",
"//$NON-NLS-1$",
"unselectable",
":",
"true",
",",
"kind",
":",
"'html'",
"//$NON-NLS-1$",
"}",
")",
";",
"proposals",
"=",
"proposals",
".",
"concat",
"(",
"arr",
")",
";",
"}",
"}",
"if",
"(",
"Array",
".",
"isArray",
"(",
"attrs",
".",
"windowevents",
")",
"&&",
"attrs",
".",
"windowevents",
".",
"length",
">",
"0",
")",
"{",
"arr",
"=",
"this",
".",
"addProposals",
"(",
"node",
",",
"attrs",
".",
"windowevents",
",",
"params",
")",
";",
"if",
"(",
"arr",
".",
"length",
">",
"0",
")",
"{",
"proposals",
".",
"push",
"(",
"{",
"proposal",
":",
"''",
",",
"description",
":",
"Messages",
"[",
"'windoweventsHeader'",
"]",
",",
"style",
":",
"'noemphasis_title'",
",",
"//$NON-NLS-1$",
"unselectable",
":",
"true",
",",
"kind",
":",
"'html'",
"//$NON-NLS-1$",
"}",
")",
";",
"proposals",
"=",
"proposals",
".",
"concat",
"(",
"arr",
")",
";",
"}",
"}",
"if",
"(",
"Array",
".",
"isArray",
"(",
"attrs",
".",
"aria",
")",
")",
"{",
"arr",
"=",
"this",
".",
"addProposals",
"(",
"node",
",",
"attrs",
".",
"aria",
",",
"params",
")",
";",
"if",
"(",
"arr",
".",
"length",
">",
"0",
")",
"{",
"proposals",
".",
"push",
"(",
"{",
"proposal",
":",
"''",
",",
"description",
":",
"'ARIA'",
",",
"//$NON-NLS-1$",
"style",
":",
"'noemphasis_title'",
",",
"//$NON-NLS-1$",
"unselectable",
":",
"true",
",",
"kind",
":",
"'html'",
"//$NON-NLS-1$",
"}",
")",
";",
"proposals",
"=",
"proposals",
".",
"concat",
"(",
"arr",
")",
";",
"}",
"}",
"return",
"proposals",
";",
"}"
] |
Returns the attributes that can be used in the specified tag
@param {Object} node The AST node for the tag we are completing within
@param {Object} params The parameters
@returns {Array.<Object>} The array of proposals
@since 10.0
|
[
"Returns",
"the",
"attributes",
"that",
"can",
"be",
"used",
"in",
"the",
"specified",
"tag"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/webtools/htmlContentAssist.js#L495-L580
|
|
14,578
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/webtools/htmlContentAssist.js
|
function(node, source, params) {
// TODO We can do better with the new parser, handle no quotes cases too
if(node && node.type === 'attr') {
if (node.valueRange) {
var range = node.valueRange;
return range[0] <= params.offset && range[1] >= params.offset;
}
return this.within('"', '"', source, params.offset, node.range) || //$NON-NLS-1$ //$NON-NLS-2$
this.within("'", "'", source, params.offset, node.range); //$NON-NLS-1$ //$NON-NLS-2$
}
return false;
}
|
javascript
|
function(node, source, params) {
// TODO We can do better with the new parser, handle no quotes cases too
if(node && node.type === 'attr') {
if (node.valueRange) {
var range = node.valueRange;
return range[0] <= params.offset && range[1] >= params.offset;
}
return this.within('"', '"', source, params.offset, node.range) || //$NON-NLS-1$ //$NON-NLS-2$
this.within("'", "'", source, params.offset, node.range); //$NON-NLS-1$ //$NON-NLS-2$
}
return false;
}
|
[
"function",
"(",
"node",
",",
"source",
",",
"params",
")",
"{",
"// TODO We can do better with the new parser, handle no quotes cases too",
"if",
"(",
"node",
"&&",
"node",
".",
"type",
"===",
"'attr'",
")",
"{",
"if",
"(",
"node",
".",
"valueRange",
")",
"{",
"var",
"range",
"=",
"node",
".",
"valueRange",
";",
"return",
"range",
"[",
"0",
"]",
"<=",
"params",
".",
"offset",
"&&",
"range",
"[",
"1",
"]",
">=",
"params",
".",
"offset",
";",
"}",
"return",
"this",
".",
"within",
"(",
"'\"'",
",",
"'\"'",
",",
"source",
",",
"params",
".",
"offset",
",",
"node",
".",
"range",
")",
"||",
"//$NON-NLS-1$ //$NON-NLS-2$",
"this",
".",
"within",
"(",
"\"'\"",
",",
"\"'\"",
",",
"source",
",",
"params",
".",
"offset",
",",
"node",
".",
"range",
")",
";",
"//$NON-NLS-1$ //$NON-NLS-2$",
"}",
"return",
"false",
";",
"}"
] |
Computes if we are trying to complete attributes
@param {Object} node The AST node to check with the offset
@param {String} source The backing source
@param {Object} params The parameters
@returns {Boolean} True if we are completing the attributes of a tag, false otherwise
@since 10.0
|
[
"Computes",
"if",
"we",
"are",
"trying",
"to",
"complete",
"attributes"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/webtools/htmlContentAssist.js#L778-L789
|
|
14,579
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/webtools/htmlContentAssist.js
|
function(start, end, source, offset, bounds) {
var idx = offset;
var _c;
var before = false;
while(idx > bounds[0]) {
_c = source[idx];
if(_c === start) {
before = true;
break;
}
idx--;
}
if(before) {
idx = offset;
while(idx < bounds[1]) {
_c = source[idx];
if(_c === end) {
return true;
}
idx++;
}
}
return false;
}
|
javascript
|
function(start, end, source, offset, bounds) {
var idx = offset;
var _c;
var before = false;
while(idx > bounds[0]) {
_c = source[idx];
if(_c === start) {
before = true;
break;
}
idx--;
}
if(before) {
idx = offset;
while(idx < bounds[1]) {
_c = source[idx];
if(_c === end) {
return true;
}
idx++;
}
}
return false;
}
|
[
"function",
"(",
"start",
",",
"end",
",",
"source",
",",
"offset",
",",
"bounds",
")",
"{",
"var",
"idx",
"=",
"offset",
";",
"var",
"_c",
";",
"var",
"before",
"=",
"false",
";",
"while",
"(",
"idx",
">",
"bounds",
"[",
"0",
"]",
")",
"{",
"_c",
"=",
"source",
"[",
"idx",
"]",
";",
"if",
"(",
"_c",
"===",
"start",
")",
"{",
"before",
"=",
"true",
";",
"break",
";",
"}",
"idx",
"--",
";",
"}",
"if",
"(",
"before",
")",
"{",
"idx",
"=",
"offset",
";",
"while",
"(",
"idx",
"<",
"bounds",
"[",
"1",
"]",
")",
"{",
"_c",
"=",
"source",
"[",
"idx",
"]",
";",
"if",
"(",
"_c",
"===",
"end",
")",
"{",
"return",
"true",
";",
"}",
"idx",
"++",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
A util method to determine if the caret is within two given chars, that are found within
the given bounds
@param {String} start The char to the LHS
@param {String} end The char to the RHS
@param {String} source The source to check against
@param {Number} offset
|
[
"A",
"util",
"method",
"to",
"determine",
"if",
"the",
"caret",
"is",
"within",
"two",
"given",
"chars",
"that",
"are",
"found",
"within",
"the",
"given",
"bounds"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/webtools/htmlContentAssist.js#L823-L846
|
|
14,580
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.core/web/orion/operation.js
|
handle
|
function handle(operationLocation, onSuccess, onError) {
var def = new Deferred();
_trackCancel(operationLocation, def);
_getOperation({location: operationLocation, timeout: 100}, def, onSuccess, onError);
return def;
}
|
javascript
|
function handle(operationLocation, onSuccess, onError) {
var def = new Deferred();
_trackCancel(operationLocation, def);
_getOperation({location: operationLocation, timeout: 100}, def, onSuccess, onError);
return def;
}
|
[
"function",
"handle",
"(",
"operationLocation",
",",
"onSuccess",
",",
"onError",
")",
"{",
"var",
"def",
"=",
"new",
"Deferred",
"(",
")",
";",
"_trackCancel",
"(",
"operationLocation",
",",
"def",
")",
";",
"_getOperation",
"(",
"{",
"location",
":",
"operationLocation",
",",
"timeout",
":",
"100",
"}",
",",
"def",
",",
"onSuccess",
",",
"onError",
")",
";",
"return",
"def",
";",
"}"
] |
Handles a long-running operation as a promise.
@name orion.operation.handle
@function
@param {String} operationLocation
@param {Function} [onSuccess] If provided, will be called to transform a successful operation into the resolve value of the
returned promise.
@param {Function} [onError] If provided, will be called to trasnform a failed operation into the reject value of the
returned promise.
@returns {orion.Promise}
|
[
"Handles",
"a",
"long",
"-",
"running",
"operation",
"as",
"a",
"promise",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.core/web/orion/operation.js#L117-L122
|
14,581
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/problems/problemsView.js
|
ProblemsView
|
function ProblemsView(options, slideout) {
if(slideout) {
SlideoutViewMode.call(this, slideout);
}
var parentId = options.parentId ? options.parentId : "orion.PropertyPanel.container";
this._parent = lib.node(parentId);
this.serviceRegistry = options.serviceRegistry;
this.commandRegistry = options.commandRegistry;
this.preferences = options.preferences;
this.fileClient = options.fileClient;
this.contentTypeRegistry = options.contentTypeRegistry;
this._init(slideout);
}
|
javascript
|
function ProblemsView(options, slideout) {
if(slideout) {
SlideoutViewMode.call(this, slideout);
}
var parentId = options.parentId ? options.parentId : "orion.PropertyPanel.container";
this._parent = lib.node(parentId);
this.serviceRegistry = options.serviceRegistry;
this.commandRegistry = options.commandRegistry;
this.preferences = options.preferences;
this.fileClient = options.fileClient;
this.contentTypeRegistry = options.contentTypeRegistry;
this._init(slideout);
}
|
[
"function",
"ProblemsView",
"(",
"options",
",",
"slideout",
")",
"{",
"if",
"(",
"slideout",
")",
"{",
"SlideoutViewMode",
".",
"call",
"(",
"this",
",",
"slideout",
")",
";",
"}",
"var",
"parentId",
"=",
"options",
".",
"parentId",
"?",
"options",
".",
"parentId",
":",
"\"orion.PropertyPanel.container\"",
";",
"this",
".",
"_parent",
"=",
"lib",
".",
"node",
"(",
"parentId",
")",
";",
"this",
".",
"serviceRegistry",
"=",
"options",
".",
"serviceRegistry",
";",
"this",
".",
"commandRegistry",
"=",
"options",
".",
"commandRegistry",
";",
"this",
".",
"preferences",
"=",
"options",
".",
"preferences",
";",
"this",
".",
"fileClient",
"=",
"options",
".",
"fileClient",
";",
"this",
".",
"contentTypeRegistry",
"=",
"options",
".",
"contentTypeRegistry",
";",
"this",
".",
"_init",
"(",
"slideout",
")",
";",
"}"
] |
Constructs a new ProblemView object.
@class
@name orion.BrowseView
|
[
"Constructs",
"a",
"new",
"ProblemView",
"object",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/problems/problemsView.js#L27-L39
|
14,582
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/sites/siteClient.js
|
_doServiceCall
|
function _doServiceCall(service, methodName, args) {
var serviceMethod = service[methodName];
var clientDeferred = new Deferred();
if (typeof serviceMethod !== 'function') { //$NON-NLS-0$
throw messages['Service method missing: '] + methodName;
}
// On success, just forward the result to the client
var onSuccess = function(result) {
clientDeferred.resolve(result);
};
// On failure we might need to retry
var onError = function(error) {
// Forward other errors to client
clientDeferred.reject(error);
};
serviceMethod.apply(service, args).then(onSuccess, onError);
return clientDeferred;
}
|
javascript
|
function _doServiceCall(service, methodName, args) {
var serviceMethod = service[methodName];
var clientDeferred = new Deferred();
if (typeof serviceMethod !== 'function') { //$NON-NLS-0$
throw messages['Service method missing: '] + methodName;
}
// On success, just forward the result to the client
var onSuccess = function(result) {
clientDeferred.resolve(result);
};
// On failure we might need to retry
var onError = function(error) {
// Forward other errors to client
clientDeferred.reject(error);
};
serviceMethod.apply(service, args).then(onSuccess, onError);
return clientDeferred;
}
|
[
"function",
"_doServiceCall",
"(",
"service",
",",
"methodName",
",",
"args",
")",
"{",
"var",
"serviceMethod",
"=",
"service",
"[",
"methodName",
"]",
";",
"var",
"clientDeferred",
"=",
"new",
"Deferred",
"(",
")",
";",
"if",
"(",
"typeof",
"serviceMethod",
"!==",
"'function'",
")",
"{",
"//$NON-NLS-0$",
"throw",
"messages",
"[",
"'Service method missing: '",
"]",
"+",
"methodName",
";",
"}",
"// On success, just forward the result to the client",
"var",
"onSuccess",
"=",
"function",
"(",
"result",
")",
"{",
"clientDeferred",
".",
"resolve",
"(",
"result",
")",
";",
"}",
";",
"// On failure we might need to retry",
"var",
"onError",
"=",
"function",
"(",
"error",
")",
"{",
"// Forward other errors to client",
"clientDeferred",
".",
"reject",
"(",
"error",
")",
";",
"}",
";",
"serviceMethod",
".",
"apply",
"(",
"service",
",",
"args",
")",
".",
"then",
"(",
"onSuccess",
",",
"onError",
")",
";",
"return",
"clientDeferred",
";",
"}"
] |
Performs a service call, handling authentication and retrying after auth.
@returns {Promise}
|
[
"Performs",
"a",
"service",
"call",
"handling",
"authentication",
"and",
"retrying",
"after",
"auth",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/sites/siteClient.js#L18-L36
|
14,583
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/sites/siteClient.js
|
SiteClient
|
function SiteClient(serviceRegistry, siteService, siteServiceRef) {
this._serviceRegistry = serviceRegistry;
this._siteService = siteService;
this._selfHost = siteServiceRef.getProperty('canSelfHost'); //$NON-NLS-0$
this._selfHostConfig = siteServiceRef.getProperty('selfHostingConfig'); //$NON-NLS-0$
this._sitePattern = siteServiceRef.getProperty('sitePattern'); //$NON-NLS-0$
this._filePattern = siteServiceRef.getProperty('filePattern'); //$NON-NLS-0$
this._name = siteServiceRef.getProperty('name'); //$NON-NLS-0$
this._id = siteServiceRef.getProperty('id'); //$NON-NLS-0$
this._getService = function() {
return this._siteService;
};
this._getFilePattern = function() {
return this._filePattern;
};
this._getFileClient = function() {
return getFileClient(this._serviceRegistry, this._getFilePattern());
};
this._canSelfHost = function() {
return this._selfHost;
};
}
|
javascript
|
function SiteClient(serviceRegistry, siteService, siteServiceRef) {
this._serviceRegistry = serviceRegistry;
this._siteService = siteService;
this._selfHost = siteServiceRef.getProperty('canSelfHost'); //$NON-NLS-0$
this._selfHostConfig = siteServiceRef.getProperty('selfHostingConfig'); //$NON-NLS-0$
this._sitePattern = siteServiceRef.getProperty('sitePattern'); //$NON-NLS-0$
this._filePattern = siteServiceRef.getProperty('filePattern'); //$NON-NLS-0$
this._name = siteServiceRef.getProperty('name'); //$NON-NLS-0$
this._id = siteServiceRef.getProperty('id'); //$NON-NLS-0$
this._getService = function() {
return this._siteService;
};
this._getFilePattern = function() {
return this._filePattern;
};
this._getFileClient = function() {
return getFileClient(this._serviceRegistry, this._getFilePattern());
};
this._canSelfHost = function() {
return this._selfHost;
};
}
|
[
"function",
"SiteClient",
"(",
"serviceRegistry",
",",
"siteService",
",",
"siteServiceRef",
")",
"{",
"this",
".",
"_serviceRegistry",
"=",
"serviceRegistry",
";",
"this",
".",
"_siteService",
"=",
"siteService",
";",
"this",
".",
"_selfHost",
"=",
"siteServiceRef",
".",
"getProperty",
"(",
"'canSelfHost'",
")",
";",
"//$NON-NLS-0$",
"this",
".",
"_selfHostConfig",
"=",
"siteServiceRef",
".",
"getProperty",
"(",
"'selfHostingConfig'",
")",
";",
"//$NON-NLS-0$",
"this",
".",
"_sitePattern",
"=",
"siteServiceRef",
".",
"getProperty",
"(",
"'sitePattern'",
")",
";",
"//$NON-NLS-0$",
"this",
".",
"_filePattern",
"=",
"siteServiceRef",
".",
"getProperty",
"(",
"'filePattern'",
")",
";",
"//$NON-NLS-0$",
"this",
".",
"_name",
"=",
"siteServiceRef",
".",
"getProperty",
"(",
"'name'",
")",
";",
"//$NON-NLS-0$",
"this",
".",
"_id",
"=",
"siteServiceRef",
".",
"getProperty",
"(",
"'id'",
")",
";",
"//$NON-NLS-0$",
"this",
".",
"_getService",
"=",
"function",
"(",
")",
"{",
"return",
"this",
".",
"_siteService",
";",
"}",
";",
"this",
".",
"_getFilePattern",
"=",
"function",
"(",
")",
"{",
"return",
"this",
".",
"_filePattern",
";",
"}",
";",
"this",
".",
"_getFileClient",
"=",
"function",
"(",
")",
"{",
"return",
"getFileClient",
"(",
"this",
".",
"_serviceRegistry",
",",
"this",
".",
"_getFilePattern",
"(",
")",
")",
";",
"}",
";",
"this",
".",
"_canSelfHost",
"=",
"function",
"(",
")",
"{",
"return",
"this",
".",
"_selfHost",
";",
"}",
";",
"}"
] |
Constructs a new SiteClient.
@name orion.sites.SiteClient
@extends orion.sites.SiteService
@class Convenience API for interacting with a particular {@link orion.sites.SiteService}.
@param {orion.serviceregistry.ServiceRegistry} serviceRegistry
@param {orion.serviceregistry.Service} siteService
@param {orion.serviceregistry.ServiceReference} siteServiceRef
|
[
"Constructs",
"a",
"new",
"SiteClient",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/sites/siteClient.js#L54-L76
|
14,584
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/sites/siteClient.js
|
function(site, file) {
if (!site) {
var d = new Deferred();
d.resolve(false);
return d;
}
return this.getURLOnSite(site, file).then(function(url) {
return url !== null;
});
}
|
javascript
|
function(site, file) {
if (!site) {
var d = new Deferred();
d.resolve(false);
return d;
}
return this.getURLOnSite(site, file).then(function(url) {
return url !== null;
});
}
|
[
"function",
"(",
"site",
",",
"file",
")",
"{",
"if",
"(",
"!",
"site",
")",
"{",
"var",
"d",
"=",
"new",
"Deferred",
"(",
")",
";",
"d",
".",
"resolve",
"(",
"false",
")",
";",
"return",
"d",
";",
"}",
"return",
"this",
".",
"getURLOnSite",
"(",
"site",
",",
"file",
")",
".",
"then",
"(",
"function",
"(",
"url",
")",
"{",
"return",
"url",
"!==",
"null",
";",
"}",
")",
";",
"}"
] |
Convenience methods below
|
[
"Convenience",
"methods",
"below"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/sites/siteClient.js#L82-L91
|
|
14,585
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/widgets/nav/mini-nav.js
|
function(item) {
this.scope("");
return this.fileClient.getWorkspace(item.Location).then(function(workspace) {
return this.loadRoot(workspace).then(function() {
return this.showItem(item, false); // call with reroot=false to avoid recursion
}.bind(this));
}.bind(this));
}
|
javascript
|
function(item) {
this.scope("");
return this.fileClient.getWorkspace(item.Location).then(function(workspace) {
return this.loadRoot(workspace).then(function() {
return this.showItem(item, false); // call with reroot=false to avoid recursion
}.bind(this));
}.bind(this));
}
|
[
"function",
"(",
"item",
")",
"{",
"this",
".",
"scope",
"(",
"\"\"",
")",
";",
"return",
"this",
".",
"fileClient",
".",
"getWorkspace",
"(",
"item",
".",
"Location",
")",
".",
"then",
"(",
"function",
"(",
"workspace",
")",
"{",
"return",
"this",
".",
"loadRoot",
"(",
"workspace",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"return",
"this",
".",
"showItem",
"(",
"item",
",",
"false",
")",
";",
"// call with reroot=false to avoid recursion",
"}",
".",
"bind",
"(",
"this",
")",
")",
";",
"}",
".",
"bind",
"(",
"this",
")",
")",
";",
"}"
] |
Re-roots the tree so that the given item is displayable.
@param {Object} The item to be expanded.
@returns {orion.Promise}
|
[
"Re",
"-",
"roots",
"the",
"tree",
"so",
"that",
"the",
"given",
"item",
"is",
"displayable",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/widgets/nav/mini-nav.js#L64-L71
|
|
14,586
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.core/web/orion/EventTarget.js
|
function(eventName, listener) {
if (typeof listener === "function" || listener.handleEvent) {
this._namedListeners[eventName] = this._namedListeners[eventName] || [];
this._namedListeners[eventName].push(listener);
}
}
|
javascript
|
function(eventName, listener) {
if (typeof listener === "function" || listener.handleEvent) {
this._namedListeners[eventName] = this._namedListeners[eventName] || [];
this._namedListeners[eventName].push(listener);
}
}
|
[
"function",
"(",
"eventName",
",",
"listener",
")",
"{",
"if",
"(",
"typeof",
"listener",
"===",
"\"function\"",
"||",
"listener",
".",
"handleEvent",
")",
"{",
"this",
".",
"_namedListeners",
"[",
"eventName",
"]",
"=",
"this",
".",
"_namedListeners",
"[",
"eventName",
"]",
"||",
"[",
"]",
";",
"this",
".",
"_namedListeners",
"[",
"eventName",
"]",
".",
"push",
"(",
"listener",
")",
";",
"}",
"}"
] |
Adds an event listener for a named event
@param {String} eventName The event name
@param {Function} listener The function called when an event occurs
|
[
"Adds",
"an",
"event",
"listener",
"for",
"a",
"named",
"event"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.core/web/orion/EventTarget.js#L61-L66
|
|
14,587
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.core/web/orion/EventTarget.js
|
function(eventName, listener) {
var listeners = this._namedListeners[eventName];
if (listeners) {
for (var i = 0; i < listeners.length; i++) {
if (listeners[i] === listener) {
if (listeners.length === 1) {
delete this._namedListeners[eventName];
} else {
listeners.splice(i, 1);
}
break;
}
}
}
}
|
javascript
|
function(eventName, listener) {
var listeners = this._namedListeners[eventName];
if (listeners) {
for (var i = 0; i < listeners.length; i++) {
if (listeners[i] === listener) {
if (listeners.length === 1) {
delete this._namedListeners[eventName];
} else {
listeners.splice(i, 1);
}
break;
}
}
}
}
|
[
"function",
"(",
"eventName",
",",
"listener",
")",
"{",
"var",
"listeners",
"=",
"this",
".",
"_namedListeners",
"[",
"eventName",
"]",
";",
"if",
"(",
"listeners",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"listeners",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"listeners",
"[",
"i",
"]",
"===",
"listener",
")",
"{",
"if",
"(",
"listeners",
".",
"length",
"===",
"1",
")",
"{",
"delete",
"this",
".",
"_namedListeners",
"[",
"eventName",
"]",
";",
"}",
"else",
"{",
"listeners",
".",
"splice",
"(",
"i",
",",
"1",
")",
";",
"}",
"break",
";",
"}",
"}",
"}",
"}"
] |
Removes an event listener for a named event
@param {String} eventName The event name
@param {Function} listener The function called when an event occurs
|
[
"Removes",
"an",
"event",
"listener",
"for",
"a",
"named",
"event"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.core/web/orion/EventTarget.js#L73-L87
|
|
14,588
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/gcli/gcli/types/basic.js
|
NumberType
|
function NumberType(typeSpec) {
// Default to integer values
this._allowFloat = !!typeSpec.allowFloat;
if (typeSpec) {
this._min = typeSpec.min;
this._max = typeSpec.max;
this._step = typeSpec.step || 1;
if (!this._allowFloat &&
(this._isFloat(this._min) ||
this._isFloat(this._max) ||
this._isFloat(this._step))) {
throw new Error('allowFloat is false, but non-integer values given in type spec');
}
}
else {
this._step = 1;
}
}
|
javascript
|
function NumberType(typeSpec) {
// Default to integer values
this._allowFloat = !!typeSpec.allowFloat;
if (typeSpec) {
this._min = typeSpec.min;
this._max = typeSpec.max;
this._step = typeSpec.step || 1;
if (!this._allowFloat &&
(this._isFloat(this._min) ||
this._isFloat(this._max) ||
this._isFloat(this._step))) {
throw new Error('allowFloat is false, but non-integer values given in type spec');
}
}
else {
this._step = 1;
}
}
|
[
"function",
"NumberType",
"(",
"typeSpec",
")",
"{",
"// Default to integer values",
"this",
".",
"_allowFloat",
"=",
"!",
"!",
"typeSpec",
".",
"allowFloat",
";",
"if",
"(",
"typeSpec",
")",
"{",
"this",
".",
"_min",
"=",
"typeSpec",
".",
"min",
";",
"this",
".",
"_max",
"=",
"typeSpec",
".",
"max",
";",
"this",
".",
"_step",
"=",
"typeSpec",
".",
"step",
"||",
"1",
";",
"if",
"(",
"!",
"this",
".",
"_allowFloat",
"&&",
"(",
"this",
".",
"_isFloat",
"(",
"this",
".",
"_min",
")",
"||",
"this",
".",
"_isFloat",
"(",
"this",
".",
"_max",
")",
"||",
"this",
".",
"_isFloat",
"(",
"this",
".",
"_step",
")",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'allowFloat is false, but non-integer values given in type spec'",
")",
";",
"}",
"}",
"else",
"{",
"this",
".",
"_step",
"=",
"1",
";",
"}",
"}"
] |
We distinguish between integers and floats with the _allowFloat flag.
|
[
"We",
"distinguish",
"between",
"integers",
"and",
"floats",
"with",
"the",
"_allowFloat",
"flag",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/types/basic.js#L87-L106
|
14,589
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/gcli/gcli/types/basic.js
|
DelegateType
|
function DelegateType(typeSpec) {
if (typeof typeSpec.delegateType !== 'function') {
throw new Error('Instances of DelegateType need typeSpec.delegateType to be a function that returns a type');
}
Object.keys(typeSpec).forEach(function(key) {
this[key] = typeSpec[key];
}, this);
}
|
javascript
|
function DelegateType(typeSpec) {
if (typeof typeSpec.delegateType !== 'function') {
throw new Error('Instances of DelegateType need typeSpec.delegateType to be a function that returns a type');
}
Object.keys(typeSpec).forEach(function(key) {
this[key] = typeSpec[key];
}, this);
}
|
[
"function",
"DelegateType",
"(",
"typeSpec",
")",
"{",
"if",
"(",
"typeof",
"typeSpec",
".",
"delegateType",
"!==",
"'function'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Instances of DelegateType need typeSpec.delegateType to be a function that returns a type'",
")",
";",
"}",
"Object",
".",
"keys",
"(",
"typeSpec",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"this",
"[",
"key",
"]",
"=",
"typeSpec",
"[",
"key",
"]",
";",
"}",
",",
"this",
")",
";",
"}"
] |
A type for "we don't know right now, but hope to soon".
|
[
"A",
"type",
"for",
"we",
"don",
"t",
"know",
"right",
"now",
"but",
"hope",
"to",
"soon",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/types/basic.js#L276-L283
|
14,590
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/gcli/gcli/types/basic.js
|
ArrayType
|
function ArrayType(typeSpec) {
if (!typeSpec.subtype) {
console.error('Array.typeSpec is missing subtype. Assuming string.' +
JSON.stringify(typeSpec));
typeSpec.subtype = 'string';
}
Object.keys(typeSpec).forEach(function(key) {
this[key] = typeSpec[key];
}, this);
this.subtype = types.getType(this.subtype);
}
|
javascript
|
function ArrayType(typeSpec) {
if (!typeSpec.subtype) {
console.error('Array.typeSpec is missing subtype. Assuming string.' +
JSON.stringify(typeSpec));
typeSpec.subtype = 'string';
}
Object.keys(typeSpec).forEach(function(key) {
this[key] = typeSpec[key];
}, this);
this.subtype = types.getType(this.subtype);
}
|
[
"function",
"ArrayType",
"(",
"typeSpec",
")",
"{",
"if",
"(",
"!",
"typeSpec",
".",
"subtype",
")",
"{",
"console",
".",
"error",
"(",
"'Array.typeSpec is missing subtype. Assuming string.'",
"+",
"JSON",
".",
"stringify",
"(",
"typeSpec",
")",
")",
";",
"typeSpec",
".",
"subtype",
"=",
"'string'",
";",
"}",
"Object",
".",
"keys",
"(",
"typeSpec",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"this",
"[",
"key",
"]",
"=",
"typeSpec",
"[",
"key",
"]",
";",
"}",
",",
"this",
")",
";",
"this",
".",
"subtype",
"=",
"types",
".",
"getType",
"(",
"this",
".",
"subtype",
")",
";",
"}"
] |
A set of objects of the same type
|
[
"A",
"set",
"of",
"objects",
"of",
"the",
"same",
"type"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/types/basic.js#L355-L366
|
14,591
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/utils/token-store.js
|
get
|
function get(start, end) {
var result = [],
i;
for (i = Math.max(0, start); i < end && i < length; i++) {
result.push(tokens[i]);
}
return result;
}
|
javascript
|
function get(start, end) {
var result = [],
i;
for (i = Math.max(0, start); i < end && i < length; i++) {
result.push(tokens[i]);
}
return result;
}
|
[
"function",
"get",
"(",
"start",
",",
"end",
")",
"{",
"var",
"result",
"=",
"[",
"]",
",",
"i",
";",
"for",
"(",
"i",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"start",
")",
";",
"i",
"<",
"end",
"&&",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"result",
".",
"push",
"(",
"tokens",
"[",
"i",
"]",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Gets tokens in a given interval.
@param {int} start Inclusive index of the first token. 0 if negative.
@param {int} end Exclusive index of the last token.
@returns {Token[]} Tokens in the interval.
|
[
"Gets",
"tokens",
"in",
"a",
"given",
"interval",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/utils/token-store.js#L26-L35
|
14,592
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/utils/token-store.js
|
lastTokenIndex
|
function lastTokenIndex(node) {
var end = node.range[1],
cursor = ends[end];
// If the node extends beyond its last token, get the token before the
// next token
if (typeof cursor === "undefined") {
cursor = starts[end] - 1;
}
// If there isn't a next token, the desired token is the last one in the
// array
if (isNaN(cursor)) {
cursor = length - 1;
}
return cursor;
}
|
javascript
|
function lastTokenIndex(node) {
var end = node.range[1],
cursor = ends[end];
// If the node extends beyond its last token, get the token before the
// next token
if (typeof cursor === "undefined") {
cursor = starts[end] - 1;
}
// If there isn't a next token, the desired token is the last one in the
// array
if (isNaN(cursor)) {
cursor = length - 1;
}
return cursor;
}
|
[
"function",
"lastTokenIndex",
"(",
"node",
")",
"{",
"var",
"end",
"=",
"node",
".",
"range",
"[",
"1",
"]",
",",
"cursor",
"=",
"ends",
"[",
"end",
"]",
";",
"// If the node extends beyond its last token, get the token before the",
"// next token",
"if",
"(",
"typeof",
"cursor",
"===",
"\"undefined\"",
")",
"{",
"cursor",
"=",
"starts",
"[",
"end",
"]",
"-",
"1",
";",
"}",
"// If there isn't a next token, the desired token is the last one in the",
"// array",
"if",
"(",
"isNaN",
"(",
"cursor",
")",
")",
"{",
"cursor",
"=",
"length",
"-",
"1",
";",
"}",
"return",
"cursor",
";",
"}"
] |
Gets the index in the tokens array of the last token belonging to a node.
Usually a node ends exactly at a token, but due to ASI, sometimes a
node's range extends beyond its last token.
@param {ASTNode} node The node for which to find the last token's index.
@returns {int} Index in the tokens array of the node's last token.
|
[
"Gets",
"the",
"index",
"in",
"the",
"tokens",
"array",
"of",
"the",
"last",
"token",
"belonging",
"to",
"a",
"node",
".",
"Usually",
"a",
"node",
"ends",
"exactly",
"at",
"a",
"token",
"but",
"due",
"to",
"ASI",
"sometimes",
"a",
"node",
"s",
"range",
"extends",
"beyond",
"its",
"last",
"token",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/utils/token-store.js#L44-L61
|
14,593
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/commands.js
|
executeBinding
|
function executeBinding(binding) {
var invocation = binding.invocation;
if (invocation) {
var command = binding.command;
if (typeof(command.hrefCallback) === 'function') {
var href = command.hrefCallback.call(invocation.handler || window, invocation);
if (href.then){
href.then(function(l){
window.open(urlModifier(l));
});
} else {
// We assume window open since there's no link gesture to tell us what to do.
window.open(urlModifier(href));
}
return true;
} else if (invocation.commandRegistry) {
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=411282
invocation.commandRegistry._invoke(invocation);
return true;
} else if (command.onClick || command.callback) {
// TODO: what is this timeout for?
window.setTimeout(function() {
(command.onClick || command.callback).call(invocation.handler || window, invocation);
}, 0);
return true;
}
}
return false;
}
|
javascript
|
function executeBinding(binding) {
var invocation = binding.invocation;
if (invocation) {
var command = binding.command;
if (typeof(command.hrefCallback) === 'function') {
var href = command.hrefCallback.call(invocation.handler || window, invocation);
if (href.then){
href.then(function(l){
window.open(urlModifier(l));
});
} else {
// We assume window open since there's no link gesture to tell us what to do.
window.open(urlModifier(href));
}
return true;
} else if (invocation.commandRegistry) {
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=411282
invocation.commandRegistry._invoke(invocation);
return true;
} else if (command.onClick || command.callback) {
// TODO: what is this timeout for?
window.setTimeout(function() {
(command.onClick || command.callback).call(invocation.handler || window, invocation);
}, 0);
return true;
}
}
return false;
}
|
[
"function",
"executeBinding",
"(",
"binding",
")",
"{",
"var",
"invocation",
"=",
"binding",
".",
"invocation",
";",
"if",
"(",
"invocation",
")",
"{",
"var",
"command",
"=",
"binding",
".",
"command",
";",
"if",
"(",
"typeof",
"(",
"command",
".",
"hrefCallback",
")",
"===",
"'function'",
")",
"{",
"var",
"href",
"=",
"command",
".",
"hrefCallback",
".",
"call",
"(",
"invocation",
".",
"handler",
"||",
"window",
",",
"invocation",
")",
";",
"if",
"(",
"href",
".",
"then",
")",
"{",
"href",
".",
"then",
"(",
"function",
"(",
"l",
")",
"{",
"window",
".",
"open",
"(",
"urlModifier",
"(",
"l",
")",
")",
";",
"}",
")",
";",
"}",
"else",
"{",
"// We assume window open since there's no link gesture to tell us what to do.",
"window",
".",
"open",
"(",
"urlModifier",
"(",
"href",
")",
")",
";",
"}",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"invocation",
".",
"commandRegistry",
")",
"{",
"// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=411282",
"invocation",
".",
"commandRegistry",
".",
"_invoke",
"(",
"invocation",
")",
";",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"command",
".",
"onClick",
"||",
"command",
".",
"callback",
")",
"{",
"// TODO: what is this timeout for?",
"window",
".",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"(",
"command",
".",
"onClick",
"||",
"command",
".",
"callback",
")",
".",
"call",
"(",
"invocation",
".",
"handler",
"||",
"window",
",",
"invocation",
")",
";",
"}",
",",
"0",
")",
";",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Executes a binding if possible.
@name orion.commands.executeBinding
@function
@static
@param {Object} binding
@returns {Boolean} <code>true</code> if the binding was executed, <code>false</code> otherwise.
|
[
"Executes",
"a",
"binding",
"if",
"possible",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commands.js#L59-L87
|
14,594
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/commands.js
|
function(parent, items, handler, userData, commandService) {
var choices = this.getChoices(items, handler, userData);
var addCheck = choices.some(function(choice) {
return choice.checked;
});
choices.forEach(function(choice) {
if (choice.name) {
var itemNode = document.createElement("li"); //$NON-NLS-0$
itemNode.setAttribute("role", "none"); //$NON-NLS-0$ //$NON-NLS-1$
parent.appendChild(itemNode);
var node = document.createElement("span"); //$NON-NLS-0$
node.tabIndex = -1;
node.classList.add("dropdownMenuItem"); //$NON-NLS-0$
node.style.outline = "none";
if (addCheck) {
node.setAttribute("role", "menuitemradio"); //$NON-NLS-1$ //$NON-NLS-0$
node.setAttribute("aria-checked", choice.checked ? "true" : "false"); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
var check = document.createElement("span"); //$NON-NLS-0$
check.classList.add("check"); //$NON-NLS-0$
check.setAttribute("role", "none"); //$NON-NLS-0$ //$NON-NLS-1$
check.setAttribute("aria-hidden", "true"); //$NON-NLS-1$ //$NON-NLS-0$
check.appendChild(document.createTextNode(choice.checked ? "\u25CF" : "")); //$NON-NLS-1$ //$NON-NLS-0$
node.appendChild(check);
} else {
node.setAttribute("role", "menuitem"); //$NON-NLS-1$ //$NON-NLS-0$
}
if (choice.imageClass) {
var image = document.createElement("span"); //$NON-NLS-0$
image.classList.add(choice.imageClass);
node.appendChild(image);
}
var span = document.createElement("span"); //$NON-NLS-0$
var text = document.createTextNode(choice.name);
span.appendChild(text);
node.appendChild(span);
itemNode.appendChild(node);
node.choice = choice;
node.addEventListener("click", function(event) { //$NON-NLS-0$
mMetrics.logEvent("command", "invoke", this.id + ">" + choice.name); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
choice.callback.call(choice, items);
}.bind(this), false);
node.addEventListener("keydown", function(event) { //$NON-NLS-0$
if (event.keyCode === lib.KEY.ENTER || event.keyCode === lib.KEY.SPACE) {
mMetrics.logEvent("command", "invoke", this.id + ">" + choice.name); //$NON-NLS-3$ //$NON-NLS-1$ //$NON-NLS-0$
choice.callback.call(choice, items);
}
}.bind(this), false);
} else { // anything not named is a separator
commandService._generateMenuSeparator(parent);
}
}.bind(this));
}
|
javascript
|
function(parent, items, handler, userData, commandService) {
var choices = this.getChoices(items, handler, userData);
var addCheck = choices.some(function(choice) {
return choice.checked;
});
choices.forEach(function(choice) {
if (choice.name) {
var itemNode = document.createElement("li"); //$NON-NLS-0$
itemNode.setAttribute("role", "none"); //$NON-NLS-0$ //$NON-NLS-1$
parent.appendChild(itemNode);
var node = document.createElement("span"); //$NON-NLS-0$
node.tabIndex = -1;
node.classList.add("dropdownMenuItem"); //$NON-NLS-0$
node.style.outline = "none";
if (addCheck) {
node.setAttribute("role", "menuitemradio"); //$NON-NLS-1$ //$NON-NLS-0$
node.setAttribute("aria-checked", choice.checked ? "true" : "false"); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
var check = document.createElement("span"); //$NON-NLS-0$
check.classList.add("check"); //$NON-NLS-0$
check.setAttribute("role", "none"); //$NON-NLS-0$ //$NON-NLS-1$
check.setAttribute("aria-hidden", "true"); //$NON-NLS-1$ //$NON-NLS-0$
check.appendChild(document.createTextNode(choice.checked ? "\u25CF" : "")); //$NON-NLS-1$ //$NON-NLS-0$
node.appendChild(check);
} else {
node.setAttribute("role", "menuitem"); //$NON-NLS-1$ //$NON-NLS-0$
}
if (choice.imageClass) {
var image = document.createElement("span"); //$NON-NLS-0$
image.classList.add(choice.imageClass);
node.appendChild(image);
}
var span = document.createElement("span"); //$NON-NLS-0$
var text = document.createTextNode(choice.name);
span.appendChild(text);
node.appendChild(span);
itemNode.appendChild(node);
node.choice = choice;
node.addEventListener("click", function(event) { //$NON-NLS-0$
mMetrics.logEvent("command", "invoke", this.id + ">" + choice.name); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
choice.callback.call(choice, items);
}.bind(this), false);
node.addEventListener("keydown", function(event) { //$NON-NLS-0$
if (event.keyCode === lib.KEY.ENTER || event.keyCode === lib.KEY.SPACE) {
mMetrics.logEvent("command", "invoke", this.id + ">" + choice.name); //$NON-NLS-3$ //$NON-NLS-1$ //$NON-NLS-0$
choice.callback.call(choice, items);
}
}.bind(this), false);
} else { // anything not named is a separator
commandService._generateMenuSeparator(parent);
}
}.bind(this));
}
|
[
"function",
"(",
"parent",
",",
"items",
",",
"handler",
",",
"userData",
",",
"commandService",
")",
"{",
"var",
"choices",
"=",
"this",
".",
"getChoices",
"(",
"items",
",",
"handler",
",",
"userData",
")",
";",
"var",
"addCheck",
"=",
"choices",
".",
"some",
"(",
"function",
"(",
"choice",
")",
"{",
"return",
"choice",
".",
"checked",
";",
"}",
")",
";",
"choices",
".",
"forEach",
"(",
"function",
"(",
"choice",
")",
"{",
"if",
"(",
"choice",
".",
"name",
")",
"{",
"var",
"itemNode",
"=",
"document",
".",
"createElement",
"(",
"\"li\"",
")",
";",
"//$NON-NLS-0$",
"itemNode",
".",
"setAttribute",
"(",
"\"role\"",
",",
"\"none\"",
")",
";",
"//$NON-NLS-0$ //$NON-NLS-1$",
"parent",
".",
"appendChild",
"(",
"itemNode",
")",
";",
"var",
"node",
"=",
"document",
".",
"createElement",
"(",
"\"span\"",
")",
";",
"//$NON-NLS-0$",
"node",
".",
"tabIndex",
"=",
"-",
"1",
";",
"node",
".",
"classList",
".",
"add",
"(",
"\"dropdownMenuItem\"",
")",
";",
"//$NON-NLS-0$",
"node",
".",
"style",
".",
"outline",
"=",
"\"none\"",
";",
"if",
"(",
"addCheck",
")",
"{",
"node",
".",
"setAttribute",
"(",
"\"role\"",
",",
"\"menuitemradio\"",
")",
";",
"//$NON-NLS-1$ //$NON-NLS-0$",
"node",
".",
"setAttribute",
"(",
"\"aria-checked\"",
",",
"choice",
".",
"checked",
"?",
"\"true\"",
":",
"\"false\"",
")",
";",
"//$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$",
"var",
"check",
"=",
"document",
".",
"createElement",
"(",
"\"span\"",
")",
";",
"//$NON-NLS-0$",
"check",
".",
"classList",
".",
"add",
"(",
"\"check\"",
")",
";",
"//$NON-NLS-0$",
"check",
".",
"setAttribute",
"(",
"\"role\"",
",",
"\"none\"",
")",
";",
"//$NON-NLS-0$ //$NON-NLS-1$",
"check",
".",
"setAttribute",
"(",
"\"aria-hidden\"",
",",
"\"true\"",
")",
";",
"//$NON-NLS-1$ //$NON-NLS-0$",
"check",
".",
"appendChild",
"(",
"document",
".",
"createTextNode",
"(",
"choice",
".",
"checked",
"?",
"\"\\u25CF\"",
":",
"\"\"",
")",
")",
";",
"//$NON-NLS-1$ //$NON-NLS-0$",
"node",
".",
"appendChild",
"(",
"check",
")",
";",
"}",
"else",
"{",
"node",
".",
"setAttribute",
"(",
"\"role\"",
",",
"\"menuitem\"",
")",
";",
"//$NON-NLS-1$ //$NON-NLS-0$",
"}",
"if",
"(",
"choice",
".",
"imageClass",
")",
"{",
"var",
"image",
"=",
"document",
".",
"createElement",
"(",
"\"span\"",
")",
";",
"//$NON-NLS-0$",
"image",
".",
"classList",
".",
"add",
"(",
"choice",
".",
"imageClass",
")",
";",
"node",
".",
"appendChild",
"(",
"image",
")",
";",
"}",
"var",
"span",
"=",
"document",
".",
"createElement",
"(",
"\"span\"",
")",
";",
"//$NON-NLS-0$",
"var",
"text",
"=",
"document",
".",
"createTextNode",
"(",
"choice",
".",
"name",
")",
";",
"span",
".",
"appendChild",
"(",
"text",
")",
";",
"node",
".",
"appendChild",
"(",
"span",
")",
";",
"itemNode",
".",
"appendChild",
"(",
"node",
")",
";",
"node",
".",
"choice",
"=",
"choice",
";",
"node",
".",
"addEventListener",
"(",
"\"click\"",
",",
"function",
"(",
"event",
")",
"{",
"//$NON-NLS-0$",
"mMetrics",
".",
"logEvent",
"(",
"\"command\"",
",",
"\"invoke\"",
",",
"this",
".",
"id",
"+",
"\">\"",
"+",
"choice",
".",
"name",
")",
";",
"//$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$",
"choice",
".",
"callback",
".",
"call",
"(",
"choice",
",",
"items",
")",
";",
"}",
".",
"bind",
"(",
"this",
")",
",",
"false",
")",
";",
"node",
".",
"addEventListener",
"(",
"\"keydown\"",
",",
"function",
"(",
"event",
")",
"{",
"//$NON-NLS-0$",
"if",
"(",
"event",
".",
"keyCode",
"===",
"lib",
".",
"KEY",
".",
"ENTER",
"||",
"event",
".",
"keyCode",
"===",
"lib",
".",
"KEY",
".",
"SPACE",
")",
"{",
"mMetrics",
".",
"logEvent",
"(",
"\"command\"",
",",
"\"invoke\"",
",",
"this",
".",
"id",
"+",
"\">\"",
"+",
"choice",
".",
"name",
")",
";",
"//$NON-NLS-3$ //$NON-NLS-1$ //$NON-NLS-0$",
"choice",
".",
"callback",
".",
"call",
"(",
"choice",
",",
"items",
")",
";",
"}",
"}",
".",
"bind",
"(",
"this",
")",
",",
"false",
")",
";",
"}",
"else",
"{",
"// anything not named is a separator",
"commandService",
".",
"_generateMenuSeparator",
"(",
"parent",
")",
";",
"}",
"}",
".",
"bind",
"(",
"this",
")",
")",
";",
"}"
] |
Populate the specified menu with choices using the choiceCallback.
Used internally by the command service. Not intended to be overridden or called
externally.
|
[
"Populate",
"the",
"specified",
"menu",
"with",
"choices",
"using",
"the",
"choiceCallback",
".",
"Used",
"internally",
"by",
"the",
"command",
"service",
".",
"Not",
"intended",
"to",
"be",
"overridden",
"or",
"called",
"externally",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commands.js#L757-L808
|
|
14,595
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/commands.js
|
function(items, handler, userData) {
if (this.choiceCallback) {
return this.choiceCallback.call(handler, items, userData);
}
return null;
}
|
javascript
|
function(items, handler, userData) {
if (this.choiceCallback) {
return this.choiceCallback.call(handler, items, userData);
}
return null;
}
|
[
"function",
"(",
"items",
",",
"handler",
",",
"userData",
")",
"{",
"if",
"(",
"this",
".",
"choiceCallback",
")",
"{",
"return",
"this",
".",
"choiceCallback",
".",
"call",
"(",
"handler",
",",
"items",
",",
"userData",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Get the appropriate choices using the choiceCallback.
Used internally by the command service. Not intended to be overridden or called
externally.
|
[
"Get",
"the",
"appropriate",
"choices",
"using",
"the",
"choiceCallback",
".",
"Used",
"internally",
"by",
"the",
"command",
"service",
".",
"Not",
"intended",
"to",
"be",
"overridden",
"or",
"called",
"externally",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commands.js#L815-L820
|
|
14,596
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/commands.js
|
function(choice, items) {
return function(event) {
if (choice.callback) {
choice.callback.call(choice, items, event);
}
};
}
|
javascript
|
function(choice, items) {
return function(event) {
if (choice.callback) {
choice.callback.call(choice, items, event);
}
};
}
|
[
"function",
"(",
"choice",
",",
"items",
")",
"{",
"return",
"function",
"(",
"event",
")",
"{",
"if",
"(",
"choice",
".",
"callback",
")",
"{",
"choice",
".",
"callback",
".",
"call",
"(",
"choice",
",",
"items",
",",
"event",
")",
";",
"}",
"}",
";",
"}"
] |
Make a choice callback appropriate for the given choice and items.
Used internally by the command service. Not intended to be overridden or called
externally.
|
[
"Make",
"a",
"choice",
"callback",
"appropriate",
"for",
"the",
"given",
"choice",
"and",
"items",
".",
"Used",
"internally",
"by",
"the",
"command",
"service",
".",
"Not",
"intended",
"to",
"be",
"overridden",
"or",
"called",
"externally",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/commands.js#L827-L833
|
|
14,597
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/examplePages/leftrightpanes.js
|
updateRightSide
|
function updateRightSide() {
// Many pages use the hash to determine the content.
var parameters = PageUtil.matchResourceParameters();
var content = lib.node("rightContent"); //$NON-NLS-0$
lib.empty(content);
var text = parameters.resource.length > 0 ? "Showing interesting info about " + parameters.resource + "!" : "Try adding a hash to the URL"; //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
content.appendChild(document.createTextNode(text));
// Here we use a page service, though this is usually done inside components to whom we've passed the service.
if (parameters.resource.length > 0) {
statusService.setMessage("Status for " + parameters.resource + "."); //$NON-NLS-1$ //$NON-NLS-0$
}
}
|
javascript
|
function updateRightSide() {
// Many pages use the hash to determine the content.
var parameters = PageUtil.matchResourceParameters();
var content = lib.node("rightContent"); //$NON-NLS-0$
lib.empty(content);
var text = parameters.resource.length > 0 ? "Showing interesting info about " + parameters.resource + "!" : "Try adding a hash to the URL"; //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
content.appendChild(document.createTextNode(text));
// Here we use a page service, though this is usually done inside components to whom we've passed the service.
if (parameters.resource.length > 0) {
statusService.setMessage("Status for " + parameters.resource + "."); //$NON-NLS-1$ //$NON-NLS-0$
}
}
|
[
"function",
"updateRightSide",
"(",
")",
"{",
"// Many pages use the hash to determine the content.",
"var",
"parameters",
"=",
"PageUtil",
".",
"matchResourceParameters",
"(",
")",
";",
"var",
"content",
"=",
"lib",
".",
"node",
"(",
"\"rightContent\"",
")",
";",
"//$NON-NLS-0$",
"lib",
".",
"empty",
"(",
"content",
")",
";",
"var",
"text",
"=",
"parameters",
".",
"resource",
".",
"length",
">",
"0",
"?",
"\"Showing interesting info about \"",
"+",
"parameters",
".",
"resource",
"+",
"\"!\"",
":",
"\"Try adding a hash to the URL\"",
";",
"//$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$",
"content",
".",
"appendChild",
"(",
"document",
".",
"createTextNode",
"(",
"text",
")",
")",
";",
"// Here we use a page service, though this is usually done inside components to whom we've passed the service.",
"if",
"(",
"parameters",
".",
"resource",
".",
"length",
">",
"0",
")",
"{",
"statusService",
".",
"setMessage",
"(",
"\"Status for \"",
"+",
"parameters",
".",
"resource",
"+",
"\".\"",
")",
";",
"//$NON-NLS-1$ //$NON-NLS-0$",
"}",
"}"
] |
Here we track hash changes. Another pattern is that the component on the right side would track the hash change internally.
|
[
"Here",
"we",
"track",
"hash",
"changes",
".",
"Another",
"pattern",
"is",
"that",
"the",
"component",
"on",
"the",
"right",
"side",
"would",
"track",
"the",
"hash",
"change",
"internally",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/examplePages/leftrightpanes.js#L86-L99
|
14,598
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-param-reassign.js
|
isModifyingProp
|
function isModifyingProp(reference) {
var node = reference.identifier;
var parent = node.parent;
while (parent && !stopNodePattern.test(parent.type)) {
switch (parent.type) {
// e.g. foo.a = 0;
case "AssignmentExpression":
return parent.left === node;
// e.g. ++foo.a;
case "UpdateExpression":
return true;
// e.g. delete foo.a;
case "UnaryExpression":
if (parent.operator === "delete") {
return true;
}
break;
// EXCLUDES: e.g. cache.get(foo.a).b = 0;
case "CallExpression":
if (parent.callee !== node) {
return false;
}
break;
// EXCLUDES: e.g. cache[foo.a] = 0;
case "MemberExpression":
if (parent.property === node) {
return false;
}
break;
default:
break;
}
node = parent;
parent = node.parent;
}
return false;
}
|
javascript
|
function isModifyingProp(reference) {
var node = reference.identifier;
var parent = node.parent;
while (parent && !stopNodePattern.test(parent.type)) {
switch (parent.type) {
// e.g. foo.a = 0;
case "AssignmentExpression":
return parent.left === node;
// e.g. ++foo.a;
case "UpdateExpression":
return true;
// e.g. delete foo.a;
case "UnaryExpression":
if (parent.operator === "delete") {
return true;
}
break;
// EXCLUDES: e.g. cache.get(foo.a).b = 0;
case "CallExpression":
if (parent.callee !== node) {
return false;
}
break;
// EXCLUDES: e.g. cache[foo.a] = 0;
case "MemberExpression":
if (parent.property === node) {
return false;
}
break;
default:
break;
}
node = parent;
parent = node.parent;
}
return false;
}
|
[
"function",
"isModifyingProp",
"(",
"reference",
")",
"{",
"var",
"node",
"=",
"reference",
".",
"identifier",
";",
"var",
"parent",
"=",
"node",
".",
"parent",
";",
"while",
"(",
"parent",
"&&",
"!",
"stopNodePattern",
".",
"test",
"(",
"parent",
".",
"type",
")",
")",
"{",
"switch",
"(",
"parent",
".",
"type",
")",
"{",
"// e.g. foo.a = 0;",
"case",
"\"AssignmentExpression\"",
":",
"return",
"parent",
".",
"left",
"===",
"node",
";",
"// e.g. ++foo.a;",
"case",
"\"UpdateExpression\"",
":",
"return",
"true",
";",
"// e.g. delete foo.a;",
"case",
"\"UnaryExpression\"",
":",
"if",
"(",
"parent",
".",
"operator",
"===",
"\"delete\"",
")",
"{",
"return",
"true",
";",
"}",
"break",
";",
"// EXCLUDES: e.g. cache.get(foo.a).b = 0;",
"case",
"\"CallExpression\"",
":",
"if",
"(",
"parent",
".",
"callee",
"!==",
"node",
")",
"{",
"return",
"false",
";",
"}",
"break",
";",
"// EXCLUDES: e.g. cache[foo.a] = 0;",
"case",
"\"MemberExpression\"",
":",
"if",
"(",
"parent",
".",
"property",
"===",
"node",
")",
"{",
"return",
"false",
";",
"}",
"break",
";",
"default",
":",
"break",
";",
"}",
"node",
"=",
"parent",
";",
"parent",
"=",
"node",
".",
"parent",
";",
"}",
"return",
"false",
";",
"}"
] |
Checks whether or not the reference modifies properties of its variable.
@param {Reference} reference - A reference to check.
@returns {boolean} Whether or not the reference modifies properties of its variable.
|
[
"Checks",
"whether",
"or",
"not",
"the",
"reference",
"modifies",
"properties",
"of",
"its",
"variable",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-param-reassign.js#L27-L72
|
14,599
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.help/web/help/helpService.js
|
function(object) {
var url = new URL(object.Location, self.location);
return xhr("GET", url.href, { //$NON-NLS-0$
timeout: 15000,
headers: { "Orion-Version": "1" }, //$NON-NLS-1$ //$NON-NLS-0$
log: false
}).then(function(result) {
return result.response;
}.bind(this));
}
|
javascript
|
function(object) {
var url = new URL(object.Location, self.location);
return xhr("GET", url.href, { //$NON-NLS-0$
timeout: 15000,
headers: { "Orion-Version": "1" }, //$NON-NLS-1$ //$NON-NLS-0$
log: false
}).then(function(result) {
return result.response;
}.bind(this));
}
|
[
"function",
"(",
"object",
")",
"{",
"var",
"url",
"=",
"new",
"URL",
"(",
"object",
".",
"Location",
",",
"self",
".",
"location",
")",
";",
"return",
"xhr",
"(",
"\"GET\"",
",",
"url",
".",
"href",
",",
"{",
"//$NON-NLS-0$",
"timeout",
":",
"15000",
",",
"headers",
":",
"{",
"\"Orion-Version\"",
":",
"\"1\"",
"}",
",",
"//$NON-NLS-1$ //$NON-NLS-0$",
"log",
":",
"false",
"}",
")",
".",
"then",
"(",
"function",
"(",
"result",
")",
"{",
"return",
"result",
".",
"response",
";",
"}",
".",
"bind",
"(",
"this",
")",
")",
";",
"}"
] |
Returns the contents of the file at the given location.
@param object the help item
@return A deferred that will be provided with the contents when available
|
[
"Returns",
"the",
"contents",
"of",
"the",
"file",
"at",
"the",
"given",
"location",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.help/web/help/helpService.js#L68-L77
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.