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,200
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/editorView.js
|
EditorView
|
function EditorView(options) {
this._parent = options.parent;
if(typeof this._parent === "string") {
this._parent = document.getElementById(options.parent);
}
this.id = options.id || "";
this.activateContext = options.activateContext;
this.renderToolbars = options.renderToolbars;
this.serviceRegistry = options.serviceRegistry;
this.contentTypeRegistry = options.contentTypeRegistry;
this.commandRegistry = options.commandRegistry;
this.progress = options.progress;
this.statusService = options.statusService;
this.editorCommands = options.editorCommands;
this.fileClient = options.fileService;
this.inputManager = options.inputManager;
this.preferences = options.preferences;
this.readonly = options.readonly;
this.singleMode = options.singleMode;
this.searcher = options.searcher;
this.statusReporter = options.statusReporter;
this.model = options.model;
this.undoStack = options.undoStack;
this.problemsServiceID = options.problemsServiceID || "orion.core.marker"; //$NON-NLS-0$
this.editContextServiceID = options.editContextServiceID || "orion.edit.context"; //$NON-NLS-0$
this.syntaxHighlighter = new Highlight.SyntaxHighlighter(this.serviceRegistry);
var keyAssist = mGlobalCommands.getKeyAssist ? mGlobalCommands.getKeyAssist() : null;
if(keyAssist) {
keyAssist.addProvider(this.editorCommands);
}
var mainSplitter = mGlobalCommands.getMainSplitter ? mGlobalCommands.getMainSplitter() : null;
if(mainSplitter) {
mainSplitter.splitter.addEventListener("resize", function (evt) {
if (this.editor && evt.node === mainSplitter.main) {
this.editor.resize();
}
}.bind(this));
}
if(mGlobalCommands.getGlobalEventTarget) {
mGlobalCommands.getGlobalEventTarget().addEventListener("toggleTrim", function() {
if (this.editor) {
this.editor.resize();
}
}.bind(this));
}
this.settings = {};
this._editorConfig = options.editorConfig;
this._init();
}
|
javascript
|
function EditorView(options) {
this._parent = options.parent;
if(typeof this._parent === "string") {
this._parent = document.getElementById(options.parent);
}
this.id = options.id || "";
this.activateContext = options.activateContext;
this.renderToolbars = options.renderToolbars;
this.serviceRegistry = options.serviceRegistry;
this.contentTypeRegistry = options.contentTypeRegistry;
this.commandRegistry = options.commandRegistry;
this.progress = options.progress;
this.statusService = options.statusService;
this.editorCommands = options.editorCommands;
this.fileClient = options.fileService;
this.inputManager = options.inputManager;
this.preferences = options.preferences;
this.readonly = options.readonly;
this.singleMode = options.singleMode;
this.searcher = options.searcher;
this.statusReporter = options.statusReporter;
this.model = options.model;
this.undoStack = options.undoStack;
this.problemsServiceID = options.problemsServiceID || "orion.core.marker"; //$NON-NLS-0$
this.editContextServiceID = options.editContextServiceID || "orion.edit.context"; //$NON-NLS-0$
this.syntaxHighlighter = new Highlight.SyntaxHighlighter(this.serviceRegistry);
var keyAssist = mGlobalCommands.getKeyAssist ? mGlobalCommands.getKeyAssist() : null;
if(keyAssist) {
keyAssist.addProvider(this.editorCommands);
}
var mainSplitter = mGlobalCommands.getMainSplitter ? mGlobalCommands.getMainSplitter() : null;
if(mainSplitter) {
mainSplitter.splitter.addEventListener("resize", function (evt) {
if (this.editor && evt.node === mainSplitter.main) {
this.editor.resize();
}
}.bind(this));
}
if(mGlobalCommands.getGlobalEventTarget) {
mGlobalCommands.getGlobalEventTarget().addEventListener("toggleTrim", function() {
if (this.editor) {
this.editor.resize();
}
}.bind(this));
}
this.settings = {};
this._editorConfig = options.editorConfig;
this._init();
}
|
[
"function",
"EditorView",
"(",
"options",
")",
"{",
"this",
".",
"_parent",
"=",
"options",
".",
"parent",
";",
"if",
"(",
"typeof",
"this",
".",
"_parent",
"===",
"\"string\"",
")",
"{",
"this",
".",
"_parent",
"=",
"document",
".",
"getElementById",
"(",
"options",
".",
"parent",
")",
";",
"}",
"this",
".",
"id",
"=",
"options",
".",
"id",
"||",
"\"\"",
";",
"this",
".",
"activateContext",
"=",
"options",
".",
"activateContext",
";",
"this",
".",
"renderToolbars",
"=",
"options",
".",
"renderToolbars",
";",
"this",
".",
"serviceRegistry",
"=",
"options",
".",
"serviceRegistry",
";",
"this",
".",
"contentTypeRegistry",
"=",
"options",
".",
"contentTypeRegistry",
";",
"this",
".",
"commandRegistry",
"=",
"options",
".",
"commandRegistry",
";",
"this",
".",
"progress",
"=",
"options",
".",
"progress",
";",
"this",
".",
"statusService",
"=",
"options",
".",
"statusService",
";",
"this",
".",
"editorCommands",
"=",
"options",
".",
"editorCommands",
";",
"this",
".",
"fileClient",
"=",
"options",
".",
"fileService",
";",
"this",
".",
"inputManager",
"=",
"options",
".",
"inputManager",
";",
"this",
".",
"preferences",
"=",
"options",
".",
"preferences",
";",
"this",
".",
"readonly",
"=",
"options",
".",
"readonly",
";",
"this",
".",
"singleMode",
"=",
"options",
".",
"singleMode",
";",
"this",
".",
"searcher",
"=",
"options",
".",
"searcher",
";",
"this",
".",
"statusReporter",
"=",
"options",
".",
"statusReporter",
";",
"this",
".",
"model",
"=",
"options",
".",
"model",
";",
"this",
".",
"undoStack",
"=",
"options",
".",
"undoStack",
";",
"this",
".",
"problemsServiceID",
"=",
"options",
".",
"problemsServiceID",
"||",
"\"orion.core.marker\"",
";",
"//$NON-NLS-0$\r",
"this",
".",
"editContextServiceID",
"=",
"options",
".",
"editContextServiceID",
"||",
"\"orion.edit.context\"",
";",
"//$NON-NLS-0$\r",
"this",
".",
"syntaxHighlighter",
"=",
"new",
"Highlight",
".",
"SyntaxHighlighter",
"(",
"this",
".",
"serviceRegistry",
")",
";",
"var",
"keyAssist",
"=",
"mGlobalCommands",
".",
"getKeyAssist",
"?",
"mGlobalCommands",
".",
"getKeyAssist",
"(",
")",
":",
"null",
";",
"if",
"(",
"keyAssist",
")",
"{",
"keyAssist",
".",
"addProvider",
"(",
"this",
".",
"editorCommands",
")",
";",
"}",
"var",
"mainSplitter",
"=",
"mGlobalCommands",
".",
"getMainSplitter",
"?",
"mGlobalCommands",
".",
"getMainSplitter",
"(",
")",
":",
"null",
";",
"if",
"(",
"mainSplitter",
")",
"{",
"mainSplitter",
".",
"splitter",
".",
"addEventListener",
"(",
"\"resize\"",
",",
"function",
"(",
"evt",
")",
"{",
"if",
"(",
"this",
".",
"editor",
"&&",
"evt",
".",
"node",
"===",
"mainSplitter",
".",
"main",
")",
"{",
"this",
".",
"editor",
".",
"resize",
"(",
")",
";",
"}",
"}",
".",
"bind",
"(",
"this",
")",
")",
";",
"}",
"if",
"(",
"mGlobalCommands",
".",
"getGlobalEventTarget",
")",
"{",
"mGlobalCommands",
".",
"getGlobalEventTarget",
"(",
")",
".",
"addEventListener",
"(",
"\"toggleTrim\"",
",",
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"editor",
")",
"{",
"this",
".",
"editor",
".",
"resize",
"(",
")",
";",
"}",
"}",
".",
"bind",
"(",
"this",
")",
")",
";",
"}",
"this",
".",
"settings",
"=",
"{",
"}",
";",
"this",
".",
"_editorConfig",
"=",
"options",
".",
"editorConfig",
";",
"this",
".",
"_init",
"(",
")",
";",
"}"
] |
Constructs a new EditorView object.
@class
@name orion.EditorView
@borrows orion.editor.EventTarget#addEventListener as #addEventListener
@borrows orion.editor.EventTarget#removeEventListener as #removeEventListener
@borrows orion.editor.EventTarget#dispatchEvent as #dispatchEvent
|
[
"Constructs",
"a",
"new",
"EditorView",
"object",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/editorView.js#L89-L137
|
14,201
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-extend-native.js
|
function(node) {
var lhs = node.left,
affectsProto;
if (lhs.type !== "MemberExpression" || lhs.object.type !== "MemberExpression") {
return;
}
affectsProto = lhs.object.computed ?
lhs.object.property.type === "Literal" && lhs.object.property.value === "prototype" :
lhs.object.property.name === "prototype";
if (!affectsProto) {
return;
}
modifiedBuiltins.forEach(function(builtin) {
if (lhs.object.object.name === builtin) {
context.report(node, ProblemMessages.noExtendNative, {builtin: builtin});
}
});
}
|
javascript
|
function(node) {
var lhs = node.left,
affectsProto;
if (lhs.type !== "MemberExpression" || lhs.object.type !== "MemberExpression") {
return;
}
affectsProto = lhs.object.computed ?
lhs.object.property.type === "Literal" && lhs.object.property.value === "prototype" :
lhs.object.property.name === "prototype";
if (!affectsProto) {
return;
}
modifiedBuiltins.forEach(function(builtin) {
if (lhs.object.object.name === builtin) {
context.report(node, ProblemMessages.noExtendNative, {builtin: builtin});
}
});
}
|
[
"function",
"(",
"node",
")",
"{",
"var",
"lhs",
"=",
"node",
".",
"left",
",",
"affectsProto",
";",
"if",
"(",
"lhs",
".",
"type",
"!==",
"\"MemberExpression\"",
"||",
"lhs",
".",
"object",
".",
"type",
"!==",
"\"MemberExpression\"",
")",
"{",
"return",
";",
"}",
"affectsProto",
"=",
"lhs",
".",
"object",
".",
"computed",
"?",
"lhs",
".",
"object",
".",
"property",
".",
"type",
"===",
"\"Literal\"",
"&&",
"lhs",
".",
"object",
".",
"property",
".",
"value",
"===",
"\"prototype\"",
":",
"lhs",
".",
"object",
".",
"property",
".",
"name",
"===",
"\"prototype\"",
";",
"if",
"(",
"!",
"affectsProto",
")",
"{",
"return",
";",
"}",
"modifiedBuiltins",
".",
"forEach",
"(",
"function",
"(",
"builtin",
")",
"{",
"if",
"(",
"lhs",
".",
"object",
".",
"object",
".",
"name",
"===",
"builtin",
")",
"{",
"context",
".",
"report",
"(",
"node",
",",
"ProblemMessages",
".",
"noExtendNative",
",",
"{",
"builtin",
":",
"builtin",
"}",
")",
";",
"}",
"}",
")",
";",
"}"
] |
handle the Array.prototype.extra style case
|
[
"handle",
"the",
"Array",
".",
"prototype",
".",
"extra",
"style",
"case"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-extend-native.js#L36-L57
|
|
14,202
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-unused-expressions.js
|
isValidExpression
|
function isValidExpression(node) {
if (allowTernary) {
// Recursive check for ternary and logical expressions
if (node.type === "ConditionalExpression") {
return isValidExpression(node.consequent) && isValidExpression(node.alternate);
}
}
if (allowShortCircuit) {
if (node.type === "LogicalExpression") {
return isValidExpression(node.right);
}
}
return /^(?:Assignment|Call|New|Update|Yield)Expression$/.test(node.type) ||
(node.type === "UnaryExpression" && ["delete", "void"].indexOf(node.operator) >= 0);
}
|
javascript
|
function isValidExpression(node) {
if (allowTernary) {
// Recursive check for ternary and logical expressions
if (node.type === "ConditionalExpression") {
return isValidExpression(node.consequent) && isValidExpression(node.alternate);
}
}
if (allowShortCircuit) {
if (node.type === "LogicalExpression") {
return isValidExpression(node.right);
}
}
return /^(?:Assignment|Call|New|Update|Yield)Expression$/.test(node.type) ||
(node.type === "UnaryExpression" && ["delete", "void"].indexOf(node.operator) >= 0);
}
|
[
"function",
"isValidExpression",
"(",
"node",
")",
"{",
"if",
"(",
"allowTernary",
")",
"{",
"// Recursive check for ternary and logical expressions",
"if",
"(",
"node",
".",
"type",
"===",
"\"ConditionalExpression\"",
")",
"{",
"return",
"isValidExpression",
"(",
"node",
".",
"consequent",
")",
"&&",
"isValidExpression",
"(",
"node",
".",
"alternate",
")",
";",
"}",
"}",
"if",
"(",
"allowShortCircuit",
")",
"{",
"if",
"(",
"node",
".",
"type",
"===",
"\"LogicalExpression\"",
")",
"{",
"return",
"isValidExpression",
"(",
"node",
".",
"right",
")",
";",
"}",
"}",
"return",
"/",
"^(?:Assignment|Call|New|Update|Yield)Expression$",
"/",
".",
"test",
"(",
"node",
".",
"type",
")",
"||",
"(",
"node",
".",
"type",
"===",
"\"UnaryExpression\"",
"&&",
"[",
"\"delete\"",
",",
"\"void\"",
"]",
".",
"indexOf",
"(",
"node",
".",
"operator",
")",
">=",
"0",
")",
";",
"}"
] |
Determines whether or not a given node is a valid expression. Recurses on short circuit eval and ternary nodes if enabled by flags.
@param {ASTNode} node - any node
@returns {boolean} whether the given node is a valid expression
|
[
"Determines",
"whether",
"or",
"not",
"a",
"given",
"node",
"is",
"a",
"valid",
"expression",
".",
"Recurses",
"on",
"short",
"circuit",
"eval",
"and",
"ternary",
"nodes",
"if",
"enabled",
"by",
"flags",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-unused-expressions.js#L66-L81
|
14,203
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/output_terminal.js
|
OutputTerminal
|
function OutputTerminal(options, components) {
this.element = components.element;
this.requisition = components.requisition;
this.requisition.commandOutputManager.onOutput.add(this.outputted, this);
var document = components.element.ownerDocument;
if (outputViewCss != null) {
this.style = util.importCss(outputViewCss, document, 'gcli-output-view');
}
this.template = util.toDom(document, outputViewHtml);
this.templateOptions = { allowEval: true, stack: 'output_terminal.html' };
}
|
javascript
|
function OutputTerminal(options, components) {
this.element = components.element;
this.requisition = components.requisition;
this.requisition.commandOutputManager.onOutput.add(this.outputted, this);
var document = components.element.ownerDocument;
if (outputViewCss != null) {
this.style = util.importCss(outputViewCss, document, 'gcli-output-view');
}
this.template = util.toDom(document, outputViewHtml);
this.templateOptions = { allowEval: true, stack: 'output_terminal.html' };
}
|
[
"function",
"OutputTerminal",
"(",
"options",
",",
"components",
")",
"{",
"this",
".",
"element",
"=",
"components",
".",
"element",
";",
"this",
".",
"requisition",
"=",
"components",
".",
"requisition",
";",
"this",
".",
"requisition",
".",
"commandOutputManager",
".",
"onOutput",
".",
"add",
"(",
"this",
".",
"outputted",
",",
"this",
")",
";",
"var",
"document",
"=",
"components",
".",
"element",
".",
"ownerDocument",
";",
"if",
"(",
"outputViewCss",
"!=",
"null",
")",
"{",
"this",
".",
"style",
"=",
"util",
".",
"importCss",
"(",
"outputViewCss",
",",
"document",
",",
"'gcli-output-view'",
")",
";",
"}",
"this",
".",
"template",
"=",
"util",
".",
"toDom",
"(",
"document",
",",
"outputViewHtml",
")",
";",
"this",
".",
"templateOptions",
"=",
"{",
"allowEval",
":",
"true",
",",
"stack",
":",
"'output_terminal.html'",
"}",
";",
"}"
] |
A wrapper for a set of rows|command outputs.
Register with the canon to be notified when commands have output to be
displayed.
@param options Object containing user customization properties, although
none are currently supported
@param components Object that links to other UI components. GCLI provided:
- element: Root element to populate
- requisition (optional): A click/double-click to an input row causes the
command to be sent to the input/executed if we know the requisition use
|
[
"A",
"wrapper",
"for",
"a",
"set",
"of",
"rows|command",
"outputs",
".",
"Register",
"with",
"the",
"canon",
"to",
"be",
"notified",
"when",
"commands",
"have",
"output",
"to",
"be",
"displayed",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/output_terminal.js#L41-L54
|
14,204
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/output_terminal.js
|
OutputView
|
function OutputView(outputData, outputTerminal) {
this.outputData = outputData;
this.outputTerminal = outputTerminal;
this.url = util.createUrlLookup(module);
// Elements attached to this by template().
this.elems = {
rowin: null,
rowout: null,
hide: null,
show: null,
duration: null,
throb: null,
prompt: null
};
var template = this.outputTerminal.template.cloneNode(true);
domtemplate.template(template, this, this.outputTerminal.templateOptions);
this.outputTerminal.element.appendChild(this.elems.rowin);
this.outputTerminal.element.appendChild(this.elems.rowout);
this.outputData.onClose.add(this.closed, this);
this.outputData.onChange.add(this.changed, this);
}
|
javascript
|
function OutputView(outputData, outputTerminal) {
this.outputData = outputData;
this.outputTerminal = outputTerminal;
this.url = util.createUrlLookup(module);
// Elements attached to this by template().
this.elems = {
rowin: null,
rowout: null,
hide: null,
show: null,
duration: null,
throb: null,
prompt: null
};
var template = this.outputTerminal.template.cloneNode(true);
domtemplate.template(template, this, this.outputTerminal.templateOptions);
this.outputTerminal.element.appendChild(this.elems.rowin);
this.outputTerminal.element.appendChild(this.elems.rowout);
this.outputData.onClose.add(this.closed, this);
this.outputData.onChange.add(this.changed, this);
}
|
[
"function",
"OutputView",
"(",
"outputData",
",",
"outputTerminal",
")",
"{",
"this",
".",
"outputData",
"=",
"outputData",
";",
"this",
".",
"outputTerminal",
"=",
"outputTerminal",
";",
"this",
".",
"url",
"=",
"util",
".",
"createUrlLookup",
"(",
"module",
")",
";",
"// Elements attached to this by template().",
"this",
".",
"elems",
"=",
"{",
"rowin",
":",
"null",
",",
"rowout",
":",
"null",
",",
"hide",
":",
"null",
",",
"show",
":",
"null",
",",
"duration",
":",
"null",
",",
"throb",
":",
"null",
",",
"prompt",
":",
"null",
"}",
";",
"var",
"template",
"=",
"this",
".",
"outputTerminal",
".",
"template",
".",
"cloneNode",
"(",
"true",
")",
";",
"domtemplate",
".",
"template",
"(",
"template",
",",
"this",
",",
"this",
".",
"outputTerminal",
".",
"templateOptions",
")",
";",
"this",
".",
"outputTerminal",
".",
"element",
".",
"appendChild",
"(",
"this",
".",
"elems",
".",
"rowin",
")",
";",
"this",
".",
"outputTerminal",
".",
"element",
".",
"appendChild",
"(",
"this",
".",
"elems",
".",
"rowout",
")",
";",
"this",
".",
"outputData",
".",
"onClose",
".",
"add",
"(",
"this",
".",
"closed",
",",
"this",
")",
";",
"this",
".",
"outputData",
".",
"onChange",
".",
"add",
"(",
"this",
".",
"changed",
",",
"this",
")",
";",
"}"
] |
Adds a row to the CLI output display
|
[
"Adds",
"a",
"row",
"to",
"the",
"CLI",
"output",
"display"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/output_terminal.js#L96-L121
|
14,205
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/edit/editorContext.js
|
getOptions
|
function getOptions(serviceRegistry, serviceID) {
var options = Object.create(null);
getReferences(serviceRegistry, serviceID).forEach(function(serviceRef) {
serviceRef.getPropertyKeys().forEach(function(key) {
if (key !== "service.id" && key !== "service.names" && key !== "objectClass") //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
options[key] = serviceRef.getProperty(key);
});
});
return options;
}
|
javascript
|
function getOptions(serviceRegistry, serviceID) {
var options = Object.create(null);
getReferences(serviceRegistry, serviceID).forEach(function(serviceRef) {
serviceRef.getPropertyKeys().forEach(function(key) {
if (key !== "service.id" && key !== "service.names" && key !== "objectClass") //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
options[key] = serviceRef.getProperty(key);
});
});
return options;
}
|
[
"function",
"getOptions",
"(",
"serviceRegistry",
",",
"serviceID",
")",
"{",
"var",
"options",
"=",
"Object",
".",
"create",
"(",
"null",
")",
";",
"getReferences",
"(",
"serviceRegistry",
",",
"serviceID",
")",
".",
"forEach",
"(",
"function",
"(",
"serviceRef",
")",
"{",
"serviceRef",
".",
"getPropertyKeys",
"(",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
"{",
"if",
"(",
"key",
"!==",
"\"service.id\"",
"&&",
"key",
"!==",
"\"service.names\"",
"&&",
"key",
"!==",
"\"objectClass\"",
")",
"//$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$",
"options",
"[",
"key",
"]",
"=",
"serviceRef",
".",
"getProperty",
"(",
"key",
")",
";",
"}",
")",
";",
"}",
")",
";",
"return",
"options",
";",
"}"
] |
Gets the editor context "options" object.
@name orion.edit.EditorContext.getOptions
@function
@param {orion.serviceregistry.ServiceRegistry} serviceRegistry The service registry to consult.
@returns {Object}
|
[
"Gets",
"the",
"editor",
"context",
"options",
"object",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/edit/editorContext.js#L49-L58
|
14,206
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/display.js
|
Display
|
function Display(options) {
var doc = options.document || document;
this.displayStyle = undefined;
if (displayCss != null) {
this.displayStyle = util.importCss(displayCss, doc, 'gcli-css-display');
}
// Configuring the document is complex because on the web side, there is an
// active desire to have nothing to configure, where as when embedded in
// Firefox there could be up to 4 documents, some of which can/should be
// derived from some root element.
// When a component uses a document to create elements for use under a known
// root element, then we pass in the element (if we have looked it up
// already) or an id/document
this.commandOutputManager = options.commandOutputManager;
if (this.commandOutputManager == null) {
this.commandOutputManager = new CommandOutputManager();
}
this.requisition = new Requisition(options.environment || {}, doc,
this.commandOutputManager);
this.focusManager = new FocusManager(options, {
document: doc,
requisition: this.requisition
});
this.inputElement = find(doc, options.inputElement || null, 'gcli-input');
this.inputter = new Inputter(options, {
requisition: this.requisition,
focusManager: this.focusManager,
element: this.inputElement
});
// autoResize logic: we want Completer to keep the elements at the same
// position if we created the completion element, but if someone else created
// it, then it's their job.
this.completeElement = insert(this.inputElement,
options.completeElement || null, 'gcli-row-complete');
this.completer = new Completer(options, {
requisition: this.requisition,
inputter: this.inputter,
autoResize: this.completeElement.gcliCreated,
element: this.completeElement
});
this.prompt = new Prompt(options, {
inputter: this.inputter,
element: insert(this.inputElement,
options.promptElement || null, 'gcli-prompt')
});
this.element = find(doc, options.displayElement || null, 'gcli-display');
this.element.classList.add('gcli-display');
this.template = util.toDom(doc, displayHtml);
this.elements = {};
domtemplate.template(this.template, this.elements, { stack: 'display.html' });
this.element.appendChild(this.template);
this.tooltip = new Tooltip(options, {
requisition: this.requisition,
inputter: this.inputter,
focusManager: this.focusManager,
element: this.elements.tooltip,
panelElement: this.elements.panel
});
this.inputter.tooltip = this.tooltip;
this.outputElement = util.createElement(doc, 'div');
this.outputElement.classList.add('gcli-output');
this.outputList = new OutputTerminal(options, {
requisition: this.requisition,
element: this.outputElement
});
this.element.appendChild(this.outputElement);
intro.maybeShowIntro(this.commandOutputManager, this.requisition);
}
|
javascript
|
function Display(options) {
var doc = options.document || document;
this.displayStyle = undefined;
if (displayCss != null) {
this.displayStyle = util.importCss(displayCss, doc, 'gcli-css-display');
}
// Configuring the document is complex because on the web side, there is an
// active desire to have nothing to configure, where as when embedded in
// Firefox there could be up to 4 documents, some of which can/should be
// derived from some root element.
// When a component uses a document to create elements for use under a known
// root element, then we pass in the element (if we have looked it up
// already) or an id/document
this.commandOutputManager = options.commandOutputManager;
if (this.commandOutputManager == null) {
this.commandOutputManager = new CommandOutputManager();
}
this.requisition = new Requisition(options.environment || {}, doc,
this.commandOutputManager);
this.focusManager = new FocusManager(options, {
document: doc,
requisition: this.requisition
});
this.inputElement = find(doc, options.inputElement || null, 'gcli-input');
this.inputter = new Inputter(options, {
requisition: this.requisition,
focusManager: this.focusManager,
element: this.inputElement
});
// autoResize logic: we want Completer to keep the elements at the same
// position if we created the completion element, but if someone else created
// it, then it's their job.
this.completeElement = insert(this.inputElement,
options.completeElement || null, 'gcli-row-complete');
this.completer = new Completer(options, {
requisition: this.requisition,
inputter: this.inputter,
autoResize: this.completeElement.gcliCreated,
element: this.completeElement
});
this.prompt = new Prompt(options, {
inputter: this.inputter,
element: insert(this.inputElement,
options.promptElement || null, 'gcli-prompt')
});
this.element = find(doc, options.displayElement || null, 'gcli-display');
this.element.classList.add('gcli-display');
this.template = util.toDom(doc, displayHtml);
this.elements = {};
domtemplate.template(this.template, this.elements, { stack: 'display.html' });
this.element.appendChild(this.template);
this.tooltip = new Tooltip(options, {
requisition: this.requisition,
inputter: this.inputter,
focusManager: this.focusManager,
element: this.elements.tooltip,
panelElement: this.elements.panel
});
this.inputter.tooltip = this.tooltip;
this.outputElement = util.createElement(doc, 'div');
this.outputElement.classList.add('gcli-output');
this.outputList = new OutputTerminal(options, {
requisition: this.requisition,
element: this.outputElement
});
this.element.appendChild(this.outputElement);
intro.maybeShowIntro(this.commandOutputManager, this.requisition);
}
|
[
"function",
"Display",
"(",
"options",
")",
"{",
"var",
"doc",
"=",
"options",
".",
"document",
"||",
"document",
";",
"this",
".",
"displayStyle",
"=",
"undefined",
";",
"if",
"(",
"displayCss",
"!=",
"null",
")",
"{",
"this",
".",
"displayStyle",
"=",
"util",
".",
"importCss",
"(",
"displayCss",
",",
"doc",
",",
"'gcli-css-display'",
")",
";",
"}",
"// Configuring the document is complex because on the web side, there is an",
"// active desire to have nothing to configure, where as when embedded in",
"// Firefox there could be up to 4 documents, some of which can/should be",
"// derived from some root element.",
"// When a component uses a document to create elements for use under a known",
"// root element, then we pass in the element (if we have looked it up",
"// already) or an id/document",
"this",
".",
"commandOutputManager",
"=",
"options",
".",
"commandOutputManager",
";",
"if",
"(",
"this",
".",
"commandOutputManager",
"==",
"null",
")",
"{",
"this",
".",
"commandOutputManager",
"=",
"new",
"CommandOutputManager",
"(",
")",
";",
"}",
"this",
".",
"requisition",
"=",
"new",
"Requisition",
"(",
"options",
".",
"environment",
"||",
"{",
"}",
",",
"doc",
",",
"this",
".",
"commandOutputManager",
")",
";",
"this",
".",
"focusManager",
"=",
"new",
"FocusManager",
"(",
"options",
",",
"{",
"document",
":",
"doc",
",",
"requisition",
":",
"this",
".",
"requisition",
"}",
")",
";",
"this",
".",
"inputElement",
"=",
"find",
"(",
"doc",
",",
"options",
".",
"inputElement",
"||",
"null",
",",
"'gcli-input'",
")",
";",
"this",
".",
"inputter",
"=",
"new",
"Inputter",
"(",
"options",
",",
"{",
"requisition",
":",
"this",
".",
"requisition",
",",
"focusManager",
":",
"this",
".",
"focusManager",
",",
"element",
":",
"this",
".",
"inputElement",
"}",
")",
";",
"// autoResize logic: we want Completer to keep the elements at the same",
"// position if we created the completion element, but if someone else created",
"// it, then it's their job.",
"this",
".",
"completeElement",
"=",
"insert",
"(",
"this",
".",
"inputElement",
",",
"options",
".",
"completeElement",
"||",
"null",
",",
"'gcli-row-complete'",
")",
";",
"this",
".",
"completer",
"=",
"new",
"Completer",
"(",
"options",
",",
"{",
"requisition",
":",
"this",
".",
"requisition",
",",
"inputter",
":",
"this",
".",
"inputter",
",",
"autoResize",
":",
"this",
".",
"completeElement",
".",
"gcliCreated",
",",
"element",
":",
"this",
".",
"completeElement",
"}",
")",
";",
"this",
".",
"prompt",
"=",
"new",
"Prompt",
"(",
"options",
",",
"{",
"inputter",
":",
"this",
".",
"inputter",
",",
"element",
":",
"insert",
"(",
"this",
".",
"inputElement",
",",
"options",
".",
"promptElement",
"||",
"null",
",",
"'gcli-prompt'",
")",
"}",
")",
";",
"this",
".",
"element",
"=",
"find",
"(",
"doc",
",",
"options",
".",
"displayElement",
"||",
"null",
",",
"'gcli-display'",
")",
";",
"this",
".",
"element",
".",
"classList",
".",
"add",
"(",
"'gcli-display'",
")",
";",
"this",
".",
"template",
"=",
"util",
".",
"toDom",
"(",
"doc",
",",
"displayHtml",
")",
";",
"this",
".",
"elements",
"=",
"{",
"}",
";",
"domtemplate",
".",
"template",
"(",
"this",
".",
"template",
",",
"this",
".",
"elements",
",",
"{",
"stack",
":",
"'display.html'",
"}",
")",
";",
"this",
".",
"element",
".",
"appendChild",
"(",
"this",
".",
"template",
")",
";",
"this",
".",
"tooltip",
"=",
"new",
"Tooltip",
"(",
"options",
",",
"{",
"requisition",
":",
"this",
".",
"requisition",
",",
"inputter",
":",
"this",
".",
"inputter",
",",
"focusManager",
":",
"this",
".",
"focusManager",
",",
"element",
":",
"this",
".",
"elements",
".",
"tooltip",
",",
"panelElement",
":",
"this",
".",
"elements",
".",
"panel",
"}",
")",
";",
"this",
".",
"inputter",
".",
"tooltip",
"=",
"this",
".",
"tooltip",
";",
"this",
".",
"outputElement",
"=",
"util",
".",
"createElement",
"(",
"doc",
",",
"'div'",
")",
";",
"this",
".",
"outputElement",
".",
"classList",
".",
"add",
"(",
"'gcli-output'",
")",
";",
"this",
".",
"outputList",
"=",
"new",
"OutputTerminal",
"(",
"options",
",",
"{",
"requisition",
":",
"this",
".",
"requisition",
",",
"element",
":",
"this",
".",
"outputElement",
"}",
")",
";",
"this",
".",
"element",
".",
"appendChild",
"(",
"this",
".",
"outputElement",
")",
";",
"intro",
".",
"maybeShowIntro",
"(",
"this",
".",
"commandOutputManager",
",",
"this",
".",
"requisition",
")",
";",
"}"
] |
View is responsible for generating the web UI for GCLI.
@param options Object containing user customization properties.
See the documentation for the other components for more details.
Options supported directly include:
- document (default=document):
- environment (default={}):
- dontDecorate (default=false):
- inputElement (default=#gcli-input):
- completeElement (default=#gcli-row-complete):
- displayElement (default=#gcli-display):
- promptElement (default=#gcli-prompt):
- commandOutputManager (default=new CommandOutputManager):
|
[
"View",
"is",
"responsible",
"for",
"generating",
"the",
"web",
"UI",
"for",
"GCLI",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/display.js#L78-L160
|
14,207
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/display.js
|
find
|
function find(doc, element, id) {
if (!element) {
element = doc.getElementById(id);
if (!element) {
throw new Error('Missing element, id=' + id);
}
}
return element;
}
|
javascript
|
function find(doc, element, id) {
if (!element) {
element = doc.getElementById(id);
if (!element) {
throw new Error('Missing element, id=' + id);
}
}
return element;
}
|
[
"function",
"find",
"(",
"doc",
",",
"element",
",",
"id",
")",
"{",
"if",
"(",
"!",
"element",
")",
"{",
"element",
"=",
"doc",
".",
"getElementById",
"(",
"id",
")",
";",
"if",
"(",
"!",
"element",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Missing element, id='",
"+",
"id",
")",
";",
"}",
"}",
"return",
"element",
";",
"}"
] |
Utility to help find an element by id, throwing if it wasn't found
|
[
"Utility",
"to",
"help",
"find",
"an",
"element",
"by",
"id",
"throwing",
"if",
"it",
"wasn",
"t",
"found"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/display.js#L204-L212
|
14,208
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/display.js
|
insert
|
function insert(sibling, element, id) {
var doc = sibling.ownerDocument;
if (!element) {
element = doc.getElementById('gcli-row-complete');
if (!element) {
element = util.createElement(doc, 'div');
sibling.parentNode.insertBefore(element, sibling.nextSibling);
element.gcliCreated = true;
}
}
return element;
}
|
javascript
|
function insert(sibling, element, id) {
var doc = sibling.ownerDocument;
if (!element) {
element = doc.getElementById('gcli-row-complete');
if (!element) {
element = util.createElement(doc, 'div');
sibling.parentNode.insertBefore(element, sibling.nextSibling);
element.gcliCreated = true;
}
}
return element;
}
|
[
"function",
"insert",
"(",
"sibling",
",",
"element",
",",
"id",
")",
"{",
"var",
"doc",
"=",
"sibling",
".",
"ownerDocument",
";",
"if",
"(",
"!",
"element",
")",
"{",
"element",
"=",
"doc",
".",
"getElementById",
"(",
"'gcli-row-complete'",
")",
";",
"if",
"(",
"!",
"element",
")",
"{",
"element",
"=",
"util",
".",
"createElement",
"(",
"doc",
",",
"'div'",
")",
";",
"sibling",
".",
"parentNode",
".",
"insertBefore",
"(",
"element",
",",
"sibling",
".",
"nextSibling",
")",
";",
"element",
".",
"gcliCreated",
"=",
"true",
";",
"}",
"}",
"return",
"element",
";",
"}"
] |
Utility to help find an element by id, creating it if it wasn't found
|
[
"Utility",
"to",
"help",
"find",
"an",
"element",
"by",
"id",
"creating",
"it",
"if",
"it",
"wasn",
"t",
"found"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/display.js#L217-L228
|
14,209
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-analyzer.js
|
function(node) {
this.currentNode = node;
// Updates the code path due to node's position in its parent node.
if (node.parent) {
preprocess(this, node);
}
// Updates the code path.
// And emits onCodePathStart/onCodePathSegmentStart events.
processCodePathToEnter(this, node);
// Emits node events.
this.original.enterNode(node);
this.currentNode = null;
}
|
javascript
|
function(node) {
this.currentNode = node;
// Updates the code path due to node's position in its parent node.
if (node.parent) {
preprocess(this, node);
}
// Updates the code path.
// And emits onCodePathStart/onCodePathSegmentStart events.
processCodePathToEnter(this, node);
// Emits node events.
this.original.enterNode(node);
this.currentNode = null;
}
|
[
"function",
"(",
"node",
")",
"{",
"this",
".",
"currentNode",
"=",
"node",
";",
"// Updates the code path due to node's position in its parent node.",
"if",
"(",
"node",
".",
"parent",
")",
"{",
"preprocess",
"(",
"this",
",",
"node",
")",
";",
"}",
"// Updates the code path.",
"// And emits onCodePathStart/onCodePathSegmentStart events.",
"processCodePathToEnter",
"(",
"this",
",",
"node",
")",
";",
"// Emits node events.",
"this",
".",
"original",
".",
"enterNode",
"(",
"node",
")",
";",
"this",
".",
"currentNode",
"=",
"null",
";",
"}"
] |
Does the process to enter a given AST node.
This updates state of analysis and calls `enterNode` of the wrapped.
@param {ASTNode} node - A node which is entering.
@returns {void}
|
[
"Does",
"the",
"process",
"to",
"enter",
"a",
"given",
"AST",
"node",
".",
"This",
"updates",
"state",
"of",
"analysis",
"and",
"calls",
"enterNode",
"of",
"the",
"wrapped",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-analyzer.js#L570-L586
|
|
14,210
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-analyzer.js
|
function(node) {
this.currentNode = node;// Updates the code path.
// And emits onCodePathStart/onCodePathSegmentStart events.
processCodePathToExit(this, node);
// Emits node events.
this.original.leaveNode(node);
// Emits the last onCodePathStart/onCodePathSegmentStart events.
postprocess(this, node);
this.currentNode = null;
}
|
javascript
|
function(node) {
this.currentNode = node;// Updates the code path.
// And emits onCodePathStart/onCodePathSegmentStart events.
processCodePathToExit(this, node);
// Emits node events.
this.original.leaveNode(node);
// Emits the last onCodePathStart/onCodePathSegmentStart events.
postprocess(this, node);
this.currentNode = null;
}
|
[
"function",
"(",
"node",
")",
"{",
"this",
".",
"currentNode",
"=",
"node",
";",
"// Updates the code path.",
"// And emits onCodePathStart/onCodePathSegmentStart events.",
"processCodePathToExit",
"(",
"this",
",",
"node",
")",
";",
"// Emits node events.",
"this",
".",
"original",
".",
"leaveNode",
"(",
"node",
")",
";",
"// Emits the last onCodePathStart/onCodePathSegmentStart events.",
"postprocess",
"(",
"this",
",",
"node",
")",
";",
"this",
".",
"currentNode",
"=",
"null",
";",
"}"
] |
Does the process to leave a given AST node.
This updates state of analysis and calls `leaveNode` of the wrapped.
@param {ASTNode} node - A node which is leaving.
@returns {void}
|
[
"Does",
"the",
"process",
"to",
"leave",
"a",
"given",
"AST",
"node",
".",
"This",
"updates",
"state",
"of",
"analysis",
"and",
"calls",
"leaveNode",
"of",
"the",
"wrapped",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-analyzer.js#L595-L607
|
|
14,211
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-analyzer.js
|
function(fromSegment, toSegment) {
if (fromSegment.reachable && toSegment.reachable) {
this.emitter.emit(
"onCodePathSegmentLoop",
fromSegment,
toSegment,
this.currentNode
);
}
}
|
javascript
|
function(fromSegment, toSegment) {
if (fromSegment.reachable && toSegment.reachable) {
this.emitter.emit(
"onCodePathSegmentLoop",
fromSegment,
toSegment,
this.currentNode
);
}
}
|
[
"function",
"(",
"fromSegment",
",",
"toSegment",
")",
"{",
"if",
"(",
"fromSegment",
".",
"reachable",
"&&",
"toSegment",
".",
"reachable",
")",
"{",
"this",
".",
"emitter",
".",
"emit",
"(",
"\"onCodePathSegmentLoop\"",
",",
"fromSegment",
",",
"toSegment",
",",
"this",
".",
"currentNode",
")",
";",
"}",
"}"
] |
This is called on a code path looped.
Then this raises a looped event.
@param {CodePathSegment} fromSegment - A segment of prev.
@param {CodePathSegment} toSegment - A segment of next.
@returns {void}
|
[
"This",
"is",
"called",
"on",
"a",
"code",
"path",
"looped",
".",
"Then",
"this",
"raises",
"a",
"looped",
"event",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path-analyzer.js#L616-L625
|
|
14,212
|
eclipse/orion.client
|
modules/orionode/lib/user.js
|
isAdmin
|
function isAdmin(options, username) {
return (options.configParams.get("orion.auth.user.creation") || "").split(",").some(function(user) {
return user === username;
});
}
|
javascript
|
function isAdmin(options, username) {
return (options.configParams.get("orion.auth.user.creation") || "").split(",").some(function(user) {
return user === username;
});
}
|
[
"function",
"isAdmin",
"(",
"options",
",",
"username",
")",
"{",
"return",
"(",
"options",
".",
"configParams",
".",
"get",
"(",
"\"orion.auth.user.creation\"",
")",
"||",
"\"\"",
")",
".",
"split",
"(",
"\",\"",
")",
".",
"some",
"(",
"function",
"(",
"user",
")",
"{",
"return",
"user",
"===",
"username",
";",
"}",
")",
";",
"}"
] |
Checks if the 'admin' user has been enabled in the server configuration
@param {?} options The map of server options
@see https://wiki.eclipse.org/Orion/Server_admin_guide#Allowing_users_to_create_accounts
@since 18.0
|
[
"Checks",
"if",
"the",
"admin",
"user",
"has",
"been",
"enabled",
"in",
"the",
"server",
"configuration"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/user.js#L59-L63
|
14,213
|
eclipse/orion.client
|
modules/orionode/lib/user.js
|
userJSON
|
function userJSON(user, options) {
return {
FullName: user.fullname,
UserName: user.username,
Location: api.join(options.usersRoot, user.username),
Email: user.email,
EmailConfirmed: emailConfirmed(user),
HasPassword: true,
OAuth: user.oauth || undefined,
LastLoginTimestamp: user.login_timestamp ? user.login_timestamp.getTime() : 0,
DiskUsageTimestamp: user.disk_usage_timestamp ? user.disk_usage_timestamp.getTime() : 0,
DiskUsage: user.disk_usage || 0 ,
jwt: user.jwt
};
}
|
javascript
|
function userJSON(user, options) {
return {
FullName: user.fullname,
UserName: user.username,
Location: api.join(options.usersRoot, user.username),
Email: user.email,
EmailConfirmed: emailConfirmed(user),
HasPassword: true,
OAuth: user.oauth || undefined,
LastLoginTimestamp: user.login_timestamp ? user.login_timestamp.getTime() : 0,
DiskUsageTimestamp: user.disk_usage_timestamp ? user.disk_usage_timestamp.getTime() : 0,
DiskUsage: user.disk_usage || 0 ,
jwt: user.jwt
};
}
|
[
"function",
"userJSON",
"(",
"user",
",",
"options",
")",
"{",
"return",
"{",
"FullName",
":",
"user",
".",
"fullname",
",",
"UserName",
":",
"user",
".",
"username",
",",
"Location",
":",
"api",
".",
"join",
"(",
"options",
".",
"usersRoot",
",",
"user",
".",
"username",
")",
",",
"Email",
":",
"user",
".",
"email",
",",
"EmailConfirmed",
":",
"emailConfirmed",
"(",
"user",
")",
",",
"HasPassword",
":",
"true",
",",
"OAuth",
":",
"user",
".",
"oauth",
"||",
"undefined",
",",
"LastLoginTimestamp",
":",
"user",
".",
"login_timestamp",
"?",
"user",
".",
"login_timestamp",
".",
"getTime",
"(",
")",
":",
"0",
",",
"DiskUsageTimestamp",
":",
"user",
".",
"disk_usage_timestamp",
"?",
"user",
".",
"disk_usage_timestamp",
".",
"getTime",
"(",
")",
":",
"0",
",",
"DiskUsage",
":",
"user",
".",
"disk_usage",
"||",
"0",
",",
"jwt",
":",
"user",
".",
"jwt",
"}",
";",
"}"
] |
Write out the JSON for the given user metadata
@param {{?}} user The user to write JSON for
@param {{?}} options The map of server options
@returns {?} A new JSON object for the user
|
[
"Write",
"out",
"the",
"JSON",
"for",
"the",
"given",
"user",
"metadata"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/user.js#L71-L85
|
14,214
|
eclipse/orion.client
|
modules/orionode/lib/user.js
|
oauth
|
function oauth(id, username, email, req, done) {
if (req.params["0"] === "/link") {
return done(null, {
__linkUser: true,
email: email,
username: username,
id: id
});
}
fileUtil.getMetastoreSafe(req).then(function(store) {
store.getUserByOAuth(id, function(err, user) {
if (err) {
return done(err);
}
if (!user) {
return done(null, {
__newUser: true,
email: email,
username: username,
id: id
});
}
done(null, user);
}, function noMetastore(err) {
done(err);
});
});
}
|
javascript
|
function oauth(id, username, email, req, done) {
if (req.params["0"] === "/link") {
return done(null, {
__linkUser: true,
email: email,
username: username,
id: id
});
}
fileUtil.getMetastoreSafe(req).then(function(store) {
store.getUserByOAuth(id, function(err, user) {
if (err) {
return done(err);
}
if (!user) {
return done(null, {
__newUser: true,
email: email,
username: username,
id: id
});
}
done(null, user);
}, function noMetastore(err) {
done(err);
});
});
}
|
[
"function",
"oauth",
"(",
"id",
",",
"username",
",",
"email",
",",
"req",
",",
"done",
")",
"{",
"if",
"(",
"req",
".",
"params",
"[",
"\"0\"",
"]",
"===",
"\"/link\"",
")",
"{",
"return",
"done",
"(",
"null",
",",
"{",
"__linkUser",
":",
"true",
",",
"email",
":",
"email",
",",
"username",
":",
"username",
",",
"id",
":",
"id",
"}",
")",
";",
"}",
"fileUtil",
".",
"getMetastoreSafe",
"(",
"req",
")",
".",
"then",
"(",
"function",
"(",
"store",
")",
"{",
"store",
".",
"getUserByOAuth",
"(",
"id",
",",
"function",
"(",
"err",
",",
"user",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"done",
"(",
"err",
")",
";",
"}",
"if",
"(",
"!",
"user",
")",
"{",
"return",
"done",
"(",
"null",
",",
"{",
"__newUser",
":",
"true",
",",
"email",
":",
"email",
",",
"username",
":",
"username",
",",
"id",
":",
"id",
"}",
")",
";",
"}",
"done",
"(",
"null",
",",
"user",
")",
";",
"}",
",",
"function",
"noMetastore",
"(",
"err",
")",
"{",
"done",
"(",
"err",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}"
] |
Do OAuth authentication
@param {string} id
@param {string} username
@param {string} email
@param {XMLHttpRequest} req
@param {fn(Error, {?})} done
|
[
"Do",
"OAuth",
"authentication"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/user.js#L183-L210
|
14,215
|
eclipse/orion.client
|
modules/orionode/lib/user.js
|
configureGithubOAuth
|
function configureGithubOAuth(app, options) {
if (options.configParams.get("orion.oauth.github.client")) {
const GithubStrategy = require('passport-github2').Strategy;
passport.use(new GithubStrategy({
clientID: options.configParams.get("orion.oauth.github.client"),
clientSecret: options.configParams.get("orion.oauth.github.secret"),
passReqToCallback: true,
callbackURL: (options.configParams.get("orion.auth.host") || "") + "/auth/github/callback",
scope: "user:email"
}, /* @callback */ function(req, accessToken, refreshToken, profile, done) {
const email = profile.emails[0].value;
oauth(profile.provider + "/" + profile.id, profile.username, email, req, done);
}));
app.get('/login/oauth/github', options.basicMiddleware, passport.authenticate('github'));
app.get('/mixlogin/manageoauth/oauth/github', options.basicMiddleware, passport.authenticate('github', {callbackURL: (options.configParams.get("orion.auth.host") || "") + "/auth/github/callback/link"}));
app.get('/auth/github/callback*', options.basicMiddleware, function(req, res) {
return passport.authenticate('github', {callbackURL: (options.configParams.get("orion.auth.host") || "") + "/auth/github/callback" + (req.params["0"] || "")}, /* @callback */ function(err, user, info){
createNewUser(req,res,err,user, options);
})(req,res);
});
}
}
|
javascript
|
function configureGithubOAuth(app, options) {
if (options.configParams.get("orion.oauth.github.client")) {
const GithubStrategy = require('passport-github2').Strategy;
passport.use(new GithubStrategy({
clientID: options.configParams.get("orion.oauth.github.client"),
clientSecret: options.configParams.get("orion.oauth.github.secret"),
passReqToCallback: true,
callbackURL: (options.configParams.get("orion.auth.host") || "") + "/auth/github/callback",
scope: "user:email"
}, /* @callback */ function(req, accessToken, refreshToken, profile, done) {
const email = profile.emails[0].value;
oauth(profile.provider + "/" + profile.id, profile.username, email, req, done);
}));
app.get('/login/oauth/github', options.basicMiddleware, passport.authenticate('github'));
app.get('/mixlogin/manageoauth/oauth/github', options.basicMiddleware, passport.authenticate('github', {callbackURL: (options.configParams.get("orion.auth.host") || "") + "/auth/github/callback/link"}));
app.get('/auth/github/callback*', options.basicMiddleware, function(req, res) {
return passport.authenticate('github', {callbackURL: (options.configParams.get("orion.auth.host") || "") + "/auth/github/callback" + (req.params["0"] || "")}, /* @callback */ function(err, user, info){
createNewUser(req,res,err,user, options);
})(req,res);
});
}
}
|
[
"function",
"configureGithubOAuth",
"(",
"app",
",",
"options",
")",
"{",
"if",
"(",
"options",
".",
"configParams",
".",
"get",
"(",
"\"orion.oauth.github.client\"",
")",
")",
"{",
"const",
"GithubStrategy",
"=",
"require",
"(",
"'passport-github2'",
")",
".",
"Strategy",
";",
"passport",
".",
"use",
"(",
"new",
"GithubStrategy",
"(",
"{",
"clientID",
":",
"options",
".",
"configParams",
".",
"get",
"(",
"\"orion.oauth.github.client\"",
")",
",",
"clientSecret",
":",
"options",
".",
"configParams",
".",
"get",
"(",
"\"orion.oauth.github.secret\"",
")",
",",
"passReqToCallback",
":",
"true",
",",
"callbackURL",
":",
"(",
"options",
".",
"configParams",
".",
"get",
"(",
"\"orion.auth.host\"",
")",
"||",
"\"\"",
")",
"+",
"\"/auth/github/callback\"",
",",
"scope",
":",
"\"user:email\"",
"}",
",",
"/* @callback */",
"function",
"(",
"req",
",",
"accessToken",
",",
"refreshToken",
",",
"profile",
",",
"done",
")",
"{",
"const",
"email",
"=",
"profile",
".",
"emails",
"[",
"0",
"]",
".",
"value",
";",
"oauth",
"(",
"profile",
".",
"provider",
"+",
"\"/\"",
"+",
"profile",
".",
"id",
",",
"profile",
".",
"username",
",",
"email",
",",
"req",
",",
"done",
")",
";",
"}",
")",
")",
";",
"app",
".",
"get",
"(",
"'/login/oauth/github'",
",",
"options",
".",
"basicMiddleware",
",",
"passport",
".",
"authenticate",
"(",
"'github'",
")",
")",
";",
"app",
".",
"get",
"(",
"'/mixlogin/manageoauth/oauth/github'",
",",
"options",
".",
"basicMiddleware",
",",
"passport",
".",
"authenticate",
"(",
"'github'",
",",
"{",
"callbackURL",
":",
"(",
"options",
".",
"configParams",
".",
"get",
"(",
"\"orion.auth.host\"",
")",
"||",
"\"\"",
")",
"+",
"\"/auth/github/callback/link\"",
"}",
")",
")",
";",
"app",
".",
"get",
"(",
"'/auth/github/callback*'",
",",
"options",
".",
"basicMiddleware",
",",
"function",
"(",
"req",
",",
"res",
")",
"{",
"return",
"passport",
".",
"authenticate",
"(",
"'github'",
",",
"{",
"callbackURL",
":",
"(",
"options",
".",
"configParams",
".",
"get",
"(",
"\"orion.auth.host\"",
")",
"||",
"\"\"",
")",
"+",
"\"/auth/github/callback\"",
"+",
"(",
"req",
".",
"params",
"[",
"\"0\"",
"]",
"||",
"\"\"",
")",
"}",
",",
"/* @callback */",
"function",
"(",
"err",
",",
"user",
",",
"info",
")",
"{",
"createNewUser",
"(",
"req",
",",
"res",
",",
"err",
",",
"user",
",",
"options",
")",
";",
"}",
")",
"(",
"req",
",",
"res",
")",
";",
"}",
")",
";",
"}",
"}"
] |
Optionally configures GitHub OAuth. Checks for the server property 'orion.oauth.github.client', and if found optionally
sets up the support.
@param {express.Router} app The backing app
@param {{?}} options The map of server options
@see https://wiki.eclipse.org/Orion/Server_admin_guide#Setting_up_GitHub_OAuth_authentication
|
[
"Optionally",
"configures",
"GitHub",
"OAuth",
".",
"Checks",
"for",
"the",
"server",
"property",
"orion",
".",
"oauth",
".",
"github",
".",
"client",
"and",
"if",
"found",
"optionally",
"sets",
"up",
"the",
"support",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/user.js#L320-L341
|
14,216
|
eclipse/orion.client
|
modules/orionode/lib/user.js
|
checkUserAccess
|
function checkUserAccess(req, res, next) {
const isadmin = isAdmin(options, req.user.username);
if (!req.user || !(req.params.id === req.user.username || isadmin)) {
return api.writeResponse(403, res);
}
const contextPath = options.configParams.get("orion.context.path") || "",
listenContextPath = options.configParams.get("orion.context.listenPath") || false,
uri = url.parse(req.originalUrl.substring(listenContextPath ? contextPath.length : 0)).pathname;
if(isadmin) {
return next();
}
checkRights(req.user.username, uri, req, res, next);
}
|
javascript
|
function checkUserAccess(req, res, next) {
const isadmin = isAdmin(options, req.user.username);
if (!req.user || !(req.params.id === req.user.username || isadmin)) {
return api.writeResponse(403, res);
}
const contextPath = options.configParams.get("orion.context.path") || "",
listenContextPath = options.configParams.get("orion.context.listenPath") || false,
uri = url.parse(req.originalUrl.substring(listenContextPath ? contextPath.length : 0)).pathname;
if(isadmin) {
return next();
}
checkRights(req.user.username, uri, req, res, next);
}
|
[
"function",
"checkUserAccess",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"const",
"isadmin",
"=",
"isAdmin",
"(",
"options",
",",
"req",
".",
"user",
".",
"username",
")",
";",
"if",
"(",
"!",
"req",
".",
"user",
"||",
"!",
"(",
"req",
".",
"params",
".",
"id",
"===",
"req",
".",
"user",
".",
"username",
"||",
"isadmin",
")",
")",
"{",
"return",
"api",
".",
"writeResponse",
"(",
"403",
",",
"res",
")",
";",
"}",
"const",
"contextPath",
"=",
"options",
".",
"configParams",
".",
"get",
"(",
"\"orion.context.path\"",
")",
"||",
"\"\"",
",",
"listenContextPath",
"=",
"options",
".",
"configParams",
".",
"get",
"(",
"\"orion.context.listenPath\"",
")",
"||",
"false",
",",
"uri",
"=",
"url",
".",
"parse",
"(",
"req",
".",
"originalUrl",
".",
"substring",
"(",
"listenContextPath",
"?",
"contextPath",
".",
"length",
":",
"0",
")",
")",
".",
"pathname",
";",
"if",
"(",
"isadmin",
")",
"{",
"return",
"next",
"(",
")",
";",
"}",
"checkRights",
"(",
"req",
".",
"user",
".",
"username",
",",
"uri",
",",
"req",
",",
"res",
",",
"next",
")",
";",
"}"
] |
Checks is the logged in user has access to the requested resource
@param {XMLHttpRequest} req The backing request
@param {XMLHttpResponse} res The response object
@param {fn} next The next function to skip ahead
|
[
"Checks",
"is",
"the",
"logged",
"in",
"user",
"has",
"access",
"to",
"the",
"requested",
"resource"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/user.js#L382-L394
|
14,217
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/gcli/gcli/types.js
|
function() {
var combined = Status.VALID;
for (var i = 0; i < arguments.length; i++) {
var status = arguments[i];
if (Array.isArray(status)) {
status = Status.combine.apply(null, status);
}
if (status > combined) {
combined = status;
}
}
return combined;
}
|
javascript
|
function() {
var combined = Status.VALID;
for (var i = 0; i < arguments.length; i++) {
var status = arguments[i];
if (Array.isArray(status)) {
status = Status.combine.apply(null, status);
}
if (status > combined) {
combined = status;
}
}
return combined;
}
|
[
"function",
"(",
")",
"{",
"var",
"combined",
"=",
"Status",
".",
"VALID",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"arguments",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"status",
"=",
"arguments",
"[",
"i",
"]",
";",
"if",
"(",
"Array",
".",
"isArray",
"(",
"status",
")",
")",
"{",
"status",
"=",
"Status",
".",
"combine",
".",
"apply",
"(",
"null",
",",
"status",
")",
";",
"}",
"if",
"(",
"status",
">",
"combined",
")",
"{",
"combined",
"=",
"status",
";",
"}",
"}",
"return",
"combined",
";",
"}"
] |
A combined status is the worser of the provided statuses. The statuses
can be provided either as a set of arguments or a single array
|
[
"A",
"combined",
"status",
"is",
"the",
"worser",
"of",
"the",
"provided",
"statuses",
".",
"The",
"statuses",
"can",
"be",
"provided",
"either",
"as",
"a",
"set",
"of",
"arguments",
"or",
"a",
"single",
"array"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/types.js#L68-L80
|
|
14,218
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path.js
|
function(options, callback) {
if (typeof options === "function") {
callback = options;
options = null;
}
options = options || {};
var startSegment = options.first || this.internal.initialSegment;
var lastSegment = options.last;
var item = null;
var index = 0;
var end = 0;
var segment = null;
var visited = Object.create(null);
var stack = [
[startSegment, 0]
];
var skippedSegment = null;
var broken = false;
var controller = {
skip: function() {
if (stack.length <= 1) {
broken = true;
} else {
skippedSegment = stack[stack.length - 2][0];
}
},
break: function() {
broken = true;
}
};
/**
* Checks a given previous segment has been visited.
* @param {CodePathSegment} prevSegment - A previous segment to check.
* @returns {boolean} `true` if the segment has been visited.
*/
function isVisited(prevSegment) {
return visited[prevSegment.id] ||
segment.isLoopedPrevSegment(prevSegment);
}
while (stack.length > 0) {
item = stack[stack.length - 1];
segment = item[0];
index = item[1];
if (index === 0) {
// Skip if this segment has been visited already.
if (visited[segment.id]) {
stack.pop();
continue;
}
// Skip if all previous segments have not been visited.
if (segment !== startSegment &&
segment.prevSegments.length > 0 &&
!segment.prevSegments.every(isVisited)
) {
stack.pop();
continue;
}
// Reset the flag of skipping if all branches have been skipped.
if (skippedSegment && segment.prevSegments.indexOf(skippedSegment) !== -1) {
skippedSegment = null;
}
visited[segment.id] = true;
// Call the callback when the first time.
if (!skippedSegment) {
callback.call(this, segment, controller); // eslint-disable-line callback-return
if (segment === lastSegment) {
controller.skip();
}
if (broken) {
break;
}
}
}
// Update the stack.
end = segment.nextSegments.length - 1;
if (index < end) {
item[1] += 1;
stack.push([segment.nextSegments[index], 0]);
} else if (index === end) {
item[0] = segment.nextSegments[index];
item[1] = 0;
} else {
stack.pop();
}
}
}
|
javascript
|
function(options, callback) {
if (typeof options === "function") {
callback = options;
options = null;
}
options = options || {};
var startSegment = options.first || this.internal.initialSegment;
var lastSegment = options.last;
var item = null;
var index = 0;
var end = 0;
var segment = null;
var visited = Object.create(null);
var stack = [
[startSegment, 0]
];
var skippedSegment = null;
var broken = false;
var controller = {
skip: function() {
if (stack.length <= 1) {
broken = true;
} else {
skippedSegment = stack[stack.length - 2][0];
}
},
break: function() {
broken = true;
}
};
/**
* Checks a given previous segment has been visited.
* @param {CodePathSegment} prevSegment - A previous segment to check.
* @returns {boolean} `true` if the segment has been visited.
*/
function isVisited(prevSegment) {
return visited[prevSegment.id] ||
segment.isLoopedPrevSegment(prevSegment);
}
while (stack.length > 0) {
item = stack[stack.length - 1];
segment = item[0];
index = item[1];
if (index === 0) {
// Skip if this segment has been visited already.
if (visited[segment.id]) {
stack.pop();
continue;
}
// Skip if all previous segments have not been visited.
if (segment !== startSegment &&
segment.prevSegments.length > 0 &&
!segment.prevSegments.every(isVisited)
) {
stack.pop();
continue;
}
// Reset the flag of skipping if all branches have been skipped.
if (skippedSegment && segment.prevSegments.indexOf(skippedSegment) !== -1) {
skippedSegment = null;
}
visited[segment.id] = true;
// Call the callback when the first time.
if (!skippedSegment) {
callback.call(this, segment, controller); // eslint-disable-line callback-return
if (segment === lastSegment) {
controller.skip();
}
if (broken) {
break;
}
}
}
// Update the stack.
end = segment.nextSegments.length - 1;
if (index < end) {
item[1] += 1;
stack.push([segment.nextSegments[index], 0]);
} else if (index === end) {
item[0] = segment.nextSegments[index];
item[1] = 0;
} else {
stack.pop();
}
}
}
|
[
"function",
"(",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"\"function\"",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"null",
";",
"}",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"var",
"startSegment",
"=",
"options",
".",
"first",
"||",
"this",
".",
"internal",
".",
"initialSegment",
";",
"var",
"lastSegment",
"=",
"options",
".",
"last",
";",
"var",
"item",
"=",
"null",
";",
"var",
"index",
"=",
"0",
";",
"var",
"end",
"=",
"0",
";",
"var",
"segment",
"=",
"null",
";",
"var",
"visited",
"=",
"Object",
".",
"create",
"(",
"null",
")",
";",
"var",
"stack",
"=",
"[",
"[",
"startSegment",
",",
"0",
"]",
"]",
";",
"var",
"skippedSegment",
"=",
"null",
";",
"var",
"broken",
"=",
"false",
";",
"var",
"controller",
"=",
"{",
"skip",
":",
"function",
"(",
")",
"{",
"if",
"(",
"stack",
".",
"length",
"<=",
"1",
")",
"{",
"broken",
"=",
"true",
";",
"}",
"else",
"{",
"skippedSegment",
"=",
"stack",
"[",
"stack",
".",
"length",
"-",
"2",
"]",
"[",
"0",
"]",
";",
"}",
"}",
",",
"break",
":",
"function",
"(",
")",
"{",
"broken",
"=",
"true",
";",
"}",
"}",
";",
"/**\r\n\t\t\t * Checks a given previous segment has been visited.\r\n\t\t\t * @param {CodePathSegment} prevSegment - A previous segment to check.\r\n\t\t\t * @returns {boolean} `true` if the segment has been visited.\r\n\t\t\t */",
"function",
"isVisited",
"(",
"prevSegment",
")",
"{",
"return",
"visited",
"[",
"prevSegment",
".",
"id",
"]",
"||",
"segment",
".",
"isLoopedPrevSegment",
"(",
"prevSegment",
")",
";",
"}",
"while",
"(",
"stack",
".",
"length",
">",
"0",
")",
"{",
"item",
"=",
"stack",
"[",
"stack",
".",
"length",
"-",
"1",
"]",
";",
"segment",
"=",
"item",
"[",
"0",
"]",
";",
"index",
"=",
"item",
"[",
"1",
"]",
";",
"if",
"(",
"index",
"===",
"0",
")",
"{",
"// Skip if this segment has been visited already.",
"if",
"(",
"visited",
"[",
"segment",
".",
"id",
"]",
")",
"{",
"stack",
".",
"pop",
"(",
")",
";",
"continue",
";",
"}",
"// Skip if all previous segments have not been visited.",
"if",
"(",
"segment",
"!==",
"startSegment",
"&&",
"segment",
".",
"prevSegments",
".",
"length",
">",
"0",
"&&",
"!",
"segment",
".",
"prevSegments",
".",
"every",
"(",
"isVisited",
")",
")",
"{",
"stack",
".",
"pop",
"(",
")",
";",
"continue",
";",
"}",
"// Reset the flag of skipping if all branches have been skipped.",
"if",
"(",
"skippedSegment",
"&&",
"segment",
".",
"prevSegments",
".",
"indexOf",
"(",
"skippedSegment",
")",
"!==",
"-",
"1",
")",
"{",
"skippedSegment",
"=",
"null",
";",
"}",
"visited",
"[",
"segment",
".",
"id",
"]",
"=",
"true",
";",
"// Call the callback when the first time.",
"if",
"(",
"!",
"skippedSegment",
")",
"{",
"callback",
".",
"call",
"(",
"this",
",",
"segment",
",",
"controller",
")",
";",
"// eslint-disable-line callback-return",
"if",
"(",
"segment",
"===",
"lastSegment",
")",
"{",
"controller",
".",
"skip",
"(",
")",
";",
"}",
"if",
"(",
"broken",
")",
"{",
"break",
";",
"}",
"}",
"}",
"// Update the stack.",
"end",
"=",
"segment",
".",
"nextSegments",
".",
"length",
"-",
"1",
";",
"if",
"(",
"index",
"<",
"end",
")",
"{",
"item",
"[",
"1",
"]",
"+=",
"1",
";",
"stack",
".",
"push",
"(",
"[",
"segment",
".",
"nextSegments",
"[",
"index",
"]",
",",
"0",
"]",
")",
";",
"}",
"else",
"if",
"(",
"index",
"===",
"end",
")",
"{",
"item",
"[",
"0",
"]",
"=",
"segment",
".",
"nextSegments",
"[",
"index",
"]",
";",
"item",
"[",
"1",
"]",
"=",
"0",
";",
"}",
"else",
"{",
"stack",
".",
"pop",
"(",
")",
";",
"}",
"}",
"}"
] |
Traverses all segments in this code path.
codePath.traverseSegments(function(segment, controller) {
// do something.
});
This method enumerates segments in order from the head.
The `controller` object has two methods.
- `controller.skip()` - Skip the following segments in this branch.
- `controller.break()` - Skip all following segments.
@param {object} [options] - Omittable.
@param {CodePathSegment} [options.first] - The first segment to traverse.
@param {CodePathSegment} [options.last] - The last segment to traverse.
@param {function} callback - A callback function.
@returns {void}
|
[
"Traverses",
"all",
"segments",
"in",
"this",
"code",
"path",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/code-path-analysis/code-path.js#L125-L220
|
|
14,219
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/selection.js
|
function(onDone) {
var result = Array.isArray(this._selections) ? this._selections.slice() : [];
if (typeof onDone === "function") { //$NON-NLS-0$
onDone(result);
}
return result;
}
|
javascript
|
function(onDone) {
var result = Array.isArray(this._selections) ? this._selections.slice() : [];
if (typeof onDone === "function") { //$NON-NLS-0$
onDone(result);
}
return result;
}
|
[
"function",
"(",
"onDone",
")",
"{",
"var",
"result",
"=",
"Array",
".",
"isArray",
"(",
"this",
".",
"_selections",
")",
"?",
"this",
".",
"_selections",
".",
"slice",
"(",
")",
":",
"[",
"]",
";",
"if",
"(",
"typeof",
"onDone",
"===",
"\"function\"",
")",
"{",
"//$NON-NLS-0$",
"onDone",
"(",
"result",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Obtains all current selections and passes them to the provided function.
@param {Function} onDone The function to invoke with the selections. Deprecated: just use the return value instead.
@returns {Array}
|
[
"Obtains",
"all",
"current",
"selections",
"and",
"passes",
"them",
"to",
"the",
"provided",
"function",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/selection.js#L54-L60
|
|
14,220
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/htmlparser2/parser.js
|
inherits
|
function inherits(ctor, sctor) {
ctor.prototype = Object.create(sctor.prototype);
ctor._super = sctor;
}
|
javascript
|
function inherits(ctor, sctor) {
ctor.prototype = Object.create(sctor.prototype);
ctor._super = sctor;
}
|
[
"function",
"inherits",
"(",
"ctor",
",",
"sctor",
")",
"{",
"ctor",
".",
"prototype",
"=",
"Object",
".",
"create",
"(",
"sctor",
".",
"prototype",
")",
";",
"ctor",
".",
"_super",
"=",
"sctor",
";",
"}"
] |
ORION
shim for node.js util.inherits
|
[
"ORION",
"shim",
"for",
"node",
".",
"js",
"util",
".",
"inherits"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/htmlparser2/parser.js#L175-L178
|
14,221
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.editor/web/orion/editor/eventTarget.js
|
function(type, listener, useCapture) {
if (!this._eventTypes) { this._eventTypes = {}; }
var state = this._eventTypes[type];
if (!state) {
state = this._eventTypes[type] = {level: 0, listeners: []};
}
var listeners = state.listeners;
listeners.push({listener: listener, useCapture: useCapture});
}
|
javascript
|
function(type, listener, useCapture) {
if (!this._eventTypes) { this._eventTypes = {}; }
var state = this._eventTypes[type];
if (!state) {
state = this._eventTypes[type] = {level: 0, listeners: []};
}
var listeners = state.listeners;
listeners.push({listener: listener, useCapture: useCapture});
}
|
[
"function",
"(",
"type",
",",
"listener",
",",
"useCapture",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_eventTypes",
")",
"{",
"this",
".",
"_eventTypes",
"=",
"{",
"}",
";",
"}",
"var",
"state",
"=",
"this",
".",
"_eventTypes",
"[",
"type",
"]",
";",
"if",
"(",
"!",
"state",
")",
"{",
"state",
"=",
"this",
".",
"_eventTypes",
"[",
"type",
"]",
"=",
"{",
"level",
":",
"0",
",",
"listeners",
":",
"[",
"]",
"}",
";",
"}",
"var",
"listeners",
"=",
"state",
".",
"listeners",
";",
"listeners",
".",
"push",
"(",
"{",
"listener",
":",
"listener",
",",
"useCapture",
":",
"useCapture",
"}",
")",
";",
"}"
] |
Adds an event listener to this event target.
@param {String} type The event type.
@param {Function|EventListener} listener The function or the EventListener that will be executed when the event happens.
@param {Boolean} [useCapture=false] <code>true</code> if the listener should be trigged in the capture phase.
@see orion.editor.EventTarget#removeEventListener
|
[
"Adds",
"an",
"event",
"listener",
"to",
"this",
"event",
"target",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.editor/web/orion/editor/eventTarget.js#L46-L54
|
|
14,222
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/dropdown.js
|
function(mouseEvent /* optional */) {
var actionTaken = false;
if (!this.isVisible()) {
this.dispatchEvent({type: "triggered", dropdown: this, event: mouseEvent}); //$NON-NLS-0$
if (this._populate) {
this.empty();
this._populate(this._dropdownNode);
}
var items = this.getItems();
if (items.length > 0) {
lib.setFramesEnabled(false);
if (this._boundAutoDismiss) {
lib.removeAutoDismiss(this._boundAutoDismiss);
}
this._boundAutoDismiss = this._autoDismiss.bind(this);
this._triggerNode.classList.add("dropdownTriggerOpen"); //$NON-NLS-0$
this._triggerNode.setAttribute("aria-expanded", "true"); //$NON-NLS-1$ //$NON-NLS-0$
if (this._selectionClass) {
this._triggerNode.classList.add(this._selectionClass);
}
this._dropdownNode.classList.add("dropdownMenuOpen"); //$NON-NLS-0$
this._isVisible = true;
if (this._dropdownNode.scrollHeight > this._dropdownNode.offsetHeight) {
this._buttonsAdded = addScrollButtons.call(this);
}
// add auto dismiss. Clicking anywhere but trigger or a submenu item means close.
var submenuNodes = lib.$$array(".dropdownSubMenu", this._dropdownNode); //$NON-NLS-0$
var list = [this._triggerNode].concat(submenuNodes);
if (this._buttonsAdded) {
list.push(this._topScrollButton);
list.push(this._bottomScrollButton);
}
lib.addAutoDismiss(list, this._boundAutoDismiss);
this._positionDropdown(mouseEvent);
if (this._buttonsAdded) {
positionScrollButtons.call(this);
}
this._focusDropdownNode();
actionTaken = true;
if (this._parentDropdown) {
this._parentDropdown.submenuOpen(this);
}
if (this._trapTabs) {
lib.trapTabs(this._dropdownNode);
}
}
}
return actionTaken;
}
|
javascript
|
function(mouseEvent /* optional */) {
var actionTaken = false;
if (!this.isVisible()) {
this.dispatchEvent({type: "triggered", dropdown: this, event: mouseEvent}); //$NON-NLS-0$
if (this._populate) {
this.empty();
this._populate(this._dropdownNode);
}
var items = this.getItems();
if (items.length > 0) {
lib.setFramesEnabled(false);
if (this._boundAutoDismiss) {
lib.removeAutoDismiss(this._boundAutoDismiss);
}
this._boundAutoDismiss = this._autoDismiss.bind(this);
this._triggerNode.classList.add("dropdownTriggerOpen"); //$NON-NLS-0$
this._triggerNode.setAttribute("aria-expanded", "true"); //$NON-NLS-1$ //$NON-NLS-0$
if (this._selectionClass) {
this._triggerNode.classList.add(this._selectionClass);
}
this._dropdownNode.classList.add("dropdownMenuOpen"); //$NON-NLS-0$
this._isVisible = true;
if (this._dropdownNode.scrollHeight > this._dropdownNode.offsetHeight) {
this._buttonsAdded = addScrollButtons.call(this);
}
// add auto dismiss. Clicking anywhere but trigger or a submenu item means close.
var submenuNodes = lib.$$array(".dropdownSubMenu", this._dropdownNode); //$NON-NLS-0$
var list = [this._triggerNode].concat(submenuNodes);
if (this._buttonsAdded) {
list.push(this._topScrollButton);
list.push(this._bottomScrollButton);
}
lib.addAutoDismiss(list, this._boundAutoDismiss);
this._positionDropdown(mouseEvent);
if (this._buttonsAdded) {
positionScrollButtons.call(this);
}
this._focusDropdownNode();
actionTaken = true;
if (this._parentDropdown) {
this._parentDropdown.submenuOpen(this);
}
if (this._trapTabs) {
lib.trapTabs(this._dropdownNode);
}
}
}
return actionTaken;
}
|
[
"function",
"(",
"mouseEvent",
"/* optional */",
")",
"{",
"var",
"actionTaken",
"=",
"false",
";",
"if",
"(",
"!",
"this",
".",
"isVisible",
"(",
")",
")",
"{",
"this",
".",
"dispatchEvent",
"(",
"{",
"type",
":",
"\"triggered\"",
",",
"dropdown",
":",
"this",
",",
"event",
":",
"mouseEvent",
"}",
")",
";",
"//$NON-NLS-0$",
"if",
"(",
"this",
".",
"_populate",
")",
"{",
"this",
".",
"empty",
"(",
")",
";",
"this",
".",
"_populate",
"(",
"this",
".",
"_dropdownNode",
")",
";",
"}",
"var",
"items",
"=",
"this",
".",
"getItems",
"(",
")",
";",
"if",
"(",
"items",
".",
"length",
">",
"0",
")",
"{",
"lib",
".",
"setFramesEnabled",
"(",
"false",
")",
";",
"if",
"(",
"this",
".",
"_boundAutoDismiss",
")",
"{",
"lib",
".",
"removeAutoDismiss",
"(",
"this",
".",
"_boundAutoDismiss",
")",
";",
"}",
"this",
".",
"_boundAutoDismiss",
"=",
"this",
".",
"_autoDismiss",
".",
"bind",
"(",
"this",
")",
";",
"this",
".",
"_triggerNode",
".",
"classList",
".",
"add",
"(",
"\"dropdownTriggerOpen\"",
")",
";",
"//$NON-NLS-0$",
"this",
".",
"_triggerNode",
".",
"setAttribute",
"(",
"\"aria-expanded\"",
",",
"\"true\"",
")",
";",
"//$NON-NLS-1$ //$NON-NLS-0$",
"if",
"(",
"this",
".",
"_selectionClass",
")",
"{",
"this",
".",
"_triggerNode",
".",
"classList",
".",
"add",
"(",
"this",
".",
"_selectionClass",
")",
";",
"}",
"this",
".",
"_dropdownNode",
".",
"classList",
".",
"add",
"(",
"\"dropdownMenuOpen\"",
")",
";",
"//$NON-NLS-0$",
"this",
".",
"_isVisible",
"=",
"true",
";",
"if",
"(",
"this",
".",
"_dropdownNode",
".",
"scrollHeight",
">",
"this",
".",
"_dropdownNode",
".",
"offsetHeight",
")",
"{",
"this",
".",
"_buttonsAdded",
"=",
"addScrollButtons",
".",
"call",
"(",
"this",
")",
";",
"}",
"// add auto dismiss. Clicking anywhere but trigger or a submenu item means close.",
"var",
"submenuNodes",
"=",
"lib",
".",
"$$array",
"(",
"\".dropdownSubMenu\"",
",",
"this",
".",
"_dropdownNode",
")",
";",
"//$NON-NLS-0$",
"var",
"list",
"=",
"[",
"this",
".",
"_triggerNode",
"]",
".",
"concat",
"(",
"submenuNodes",
")",
";",
"if",
"(",
"this",
".",
"_buttonsAdded",
")",
"{",
"list",
".",
"push",
"(",
"this",
".",
"_topScrollButton",
")",
";",
"list",
".",
"push",
"(",
"this",
".",
"_bottomScrollButton",
")",
";",
"}",
"lib",
".",
"addAutoDismiss",
"(",
"list",
",",
"this",
".",
"_boundAutoDismiss",
")",
";",
"this",
".",
"_positionDropdown",
"(",
"mouseEvent",
")",
";",
"if",
"(",
"this",
".",
"_buttonsAdded",
")",
"{",
"positionScrollButtons",
".",
"call",
"(",
"this",
")",
";",
"}",
"this",
".",
"_focusDropdownNode",
"(",
")",
";",
"actionTaken",
"=",
"true",
";",
"if",
"(",
"this",
".",
"_parentDropdown",
")",
"{",
"this",
".",
"_parentDropdown",
".",
"submenuOpen",
"(",
"this",
")",
";",
"}",
"if",
"(",
"this",
".",
"_trapTabs",
")",
"{",
"lib",
".",
"trapTabs",
"(",
"this",
".",
"_dropdownNode",
")",
";",
"}",
"}",
"}",
"return",
"actionTaken",
";",
"}"
] |
Open the dropdown.
|
[
"Open",
"the",
"dropdown",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/dropdown.js#L198-L253
|
|
14,223
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/dropdown.js
|
function(mouseEvent) {//Sub classes can override this to position the drop down differently.
this._dropdownNode.style.left = "";
this._dropdownNode.style.top = "";
if(this._positioningNode) {
this._dropdownNode.style.left = this._positioningNode.offsetLeft + "px";
return;
}
var bounds = lib.bounds(this._dropdownNode);
var bodyBounds = lib.bounds(document.body);
if (bounds.left + bounds.width > (bodyBounds.left + bodyBounds.width)) {
if (this._triggerNode.classList.contains("dropdownMenuItem")) { //$NON-NLS-0$
this._dropdownNode.style.left = -bounds.width + "px"; //$NON-NLS-0$
} else {
var totalBounds = lib.bounds(this._boundingNode(this._triggerNode));
var triggerBounds = lib.bounds(this._triggerNode);
this._dropdownNode.style.left = (triggerBounds.left - totalBounds.left - bounds.width + triggerBounds.width) + "px"; //$NON-NLS-0$
}
}
//ensure menu fits on page vertically
var overflowY = (bounds.top + bounds.height) - (bodyBounds.top + bodyBounds.height);
if (0 < overflowY) {
this._dropdownNode.style.top = Math.floor(this._dropdownNode.style.top - overflowY) + "px"; //$NON-NLS-0$
}
}
|
javascript
|
function(mouseEvent) {//Sub classes can override this to position the drop down differently.
this._dropdownNode.style.left = "";
this._dropdownNode.style.top = "";
if(this._positioningNode) {
this._dropdownNode.style.left = this._positioningNode.offsetLeft + "px";
return;
}
var bounds = lib.bounds(this._dropdownNode);
var bodyBounds = lib.bounds(document.body);
if (bounds.left + bounds.width > (bodyBounds.left + bodyBounds.width)) {
if (this._triggerNode.classList.contains("dropdownMenuItem")) { //$NON-NLS-0$
this._dropdownNode.style.left = -bounds.width + "px"; //$NON-NLS-0$
} else {
var totalBounds = lib.bounds(this._boundingNode(this._triggerNode));
var triggerBounds = lib.bounds(this._triggerNode);
this._dropdownNode.style.left = (triggerBounds.left - totalBounds.left - bounds.width + triggerBounds.width) + "px"; //$NON-NLS-0$
}
}
//ensure menu fits on page vertically
var overflowY = (bounds.top + bounds.height) - (bodyBounds.top + bodyBounds.height);
if (0 < overflowY) {
this._dropdownNode.style.top = Math.floor(this._dropdownNode.style.top - overflowY) + "px"; //$NON-NLS-0$
}
}
|
[
"function",
"(",
"mouseEvent",
")",
"{",
"//Sub classes can override this to position the drop down differently.",
"this",
".",
"_dropdownNode",
".",
"style",
".",
"left",
"=",
"\"\"",
";",
"this",
".",
"_dropdownNode",
".",
"style",
".",
"top",
"=",
"\"\"",
";",
"if",
"(",
"this",
".",
"_positioningNode",
")",
"{",
"this",
".",
"_dropdownNode",
".",
"style",
".",
"left",
"=",
"this",
".",
"_positioningNode",
".",
"offsetLeft",
"+",
"\"px\"",
";",
"return",
";",
"}",
"var",
"bounds",
"=",
"lib",
".",
"bounds",
"(",
"this",
".",
"_dropdownNode",
")",
";",
"var",
"bodyBounds",
"=",
"lib",
".",
"bounds",
"(",
"document",
".",
"body",
")",
";",
"if",
"(",
"bounds",
".",
"left",
"+",
"bounds",
".",
"width",
">",
"(",
"bodyBounds",
".",
"left",
"+",
"bodyBounds",
".",
"width",
")",
")",
"{",
"if",
"(",
"this",
".",
"_triggerNode",
".",
"classList",
".",
"contains",
"(",
"\"dropdownMenuItem\"",
")",
")",
"{",
"//$NON-NLS-0$",
"this",
".",
"_dropdownNode",
".",
"style",
".",
"left",
"=",
"-",
"bounds",
".",
"width",
"+",
"\"px\"",
";",
"//$NON-NLS-0$",
"}",
"else",
"{",
"var",
"totalBounds",
"=",
"lib",
".",
"bounds",
"(",
"this",
".",
"_boundingNode",
"(",
"this",
".",
"_triggerNode",
")",
")",
";",
"var",
"triggerBounds",
"=",
"lib",
".",
"bounds",
"(",
"this",
".",
"_triggerNode",
")",
";",
"this",
".",
"_dropdownNode",
".",
"style",
".",
"left",
"=",
"(",
"triggerBounds",
".",
"left",
"-",
"totalBounds",
".",
"left",
"-",
"bounds",
".",
"width",
"+",
"triggerBounds",
".",
"width",
")",
"+",
"\"px\"",
";",
"//$NON-NLS-0$",
"}",
"}",
"//ensure menu fits on page vertically",
"var",
"overflowY",
"=",
"(",
"bounds",
".",
"top",
"+",
"bounds",
".",
"height",
")",
"-",
"(",
"bodyBounds",
".",
"top",
"+",
"bodyBounds",
".",
"height",
")",
";",
"if",
"(",
"0",
"<",
"overflowY",
")",
"{",
"this",
".",
"_dropdownNode",
".",
"style",
".",
"top",
"=",
"Math",
".",
"floor",
"(",
"this",
".",
"_dropdownNode",
".",
"style",
".",
"top",
"-",
"overflowY",
")",
"+",
"\"px\"",
";",
"//$NON-NLS-0$",
"}",
"}"
] |
This method positions the dropdown menu.
The specified mouseEvent is ignored. However, subclasses
can override this method if they wish to take the mouse
position contained in the mouse event into account.
@param {MouseEvent} mouseEvent
|
[
"This",
"method",
"positions",
"the",
"dropdown",
"menu",
".",
"The",
"specified",
"mouseEvent",
"is",
"ignored",
".",
"However",
"subclasses",
"can",
"override",
"this",
"method",
"if",
"they",
"wish",
"to",
"take",
"the",
"mouse",
"position",
"contained",
"in",
"the",
"mouse",
"event",
"into",
"account",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/dropdown.js#L282-L308
|
|
14,224
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/dropdown.js
|
function(restoreFocus) {
var actionTaken = false;
if (this.isVisible()) {
this._triggerNode.classList.remove("dropdownTriggerOpen"); //$NON-NLS-0$
this._triggerNode.setAttribute("aria-expanded", "false"); //$NON-NLS-1$ //$NON-NLS-0$
if (this._selectionClass) {
this._triggerNode.classList.remove(this._selectionClass);
}
this._dropdownNode.classList.remove("dropdownMenuOpen"); //$NON-NLS-0$
lib.setFramesEnabled(true);
if (restoreFocus) {
lib.returnFocus(this._dropdownNode, this._triggerNode);
}
this._isVisible = false;
if (this._selectedItem) {
this._selectedItem.classList.remove("dropdownMenuItemSelected"); //$NON-NLS-0$
this._selectedItem = null;
}
if (this._boundAutoDismiss) {
lib.removeAutoDismiss(this._boundAutoDismiss);
this._boundAutoDismiss = null;
}
updateScrollButtonVisibility.call(this, true);
actionTaken = true;
}
return actionTaken;
}
|
javascript
|
function(restoreFocus) {
var actionTaken = false;
if (this.isVisible()) {
this._triggerNode.classList.remove("dropdownTriggerOpen"); //$NON-NLS-0$
this._triggerNode.setAttribute("aria-expanded", "false"); //$NON-NLS-1$ //$NON-NLS-0$
if (this._selectionClass) {
this._triggerNode.classList.remove(this._selectionClass);
}
this._dropdownNode.classList.remove("dropdownMenuOpen"); //$NON-NLS-0$
lib.setFramesEnabled(true);
if (restoreFocus) {
lib.returnFocus(this._dropdownNode, this._triggerNode);
}
this._isVisible = false;
if (this._selectedItem) {
this._selectedItem.classList.remove("dropdownMenuItemSelected"); //$NON-NLS-0$
this._selectedItem = null;
}
if (this._boundAutoDismiss) {
lib.removeAutoDismiss(this._boundAutoDismiss);
this._boundAutoDismiss = null;
}
updateScrollButtonVisibility.call(this, true);
actionTaken = true;
}
return actionTaken;
}
|
[
"function",
"(",
"restoreFocus",
")",
"{",
"var",
"actionTaken",
"=",
"false",
";",
"if",
"(",
"this",
".",
"isVisible",
"(",
")",
")",
"{",
"this",
".",
"_triggerNode",
".",
"classList",
".",
"remove",
"(",
"\"dropdownTriggerOpen\"",
")",
";",
"//$NON-NLS-0$",
"this",
".",
"_triggerNode",
".",
"setAttribute",
"(",
"\"aria-expanded\"",
",",
"\"false\"",
")",
";",
"//$NON-NLS-1$ //$NON-NLS-0$",
"if",
"(",
"this",
".",
"_selectionClass",
")",
"{",
"this",
".",
"_triggerNode",
".",
"classList",
".",
"remove",
"(",
"this",
".",
"_selectionClass",
")",
";",
"}",
"this",
".",
"_dropdownNode",
".",
"classList",
".",
"remove",
"(",
"\"dropdownMenuOpen\"",
")",
";",
"//$NON-NLS-0$",
"lib",
".",
"setFramesEnabled",
"(",
"true",
")",
";",
"if",
"(",
"restoreFocus",
")",
"{",
"lib",
".",
"returnFocus",
"(",
"this",
".",
"_dropdownNode",
",",
"this",
".",
"_triggerNode",
")",
";",
"}",
"this",
".",
"_isVisible",
"=",
"false",
";",
"if",
"(",
"this",
".",
"_selectedItem",
")",
"{",
"this",
".",
"_selectedItem",
".",
"classList",
".",
"remove",
"(",
"\"dropdownMenuItemSelected\"",
")",
";",
"//$NON-NLS-0$\t\t",
"this",
".",
"_selectedItem",
"=",
"null",
";",
"}",
"if",
"(",
"this",
".",
"_boundAutoDismiss",
")",
"{",
"lib",
".",
"removeAutoDismiss",
"(",
"this",
".",
"_boundAutoDismiss",
")",
";",
"this",
".",
"_boundAutoDismiss",
"=",
"null",
";",
"}",
"updateScrollButtonVisibility",
".",
"call",
"(",
"this",
",",
"true",
")",
";",
"actionTaken",
"=",
"true",
";",
"}",
"return",
"actionTaken",
";",
"}"
] |
Close the dropdown.
|
[
"Close",
"the",
"dropdown",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/dropdown.js#L325-L353
|
|
14,225
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/dropdown.js
|
function(item, direction, select) {
while (item.parentNode && (document !== item.parentNode) && item.parentNode.getAttribute("role") !== "menubar") {
item = item.parentNode;
}
if (!item.parentNode || document === item.parentNode) {
return; // item is not in a menubar
}
var trigger = item.childNodes[0];
var menuBar = item.parentNode;
var mbItems = menuBar.dropdown.getItems();
var mbItem = null;
for (var i = 0; i < mbItems.length; i++) {
if (mbItems[i] === trigger) {
if (direction === lib.KEY.LEFT) {
mbItem = i > 0 ? mbItems[i - 1] : mbItems[mbItems.length - 1];
} else {
mbItem = i < mbItems.length - 1 ? mbItems[i + 1] : mbItems[0];
}
break;
}
}
trigger.dropdown._closeSelectedSubmenu();
trigger.dropdown.close(false);
if (mbItem) {
mbItem.dropdown.open();
if (select) {
mbItem.dropdown._selectItem();
}
}
}
|
javascript
|
function(item, direction, select) {
while (item.parentNode && (document !== item.parentNode) && item.parentNode.getAttribute("role") !== "menubar") {
item = item.parentNode;
}
if (!item.parentNode || document === item.parentNode) {
return; // item is not in a menubar
}
var trigger = item.childNodes[0];
var menuBar = item.parentNode;
var mbItems = menuBar.dropdown.getItems();
var mbItem = null;
for (var i = 0; i < mbItems.length; i++) {
if (mbItems[i] === trigger) {
if (direction === lib.KEY.LEFT) {
mbItem = i > 0 ? mbItems[i - 1] : mbItems[mbItems.length - 1];
} else {
mbItem = i < mbItems.length - 1 ? mbItems[i + 1] : mbItems[0];
}
break;
}
}
trigger.dropdown._closeSelectedSubmenu();
trigger.dropdown.close(false);
if (mbItem) {
mbItem.dropdown.open();
if (select) {
mbItem.dropdown._selectItem();
}
}
}
|
[
"function",
"(",
"item",
",",
"direction",
",",
"select",
")",
"{",
"while",
"(",
"item",
".",
"parentNode",
"&&",
"(",
"document",
"!==",
"item",
".",
"parentNode",
")",
"&&",
"item",
".",
"parentNode",
".",
"getAttribute",
"(",
"\"role\"",
")",
"!==",
"\"menubar\"",
")",
"{",
"item",
"=",
"item",
".",
"parentNode",
";",
"}",
"if",
"(",
"!",
"item",
".",
"parentNode",
"||",
"document",
"===",
"item",
".",
"parentNode",
")",
"{",
"return",
";",
"// item is not in a menubar",
"}",
"var",
"trigger",
"=",
"item",
".",
"childNodes",
"[",
"0",
"]",
";",
"var",
"menuBar",
"=",
"item",
".",
"parentNode",
";",
"var",
"mbItems",
"=",
"menuBar",
".",
"dropdown",
".",
"getItems",
"(",
")",
";",
"var",
"mbItem",
"=",
"null",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"mbItems",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"mbItems",
"[",
"i",
"]",
"===",
"trigger",
")",
"{",
"if",
"(",
"direction",
"===",
"lib",
".",
"KEY",
".",
"LEFT",
")",
"{",
"mbItem",
"=",
"i",
">",
"0",
"?",
"mbItems",
"[",
"i",
"-",
"1",
"]",
":",
"mbItems",
"[",
"mbItems",
".",
"length",
"-",
"1",
"]",
";",
"}",
"else",
"{",
"mbItem",
"=",
"i",
"<",
"mbItems",
".",
"length",
"-",
"1",
"?",
"mbItems",
"[",
"i",
"+",
"1",
"]",
":",
"mbItems",
"[",
"0",
"]",
";",
"}",
"break",
";",
"}",
"}",
"trigger",
".",
"dropdown",
".",
"_closeSelectedSubmenu",
"(",
")",
";",
"trigger",
".",
"dropdown",
".",
"close",
"(",
"false",
")",
";",
"if",
"(",
"mbItem",
")",
"{",
"mbItem",
".",
"dropdown",
".",
"open",
"(",
")",
";",
"if",
"(",
"select",
")",
"{",
"mbItem",
".",
"dropdown",
".",
"_selectItem",
"(",
")",
";",
"}",
"}",
"}"
] |
Closes the menubar menu containing the specified item
and opens the menu next to it in the specified direction.
@param {Object} item An item within a menu
@param {Integer} direction Either KEY.RIGHT or KEY.LEFT typed by user
@param {Boolean} select If true, select the first item
|
[
"Closes",
"the",
"menubar",
"menu",
"containing",
"the",
"specified",
"item",
"and",
"opens",
"the",
"menu",
"next",
"to",
"it",
"in",
"the",
"specified",
"direction",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/dropdown.js#L504-L534
|
|
14,226
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/dropdown.js
|
function(item) {
var itemToSelect = item || this.getItems()[0];
if (itemToSelect) {
if (this._selectedItem) {
this._selectedItem.classList.remove("dropdownMenuItemSelected"); //$NON-NLS-0$
}
this._selectedItem = itemToSelect;
this._selectedItem.classList.add("dropdownMenuItemSelected"); //$NON-NLS-0$
this._selectedItem.focus();
if (this._buttonsAdded) {
var itemBounds = this._selectedItem.getBoundingClientRect();
var menuBounds = this._dropdownNode.getBoundingClientRect();
if (this._selectedItem.offsetTop < this._dropdownNode.scrollTop) {
this._selectedItem.scrollIntoView(true);
if (this._dropdownNode.scrollTop < 5) {
this._dropdownNode.scrollTop = 0;
}
}
else if (itemBounds.bottom > menuBounds.bottom) {
this._selectedItem.scrollIntoView(false);
if ((this._dropdownNode.scrollHeight - this._dropdownNode.scrollTop - this._dropdownNode.clientHeight) < 5) {
this._dropdownNode.scrollTop = this._dropdownNode.scrollHeight - this._dropdownNode.clientHeight;
}
}
updateScrollButtonVisibility.call(this);
}
}
}
|
javascript
|
function(item) {
var itemToSelect = item || this.getItems()[0];
if (itemToSelect) {
if (this._selectedItem) {
this._selectedItem.classList.remove("dropdownMenuItemSelected"); //$NON-NLS-0$
}
this._selectedItem = itemToSelect;
this._selectedItem.classList.add("dropdownMenuItemSelected"); //$NON-NLS-0$
this._selectedItem.focus();
if (this._buttonsAdded) {
var itemBounds = this._selectedItem.getBoundingClientRect();
var menuBounds = this._dropdownNode.getBoundingClientRect();
if (this._selectedItem.offsetTop < this._dropdownNode.scrollTop) {
this._selectedItem.scrollIntoView(true);
if (this._dropdownNode.scrollTop < 5) {
this._dropdownNode.scrollTop = 0;
}
}
else if (itemBounds.bottom > menuBounds.bottom) {
this._selectedItem.scrollIntoView(false);
if ((this._dropdownNode.scrollHeight - this._dropdownNode.scrollTop - this._dropdownNode.clientHeight) < 5) {
this._dropdownNode.scrollTop = this._dropdownNode.scrollHeight - this._dropdownNode.clientHeight;
}
}
updateScrollButtonVisibility.call(this);
}
}
}
|
[
"function",
"(",
"item",
")",
"{",
"var",
"itemToSelect",
"=",
"item",
"||",
"this",
".",
"getItems",
"(",
")",
"[",
"0",
"]",
";",
"if",
"(",
"itemToSelect",
")",
"{",
"if",
"(",
"this",
".",
"_selectedItem",
")",
"{",
"this",
".",
"_selectedItem",
".",
"classList",
".",
"remove",
"(",
"\"dropdownMenuItemSelected\"",
")",
";",
"//$NON-NLS-0$",
"}",
"this",
".",
"_selectedItem",
"=",
"itemToSelect",
";",
"this",
".",
"_selectedItem",
".",
"classList",
".",
"add",
"(",
"\"dropdownMenuItemSelected\"",
")",
";",
"//$NON-NLS-0$\t",
"this",
".",
"_selectedItem",
".",
"focus",
"(",
")",
";",
"if",
"(",
"this",
".",
"_buttonsAdded",
")",
"{",
"var",
"itemBounds",
"=",
"this",
".",
"_selectedItem",
".",
"getBoundingClientRect",
"(",
")",
";",
"var",
"menuBounds",
"=",
"this",
".",
"_dropdownNode",
".",
"getBoundingClientRect",
"(",
")",
";",
"if",
"(",
"this",
".",
"_selectedItem",
".",
"offsetTop",
"<",
"this",
".",
"_dropdownNode",
".",
"scrollTop",
")",
"{",
"this",
".",
"_selectedItem",
".",
"scrollIntoView",
"(",
"true",
")",
";",
"if",
"(",
"this",
".",
"_dropdownNode",
".",
"scrollTop",
"<",
"5",
")",
"{",
"this",
".",
"_dropdownNode",
".",
"scrollTop",
"=",
"0",
";",
"}",
"}",
"else",
"if",
"(",
"itemBounds",
".",
"bottom",
">",
"menuBounds",
".",
"bottom",
")",
"{",
"this",
".",
"_selectedItem",
".",
"scrollIntoView",
"(",
"false",
")",
";",
"if",
"(",
"(",
"this",
".",
"_dropdownNode",
".",
"scrollHeight",
"-",
"this",
".",
"_dropdownNode",
".",
"scrollTop",
"-",
"this",
".",
"_dropdownNode",
".",
"clientHeight",
")",
"<",
"5",
")",
"{",
"this",
".",
"_dropdownNode",
".",
"scrollTop",
"=",
"this",
".",
"_dropdownNode",
".",
"scrollHeight",
"-",
"this",
".",
"_dropdownNode",
".",
"clientHeight",
";",
"}",
"}",
"updateScrollButtonVisibility",
".",
"call",
"(",
"this",
")",
";",
"}",
"}",
"}"
] |
Selects the specified dropdown menu item or the first
dropdown menu item if none is specified.
@param {Object} item The dropdown menu item that should be selected. See @ref getItems() for details. Optional.
|
[
"Selects",
"the",
"specified",
"dropdown",
"menu",
"item",
"or",
"the",
"first",
"dropdown",
"menu",
"item",
"if",
"none",
"is",
"specified",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/dropdown.js#L541-L568
|
|
14,227
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/dropdown.js
|
function(text, innerNodeType) {
var li = createMenuItem(text, innerNodeType);
this._dropdownNode.appendChild(li);
return li;
}
|
javascript
|
function(text, innerNodeType) {
var li = createMenuItem(text, innerNodeType);
this._dropdownNode.appendChild(li);
return li;
}
|
[
"function",
"(",
"text",
",",
"innerNodeType",
")",
"{",
"var",
"li",
"=",
"createMenuItem",
"(",
"text",
",",
"innerNodeType",
")",
";",
"this",
".",
"_dropdownNode",
".",
"appendChild",
"(",
"li",
")",
";",
"return",
"li",
";",
"}"
] |
Creates a new menu item and appends it to the bottom of this dropdown.
@param {String} text The text to display inside the new menu item. Optional.
@param {String} innerNodeType The type of the inner node to create. The default is "span". Optional.
@returns {Object} The top-most new element that was created
|
[
"Creates",
"a",
"new",
"menu",
"item",
"and",
"appends",
"it",
"to",
"the",
"bottom",
"of",
"this",
"dropdown",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/dropdown.js#L605-L609
|
|
14,228
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/dropdown.js
|
createMenuItem
|
function createMenuItem(text, innerNodeType) {
innerNodeType = innerNodeType === undefined ? "span" : innerNodeType; //$NON-NLS-0$
var element = document.createElement(innerNodeType); //$NON-NLS-0$
element.className = "dropdownMenuItem"; //$NON-NLS-0$
element.setAttribute("role", "menuitem"); //$NON-NLS-0$ //$NON-NLS-1$
element.tabIndex = -1;
element.style.outline = "none";
if (text) {
var span = document.createElement("span"); //$NON-NLS-0$
span.appendChild(document.createTextNode(text));
span.classList.add("dropdownCommandName"); //$NON-NLS-0$
element.appendChild(span);
}
var li = document.createElement("li"); //$NON-NLS-0$
li.setAttribute("role", "none"); //$NON-NLS-0$ //$NON-NLS-1$
li.appendChild(element); //$NON-NLS-0$
return li;
}
|
javascript
|
function createMenuItem(text, innerNodeType) {
innerNodeType = innerNodeType === undefined ? "span" : innerNodeType; //$NON-NLS-0$
var element = document.createElement(innerNodeType); //$NON-NLS-0$
element.className = "dropdownMenuItem"; //$NON-NLS-0$
element.setAttribute("role", "menuitem"); //$NON-NLS-0$ //$NON-NLS-1$
element.tabIndex = -1;
element.style.outline = "none";
if (text) {
var span = document.createElement("span"); //$NON-NLS-0$
span.appendChild(document.createTextNode(text));
span.classList.add("dropdownCommandName"); //$NON-NLS-0$
element.appendChild(span);
}
var li = document.createElement("li"); //$NON-NLS-0$
li.setAttribute("role", "none"); //$NON-NLS-0$ //$NON-NLS-1$
li.appendChild(element); //$NON-NLS-0$
return li;
}
|
[
"function",
"createMenuItem",
"(",
"text",
",",
"innerNodeType",
")",
"{",
"innerNodeType",
"=",
"innerNodeType",
"===",
"undefined",
"?",
"\"span\"",
":",
"innerNodeType",
";",
"//$NON-NLS-0$",
"var",
"element",
"=",
"document",
".",
"createElement",
"(",
"innerNodeType",
")",
";",
"//$NON-NLS-0$",
"element",
".",
"className",
"=",
"\"dropdownMenuItem\"",
";",
"//$NON-NLS-0$",
"element",
".",
"setAttribute",
"(",
"\"role\"",
",",
"\"menuitem\"",
")",
";",
"//$NON-NLS-0$ //$NON-NLS-1$",
"element",
".",
"tabIndex",
"=",
"-",
"1",
";",
"element",
".",
"style",
".",
"outline",
"=",
"\"none\"",
";",
"if",
"(",
"text",
")",
"{",
"var",
"span",
"=",
"document",
".",
"createElement",
"(",
"\"span\"",
")",
";",
"//$NON-NLS-0$",
"span",
".",
"appendChild",
"(",
"document",
".",
"createTextNode",
"(",
"text",
")",
")",
";",
"span",
".",
"classList",
".",
"add",
"(",
"\"dropdownCommandName\"",
")",
";",
"//$NON-NLS-0$",
"element",
".",
"appendChild",
"(",
"span",
")",
";",
"}",
"var",
"li",
"=",
"document",
".",
"createElement",
"(",
"\"li\"",
")",
";",
"//$NON-NLS-0$",
"li",
".",
"setAttribute",
"(",
"\"role\"",
",",
"\"none\"",
")",
";",
"//$NON-NLS-0$ //$NON-NLS-1$",
"li",
".",
"appendChild",
"(",
"element",
")",
";",
"//$NON-NLS-0$",
"return",
"li",
";",
"}"
] |
Creates a new menu item and returns it to the caller.
@param {String} text The text to display inside the new menu item. Optional.
@param {String} innerNodeType The type of the inner node to create. The default is "span". Optional.
@returns {Object} The top-most new element that was created
|
[
"Creates",
"a",
"new",
"menu",
"item",
"and",
"returns",
"it",
"to",
"the",
"caller",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/dropdown.js#L628-L649
|
14,229
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/dropdown.js
|
appendKeyBindingString
|
function appendKeyBindingString(element, keyBindingString) {
var span = document.createElement("span"); //$NON-NLS-0$
span.classList.add("dropdownKeyBinding"); //$NON-NLS-0$
span.appendChild(document.createTextNode(keyBindingString));
element.appendChild(span);
}
|
javascript
|
function appendKeyBindingString(element, keyBindingString) {
var span = document.createElement("span"); //$NON-NLS-0$
span.classList.add("dropdownKeyBinding"); //$NON-NLS-0$
span.appendChild(document.createTextNode(keyBindingString));
element.appendChild(span);
}
|
[
"function",
"appendKeyBindingString",
"(",
"element",
",",
"keyBindingString",
")",
"{",
"var",
"span",
"=",
"document",
".",
"createElement",
"(",
"\"span\"",
")",
";",
"//$NON-NLS-0$",
"span",
".",
"classList",
".",
"add",
"(",
"\"dropdownKeyBinding\"",
")",
";",
"//$NON-NLS-0$",
"span",
".",
"appendChild",
"(",
"document",
".",
"createTextNode",
"(",
"keyBindingString",
")",
")",
";",
"element",
".",
"appendChild",
"(",
"span",
")",
";",
"}"
] |
Appends the specified keyBindingString to the specified menu item.
@param {Object} element The menu item to append the keybinding string to. Required.
@param {String} keyBindingString The keybinding string to append. Required.
|
[
"Appends",
"the",
"specified",
"keyBindingString",
"to",
"the",
"specified",
"menu",
"item",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/dropdown.js#L666-L671
|
14,230
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/dropdown.js
|
addScrollButtons
|
function addScrollButtons() {
var dropdown = this;
if(!this._topScrollButton && !this._bottomScrollButton) { // if scroll buttons haven't been made yet
this._topScrollButton = document.createElement("button");
this._bottomScrollButton = document.createElement("button");
this._topScrollButton.classList.add("menuScrollButton", "menuTopScrollButton", "core-sprite-openarrow");
this._bottomScrollButton.classList.add("menuScrollButton", "menuBottomScrollButton", "core-sprite-openarrow");
this._topScrollButton.addEventListener("mousedown", function(evt){ //$NON-NLS-0$
if (this._activeScrollInterval) {
window.clearInterval(this._activeScrollInterval);
}
this._activeScrollInterval = window.setInterval(scrollUp.bind(null, evt.shiftKey ? 20 : 2), 10);
}.bind(this));
this._topScrollButton.addEventListener("mouseup", function(){ //$NON-NLS-0$
if (this._activeScrollInterval) {
window.clearInterval(this._activeScrollInterval);
this._activeScrollInterval = null;
}
}.bind(this));
this._bottomScrollButton.addEventListener("mousedown", function(evt){ //$NON-NLS-0$
if (this._activeScrollInterval) {
window.clearInterval(this._activeScrollInterval);
}
this._activeScrollInterval = window.setInterval(scrollDown.bind(null, evt.shiftKey ? 20 : 2), 10);
}.bind(this));
this._bottomScrollButton.addEventListener("mouseup", function(){ //$NON-NLS-0$
if (this._activeScrollInterval) {
window.clearInterval(this._activeScrollInterval);
this._activeScrollInterval = null;
}
}.bind(this));
this._dropdownNode.parentNode.insertBefore(this._topScrollButton, this._dropdownNode);
this._dropdownNode.parentNode.insertBefore(this._bottomScrollButton, this._dropdownNode.nextElementSibling);
this._dropdownNode.style.overflow = "hidden";
}
updateScrollButtonVisibility.call(this);
return true;
function scrollDown(increment) {
dropdown._dropdownNode.scrollTop+=increment;
updateScrollButtonVisibility.call(dropdown);
}
function scrollUp(increment) {
dropdown._dropdownNode.scrollTop-=increment;
updateScrollButtonVisibility.call(dropdown);
}
}
|
javascript
|
function addScrollButtons() {
var dropdown = this;
if(!this._topScrollButton && !this._bottomScrollButton) { // if scroll buttons haven't been made yet
this._topScrollButton = document.createElement("button");
this._bottomScrollButton = document.createElement("button");
this._topScrollButton.classList.add("menuScrollButton", "menuTopScrollButton", "core-sprite-openarrow");
this._bottomScrollButton.classList.add("menuScrollButton", "menuBottomScrollButton", "core-sprite-openarrow");
this._topScrollButton.addEventListener("mousedown", function(evt){ //$NON-NLS-0$
if (this._activeScrollInterval) {
window.clearInterval(this._activeScrollInterval);
}
this._activeScrollInterval = window.setInterval(scrollUp.bind(null, evt.shiftKey ? 20 : 2), 10);
}.bind(this));
this._topScrollButton.addEventListener("mouseup", function(){ //$NON-NLS-0$
if (this._activeScrollInterval) {
window.clearInterval(this._activeScrollInterval);
this._activeScrollInterval = null;
}
}.bind(this));
this._bottomScrollButton.addEventListener("mousedown", function(evt){ //$NON-NLS-0$
if (this._activeScrollInterval) {
window.clearInterval(this._activeScrollInterval);
}
this._activeScrollInterval = window.setInterval(scrollDown.bind(null, evt.shiftKey ? 20 : 2), 10);
}.bind(this));
this._bottomScrollButton.addEventListener("mouseup", function(){ //$NON-NLS-0$
if (this._activeScrollInterval) {
window.clearInterval(this._activeScrollInterval);
this._activeScrollInterval = null;
}
}.bind(this));
this._dropdownNode.parentNode.insertBefore(this._topScrollButton, this._dropdownNode);
this._dropdownNode.parentNode.insertBefore(this._bottomScrollButton, this._dropdownNode.nextElementSibling);
this._dropdownNode.style.overflow = "hidden";
}
updateScrollButtonVisibility.call(this);
return true;
function scrollDown(increment) {
dropdown._dropdownNode.scrollTop+=increment;
updateScrollButtonVisibility.call(dropdown);
}
function scrollUp(increment) {
dropdown._dropdownNode.scrollTop-=increment;
updateScrollButtonVisibility.call(dropdown);
}
}
|
[
"function",
"addScrollButtons",
"(",
")",
"{",
"var",
"dropdown",
"=",
"this",
";",
"if",
"(",
"!",
"this",
".",
"_topScrollButton",
"&&",
"!",
"this",
".",
"_bottomScrollButton",
")",
"{",
"// if scroll buttons haven't been made yet",
"this",
".",
"_topScrollButton",
"=",
"document",
".",
"createElement",
"(",
"\"button\"",
")",
";",
"this",
".",
"_bottomScrollButton",
"=",
"document",
".",
"createElement",
"(",
"\"button\"",
")",
";",
"this",
".",
"_topScrollButton",
".",
"classList",
".",
"add",
"(",
"\"menuScrollButton\"",
",",
"\"menuTopScrollButton\"",
",",
"\"core-sprite-openarrow\"",
")",
";",
"this",
".",
"_bottomScrollButton",
".",
"classList",
".",
"add",
"(",
"\"menuScrollButton\"",
",",
"\"menuBottomScrollButton\"",
",",
"\"core-sprite-openarrow\"",
")",
";",
"this",
".",
"_topScrollButton",
".",
"addEventListener",
"(",
"\"mousedown\"",
",",
"function",
"(",
"evt",
")",
"{",
"//$NON-NLS-0$",
"if",
"(",
"this",
".",
"_activeScrollInterval",
")",
"{",
"window",
".",
"clearInterval",
"(",
"this",
".",
"_activeScrollInterval",
")",
";",
"}",
"this",
".",
"_activeScrollInterval",
"=",
"window",
".",
"setInterval",
"(",
"scrollUp",
".",
"bind",
"(",
"null",
",",
"evt",
".",
"shiftKey",
"?",
"20",
":",
"2",
")",
",",
"10",
")",
";",
"}",
".",
"bind",
"(",
"this",
")",
")",
";",
"this",
".",
"_topScrollButton",
".",
"addEventListener",
"(",
"\"mouseup\"",
",",
"function",
"(",
")",
"{",
"//$NON-NLS-0$",
"if",
"(",
"this",
".",
"_activeScrollInterval",
")",
"{",
"window",
".",
"clearInterval",
"(",
"this",
".",
"_activeScrollInterval",
")",
";",
"this",
".",
"_activeScrollInterval",
"=",
"null",
";",
"}",
"}",
".",
"bind",
"(",
"this",
")",
")",
";",
"this",
".",
"_bottomScrollButton",
".",
"addEventListener",
"(",
"\"mousedown\"",
",",
"function",
"(",
"evt",
")",
"{",
"//$NON-NLS-0$",
"if",
"(",
"this",
".",
"_activeScrollInterval",
")",
"{",
"window",
".",
"clearInterval",
"(",
"this",
".",
"_activeScrollInterval",
")",
";",
"}",
"this",
".",
"_activeScrollInterval",
"=",
"window",
".",
"setInterval",
"(",
"scrollDown",
".",
"bind",
"(",
"null",
",",
"evt",
".",
"shiftKey",
"?",
"20",
":",
"2",
")",
",",
"10",
")",
";",
"}",
".",
"bind",
"(",
"this",
")",
")",
";",
"this",
".",
"_bottomScrollButton",
".",
"addEventListener",
"(",
"\"mouseup\"",
",",
"function",
"(",
")",
"{",
"//$NON-NLS-0$",
"if",
"(",
"this",
".",
"_activeScrollInterval",
")",
"{",
"window",
".",
"clearInterval",
"(",
"this",
".",
"_activeScrollInterval",
")",
";",
"this",
".",
"_activeScrollInterval",
"=",
"null",
";",
"}",
"}",
".",
"bind",
"(",
"this",
")",
")",
";",
"this",
".",
"_dropdownNode",
".",
"parentNode",
".",
"insertBefore",
"(",
"this",
".",
"_topScrollButton",
",",
"this",
".",
"_dropdownNode",
")",
";",
"this",
".",
"_dropdownNode",
".",
"parentNode",
".",
"insertBefore",
"(",
"this",
".",
"_bottomScrollButton",
",",
"this",
".",
"_dropdownNode",
".",
"nextElementSibling",
")",
";",
"this",
".",
"_dropdownNode",
".",
"style",
".",
"overflow",
"=",
"\"hidden\"",
";",
"}",
"updateScrollButtonVisibility",
".",
"call",
"(",
"this",
")",
";",
"return",
"true",
";",
"function",
"scrollDown",
"(",
"increment",
")",
"{",
"dropdown",
".",
"_dropdownNode",
".",
"scrollTop",
"+=",
"increment",
";",
"updateScrollButtonVisibility",
".",
"call",
"(",
"dropdown",
")",
";",
"}",
"function",
"scrollUp",
"(",
"increment",
")",
"{",
"dropdown",
".",
"_dropdownNode",
".",
"scrollTop",
"-=",
"increment",
";",
"updateScrollButtonVisibility",
".",
"call",
"(",
"dropdown",
")",
";",
"}",
"}"
] |
Adds scrolling feature to a list
|
[
"Adds",
"scrolling",
"feature",
"to",
"a",
"list"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/dropdown.js#L676-L728
|
14,231
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/dropdown.js
|
updateScrollButtonVisibility
|
function updateScrollButtonVisibility(hideAll) {
if (hideAll && this._topScrollButton && this._bottomScrollButton) {
this._topScrollButton.style.display = "none";
this._bottomScrollButton.style.display = "none";
}
else if (!hideAll) {
if (this._dropdownNode.scrollTop > 0) {
this._topScrollButton.style.display = "block";
}
else {
this._topScrollButton.style.display = "none";
}
if (this._dropdownNode.scrollHeight > this._dropdownNode.scrollTop + this._dropdownNode.offsetHeight) {
this._bottomScrollButton.style.display = "block";
}
else {
this._bottomScrollButton.style.display = "none";
}
}
}
|
javascript
|
function updateScrollButtonVisibility(hideAll) {
if (hideAll && this._topScrollButton && this._bottomScrollButton) {
this._topScrollButton.style.display = "none";
this._bottomScrollButton.style.display = "none";
}
else if (!hideAll) {
if (this._dropdownNode.scrollTop > 0) {
this._topScrollButton.style.display = "block";
}
else {
this._topScrollButton.style.display = "none";
}
if (this._dropdownNode.scrollHeight > this._dropdownNode.scrollTop + this._dropdownNode.offsetHeight) {
this._bottomScrollButton.style.display = "block";
}
else {
this._bottomScrollButton.style.display = "none";
}
}
}
|
[
"function",
"updateScrollButtonVisibility",
"(",
"hideAll",
")",
"{",
"if",
"(",
"hideAll",
"&&",
"this",
".",
"_topScrollButton",
"&&",
"this",
".",
"_bottomScrollButton",
")",
"{",
"this",
".",
"_topScrollButton",
".",
"style",
".",
"display",
"=",
"\"none\"",
";",
"this",
".",
"_bottomScrollButton",
".",
"style",
".",
"display",
"=",
"\"none\"",
";",
"}",
"else",
"if",
"(",
"!",
"hideAll",
")",
"{",
"if",
"(",
"this",
".",
"_dropdownNode",
".",
"scrollTop",
">",
"0",
")",
"{",
"this",
".",
"_topScrollButton",
".",
"style",
".",
"display",
"=",
"\"block\"",
";",
"}",
"else",
"{",
"this",
".",
"_topScrollButton",
".",
"style",
".",
"display",
"=",
"\"none\"",
";",
"}",
"if",
"(",
"this",
".",
"_dropdownNode",
".",
"scrollHeight",
">",
"this",
".",
"_dropdownNode",
".",
"scrollTop",
"+",
"this",
".",
"_dropdownNode",
".",
"offsetHeight",
")",
"{",
"this",
".",
"_bottomScrollButton",
".",
"style",
".",
"display",
"=",
"\"block\"",
";",
"}",
"else",
"{",
"this",
".",
"_bottomScrollButton",
".",
"style",
".",
"display",
"=",
"\"none\"",
";",
"}",
"}",
"}"
] |
Hides or shows the scroll buttons
@param {Boolean} hideAll True if hiding both buttons. Required.
|
[
"Hides",
"or",
"shows",
"the",
"scroll",
"buttons"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/dropdown.js#L734-L753
|
14,232
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/webui/dropdown.js
|
positionScrollButtons
|
function positionScrollButtons() {
this._topScrollButton.style.width = this._dropdownNode.clientWidth + 1 + "px";
this._bottomScrollButton.style.width = this._dropdownNode.clientWidth + 1 + "px";
this._topScrollButton.style.top = this._dropdownNode.style.top;
this._topScrollButton.style.left = this._topScrollButton.parentNode.clientWidth + "px";
this._bottomScrollButton.style.top = Number(this._dropdownNode.style.top.replace("px", "")) + (this._dropdownNode.clientHeight-this._bottomScrollButton.clientHeight + 1)+"px";
this._bottomScrollButton.style.left = this._bottomScrollButton.parentNode.clientWidth + "px";
}
|
javascript
|
function positionScrollButtons() {
this._topScrollButton.style.width = this._dropdownNode.clientWidth + 1 + "px";
this._bottomScrollButton.style.width = this._dropdownNode.clientWidth + 1 + "px";
this._topScrollButton.style.top = this._dropdownNode.style.top;
this._topScrollButton.style.left = this._topScrollButton.parentNode.clientWidth + "px";
this._bottomScrollButton.style.top = Number(this._dropdownNode.style.top.replace("px", "")) + (this._dropdownNode.clientHeight-this._bottomScrollButton.clientHeight + 1)+"px";
this._bottomScrollButton.style.left = this._bottomScrollButton.parentNode.clientWidth + "px";
}
|
[
"function",
"positionScrollButtons",
"(",
")",
"{",
"this",
".",
"_topScrollButton",
".",
"style",
".",
"width",
"=",
"this",
".",
"_dropdownNode",
".",
"clientWidth",
"+",
"1",
"+",
"\"px\"",
";",
"this",
".",
"_bottomScrollButton",
".",
"style",
".",
"width",
"=",
"this",
".",
"_dropdownNode",
".",
"clientWidth",
"+",
"1",
"+",
"\"px\"",
";",
"this",
".",
"_topScrollButton",
".",
"style",
".",
"top",
"=",
"this",
".",
"_dropdownNode",
".",
"style",
".",
"top",
";",
"this",
".",
"_topScrollButton",
".",
"style",
".",
"left",
"=",
"this",
".",
"_topScrollButton",
".",
"parentNode",
".",
"clientWidth",
"+",
"\"px\"",
";",
"this",
".",
"_bottomScrollButton",
".",
"style",
".",
"top",
"=",
"Number",
"(",
"this",
".",
"_dropdownNode",
".",
"style",
".",
"top",
".",
"replace",
"(",
"\"px\"",
",",
"\"\"",
")",
")",
"+",
"(",
"this",
".",
"_dropdownNode",
".",
"clientHeight",
"-",
"this",
".",
"_bottomScrollButton",
".",
"clientHeight",
"+",
"1",
")",
"+",
"\"px\"",
";",
"this",
".",
"_bottomScrollButton",
".",
"style",
".",
"left",
"=",
"this",
".",
"_bottomScrollButton",
".",
"parentNode",
".",
"clientWidth",
"+",
"\"px\"",
";",
"}"
] |
Positions the top and bottom scroll buttons according to where the dropdown list is positioned
|
[
"Positions",
"the",
"top",
"and",
"bottom",
"scroll",
"buttons",
"according",
"to",
"where",
"the",
"dropdown",
"list",
"is",
"positioned"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/webui/dropdown.js#L758-L765
|
14,233
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.core/web/orion/bidiFormat.js
|
function (text, type, args, isRtl, locale) {
return getHandler(type).format(text, args, isRtl, true, locale);
}
|
javascript
|
function (text, type, args, isRtl, locale) {
return getHandler(type).format(text, args, isRtl, true, locale);
}
|
[
"function",
"(",
"text",
",",
"type",
",",
"args",
",",
"isRtl",
",",
"locale",
")",
"{",
"return",
"getHandler",
"(",
"type",
")",
".",
"format",
"(",
"text",
",",
"args",
",",
"isRtl",
",",
"true",
",",
"locale",
")",
";",
"}"
] |
Returns the HTML representation of a given structured text
@param text - the structured text
@param type - could be one of filepath, url, email
@param args - pass additional arguments to the handler. generally null.
@param isRtl - indicates if the GUI is mirrored
@param locale - the browser locale
|
[
"Returns",
"the",
"HTML",
"representation",
"of",
"a",
"given",
"structured",
"text"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.core/web/orion/bidiFormat.js#L1319-L1321
|
|
14,234
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.core/web/orion/bidiFormat.js
|
function (element, type, args, isRtl, locale) {
return attachElement(element, type, args, isRtl, locale);
}
|
javascript
|
function (element, type, args, isRtl, locale) {
return attachElement(element, type, args, isRtl, locale);
}
|
[
"function",
"(",
"element",
",",
"type",
",",
"args",
",",
"isRtl",
",",
"locale",
")",
"{",
"return",
"attachElement",
"(",
"element",
",",
"type",
",",
"args",
",",
"isRtl",
",",
"locale",
")",
";",
"}"
] |
Handle Structured text correct display for a given HTML element.
@param element - the element : should be of type div contenteditable=true
@param type - could be one of filepath, url, email
@param args - pass additional arguments to the handler. generally null.
@param isRtl - indicates if the GUI is mirrored
@param locale - the browser locale
|
[
"Handle",
"Structured",
"text",
"correct",
"display",
"for",
"a",
"given",
"HTML",
"element",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.core/web/orion/bidiFormat.js#L1330-L1332
|
|
14,235
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/config/config-ops.js
|
function(env) {
var envConfig = this.createEmptyConfig();
if (env) {
envConfig.env = env;
Object.keys(env).filter(function(name) {
return env[name];
}).forEach(function(name) {
var environment = Environments.name;
if (environment) {
if (environment.globals) {
assign(envConfig.globals, environment.globals);
}
if (environment.parserOptions) {
assign(envConfig.parserOptions, environment.parserOptions);
}
}
});
}
return envConfig;
}
|
javascript
|
function(env) {
var envConfig = this.createEmptyConfig();
if (env) {
envConfig.env = env;
Object.keys(env).filter(function(name) {
return env[name];
}).forEach(function(name) {
var environment = Environments.name;
if (environment) {
if (environment.globals) {
assign(envConfig.globals, environment.globals);
}
if (environment.parserOptions) {
assign(envConfig.parserOptions, environment.parserOptions);
}
}
});
}
return envConfig;
}
|
[
"function",
"(",
"env",
")",
"{",
"var",
"envConfig",
"=",
"this",
".",
"createEmptyConfig",
"(",
")",
";",
"if",
"(",
"env",
")",
"{",
"envConfig",
".",
"env",
"=",
"env",
";",
"Object",
".",
"keys",
"(",
"env",
")",
".",
"filter",
"(",
"function",
"(",
"name",
")",
"{",
"return",
"env",
"[",
"name",
"]",
";",
"}",
")",
".",
"forEach",
"(",
"function",
"(",
"name",
")",
"{",
"var",
"environment",
"=",
"Environments",
".",
"name",
";",
"if",
"(",
"environment",
")",
"{",
"if",
"(",
"environment",
".",
"globals",
")",
"{",
"assign",
"(",
"envConfig",
".",
"globals",
",",
"environment",
".",
"globals",
")",
";",
"}",
"if",
"(",
"environment",
".",
"parserOptions",
")",
"{",
"assign",
"(",
"envConfig",
".",
"parserOptions",
",",
"environment",
".",
"parserOptions",
")",
";",
"}",
"}",
"}",
")",
";",
"}",
"return",
"envConfig",
";",
"}"
] |
Creates an environment config based on the specified environments.
@param {Object<string,boolean>} env The environment settings.
@returns {Object} A configuration object with the appropriate rules and globals
set.
|
[
"Creates",
"an",
"environment",
"config",
"based",
"on",
"the",
"specified",
"environments",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/config/config-ops.js#L51-L77
|
|
14,236
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/config/config-ops.js
|
function(config) {
if (config.env && typeof config.env === "object") {
return this.merge(this.createEnvironmentConfig(config.env), config);
}
return config;
}
|
javascript
|
function(config) {
if (config.env && typeof config.env === "object") {
return this.merge(this.createEnvironmentConfig(config.env), config);
}
return config;
}
|
[
"function",
"(",
"config",
")",
"{",
"if",
"(",
"config",
".",
"env",
"&&",
"typeof",
"config",
".",
"env",
"===",
"\"object\"",
")",
"{",
"return",
"this",
".",
"merge",
"(",
"this",
".",
"createEnvironmentConfig",
"(",
"config",
".",
"env",
")",
",",
"config",
")",
";",
"}",
"return",
"config",
";",
"}"
] |
Given a config with environment settings, applies the globals and
ecmaFeatures to the configuration and returns the result.
@param {Object} config The configuration information.
@returns {Object} The updated configuration information.
|
[
"Given",
"a",
"config",
"with",
"environment",
"settings",
"applies",
"the",
"globals",
"and",
"ecmaFeatures",
"to",
"the",
"configuration",
"and",
"returns",
"the",
"result",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/config/config-ops.js#L85-L91
|
|
14,237
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/config/config-ops.js
|
function(ruleConfig) {
var severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;
if (typeof severity === "string") {
severity = RULE_SEVERITY[severity.toLowerCase()] || 0;
}
return typeof severity === "number" && severity === 2;
}
|
javascript
|
function(ruleConfig) {
var severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;
if (typeof severity === "string") {
severity = RULE_SEVERITY[severity.toLowerCase()] || 0;
}
return typeof severity === "number" && severity === 2;
}
|
[
"function",
"(",
"ruleConfig",
")",
"{",
"var",
"severity",
"=",
"Array",
".",
"isArray",
"(",
"ruleConfig",
")",
"?",
"ruleConfig",
"[",
"0",
"]",
":",
"ruleConfig",
";",
"if",
"(",
"typeof",
"severity",
"===",
"\"string\"",
")",
"{",
"severity",
"=",
"RULE_SEVERITY",
"[",
"severity",
".",
"toLowerCase",
"(",
")",
"]",
"||",
"0",
";",
"}",
"return",
"typeof",
"severity",
"===",
"\"number\"",
"&&",
"severity",
"===",
"2",
";",
"}"
] |
Determines if the severity for the given rule configuration represents an error.
@param {int|string|Array} ruleConfig The configuration for an individual rule.
@returns {boolean} True if the rule represents an error, false if not.
|
[
"Determines",
"if",
"the",
"severity",
"for",
"the",
"given",
"rule",
"configuration",
"represents",
"an",
"error",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/config/config-ops.js#L238-L247
|
|
14,238
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/config/config-ops.js
|
function(ruleConfig) {
var severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;
if (typeof severity === "string") {
severity = severity.toLowerCase();
}
return VALID_SEVERITIES.indexOf(severity) !== -1;
}
|
javascript
|
function(ruleConfig) {
var severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;
if (typeof severity === "string") {
severity = severity.toLowerCase();
}
return VALID_SEVERITIES.indexOf(severity) !== -1;
}
|
[
"function",
"(",
"ruleConfig",
")",
"{",
"var",
"severity",
"=",
"Array",
".",
"isArray",
"(",
"ruleConfig",
")",
"?",
"ruleConfig",
"[",
"0",
"]",
":",
"ruleConfig",
";",
"if",
"(",
"typeof",
"severity",
"===",
"\"string\"",
")",
"{",
"severity",
"=",
"severity",
".",
"toLowerCase",
"(",
")",
";",
"}",
"return",
"VALID_SEVERITIES",
".",
"indexOf",
"(",
"severity",
")",
"!==",
"-",
"1",
";",
"}"
] |
Checks whether a given config has valid severity or not.
@param {number|string|Array} ruleConfig - The configuration for an individual rule.
@returns {boolean} `true` if the configuration has valid severity.
|
[
"Checks",
"whether",
"a",
"given",
"config",
"has",
"valid",
"severity",
"or",
"not",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/config/config-ops.js#L254-L261
|
|
14,239
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/shell/paramType-file.js
|
function(promise, result, output, isProgress) {
var element = document.createElement("div"); //$NON-NLS-0$
var waitCount = 0;
var successFn = function(file) {
this.callback = function() {
var string = i18nUtil.formatMessage(
messages["WroteMsg"],
typeof(file) === "string" ? file : this.shellPageFileService.computePathString(file)); //$NON-NLS-0$
var writer = new mResultWriters.ShellStringWriter(element);
writer.write(string + "\n"); //$NON-NLS-0$
if (--waitCount !== 0 || isProgress) {
promise.progress(element);
} else {
promise.resolve(element);
}
}.bind(this);
return this;
}.bind(this);
var errorFn = function(file) {
this.callback = function(error) {
var string = i18nUtil.formatMessage(
messages["WriteFailMsg"],
typeof(file) === "string" ? file : this.shellPageFileService.computePathString(file)); //$NON-NLS-0$
string += " [" + error + "]"; //$NON-NLS-1$ //$NON-NLS-0$
var writer = new mResultWriters.ShellStringWriter(element);
writer.write(string + "\n"); //$NON-NLS-0$
if (--waitCount !== 0 || isProgress) {
promise.progress(element);
} else {
promise.resolve(element);
}
}.bind(this);
return this;
}.bind(this);
var destination = output || this.shellPageFileService.getCurrentDirectory();
waitCount++;
this.shellPageFileService.ensureDirectory(null, destination).then(
function(directory) {
waitCount--;
var files = result.getValue();
if (!result.isArray()) {
files = [files];
}
files.forEach(function(file) {
waitCount++;
var pathSegments = file.path.split(this.shellPageFileService.SEPARATOR);
/* normalize instances of '.' and '..' in the path */
var index = 0;
while (index < pathSegments.length) {
var segment = pathSegments[index];
if (segment === ".") { //$NON-NLS-0$
pathSegments.splice(index, 1);
} else if (segment === "..") { //$NON-NLS-0$
if (index === 0) {
/* invalid, destination must be a descendent of the cwd */
errorFn(i18nUtil.formatMessage(messages["WriteFailNotDescendentOfOutputDir"], file.path));
return;
}
pathSegments.splice(index-- - 1, 2);
} else {
index++;
}
}
var writeFile = function(parentNode, fileToWrite, pathSegments) {
var segment = pathSegments[0];
pathSegments.splice(0,1);
var nodeString = this.shellPageFileService.computePathString(parentNode) + this.shellPageFileService.SEPARATOR + segment;
if (pathSegments.length === 0) {
/* attempt to write the new resource */
if (fileToWrite.isDirectory) {
this.shellPageFileService.ensureDirectory(parentNode, segment).then(successFn(nodeString).callback, errorFn(nodeString).callback);
} else {
this.shellPageFileService.ensureFile(parentNode, segment).then(
function(file) {
var writer = new mResultWriters.FileBlobWriter(file, this.shellPageFileService);
writer.addBlob(fileToWrite.blob);
writer.write().then(successFn(file).callback, errorFn(file).callback);
}.bind(this),
errorFn(nodeString).callback
);
}
return;
}
/* more lead-up path segments to go */
this.shellPageFileService.ensureDirectory(parentNode, segment).then(
function(newNode) {
writeFile(newNode, fileToWrite, pathSegments);
},
errorFn(this.shellPageFileService.computePathString(parentNode) + this.shellPageFileService.SEPARATOR + segment).callback
);
}.bind(this);
writeFile(directory, file, pathSegments);
}.bind(this));
}.bind(this),
errorFn(destination).callback
);
}
|
javascript
|
function(promise, result, output, isProgress) {
var element = document.createElement("div"); //$NON-NLS-0$
var waitCount = 0;
var successFn = function(file) {
this.callback = function() {
var string = i18nUtil.formatMessage(
messages["WroteMsg"],
typeof(file) === "string" ? file : this.shellPageFileService.computePathString(file)); //$NON-NLS-0$
var writer = new mResultWriters.ShellStringWriter(element);
writer.write(string + "\n"); //$NON-NLS-0$
if (--waitCount !== 0 || isProgress) {
promise.progress(element);
} else {
promise.resolve(element);
}
}.bind(this);
return this;
}.bind(this);
var errorFn = function(file) {
this.callback = function(error) {
var string = i18nUtil.formatMessage(
messages["WriteFailMsg"],
typeof(file) === "string" ? file : this.shellPageFileService.computePathString(file)); //$NON-NLS-0$
string += " [" + error + "]"; //$NON-NLS-1$ //$NON-NLS-0$
var writer = new mResultWriters.ShellStringWriter(element);
writer.write(string + "\n"); //$NON-NLS-0$
if (--waitCount !== 0 || isProgress) {
promise.progress(element);
} else {
promise.resolve(element);
}
}.bind(this);
return this;
}.bind(this);
var destination = output || this.shellPageFileService.getCurrentDirectory();
waitCount++;
this.shellPageFileService.ensureDirectory(null, destination).then(
function(directory) {
waitCount--;
var files = result.getValue();
if (!result.isArray()) {
files = [files];
}
files.forEach(function(file) {
waitCount++;
var pathSegments = file.path.split(this.shellPageFileService.SEPARATOR);
/* normalize instances of '.' and '..' in the path */
var index = 0;
while (index < pathSegments.length) {
var segment = pathSegments[index];
if (segment === ".") { //$NON-NLS-0$
pathSegments.splice(index, 1);
} else if (segment === "..") { //$NON-NLS-0$
if (index === 0) {
/* invalid, destination must be a descendent of the cwd */
errorFn(i18nUtil.formatMessage(messages["WriteFailNotDescendentOfOutputDir"], file.path));
return;
}
pathSegments.splice(index-- - 1, 2);
} else {
index++;
}
}
var writeFile = function(parentNode, fileToWrite, pathSegments) {
var segment = pathSegments[0];
pathSegments.splice(0,1);
var nodeString = this.shellPageFileService.computePathString(parentNode) + this.shellPageFileService.SEPARATOR + segment;
if (pathSegments.length === 0) {
/* attempt to write the new resource */
if (fileToWrite.isDirectory) {
this.shellPageFileService.ensureDirectory(parentNode, segment).then(successFn(nodeString).callback, errorFn(nodeString).callback);
} else {
this.shellPageFileService.ensureFile(parentNode, segment).then(
function(file) {
var writer = new mResultWriters.FileBlobWriter(file, this.shellPageFileService);
writer.addBlob(fileToWrite.blob);
writer.write().then(successFn(file).callback, errorFn(file).callback);
}.bind(this),
errorFn(nodeString).callback
);
}
return;
}
/* more lead-up path segments to go */
this.shellPageFileService.ensureDirectory(parentNode, segment).then(
function(newNode) {
writeFile(newNode, fileToWrite, pathSegments);
},
errorFn(this.shellPageFileService.computePathString(parentNode) + this.shellPageFileService.SEPARATOR + segment).callback
);
}.bind(this);
writeFile(directory, file, pathSegments);
}.bind(this));
}.bind(this),
errorFn(destination).callback
);
}
|
[
"function",
"(",
"promise",
",",
"result",
",",
"output",
",",
"isProgress",
")",
"{",
"var",
"element",
"=",
"document",
".",
"createElement",
"(",
"\"div\"",
")",
";",
"//$NON-NLS-0$",
"var",
"waitCount",
"=",
"0",
";",
"var",
"successFn",
"=",
"function",
"(",
"file",
")",
"{",
"this",
".",
"callback",
"=",
"function",
"(",
")",
"{",
"var",
"string",
"=",
"i18nUtil",
".",
"formatMessage",
"(",
"messages",
"[",
"\"WroteMsg\"",
"]",
",",
"typeof",
"(",
"file",
")",
"===",
"\"string\"",
"?",
"file",
":",
"this",
".",
"shellPageFileService",
".",
"computePathString",
"(",
"file",
")",
")",
";",
"//$NON-NLS-0$",
"var",
"writer",
"=",
"new",
"mResultWriters",
".",
"ShellStringWriter",
"(",
"element",
")",
";",
"writer",
".",
"write",
"(",
"string",
"+",
"\"\\n\"",
")",
";",
"//$NON-NLS-0$",
"if",
"(",
"--",
"waitCount",
"!==",
"0",
"||",
"isProgress",
")",
"{",
"promise",
".",
"progress",
"(",
"element",
")",
";",
"}",
"else",
"{",
"promise",
".",
"resolve",
"(",
"element",
")",
";",
"}",
"}",
".",
"bind",
"(",
"this",
")",
";",
"return",
"this",
";",
"}",
".",
"bind",
"(",
"this",
")",
";",
"var",
"errorFn",
"=",
"function",
"(",
"file",
")",
"{",
"this",
".",
"callback",
"=",
"function",
"(",
"error",
")",
"{",
"var",
"string",
"=",
"i18nUtil",
".",
"formatMessage",
"(",
"messages",
"[",
"\"WriteFailMsg\"",
"]",
",",
"typeof",
"(",
"file",
")",
"===",
"\"string\"",
"?",
"file",
":",
"this",
".",
"shellPageFileService",
".",
"computePathString",
"(",
"file",
")",
")",
";",
"//$NON-NLS-0$",
"string",
"+=",
"\" [\"",
"+",
"error",
"+",
"\"]\"",
";",
"//$NON-NLS-1$ //$NON-NLS-0$",
"var",
"writer",
"=",
"new",
"mResultWriters",
".",
"ShellStringWriter",
"(",
"element",
")",
";",
"writer",
".",
"write",
"(",
"string",
"+",
"\"\\n\"",
")",
";",
"//$NON-NLS-0$",
"if",
"(",
"--",
"waitCount",
"!==",
"0",
"||",
"isProgress",
")",
"{",
"promise",
".",
"progress",
"(",
"element",
")",
";",
"}",
"else",
"{",
"promise",
".",
"resolve",
"(",
"element",
")",
";",
"}",
"}",
".",
"bind",
"(",
"this",
")",
";",
"return",
"this",
";",
"}",
".",
"bind",
"(",
"this",
")",
";",
"var",
"destination",
"=",
"output",
"||",
"this",
".",
"shellPageFileService",
".",
"getCurrentDirectory",
"(",
")",
";",
"waitCount",
"++",
";",
"this",
".",
"shellPageFileService",
".",
"ensureDirectory",
"(",
"null",
",",
"destination",
")",
".",
"then",
"(",
"function",
"(",
"directory",
")",
"{",
"waitCount",
"--",
";",
"var",
"files",
"=",
"result",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"!",
"result",
".",
"isArray",
"(",
")",
")",
"{",
"files",
"=",
"[",
"files",
"]",
";",
"}",
"files",
".",
"forEach",
"(",
"function",
"(",
"file",
")",
"{",
"waitCount",
"++",
";",
"var",
"pathSegments",
"=",
"file",
".",
"path",
".",
"split",
"(",
"this",
".",
"shellPageFileService",
".",
"SEPARATOR",
")",
";",
"/* normalize instances of '.' and '..' in the path */",
"var",
"index",
"=",
"0",
";",
"while",
"(",
"index",
"<",
"pathSegments",
".",
"length",
")",
"{",
"var",
"segment",
"=",
"pathSegments",
"[",
"index",
"]",
";",
"if",
"(",
"segment",
"===",
"\".\"",
")",
"{",
"//$NON-NLS-0$",
"pathSegments",
".",
"splice",
"(",
"index",
",",
"1",
")",
";",
"}",
"else",
"if",
"(",
"segment",
"===",
"\"..\"",
")",
"{",
"//$NON-NLS-0$",
"if",
"(",
"index",
"===",
"0",
")",
"{",
"/* invalid, destination must be a descendent of the cwd */",
"errorFn",
"(",
"i18nUtil",
".",
"formatMessage",
"(",
"messages",
"[",
"\"WriteFailNotDescendentOfOutputDir\"",
"]",
",",
"file",
".",
"path",
")",
")",
";",
"return",
";",
"}",
"pathSegments",
".",
"splice",
"(",
"index",
"--",
"-",
"1",
",",
"2",
")",
";",
"}",
"else",
"{",
"index",
"++",
";",
"}",
"}",
"var",
"writeFile",
"=",
"function",
"(",
"parentNode",
",",
"fileToWrite",
",",
"pathSegments",
")",
"{",
"var",
"segment",
"=",
"pathSegments",
"[",
"0",
"]",
";",
"pathSegments",
".",
"splice",
"(",
"0",
",",
"1",
")",
";",
"var",
"nodeString",
"=",
"this",
".",
"shellPageFileService",
".",
"computePathString",
"(",
"parentNode",
")",
"+",
"this",
".",
"shellPageFileService",
".",
"SEPARATOR",
"+",
"segment",
";",
"if",
"(",
"pathSegments",
".",
"length",
"===",
"0",
")",
"{",
"/* attempt to write the new resource */",
"if",
"(",
"fileToWrite",
".",
"isDirectory",
")",
"{",
"this",
".",
"shellPageFileService",
".",
"ensureDirectory",
"(",
"parentNode",
",",
"segment",
")",
".",
"then",
"(",
"successFn",
"(",
"nodeString",
")",
".",
"callback",
",",
"errorFn",
"(",
"nodeString",
")",
".",
"callback",
")",
";",
"}",
"else",
"{",
"this",
".",
"shellPageFileService",
".",
"ensureFile",
"(",
"parentNode",
",",
"segment",
")",
".",
"then",
"(",
"function",
"(",
"file",
")",
"{",
"var",
"writer",
"=",
"new",
"mResultWriters",
".",
"FileBlobWriter",
"(",
"file",
",",
"this",
".",
"shellPageFileService",
")",
";",
"writer",
".",
"addBlob",
"(",
"fileToWrite",
".",
"blob",
")",
";",
"writer",
".",
"write",
"(",
")",
".",
"then",
"(",
"successFn",
"(",
"file",
")",
".",
"callback",
",",
"errorFn",
"(",
"file",
")",
".",
"callback",
")",
";",
"}",
".",
"bind",
"(",
"this",
")",
",",
"errorFn",
"(",
"nodeString",
")",
".",
"callback",
")",
";",
"}",
"return",
";",
"}",
"/* more lead-up path segments to go */",
"this",
".",
"shellPageFileService",
".",
"ensureDirectory",
"(",
"parentNode",
",",
"segment",
")",
".",
"then",
"(",
"function",
"(",
"newNode",
")",
"{",
"writeFile",
"(",
"newNode",
",",
"fileToWrite",
",",
"pathSegments",
")",
";",
"}",
",",
"errorFn",
"(",
"this",
".",
"shellPageFileService",
".",
"computePathString",
"(",
"parentNode",
")",
"+",
"this",
".",
"shellPageFileService",
".",
"SEPARATOR",
"+",
"segment",
")",
".",
"callback",
")",
";",
"}",
".",
"bind",
"(",
"this",
")",
";",
"writeFile",
"(",
"directory",
",",
"file",
",",
"pathSegments",
")",
";",
"}",
".",
"bind",
"(",
"this",
")",
")",
";",
"}",
".",
"bind",
"(",
"this",
")",
",",
"errorFn",
"(",
"destination",
")",
".",
"callback",
")",
";",
"}"
] |
This function handles results of this custom type returned from commands.
|
[
"This",
"function",
"handles",
"results",
"of",
"this",
"custom",
"type",
"returned",
"from",
"commands",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/shell/paramType-file.js#L232-L333
|
|
14,240
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/compare/diffParser.js
|
function(hunkRangeNo ){
var lastToken = " "; //$NON-NLS-0$
var startNo = this._hunkRanges[hunkRangeNo][0] + 1;
var endNo = (hunkRangeNo === (this._hunkRanges.length - 1) ) ? this._diffContents.length : this._hunkRanges[hunkRangeNo+1][0];
var oCursor = 0;
var nCursor = 0;
var oBlkStart = this._hunkRanges[hunkRangeNo][1];
var nBlkStart = this._hunkRanges[hunkRangeNo][3];
var lastPlusPos = startNo;
var lastMinusPos = startNo;
for (var i = startNo ; i< endNo ; i++){
if( 0 === this._diffContents[i].length){
continue;
}
var curToken = this._diffContents[i][0];
if(curToken === "\\"){ //$NON-NLS-0$
if( NO_NEW_LINE === this._diffContents[i].substring(0 , this._diffContents[i].length-1) ||
NO_NEW_LINE === this._diffContents[i]){
if(lastToken === "-"){ //$NON-NLS-0$
this._oNewLineAtEnd = false;
} else if(lastToken === " "){ //$NON-NLS-0$
this._nNewLineAtEnd = false;
this._oNewLineAtEnd = false;
} else {
this._nNewLineAtEnd = false;
}
if(i > startNo && this._diffContents[i-1][this._diffContents[i-1].length-1] === "\r"){ //$NON-NLS-0$
this._diffContents[i-1] = this._diffContents[i-1].substring(0 , this._diffContents[i-1].length-1);
}
continue;
}
}
switch(curToken){
case "-": //$NON-NLS-0$
case "+": //$NON-NLS-0$
case " ": //$NON-NLS-0$
break;
default:
continue;
}
if(lastToken !== curToken){
if(curToken === "+"){ //$NON-NLS-0$
lastPlusPos = i;
}
if(curToken === "-"){ //$NON-NLS-0$
lastMinusPos = i;
}
switch(lastToken){
case " ": //$NON-NLS-0$
oBlkStart = this._hunkRanges[hunkRangeNo][1] + oCursor;
nBlkStart = this._hunkRanges[hunkRangeNo][3] + nCursor;
break;
case "-": //$NON-NLS-0$
this._createMinusBlock(oBlkStart , nBlkStart ,this._hunkRanges[hunkRangeNo][1] + oCursor - oBlkStart, lastMinusPos);
break;
case "+": //$NON-NLS-0$
this._createPlusBlock(oBlkStart , nBlkStart ,this._hunkRanges[hunkRangeNo][3] + nCursor - nBlkStart , lastPlusPos);
break;
default:
}
lastToken = curToken;
}
switch(curToken){
case "-": //$NON-NLS-0$
oCursor++;
break;
case "+": //$NON-NLS-0$
nCursor++;
break;
case " ": //$NON-NLS-0$
oCursor++;
nCursor++;
break;
}
}
switch(lastToken){
case "-": //$NON-NLS-0$
this._createMinusBlock(oBlkStart , nBlkStart ,this._hunkRanges[hunkRangeNo][1] + oCursor - oBlkStart, lastMinusPos);
break;
case "+": //$NON-NLS-0$
this._createPlusBlock(oBlkStart , nBlkStart ,this._hunkRanges[hunkRangeNo][3] + nCursor - nBlkStart , lastPlusPos);
break;
}
}
|
javascript
|
function(hunkRangeNo ){
var lastToken = " "; //$NON-NLS-0$
var startNo = this._hunkRanges[hunkRangeNo][0] + 1;
var endNo = (hunkRangeNo === (this._hunkRanges.length - 1) ) ? this._diffContents.length : this._hunkRanges[hunkRangeNo+1][0];
var oCursor = 0;
var nCursor = 0;
var oBlkStart = this._hunkRanges[hunkRangeNo][1];
var nBlkStart = this._hunkRanges[hunkRangeNo][3];
var lastPlusPos = startNo;
var lastMinusPos = startNo;
for (var i = startNo ; i< endNo ; i++){
if( 0 === this._diffContents[i].length){
continue;
}
var curToken = this._diffContents[i][0];
if(curToken === "\\"){ //$NON-NLS-0$
if( NO_NEW_LINE === this._diffContents[i].substring(0 , this._diffContents[i].length-1) ||
NO_NEW_LINE === this._diffContents[i]){
if(lastToken === "-"){ //$NON-NLS-0$
this._oNewLineAtEnd = false;
} else if(lastToken === " "){ //$NON-NLS-0$
this._nNewLineAtEnd = false;
this._oNewLineAtEnd = false;
} else {
this._nNewLineAtEnd = false;
}
if(i > startNo && this._diffContents[i-1][this._diffContents[i-1].length-1] === "\r"){ //$NON-NLS-0$
this._diffContents[i-1] = this._diffContents[i-1].substring(0 , this._diffContents[i-1].length-1);
}
continue;
}
}
switch(curToken){
case "-": //$NON-NLS-0$
case "+": //$NON-NLS-0$
case " ": //$NON-NLS-0$
break;
default:
continue;
}
if(lastToken !== curToken){
if(curToken === "+"){ //$NON-NLS-0$
lastPlusPos = i;
}
if(curToken === "-"){ //$NON-NLS-0$
lastMinusPos = i;
}
switch(lastToken){
case " ": //$NON-NLS-0$
oBlkStart = this._hunkRanges[hunkRangeNo][1] + oCursor;
nBlkStart = this._hunkRanges[hunkRangeNo][3] + nCursor;
break;
case "-": //$NON-NLS-0$
this._createMinusBlock(oBlkStart , nBlkStart ,this._hunkRanges[hunkRangeNo][1] + oCursor - oBlkStart, lastMinusPos);
break;
case "+": //$NON-NLS-0$
this._createPlusBlock(oBlkStart , nBlkStart ,this._hunkRanges[hunkRangeNo][3] + nCursor - nBlkStart , lastPlusPos);
break;
default:
}
lastToken = curToken;
}
switch(curToken){
case "-": //$NON-NLS-0$
oCursor++;
break;
case "+": //$NON-NLS-0$
nCursor++;
break;
case " ": //$NON-NLS-0$
oCursor++;
nCursor++;
break;
}
}
switch(lastToken){
case "-": //$NON-NLS-0$
this._createMinusBlock(oBlkStart , nBlkStart ,this._hunkRanges[hunkRangeNo][1] + oCursor - oBlkStart, lastMinusPos);
break;
case "+": //$NON-NLS-0$
this._createPlusBlock(oBlkStart , nBlkStart ,this._hunkRanges[hunkRangeNo][3] + nCursor - nBlkStart , lastPlusPos);
break;
}
}
|
[
"function",
"(",
"hunkRangeNo",
")",
"{",
"var",
"lastToken",
"=",
"\" \"",
";",
"//$NON-NLS-0$",
"var",
"startNo",
"=",
"this",
".",
"_hunkRanges",
"[",
"hunkRangeNo",
"]",
"[",
"0",
"]",
"+",
"1",
";",
"var",
"endNo",
"=",
"(",
"hunkRangeNo",
"===",
"(",
"this",
".",
"_hunkRanges",
".",
"length",
"-",
"1",
")",
")",
"?",
"this",
".",
"_diffContents",
".",
"length",
":",
"this",
".",
"_hunkRanges",
"[",
"hunkRangeNo",
"+",
"1",
"]",
"[",
"0",
"]",
";",
"var",
"oCursor",
"=",
"0",
";",
"var",
"nCursor",
"=",
"0",
";",
"var",
"oBlkStart",
"=",
"this",
".",
"_hunkRanges",
"[",
"hunkRangeNo",
"]",
"[",
"1",
"]",
";",
"var",
"nBlkStart",
"=",
"this",
".",
"_hunkRanges",
"[",
"hunkRangeNo",
"]",
"[",
"3",
"]",
";",
"var",
"lastPlusPos",
"=",
"startNo",
";",
"var",
"lastMinusPos",
"=",
"startNo",
";",
"for",
"(",
"var",
"i",
"=",
"startNo",
";",
"i",
"<",
"endNo",
";",
"i",
"++",
")",
"{",
"if",
"(",
"0",
"===",
"this",
".",
"_diffContents",
"[",
"i",
"]",
".",
"length",
")",
"{",
"continue",
";",
"}",
"var",
"curToken",
"=",
"this",
".",
"_diffContents",
"[",
"i",
"]",
"[",
"0",
"]",
";",
"if",
"(",
"curToken",
"===",
"\"\\\\\"",
")",
"{",
"//$NON-NLS-0$",
"if",
"(",
"NO_NEW_LINE",
"===",
"this",
".",
"_diffContents",
"[",
"i",
"]",
".",
"substring",
"(",
"0",
",",
"this",
".",
"_diffContents",
"[",
"i",
"]",
".",
"length",
"-",
"1",
")",
"||",
"NO_NEW_LINE",
"===",
"this",
".",
"_diffContents",
"[",
"i",
"]",
")",
"{",
"if",
"(",
"lastToken",
"===",
"\"-\"",
")",
"{",
"//$NON-NLS-0$",
"this",
".",
"_oNewLineAtEnd",
"=",
"false",
";",
"}",
"else",
"if",
"(",
"lastToken",
"===",
"\" \"",
")",
"{",
"//$NON-NLS-0$",
"this",
".",
"_nNewLineAtEnd",
"=",
"false",
";",
"this",
".",
"_oNewLineAtEnd",
"=",
"false",
";",
"}",
"else",
"{",
"this",
".",
"_nNewLineAtEnd",
"=",
"false",
";",
"}",
"if",
"(",
"i",
">",
"startNo",
"&&",
"this",
".",
"_diffContents",
"[",
"i",
"-",
"1",
"]",
"[",
"this",
".",
"_diffContents",
"[",
"i",
"-",
"1",
"]",
".",
"length",
"-",
"1",
"]",
"===",
"\"\\r\"",
")",
"{",
"//$NON-NLS-0$",
"this",
".",
"_diffContents",
"[",
"i",
"-",
"1",
"]",
"=",
"this",
".",
"_diffContents",
"[",
"i",
"-",
"1",
"]",
".",
"substring",
"(",
"0",
",",
"this",
".",
"_diffContents",
"[",
"i",
"-",
"1",
"]",
".",
"length",
"-",
"1",
")",
";",
"}",
"continue",
";",
"}",
"}",
"switch",
"(",
"curToken",
")",
"{",
"case",
"\"-\"",
":",
"//$NON-NLS-0$",
"case",
"\"+\"",
":",
"//$NON-NLS-0$",
"case",
"\" \"",
":",
"//$NON-NLS-0$",
"break",
";",
"default",
":",
"continue",
";",
"}",
"if",
"(",
"lastToken",
"!==",
"curToken",
")",
"{",
"if",
"(",
"curToken",
"===",
"\"+\"",
")",
"{",
"//$NON-NLS-0$",
"lastPlusPos",
"=",
"i",
";",
"}",
"if",
"(",
"curToken",
"===",
"\"-\"",
")",
"{",
"//$NON-NLS-0$",
"lastMinusPos",
"=",
"i",
";",
"}",
"switch",
"(",
"lastToken",
")",
"{",
"case",
"\" \"",
":",
"//$NON-NLS-0$",
"oBlkStart",
"=",
"this",
".",
"_hunkRanges",
"[",
"hunkRangeNo",
"]",
"[",
"1",
"]",
"+",
"oCursor",
";",
"nBlkStart",
"=",
"this",
".",
"_hunkRanges",
"[",
"hunkRangeNo",
"]",
"[",
"3",
"]",
"+",
"nCursor",
";",
"break",
";",
"case",
"\"-\"",
":",
"//$NON-NLS-0$",
"this",
".",
"_createMinusBlock",
"(",
"oBlkStart",
",",
"nBlkStart",
",",
"this",
".",
"_hunkRanges",
"[",
"hunkRangeNo",
"]",
"[",
"1",
"]",
"+",
"oCursor",
"-",
"oBlkStart",
",",
"lastMinusPos",
")",
";",
"break",
";",
"case",
"\"+\"",
":",
"//$NON-NLS-0$",
"this",
".",
"_createPlusBlock",
"(",
"oBlkStart",
",",
"nBlkStart",
",",
"this",
".",
"_hunkRanges",
"[",
"hunkRangeNo",
"]",
"[",
"3",
"]",
"+",
"nCursor",
"-",
"nBlkStart",
",",
"lastPlusPos",
")",
";",
"break",
";",
"default",
":",
"}",
"lastToken",
"=",
"curToken",
";",
"}",
"switch",
"(",
"curToken",
")",
"{",
"case",
"\"-\"",
":",
"//$NON-NLS-0$",
"oCursor",
"++",
";",
"break",
";",
"case",
"\"+\"",
":",
"//$NON-NLS-0$",
"nCursor",
"++",
";",
"break",
";",
"case",
"\" \"",
":",
"//$NON-NLS-0$",
"oCursor",
"++",
";",
"nCursor",
"++",
";",
"break",
";",
"}",
"}",
"switch",
"(",
"lastToken",
")",
"{",
"case",
"\"-\"",
":",
"//$NON-NLS-0$",
"this",
".",
"_createMinusBlock",
"(",
"oBlkStart",
",",
"nBlkStart",
",",
"this",
".",
"_hunkRanges",
"[",
"hunkRangeNo",
"]",
"[",
"1",
"]",
"+",
"oCursor",
"-",
"oBlkStart",
",",
"lastMinusPos",
")",
";",
"break",
";",
"case",
"\"+\"",
":",
"//$NON-NLS-0$",
"this",
".",
"_createPlusBlock",
"(",
"oBlkStart",
",",
"nBlkStart",
",",
"this",
".",
"_hunkRanges",
"[",
"hunkRangeNo",
"]",
"[",
"3",
"]",
"+",
"nCursor",
"-",
"nBlkStart",
",",
"lastPlusPos",
")",
";",
"break",
";",
"}",
"}"
] |
read line by line in a hunk range
|
[
"read",
"line",
"by",
"line",
"in",
"a",
"hunk",
"range"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/compare/diffParser.js#L221-L307
|
|
14,241
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/compare/diffParser.js
|
function(body , retVal){
if( body ){
var number = parseInt(body, 10);
retVal.push( number >= 0 ? number : 1);
} else {
retVal.push(1);
}
}
|
javascript
|
function(body , retVal){
if( body ){
var number = parseInt(body, 10);
retVal.push( number >= 0 ? number : 1);
} else {
retVal.push(1);
}
}
|
[
"function",
"(",
"body",
",",
"retVal",
")",
"{",
"if",
"(",
"body",
")",
"{",
"var",
"number",
"=",
"parseInt",
"(",
"body",
",",
"10",
")",
";",
"retVal",
".",
"push",
"(",
"number",
">=",
"0",
"?",
"number",
":",
"1",
")",
";",
"}",
"else",
"{",
"retVal",
".",
"push",
"(",
"1",
")",
";",
"}",
"}"
] |
In many versions of GNU diff, each range can omit the comma and trailing value s, in which case s defaults to 1.
|
[
"In",
"many",
"versions",
"of",
"GNU",
"diff",
"each",
"range",
"can",
"omit",
"the",
"comma",
"and",
"trailing",
"value",
"s",
"in",
"which",
"case",
"s",
"defaults",
"to",
"1",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/compare/diffParser.js#L394-L401
|
|
14,242
|
eclipse/orion.client
|
modules/orionode/lib/graceful-cluster/graceful-cluster.js
|
checkRestartQueue
|
function checkRestartQueue() {
// Kill one worker only if maximum count are working.
if (restartQueue.length > 0 && listeningWorkersCount === workersCount && !currentRestartingPid) {
var pid = restartQueue.shift();
try {
// Store process id to wait for its finish.
currentRestartingPid = pid;
// Send SIGTERM signal to worker. SIGTERM starts graceful shutdown of worker inside it.
process.kill(pid);
} catch(ex) {
// Reset current pid.
currentRestartingPid = null;
// If no process killed, try next in queue.
process.nextTick(checkRestartQueue);
// Fail silent on 'No such process'. May occur when kill message received after kill initiated but not finished.
if (ex.code !== 'ESRCH') {
throw ex;
}
}
}
}
|
javascript
|
function checkRestartQueue() {
// Kill one worker only if maximum count are working.
if (restartQueue.length > 0 && listeningWorkersCount === workersCount && !currentRestartingPid) {
var pid = restartQueue.shift();
try {
// Store process id to wait for its finish.
currentRestartingPid = pid;
// Send SIGTERM signal to worker. SIGTERM starts graceful shutdown of worker inside it.
process.kill(pid);
} catch(ex) {
// Reset current pid.
currentRestartingPid = null;
// If no process killed, try next in queue.
process.nextTick(checkRestartQueue);
// Fail silent on 'No such process'. May occur when kill message received after kill initiated but not finished.
if (ex.code !== 'ESRCH') {
throw ex;
}
}
}
}
|
[
"function",
"checkRestartQueue",
"(",
")",
"{",
"// Kill one worker only if maximum count are working.",
"if",
"(",
"restartQueue",
".",
"length",
">",
"0",
"&&",
"listeningWorkersCount",
"===",
"workersCount",
"&&",
"!",
"currentRestartingPid",
")",
"{",
"var",
"pid",
"=",
"restartQueue",
".",
"shift",
"(",
")",
";",
"try",
"{",
"// Store process id to wait for its finish.",
"currentRestartingPid",
"=",
"pid",
";",
"// Send SIGTERM signal to worker. SIGTERM starts graceful shutdown of worker inside it.",
"process",
".",
"kill",
"(",
"pid",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"// Reset current pid.",
"currentRestartingPid",
"=",
"null",
";",
"// If no process killed, try next in queue.",
"process",
".",
"nextTick",
"(",
"checkRestartQueue",
")",
";",
"// Fail silent on 'No such process'. May occur when kill message received after kill initiated but not finished.",
"if",
"(",
"ex",
".",
"code",
"!==",
"'ESRCH'",
")",
"{",
"throw",
"ex",
";",
"}",
"}",
"}",
"}"
] |
Prevent killing all workers at same time when restarting.
|
[
"Prevent",
"killing",
"all",
"workers",
"at",
"same",
"time",
"when",
"restarting",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/graceful-cluster/graceful-cluster.js#L54-L78
|
14,243
|
eclipse/orion.client
|
modules/orionode/lib/graceful-cluster/graceful-cluster.js
|
fork
|
function fork() {
cluster.fork().on('message', function(message) {
if (message.cmd === 'restart' && message.pid && restartQueue.indexOf(message.pid) === -1) {
// When worker asks to restart gracefully in cluster, then add it to restart queue.
log('Cluster graceful shutdown: queued. pid=' + message.pid);
restartQueue.push(message.pid);
checkRestartQueue();
}
});
}
|
javascript
|
function fork() {
cluster.fork().on('message', function(message) {
if (message.cmd === 'restart' && message.pid && restartQueue.indexOf(message.pid) === -1) {
// When worker asks to restart gracefully in cluster, then add it to restart queue.
log('Cluster graceful shutdown: queued. pid=' + message.pid);
restartQueue.push(message.pid);
checkRestartQueue();
}
});
}
|
[
"function",
"fork",
"(",
")",
"{",
"cluster",
".",
"fork",
"(",
")",
".",
"on",
"(",
"'message'",
",",
"function",
"(",
"message",
")",
"{",
"if",
"(",
"message",
".",
"cmd",
"===",
"'restart'",
"&&",
"message",
".",
"pid",
"&&",
"restartQueue",
".",
"indexOf",
"(",
"message",
".",
"pid",
")",
"===",
"-",
"1",
")",
"{",
"// When worker asks to restart gracefully in cluster, then add it to restart queue.",
"log",
"(",
"'Cluster graceful shutdown: queued. pid='",
"+",
"message",
".",
"pid",
")",
";",
"restartQueue",
".",
"push",
"(",
"message",
".",
"pid",
")",
";",
"checkRestartQueue",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Create fork with 'on restart' message event listener.
|
[
"Create",
"fork",
"with",
"on",
"restart",
"message",
"event",
"listener",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/graceful-cluster/graceful-cluster.js#L81-L90
|
14,244
|
eclipse/orion.client
|
modules/orionode/lib/graceful-cluster/graceful-cluster.js
|
checkIfNoWorkersAndExit
|
function checkIfNoWorkersAndExit() {
if (!currentWorkersCount) {
log('Cluster graceful shutdown: done.');
if (shutdownTimer) clearTimeout(shutdownTimer);
exitFunction();
} else {
log('Cluster graceful shutdown: wait ' + currentWorkersCount + ' worker' + (currentWorkersCount > 1 ? 's' : '') + '.');
}
}
|
javascript
|
function checkIfNoWorkersAndExit() {
if (!currentWorkersCount) {
log('Cluster graceful shutdown: done.');
if (shutdownTimer) clearTimeout(shutdownTimer);
exitFunction();
} else {
log('Cluster graceful shutdown: wait ' + currentWorkersCount + ' worker' + (currentWorkersCount > 1 ? 's' : '') + '.');
}
}
|
[
"function",
"checkIfNoWorkersAndExit",
"(",
")",
"{",
"if",
"(",
"!",
"currentWorkersCount",
")",
"{",
"log",
"(",
"'Cluster graceful shutdown: done.'",
")",
";",
"if",
"(",
"shutdownTimer",
")",
"clearTimeout",
"(",
"shutdownTimer",
")",
";",
"exitFunction",
"(",
")",
";",
"}",
"else",
"{",
"log",
"(",
"'Cluster graceful shutdown: wait '",
"+",
"currentWorkersCount",
"+",
"' worker'",
"+",
"(",
"currentWorkersCount",
">",
"1",
"?",
"'s'",
":",
"''",
")",
"+",
"'.'",
")",
";",
"}",
"}"
] |
Check if has alive workers and exit.
|
[
"Check",
"if",
"has",
"alive",
"workers",
"and",
"exit",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/graceful-cluster/graceful-cluster.js#L98-L106
|
14,245
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js
|
function(){
/*
* media_query_list
* : S* [media_query [ ',' S* media_query ]* ]?
* ;
*/
var tokenStream = this._tokenStream,
mediaList = [];
this._readWhitespace();
if (tokenStream.peek() === Tokens.IDENT || tokenStream.peek() === Tokens.LPAREN){
mediaList.push(this._media_query());
}
while(tokenStream.match(Tokens.COMMA)){
this._readWhitespace();
mediaList.push(this._media_query());
}
return mediaList;
}
|
javascript
|
function(){
/*
* media_query_list
* : S* [media_query [ ',' S* media_query ]* ]?
* ;
*/
var tokenStream = this._tokenStream,
mediaList = [];
this._readWhitespace();
if (tokenStream.peek() === Tokens.IDENT || tokenStream.peek() === Tokens.LPAREN){
mediaList.push(this._media_query());
}
while(tokenStream.match(Tokens.COMMA)){
this._readWhitespace();
mediaList.push(this._media_query());
}
return mediaList;
}
|
[
"function",
"(",
")",
"{",
"/*\n * media_query_list\n * : S* [media_query [ ',' S* media_query ]* ]?\n * ;\n */",
"var",
"tokenStream",
"=",
"this",
".",
"_tokenStream",
",",
"mediaList",
"=",
"[",
"]",
";",
"this",
".",
"_readWhitespace",
"(",
")",
";",
"if",
"(",
"tokenStream",
".",
"peek",
"(",
")",
"===",
"Tokens",
".",
"IDENT",
"||",
"tokenStream",
".",
"peek",
"(",
")",
"===",
"Tokens",
".",
"LPAREN",
")",
"{",
"mediaList",
".",
"push",
"(",
"this",
".",
"_media_query",
"(",
")",
")",
";",
"}",
"while",
"(",
"tokenStream",
".",
"match",
"(",
"Tokens",
".",
"COMMA",
")",
")",
"{",
"this",
".",
"_readWhitespace",
"(",
")",
";",
"mediaList",
".",
"push",
"(",
"this",
".",
"_media_query",
"(",
")",
")",
";",
"}",
"return",
"mediaList",
";",
"}"
] |
CSS3 Media Queries
|
[
"CSS3",
"Media",
"Queries"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js#L1408-L1427
|
|
14,246
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js
|
function(){
/*
* ruleset
* : selectors_group
* '{' S* declaration? [ ';' S* declaration? ]* '}' S*
* ;
*/
var tokenStream = this._tokenStream,
tt,
selectors;
var node = this.startNode('Rule', tokenStream.curr().range[0], 'body'); //ORION AST generation
/*
* Error Recovery: If even a single selector fails to parse,
* then the entire ruleset should be thrown away.
*/
try {
selectors = this._selectors_group();
} catch (ex){
if (ex instanceof SyntaxError && !this.options.strict){
//fire error event
this.fire({
type: "error",
error: ex,
message: ex.message,
line: ex.line,
col: ex.col
});
//skip over everything until closing brace
tt = tokenStream.advance([Tokens.RBRACE]);
if (tt === Tokens.RBRACE){
//if there's a right brace, the rule is finished so don't do anything
} else {
//otherwise, rethrow the error because it wasn't handled properly
throw ex;
}
} else {
//not a syntax error, rethrow it
throw ex;
}
//trigger parser to continue
return true;
}
//if it got here, all selectors parsed
if (selectors){
this.fire({
type: "startrule",
selectors: selectors,
line: selectors[0].line,
col: selectors[0].col
});
this._readDeclarations(true);
this.fire({
type: "endrule",
selectors: selectors,
line: selectors[0].line,
col: selectors[0].col
});
var rbraceRange = this.findLastTokenRange('RBRACE', node.range[0]); // ORION AST Generation select the RBRACE token
this.endNode(node, rbraceRange[1]); //ORION AST Generation
}
// ORION AST Generation, don't create an empty rule node if no rule selectors found
if (selectors === null){
this.removeNode(node, 'body');
}
return selectors;
}
|
javascript
|
function(){
/*
* ruleset
* : selectors_group
* '{' S* declaration? [ ';' S* declaration? ]* '}' S*
* ;
*/
var tokenStream = this._tokenStream,
tt,
selectors;
var node = this.startNode('Rule', tokenStream.curr().range[0], 'body'); //ORION AST generation
/*
* Error Recovery: If even a single selector fails to parse,
* then the entire ruleset should be thrown away.
*/
try {
selectors = this._selectors_group();
} catch (ex){
if (ex instanceof SyntaxError && !this.options.strict){
//fire error event
this.fire({
type: "error",
error: ex,
message: ex.message,
line: ex.line,
col: ex.col
});
//skip over everything until closing brace
tt = tokenStream.advance([Tokens.RBRACE]);
if (tt === Tokens.RBRACE){
//if there's a right brace, the rule is finished so don't do anything
} else {
//otherwise, rethrow the error because it wasn't handled properly
throw ex;
}
} else {
//not a syntax error, rethrow it
throw ex;
}
//trigger parser to continue
return true;
}
//if it got here, all selectors parsed
if (selectors){
this.fire({
type: "startrule",
selectors: selectors,
line: selectors[0].line,
col: selectors[0].col
});
this._readDeclarations(true);
this.fire({
type: "endrule",
selectors: selectors,
line: selectors[0].line,
col: selectors[0].col
});
var rbraceRange = this.findLastTokenRange('RBRACE', node.range[0]); // ORION AST Generation select the RBRACE token
this.endNode(node, rbraceRange[1]); //ORION AST Generation
}
// ORION AST Generation, don't create an empty rule node if no rule selectors found
if (selectors === null){
this.removeNode(node, 'body');
}
return selectors;
}
|
[
"function",
"(",
")",
"{",
"/*\n * ruleset\n * : selectors_group\n * '{' S* declaration? [ ';' S* declaration? ]* '}' S*\n * ;\n */",
"var",
"tokenStream",
"=",
"this",
".",
"_tokenStream",
",",
"tt",
",",
"selectors",
";",
"var",
"node",
"=",
"this",
".",
"startNode",
"(",
"'Rule'",
",",
"tokenStream",
".",
"curr",
"(",
")",
".",
"range",
"[",
"0",
"]",
",",
"'body'",
")",
";",
"//ORION AST generation",
"/*\n * Error Recovery: If even a single selector fails to parse,\n * then the entire ruleset should be thrown away.\n */",
"try",
"{",
"selectors",
"=",
"this",
".",
"_selectors_group",
"(",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"if",
"(",
"ex",
"instanceof",
"SyntaxError",
"&&",
"!",
"this",
".",
"options",
".",
"strict",
")",
"{",
"//fire error event",
"this",
".",
"fire",
"(",
"{",
"type",
":",
"\"error\"",
",",
"error",
":",
"ex",
",",
"message",
":",
"ex",
".",
"message",
",",
"line",
":",
"ex",
".",
"line",
",",
"col",
":",
"ex",
".",
"col",
"}",
")",
";",
"//skip over everything until closing brace",
"tt",
"=",
"tokenStream",
".",
"advance",
"(",
"[",
"Tokens",
".",
"RBRACE",
"]",
")",
";",
"if",
"(",
"tt",
"===",
"Tokens",
".",
"RBRACE",
")",
"{",
"//if there's a right brace, the rule is finished so don't do anything",
"}",
"else",
"{",
"//otherwise, rethrow the error because it wasn't handled properly",
"throw",
"ex",
";",
"}",
"}",
"else",
"{",
"//not a syntax error, rethrow it",
"throw",
"ex",
";",
"}",
"//trigger parser to continue",
"return",
"true",
";",
"}",
"//if it got here, all selectors parsed",
"if",
"(",
"selectors",
")",
"{",
"this",
".",
"fire",
"(",
"{",
"type",
":",
"\"startrule\"",
",",
"selectors",
":",
"selectors",
",",
"line",
":",
"selectors",
"[",
"0",
"]",
".",
"line",
",",
"col",
":",
"selectors",
"[",
"0",
"]",
".",
"col",
"}",
")",
";",
"this",
".",
"_readDeclarations",
"(",
"true",
")",
";",
"this",
".",
"fire",
"(",
"{",
"type",
":",
"\"endrule\"",
",",
"selectors",
":",
"selectors",
",",
"line",
":",
"selectors",
"[",
"0",
"]",
".",
"line",
",",
"col",
":",
"selectors",
"[",
"0",
"]",
".",
"col",
"}",
")",
";",
"var",
"rbraceRange",
"=",
"this",
".",
"findLastTokenRange",
"(",
"'RBRACE'",
",",
"node",
".",
"range",
"[",
"0",
"]",
")",
";",
"// ORION AST Generation select the RBRACE token",
"this",
".",
"endNode",
"(",
"node",
",",
"rbraceRange",
"[",
"1",
"]",
")",
";",
"//ORION AST Generation",
"}",
"// ORION AST Generation, don't create an empty rule node if no rule selectors found",
"if",
"(",
"selectors",
"===",
"null",
")",
"{",
"this",
".",
"removeNode",
"(",
"node",
",",
"'body'",
")",
";",
"}",
"return",
"selectors",
";",
"}"
] |
Augmented with CSS3 Selectors
|
[
"Augmented",
"with",
"CSS3",
"Selectors"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js#L1990-L2068
|
|
14,247
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js
|
function(checkStart, readMargins){
/*
* Reads the pattern
* S* '{' S* declaration [ ';' S* declaration ]* '}' S*
* or
* S* '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S*
* Note that this is how it is described in CSS3 Paged Media, but is actually incorrect.
* A semicolon is only necessary following a declaration if there's another declaration
* or margin afterwards.
*/
var tokenStream = this._tokenStream,
tt;
this._readWhitespace();
var node = this.startNode('DeclarationBody', this._tokenStream.curr().range[0], 'declarationBody'); // ORION AST Generation
node.declarations = []; // ORION AST Generation
if (checkStart){
tokenStream.mustMatch(Tokens.LBRACE);
}
this._readWhitespace();
try {
while(true){
if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())){
//noop
} else if (this._declaration()){
if (!tokenStream.match(Tokens.SEMICOLON)){
break;
}
} else {
break;
}
//if ((!this._margin() && !this._declaration()) || !tokenStream.match(Tokens.SEMICOLON)){
// break;
//}
this._readWhitespace();
}
tokenStream.mustMatch(Tokens.RBRACE);
this._readWhitespace();
} catch (ex) {
if (ex instanceof SyntaxError && !this.options.strict){
//fire error event
this.fire({
type: "error",
error: ex,
message: ex.message,
line: ex.line,
col: ex.col
});
//see if there's another declaration
tt = tokenStream.advance([Tokens.SEMICOLON, Tokens.RBRACE]);
if (tt === Tokens.SEMICOLON){
//if there's a semicolon, then there might be another declaration
this._readDeclarations(false, readMargins);
} else if (tt !== Tokens.RBRACE){
//if there's a right brace, the rule is finished so don't do anything
//otherwise, rethrow the error because it wasn't handled properly
throw ex;
}
} else {
//not a syntax error, rethrow it
throw ex;
}
}
var rbraceRange = this.findLastTokenRange('RBRACE', node.range[0]); // ORION AST Generation select the RBRACE token
this.endNode(node, rbraceRange[1]); //ORION AST Generation
}
|
javascript
|
function(checkStart, readMargins){
/*
* Reads the pattern
* S* '{' S* declaration [ ';' S* declaration ]* '}' S*
* or
* S* '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S*
* Note that this is how it is described in CSS3 Paged Media, but is actually incorrect.
* A semicolon is only necessary following a declaration if there's another declaration
* or margin afterwards.
*/
var tokenStream = this._tokenStream,
tt;
this._readWhitespace();
var node = this.startNode('DeclarationBody', this._tokenStream.curr().range[0], 'declarationBody'); // ORION AST Generation
node.declarations = []; // ORION AST Generation
if (checkStart){
tokenStream.mustMatch(Tokens.LBRACE);
}
this._readWhitespace();
try {
while(true){
if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())){
//noop
} else if (this._declaration()){
if (!tokenStream.match(Tokens.SEMICOLON)){
break;
}
} else {
break;
}
//if ((!this._margin() && !this._declaration()) || !tokenStream.match(Tokens.SEMICOLON)){
// break;
//}
this._readWhitespace();
}
tokenStream.mustMatch(Tokens.RBRACE);
this._readWhitespace();
} catch (ex) {
if (ex instanceof SyntaxError && !this.options.strict){
//fire error event
this.fire({
type: "error",
error: ex,
message: ex.message,
line: ex.line,
col: ex.col
});
//see if there's another declaration
tt = tokenStream.advance([Tokens.SEMICOLON, Tokens.RBRACE]);
if (tt === Tokens.SEMICOLON){
//if there's a semicolon, then there might be another declaration
this._readDeclarations(false, readMargins);
} else if (tt !== Tokens.RBRACE){
//if there's a right brace, the rule is finished so don't do anything
//otherwise, rethrow the error because it wasn't handled properly
throw ex;
}
} else {
//not a syntax error, rethrow it
throw ex;
}
}
var rbraceRange = this.findLastTokenRange('RBRACE', node.range[0]); // ORION AST Generation select the RBRACE token
this.endNode(node, rbraceRange[1]); //ORION AST Generation
}
|
[
"function",
"(",
"checkStart",
",",
"readMargins",
")",
"{",
"/*\n * Reads the pattern\n * S* '{' S* declaration [ ';' S* declaration ]* '}' S*\n * or\n * S* '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S*\n * Note that this is how it is described in CSS3 Paged Media, but is actually incorrect.\n * A semicolon is only necessary following a declaration if there's another declaration\n * or margin afterwards.\n */",
"var",
"tokenStream",
"=",
"this",
".",
"_tokenStream",
",",
"tt",
";",
"this",
".",
"_readWhitespace",
"(",
")",
";",
"var",
"node",
"=",
"this",
".",
"startNode",
"(",
"'DeclarationBody'",
",",
"this",
".",
"_tokenStream",
".",
"curr",
"(",
")",
".",
"range",
"[",
"0",
"]",
",",
"'declarationBody'",
")",
";",
"// ORION AST Generation",
"node",
".",
"declarations",
"=",
"[",
"]",
";",
"// ORION AST Generation",
"if",
"(",
"checkStart",
")",
"{",
"tokenStream",
".",
"mustMatch",
"(",
"Tokens",
".",
"LBRACE",
")",
";",
"}",
"this",
".",
"_readWhitespace",
"(",
")",
";",
"try",
"{",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"tokenStream",
".",
"match",
"(",
"Tokens",
".",
"SEMICOLON",
")",
"||",
"(",
"readMargins",
"&&",
"this",
".",
"_margin",
"(",
")",
")",
")",
"{",
"//noop",
"}",
"else",
"if",
"(",
"this",
".",
"_declaration",
"(",
")",
")",
"{",
"if",
"(",
"!",
"tokenStream",
".",
"match",
"(",
"Tokens",
".",
"SEMICOLON",
")",
")",
"{",
"break",
";",
"}",
"}",
"else",
"{",
"break",
";",
"}",
"//if ((!this._margin() && !this._declaration()) || !tokenStream.match(Tokens.SEMICOLON)){",
"// break;",
"//}",
"this",
".",
"_readWhitespace",
"(",
")",
";",
"}",
"tokenStream",
".",
"mustMatch",
"(",
"Tokens",
".",
"RBRACE",
")",
";",
"this",
".",
"_readWhitespace",
"(",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"if",
"(",
"ex",
"instanceof",
"SyntaxError",
"&&",
"!",
"this",
".",
"options",
".",
"strict",
")",
"{",
"//fire error event",
"this",
".",
"fire",
"(",
"{",
"type",
":",
"\"error\"",
",",
"error",
":",
"ex",
",",
"message",
":",
"ex",
".",
"message",
",",
"line",
":",
"ex",
".",
"line",
",",
"col",
":",
"ex",
".",
"col",
"}",
")",
";",
"//see if there's another declaration",
"tt",
"=",
"tokenStream",
".",
"advance",
"(",
"[",
"Tokens",
".",
"SEMICOLON",
",",
"Tokens",
".",
"RBRACE",
"]",
")",
";",
"if",
"(",
"tt",
"===",
"Tokens",
".",
"SEMICOLON",
")",
"{",
"//if there's a semicolon, then there might be another declaration",
"this",
".",
"_readDeclarations",
"(",
"false",
",",
"readMargins",
")",
";",
"}",
"else",
"if",
"(",
"tt",
"!==",
"Tokens",
".",
"RBRACE",
")",
"{",
"//if there's a right brace, the rule is finished so don't do anything",
"//otherwise, rethrow the error because it wasn't handled properly",
"throw",
"ex",
";",
"}",
"}",
"else",
"{",
"//not a syntax error, rethrow it",
"throw",
"ex",
";",
"}",
"}",
"var",
"rbraceRange",
"=",
"this",
".",
"findLastTokenRange",
"(",
"'RBRACE'",
",",
"node",
".",
"range",
"[",
"0",
"]",
")",
";",
"// ORION AST Generation select the RBRACE token",
"this",
".",
"endNode",
"(",
"node",
",",
"rbraceRange",
"[",
"1",
"]",
")",
";",
"//ORION AST Generation",
"}"
] |
Not part of CSS grammar, but this pattern occurs frequently
in the official CSS grammar. Split out here to eliminate
duplicate code.
@param {Boolean} checkStart Indicates if the rule should check
for the left brace at the beginning.
@param {Boolean} readMargins Indicates if the rule should check
for margin patterns.
@return {void}
@method _readDeclarations
@private
|
[
"Not",
"part",
"of",
"CSS",
"grammar",
"but",
"this",
"pattern",
"occurs",
"frequently",
"in",
"the",
"official",
"CSS",
"grammar",
".",
"Split",
"out",
"here",
"to",
"eliminate",
"duplicate",
"code",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js#L3244-L3321
|
|
14,248
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js
|
function(){
var tokenStream = this._tokenStream,
ws = "";
while(tokenStream.match(Tokens.S)){
ws += tokenStream.token().value;
}
return ws;
}
|
javascript
|
function(){
var tokenStream = this._tokenStream,
ws = "";
while(tokenStream.match(Tokens.S)){
ws += tokenStream.token().value;
}
return ws;
}
|
[
"function",
"(",
")",
"{",
"var",
"tokenStream",
"=",
"this",
".",
"_tokenStream",
",",
"ws",
"=",
"\"\"",
";",
"while",
"(",
"tokenStream",
".",
"match",
"(",
"Tokens",
".",
"S",
")",
")",
"{",
"ws",
"+=",
"tokenStream",
".",
"token",
"(",
")",
".",
"value",
";",
"}",
"return",
"ws",
";",
"}"
] |
In some cases, you can end up with two white space tokens in a
row. Instead of making a change in every function that looks for
white space, this function is used to match as much white space
as necessary.
@method _readWhitespace
@return {String} The white space if found, empty string if not.
@private
|
[
"In",
"some",
"cases",
"you",
"can",
"end",
"up",
"with",
"two",
"white",
"space",
"tokens",
"in",
"a",
"row",
".",
"Instead",
"of",
"making",
"a",
"change",
"in",
"every",
"function",
"that",
"looks",
"for",
"white",
"space",
"this",
"function",
"is",
"used",
"to",
"match",
"as",
"much",
"white",
"space",
"as",
"necessary",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js#L3332-L3342
|
|
14,249
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js
|
function(token){
throw new SyntaxError("Unexpected token '" + token.value + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol);
}
|
javascript
|
function(token){
throw new SyntaxError("Unexpected token '" + token.value + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol);
}
|
[
"function",
"(",
"token",
")",
"{",
"throw",
"new",
"SyntaxError",
"(",
"\"Unexpected token '\"",
"+",
"token",
".",
"value",
"+",
"\"' at line \"",
"+",
"token",
".",
"startLine",
"+",
"\", col \"",
"+",
"token",
".",
"startCol",
"+",
"\".\"",
",",
"token",
".",
"startLine",
",",
"token",
".",
"startCol",
")",
";",
"}"
] |
Throws an error when an unexpected token is found.
@param {Object} token The token that was found.
@method _unexpectedToken
@return {void}
@private
|
[
"Throws",
"an",
"error",
"when",
"an",
"unexpected",
"token",
"is",
"found",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js#L3352-L3354
|
|
14,250
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js
|
SelectorSubPart
|
function SelectorSubPart(text, type, line, col) {
SyntaxUnit.call(this, text, line, col, Parser.SELECTOR_SUB_PART_TYPE);
/**
* The type of modifier.
* @type String
* @property type
*/
this.type = type;
/**
* Some subparts have arguments, this represents them.
* @type Array
* @property args
*/
this.args = [];
}
|
javascript
|
function SelectorSubPart(text, type, line, col) {
SyntaxUnit.call(this, text, line, col, Parser.SELECTOR_SUB_PART_TYPE);
/**
* The type of modifier.
* @type String
* @property type
*/
this.type = type;
/**
* Some subparts have arguments, this represents them.
* @type Array
* @property args
*/
this.args = [];
}
|
[
"function",
"SelectorSubPart",
"(",
"text",
",",
"type",
",",
"line",
",",
"col",
")",
"{",
"SyntaxUnit",
".",
"call",
"(",
"this",
",",
"text",
",",
"line",
",",
"col",
",",
"Parser",
".",
"SELECTOR_SUB_PART_TYPE",
")",
";",
"/**\n * The type of modifier.\n * @type String\n * @property type\n */",
"this",
".",
"type",
"=",
"type",
";",
"/**\n * Some subparts have arguments, this represents them.\n * @type Array\n * @property args\n */",
"this",
".",
"args",
"=",
"[",
"]",
";",
"}"
] |
Represents a selector modifier string, meaning a class name, element name,
element ID, pseudo rule, etc.
@namespace parserlib.css
@class SelectorSubPart
@extends parserlib.util.SyntaxUnit
@constructor
@param {String} text The text representation of the unit.
@param {String} type The type of selector modifier.
@param {int} line The line of text on which the unit resides.
@param {int} col The column of text on which the unit resides.
|
[
"Represents",
"a",
"selector",
"modifier",
"string",
"meaning",
"a",
"class",
"name",
"element",
"name",
"element",
"ID",
"pseudo",
"rule",
"etc",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js#L4599-L4617
|
14,251
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js
|
function(other) {
var comps = ["a", "b", "c", "d"],
i, len;
for (i=0, len=comps.length; i < len; i++) {
if (this[comps[i]] < other[comps[i]]) {
return -1;
} else if (this[comps[i]] > other[comps[i]]) {
return 1;
}
}
return 0;
}
|
javascript
|
function(other) {
var comps = ["a", "b", "c", "d"],
i, len;
for (i=0, len=comps.length; i < len; i++) {
if (this[comps[i]] < other[comps[i]]) {
return -1;
} else if (this[comps[i]] > other[comps[i]]) {
return 1;
}
}
return 0;
}
|
[
"function",
"(",
"other",
")",
"{",
"var",
"comps",
"=",
"[",
"\"a\"",
",",
"\"b\"",
",",
"\"c\"",
",",
"\"d\"",
"]",
",",
"i",
",",
"len",
";",
"for",
"(",
"i",
"=",
"0",
",",
"len",
"=",
"comps",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
"[",
"comps",
"[",
"i",
"]",
"]",
"<",
"other",
"[",
"comps",
"[",
"i",
"]",
"]",
")",
"{",
"return",
"-",
"1",
";",
"}",
"else",
"if",
"(",
"this",
"[",
"comps",
"[",
"i",
"]",
"]",
">",
"other",
"[",
"comps",
"[",
"i",
"]",
"]",
")",
"{",
"return",
"1",
";",
"}",
"}",
"return",
"0",
";",
"}"
] |
Compare this specificity to another.
@param {Specificity} other The other specificity to compare to.
@return {int} -1 if the other specificity is larger, 1 if smaller, 0 if equal.
@method compare
|
[
"Compare",
"this",
"specificity",
"to",
"another",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js#L4657-L4670
|
|
14,252
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js
|
function(c, startLine, startCol) {
var reader = this._reader,
comparison = c + reader.read(),
tt = Tokens.type(comparison) || Tokens.CHAR;
return this.createToken(tt, comparison, startLine, startCol);
}
|
javascript
|
function(c, startLine, startCol) {
var reader = this._reader,
comparison = c + reader.read(),
tt = Tokens.type(comparison) || Tokens.CHAR;
return this.createToken(tt, comparison, startLine, startCol);
}
|
[
"function",
"(",
"c",
",",
"startLine",
",",
"startCol",
")",
"{",
"var",
"reader",
"=",
"this",
".",
"_reader",
",",
"comparison",
"=",
"c",
"+",
"reader",
".",
"read",
"(",
")",
",",
"tt",
"=",
"Tokens",
".",
"type",
"(",
"comparison",
")",
"||",
"Tokens",
".",
"CHAR",
";",
"return",
"this",
".",
"createToken",
"(",
"tt",
",",
"comparison",
",",
"startLine",
",",
"startCol",
")",
";",
"}"
] |
Produces a comparison token based on the given character
and location in the stream. The next character must be
read and is already known to be an equals sign.
@param {String} c The character for the token.
@param {int} startLine The beginning line for the character.
@param {int} startCol The beginning column for the character.
@return {Object} A token object.
@method comparisonToken
|
[
"Produces",
"a",
"comparison",
"token",
"based",
"on",
"the",
"given",
"character",
"and",
"location",
"in",
"the",
"stream",
".",
"The",
"next",
"character",
"must",
"be",
"read",
"and",
"is",
"already",
"known",
"to",
"be",
"an",
"equals",
"sign",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js#L5209-L5215
|
|
14,253
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js
|
function(first, startLine, startCol) {
var reader = this._reader,
value = this.readNumber(first),
ident,
tt = Tokens.NUMBER,
c = reader.peek();
if (isIdentStart(c)) {
ident = this.readName(reader.read());
value += ident;
if (/^em$|^ex$|^px$|^gd$|^rem$|^vw$|^vh$|^vmax$|^vmin$|^ch$|^cm$|^mm$|^in$|^pt$|^pc$/i.test(ident)) {
tt = Tokens.LENGTH;
} else if (/^deg|^rad$|^grad$|^turn$/i.test(ident)) {
tt = Tokens.ANGLE;
} else if (/^ms$|^s$/i.test(ident)) {
tt = Tokens.TIME;
} else if (/^hz$|^khz$/i.test(ident)) {
tt = Tokens.FREQ;
} else if (/^dpi$|^dpcm$/i.test(ident)) {
tt = Tokens.RESOLUTION;
} else {
tt = Tokens.DIMENSION;
}
} else if (c === "%") {
value += reader.read();
tt = Tokens.PERCENTAGE;
}
return this.createToken(tt, value, startLine, startCol);
}
|
javascript
|
function(first, startLine, startCol) {
var reader = this._reader,
value = this.readNumber(first),
ident,
tt = Tokens.NUMBER,
c = reader.peek();
if (isIdentStart(c)) {
ident = this.readName(reader.read());
value += ident;
if (/^em$|^ex$|^px$|^gd$|^rem$|^vw$|^vh$|^vmax$|^vmin$|^ch$|^cm$|^mm$|^in$|^pt$|^pc$/i.test(ident)) {
tt = Tokens.LENGTH;
} else if (/^deg|^rad$|^grad$|^turn$/i.test(ident)) {
tt = Tokens.ANGLE;
} else if (/^ms$|^s$/i.test(ident)) {
tt = Tokens.TIME;
} else if (/^hz$|^khz$/i.test(ident)) {
tt = Tokens.FREQ;
} else if (/^dpi$|^dpcm$/i.test(ident)) {
tt = Tokens.RESOLUTION;
} else {
tt = Tokens.DIMENSION;
}
} else if (c === "%") {
value += reader.read();
tt = Tokens.PERCENTAGE;
}
return this.createToken(tt, value, startLine, startCol);
}
|
[
"function",
"(",
"first",
",",
"startLine",
",",
"startCol",
")",
"{",
"var",
"reader",
"=",
"this",
".",
"_reader",
",",
"value",
"=",
"this",
".",
"readNumber",
"(",
"first",
")",
",",
"ident",
",",
"tt",
"=",
"Tokens",
".",
"NUMBER",
",",
"c",
"=",
"reader",
".",
"peek",
"(",
")",
";",
"if",
"(",
"isIdentStart",
"(",
"c",
")",
")",
"{",
"ident",
"=",
"this",
".",
"readName",
"(",
"reader",
".",
"read",
"(",
")",
")",
";",
"value",
"+=",
"ident",
";",
"if",
"(",
"/",
"^em$|^ex$|^px$|^gd$|^rem$|^vw$|^vh$|^vmax$|^vmin$|^ch$|^cm$|^mm$|^in$|^pt$|^pc$",
"/",
"i",
".",
"test",
"(",
"ident",
")",
")",
"{",
"tt",
"=",
"Tokens",
".",
"LENGTH",
";",
"}",
"else",
"if",
"(",
"/",
"^deg|^rad$|^grad$|^turn$",
"/",
"i",
".",
"test",
"(",
"ident",
")",
")",
"{",
"tt",
"=",
"Tokens",
".",
"ANGLE",
";",
"}",
"else",
"if",
"(",
"/",
"^ms$|^s$",
"/",
"i",
".",
"test",
"(",
"ident",
")",
")",
"{",
"tt",
"=",
"Tokens",
".",
"TIME",
";",
"}",
"else",
"if",
"(",
"/",
"^hz$|^khz$",
"/",
"i",
".",
"test",
"(",
"ident",
")",
")",
"{",
"tt",
"=",
"Tokens",
".",
"FREQ",
";",
"}",
"else",
"if",
"(",
"/",
"^dpi$|^dpcm$",
"/",
"i",
".",
"test",
"(",
"ident",
")",
")",
"{",
"tt",
"=",
"Tokens",
".",
"RESOLUTION",
";",
"}",
"else",
"{",
"tt",
"=",
"Tokens",
".",
"DIMENSION",
";",
"}",
"}",
"else",
"if",
"(",
"c",
"===",
"\"%\"",
")",
"{",
"value",
"+=",
"reader",
".",
"read",
"(",
")",
";",
"tt",
"=",
"Tokens",
".",
"PERCENTAGE",
";",
"}",
"return",
"this",
".",
"createToken",
"(",
"tt",
",",
"value",
",",
"startLine",
",",
"startCol",
")",
";",
"}"
] |
Produces a number token based on the given character
and location in the stream. This may return a token of
NUMBER, EMS, EXS, LENGTH, ANGLE, TIME, FREQ, DIMENSION,
or PERCENTAGE.
@param {String} first The first character for the token.
@param {int} startLine The beginning line for the character.
@param {int} startCol The beginning column for the character.
@return {Object} A token object.
@method numberToken
|
[
"Produces",
"a",
"number",
"token",
"based",
"on",
"the",
"given",
"character",
"and",
"location",
"in",
"the",
"stream",
".",
"This",
"may",
"return",
"a",
"token",
"of",
"NUMBER",
"EMS",
"EXS",
"LENGTH",
"ANGLE",
"TIME",
"FREQ",
"DIMENSION",
"or",
"PERCENTAGE",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js#L5426-L5457
|
|
14,254
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js
|
function(first, startLine, startCol) {
var value = first + this.readWhitespace();
return this.createToken(Tokens.S, value, startLine, startCol);
}
|
javascript
|
function(first, startLine, startCol) {
var value = first + this.readWhitespace();
return this.createToken(Tokens.S, value, startLine, startCol);
}
|
[
"function",
"(",
"first",
",",
"startLine",
",",
"startCol",
")",
"{",
"var",
"value",
"=",
"first",
"+",
"this",
".",
"readWhitespace",
"(",
")",
";",
"return",
"this",
".",
"createToken",
"(",
"Tokens",
".",
"S",
",",
"value",
",",
"startLine",
",",
"startCol",
")",
";",
"}"
] |
Produces a S token based on the specified information. Since whitespace
may have multiple characters, this consumes all whitespace characters
into a single token.
@param {String} first The first character in the token.
@param {int} startLine The beginning line for the character.
@param {int} startCol The beginning column for the character.
@return {Object} A token object.
@method whitespaceToken
|
[
"Produces",
"a",
"S",
"token",
"based",
"on",
"the",
"specified",
"information",
".",
"Since",
"whitespace",
"may",
"have",
"multiple",
"characters",
"this",
"consumes",
"all",
"whitespace",
"characters",
"into",
"a",
"single",
"token",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js#L5579-L5582
|
|
14,255
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js
|
function(first) {
var reader = this._reader,
url = first || "",
c;
for (c = reader.peek(); c; c = reader.peek()) {
// Note that the grammar at
// https://www.w3.org/TR/CSS2/grammar.html#scanner
// incorrectly includes the backslash character in the
// `url` production, although it is correctly omitted in
// the `baduri1` production.
if (nonascii.test(c) || /^[\-!#$%&*-\[\]-~]$/.test(c)) {
url += c;
reader.read();
} else if (c === "\\") {
if (/^[^\r\n\f]$/.test(reader.peek(2))) {
url += this.readEscape(reader.read(), true);
} else {
break; // bad escape sequence.
}
} else {
break; // bad character
}
}
return url;
}
|
javascript
|
function(first) {
var reader = this._reader,
url = first || "",
c;
for (c = reader.peek(); c; c = reader.peek()) {
// Note that the grammar at
// https://www.w3.org/TR/CSS2/grammar.html#scanner
// incorrectly includes the backslash character in the
// `url` production, although it is correctly omitted in
// the `baduri1` production.
if (nonascii.test(c) || /^[\-!#$%&*-\[\]-~]$/.test(c)) {
url += c;
reader.read();
} else if (c === "\\") {
if (/^[^\r\n\f]$/.test(reader.peek(2))) {
url += this.readEscape(reader.read(), true);
} else {
break; // bad escape sequence.
}
} else {
break; // bad character
}
}
return url;
}
|
[
"function",
"(",
"first",
")",
"{",
"var",
"reader",
"=",
"this",
".",
"_reader",
",",
"url",
"=",
"first",
"||",
"\"\"",
",",
"c",
";",
"for",
"(",
"c",
"=",
"reader",
".",
"peek",
"(",
")",
";",
"c",
";",
"c",
"=",
"reader",
".",
"peek",
"(",
")",
")",
"{",
"// Note that the grammar at",
"// https://www.w3.org/TR/CSS2/grammar.html#scanner",
"// incorrectly includes the backslash character in the",
"// `url` production, although it is correctly omitted in",
"// the `baduri1` production.",
"if",
"(",
"nonascii",
".",
"test",
"(",
"c",
")",
"||",
"/",
"^[\\-!#$%&*-\\[\\]-~]$",
"/",
".",
"test",
"(",
"c",
")",
")",
"{",
"url",
"+=",
"c",
";",
"reader",
".",
"read",
"(",
")",
";",
"}",
"else",
"if",
"(",
"c",
"===",
"\"\\\\\"",
")",
"{",
"if",
"(",
"/",
"^[^\\r\\n\\f]$",
"/",
".",
"test",
"(",
"reader",
".",
"peek",
"(",
"2",
")",
")",
")",
"{",
"url",
"+=",
"this",
".",
"readEscape",
"(",
"reader",
".",
"read",
"(",
")",
",",
"true",
")",
";",
"}",
"else",
"{",
"break",
";",
"// bad escape sequence.",
"}",
"}",
"else",
"{",
"break",
";",
"// bad character",
"}",
"}",
"return",
"url",
";",
"}"
] |
This method never fails, although it may return an empty string.
|
[
"This",
"method",
"never",
"fails",
"although",
"it",
"may",
"return",
"an",
"empty",
"string",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js#L5704-L5730
|
|
14,256
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js
|
SyntaxError
|
function SyntaxError(message, line, col) {
Error.call(this);
this.name = this.constructor.name;
/**
* The column at which the error occurred.
* @type int
* @property col
*/
this.col = col;
/**
* The line at which the error occurred.
* @type int
* @property line
*/
this.line = line;
/**
* The text representation of the unit.
* @type String
* @property text
*/
this.message = message;
}
|
javascript
|
function SyntaxError(message, line, col) {
Error.call(this);
this.name = this.constructor.name;
/**
* The column at which the error occurred.
* @type int
* @property col
*/
this.col = col;
/**
* The line at which the error occurred.
* @type int
* @property line
*/
this.line = line;
/**
* The text representation of the unit.
* @type String
* @property text
*/
this.message = message;
}
|
[
"function",
"SyntaxError",
"(",
"message",
",",
"line",
",",
"col",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"name",
"=",
"this",
".",
"constructor",
".",
"name",
";",
"/**\n * The column at which the error occurred.\n * @type int\n * @property col\n */",
"this",
".",
"col",
"=",
"col",
";",
"/**\n * The line at which the error occurred.\n * @type int\n * @property line\n */",
"this",
".",
"line",
"=",
"line",
";",
"/**\n * The text representation of the unit.\n * @type String\n * @property text\n */",
"this",
".",
"message",
"=",
"message",
";",
"}"
] |
Type to use when a syntax error occurs.
@class SyntaxError
@namespace parserlib.util
@constructor
@param {String} message The error message.
@param {int} line The line at which the error occurred.
@param {int} col The column at which the error occurred.
|
[
"Type",
"to",
"use",
"when",
"a",
"syntax",
"error",
"occurs",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js#L7038-L7063
|
14,257
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js
|
function(index) {
var total = index,
tt;
if (index > 0) {
//TODO: Store 5 somewhere
if (index > 5) {
throw new Error("Too much lookahead.");
}
//get all those tokens
while (total) {
tt = this.get();
total--;
}
//unget all those tokens
while (total < index) {
this.unget();
total++;
}
} else if (index < 0) {
if (this._lt[this._ltIndex+index]) {
tt = this._lt[this._ltIndex+index].type;
} else {
throw new Error("Too much lookbehind.");
}
} else {
tt = this._token.type;
}
return tt;
}
|
javascript
|
function(index) {
var total = index,
tt;
if (index > 0) {
//TODO: Store 5 somewhere
if (index > 5) {
throw new Error("Too much lookahead.");
}
//get all those tokens
while (total) {
tt = this.get();
total--;
}
//unget all those tokens
while (total < index) {
this.unget();
total++;
}
} else if (index < 0) {
if (this._lt[this._ltIndex+index]) {
tt = this._lt[this._ltIndex+index].type;
} else {
throw new Error("Too much lookbehind.");
}
} else {
tt = this._token.type;
}
return tt;
}
|
[
"function",
"(",
"index",
")",
"{",
"var",
"total",
"=",
"index",
",",
"tt",
";",
"if",
"(",
"index",
">",
"0",
")",
"{",
"//TODO: Store 5 somewhere",
"if",
"(",
"index",
">",
"5",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Too much lookahead.\"",
")",
";",
"}",
"//get all those tokens",
"while",
"(",
"total",
")",
"{",
"tt",
"=",
"this",
".",
"get",
"(",
")",
";",
"total",
"--",
";",
"}",
"//unget all those tokens",
"while",
"(",
"total",
"<",
"index",
")",
"{",
"this",
".",
"unget",
"(",
")",
";",
"total",
"++",
";",
"}",
"}",
"else",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"if",
"(",
"this",
".",
"_lt",
"[",
"this",
".",
"_ltIndex",
"+",
"index",
"]",
")",
"{",
"tt",
"=",
"this",
".",
"_lt",
"[",
"this",
".",
"_ltIndex",
"+",
"index",
"]",
".",
"type",
";",
"}",
"else",
"{",
"throw",
"new",
"Error",
"(",
"\"Too much lookbehind.\"",
")",
";",
"}",
"}",
"else",
"{",
"tt",
"=",
"this",
".",
"_token",
".",
"type",
";",
"}",
"return",
"tt",
";",
"}"
] |
Looks ahead a certain number of tokens and returns the token type at
that position. This will throw an error if you lookahead past the
end of input, past the size of the lookahead buffer, or back past
the first token in the lookahead buffer.
@param {int} The index of the token type to retrieve. 0 for the
current token, 1 for the next, -1 for the previous, etc.
@return {int} The token type of the token in the given position.
@method LA
|
[
"Looks",
"ahead",
"a",
"certain",
"number",
"of",
"tokens",
"and",
"returns",
"the",
"token",
"type",
"at",
"that",
"position",
".",
"This",
"will",
"throw",
"an",
"error",
"if",
"you",
"lookahead",
"past",
"the",
"end",
"of",
"input",
"past",
"the",
"size",
"of",
"the",
"lookahead",
"buffer",
"or",
"back",
"past",
"the",
"first",
"token",
"in",
"the",
"lookahead",
"buffer",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js#L7438-L7472
|
|
14,258
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js
|
applyEmbeddedRuleset
|
function applyEmbeddedRuleset(text, ruleset) {
var valueMap,
embedded = text && text.match(embeddedRuleset),
rules = embedded && embedded[1];
if (rules) {
valueMap = {
"true": 2, // true is error
"": 1, // blank is warning
"false": 0, // false is ignore
"info": 3, // ORION allow info severity
"3": 3, // ORION allow info severity
"2": 2, // explicit error
"1": 1, // explicit warning
"0": 0 // explicit ignore
};
rules.toLowerCase().split(",").forEach(function(rule) {
var pair = rule.split(":"),
property = pair[0] || "",
value = pair[1] || "";
ruleset[property.trim()] = valueMap[value.trim()];
});
}
return ruleset;
}
|
javascript
|
function applyEmbeddedRuleset(text, ruleset) {
var valueMap,
embedded = text && text.match(embeddedRuleset),
rules = embedded && embedded[1];
if (rules) {
valueMap = {
"true": 2, // true is error
"": 1, // blank is warning
"false": 0, // false is ignore
"info": 3, // ORION allow info severity
"3": 3, // ORION allow info severity
"2": 2, // explicit error
"1": 1, // explicit warning
"0": 0 // explicit ignore
};
rules.toLowerCase().split(",").forEach(function(rule) {
var pair = rule.split(":"),
property = pair[0] || "",
value = pair[1] || "";
ruleset[property.trim()] = valueMap[value.trim()];
});
}
return ruleset;
}
|
[
"function",
"applyEmbeddedRuleset",
"(",
"text",
",",
"ruleset",
")",
"{",
"var",
"valueMap",
",",
"embedded",
"=",
"text",
"&&",
"text",
".",
"match",
"(",
"embeddedRuleset",
")",
",",
"rules",
"=",
"embedded",
"&&",
"embedded",
"[",
"1",
"]",
";",
"if",
"(",
"rules",
")",
"{",
"valueMap",
"=",
"{",
"\"true\"",
":",
"2",
",",
"// true is error",
"\"\"",
":",
"1",
",",
"// blank is warning",
"\"false\"",
":",
"0",
",",
"// false is ignore",
"\"info\"",
":",
"3",
",",
"// ORION allow info severity",
"\"3\"",
":",
"3",
",",
"// ORION allow info severity",
"\"2\"",
":",
"2",
",",
"// explicit error",
"\"1\"",
":",
"1",
",",
"// explicit warning",
"\"0\"",
":",
"0",
"// explicit ignore",
"}",
";",
"rules",
".",
"toLowerCase",
"(",
")",
".",
"split",
"(",
"\",\"",
")",
".",
"forEach",
"(",
"function",
"(",
"rule",
")",
"{",
"var",
"pair",
"=",
"rule",
".",
"split",
"(",
"\":\"",
")",
",",
"property",
"=",
"pair",
"[",
"0",
"]",
"||",
"\"\"",
",",
"value",
"=",
"pair",
"[",
"1",
"]",
"||",
"\"\"",
";",
"ruleset",
"[",
"property",
".",
"trim",
"(",
")",
"]",
"=",
"valueMap",
"[",
"value",
".",
"trim",
"(",
")",
"]",
";",
"}",
")",
";",
"}",
"return",
"ruleset",
";",
"}"
] |
Returns a ruleset object based on embedded rules.
@param {String} text A string of css containing embedded rules.
@param {Object} ruleset A ruleset object to modify.
@return {Object} A ruleset object.
@method getEmbeddedRuleset
|
[
"Returns",
"a",
"ruleset",
"object",
"based",
"on",
"embedded",
"rules",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js#L7913-L7940
|
14,259
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js
|
Reporter
|
function Reporter(lines, ruleset, allow, ignore) {
"use strict";
/**
* List of messages being reported.
* @property messages
* @type String[]
*/
this.messages = [];
/**
* List of statistics being reported.
* @property stats
* @type String[]
*/
this.stats = [];
/**
* Lines of code being reported on. Used to provide contextual information
* for messages.
* @property lines
* @type String[]
*/
this.lines = lines;
/**
* Information about the rules. Used to determine whether an issue is an
* error or warning.
* @property ruleset
* @type Object
*/
this.ruleset = ruleset;
/**
* Lines with specific rule messages to leave out of the report.
* @property allow
* @type Object
*/
this.allow = allow;
if (!this.allow) {
this.allow = {};
}
/**
* Linesets not to include in the report.
* @property ignore
* @type [][]
*/
this.ignore = ignore;
if (!this.ignore) {
this.ignore = [];
}
}
|
javascript
|
function Reporter(lines, ruleset, allow, ignore) {
"use strict";
/**
* List of messages being reported.
* @property messages
* @type String[]
*/
this.messages = [];
/**
* List of statistics being reported.
* @property stats
* @type String[]
*/
this.stats = [];
/**
* Lines of code being reported on. Used to provide contextual information
* for messages.
* @property lines
* @type String[]
*/
this.lines = lines;
/**
* Information about the rules. Used to determine whether an issue is an
* error or warning.
* @property ruleset
* @type Object
*/
this.ruleset = ruleset;
/**
* Lines with specific rule messages to leave out of the report.
* @property allow
* @type Object
*/
this.allow = allow;
if (!this.allow) {
this.allow = {};
}
/**
* Linesets not to include in the report.
* @property ignore
* @type [][]
*/
this.ignore = ignore;
if (!this.ignore) {
this.ignore = [];
}
}
|
[
"function",
"Reporter",
"(",
"lines",
",",
"ruleset",
",",
"allow",
",",
"ignore",
")",
"{",
"\"use strict\"",
";",
"/**\n * List of messages being reported.\n * @property messages\n * @type String[]\n */",
"this",
".",
"messages",
"=",
"[",
"]",
";",
"/**\n * List of statistics being reported.\n * @property stats\n * @type String[]\n */",
"this",
".",
"stats",
"=",
"[",
"]",
";",
"/**\n * Lines of code being reported on. Used to provide contextual information\n * for messages.\n * @property lines\n * @type String[]\n */",
"this",
".",
"lines",
"=",
"lines",
";",
"/**\n * Information about the rules. Used to determine whether an issue is an\n * error or warning.\n * @property ruleset\n * @type Object\n */",
"this",
".",
"ruleset",
"=",
"ruleset",
";",
"/**\n * Lines with specific rule messages to leave out of the report.\n * @property allow\n * @type Object\n */",
"this",
".",
"allow",
"=",
"allow",
";",
"if",
"(",
"!",
"this",
".",
"allow",
")",
"{",
"this",
".",
"allow",
"=",
"{",
"}",
";",
"}",
"/**\n * Linesets not to include in the report.\n * @property ignore\n * @type [][]\n */",
"this",
".",
"ignore",
"=",
"ignore",
";",
"if",
"(",
"!",
"this",
".",
"ignore",
")",
"{",
"this",
".",
"ignore",
"=",
"[",
"]",
";",
"}",
"}"
] |
An instance of Report is used to report results of the
verification back to the main API.
@class Reporter
@constructor
@param {String[]} lines The text lines of the source.
@param {Object} ruleset The set of rules to work with, including if
they are errors or warnings.
@param {Object} explicitly allowed lines
@param {[][]} ingore list of line ranges to be ignored
|
[
"An",
"instance",
"of",
"Report",
"is",
"used",
"to",
"report",
"results",
"of",
"the",
"verification",
"back",
"to",
"the",
"main",
"API",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js#L8141-L8193
|
14,260
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js
|
function(message, line, col, rule, data) {
"use strict";
var err = {
type : "error",
line : line,
col : col,
message : message,
evidence: this.lines[line-1],
rule : rule || {}
};
if (data) {
err.data = data;
}
this.messages.push(err);
}
|
javascript
|
function(message, line, col, rule, data) {
"use strict";
var err = {
type : "error",
line : line,
col : col,
message : message,
evidence: this.lines[line-1],
rule : rule || {}
};
if (data) {
err.data = data;
}
this.messages.push(err);
}
|
[
"function",
"(",
"message",
",",
"line",
",",
"col",
",",
"rule",
",",
"data",
")",
"{",
"\"use strict\"",
";",
"var",
"err",
"=",
"{",
"type",
":",
"\"error\"",
",",
"line",
":",
"line",
",",
"col",
":",
"col",
",",
"message",
":",
"message",
",",
"evidence",
":",
"this",
".",
"lines",
"[",
"line",
"-",
"1",
"]",
",",
"rule",
":",
"rule",
"||",
"{",
"}",
"}",
";",
"if",
"(",
"data",
")",
"{",
"err",
".",
"data",
"=",
"data",
";",
"}",
"this",
".",
"messages",
".",
"push",
"(",
"err",
")",
";",
"}"
] |
Report an error.
@param {String} message The message to store.
@param {int} line The line number.
@param {int} col The column number.
@param {Object} rule The rule this message relates to.
@param {Object} data An optional object to pass message data through
@method error
ORION Include NLS data in message
|
[
"Report",
"an",
"error",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js#L8210-L8224
|
|
14,261
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js
|
function(message, line, col, rule, data) {
"use strict";
// Check if rule violation should be allowed
if (this.allow.hasOwnProperty(line) && this.allow[line].hasOwnProperty(rule.id)) {
return;
}
var ignore = false;
CSSLint.Util.forEach(this.ignore, function (range) {
if (range[0] <= line && line <= range[1]) {
ignore = true;
}
});
if (ignore) {
return;
}
var t = "info";
if(this.ruleset[rule.id] === 2) {
t = "error";
} else if(this.ruleset[rule.id] === 1) {
t = "warning";
}
var err = {
type : t,
line : line,
col : col,
message : message,
evidence: this.lines[line-1],
rule : rule
};
if(data) {
err.data = data;
}
this.messages.push(err);
}
|
javascript
|
function(message, line, col, rule, data) {
"use strict";
// Check if rule violation should be allowed
if (this.allow.hasOwnProperty(line) && this.allow[line].hasOwnProperty(rule.id)) {
return;
}
var ignore = false;
CSSLint.Util.forEach(this.ignore, function (range) {
if (range[0] <= line && line <= range[1]) {
ignore = true;
}
});
if (ignore) {
return;
}
var t = "info";
if(this.ruleset[rule.id] === 2) {
t = "error";
} else if(this.ruleset[rule.id] === 1) {
t = "warning";
}
var err = {
type : t,
line : line,
col : col,
message : message,
evidence: this.lines[line-1],
rule : rule
};
if(data) {
err.data = data;
}
this.messages.push(err);
}
|
[
"function",
"(",
"message",
",",
"line",
",",
"col",
",",
"rule",
",",
"data",
")",
"{",
"\"use strict\"",
";",
"// Check if rule violation should be allowed",
"if",
"(",
"this",
".",
"allow",
".",
"hasOwnProperty",
"(",
"line",
")",
"&&",
"this",
".",
"allow",
"[",
"line",
"]",
".",
"hasOwnProperty",
"(",
"rule",
".",
"id",
")",
")",
"{",
"return",
";",
"}",
"var",
"ignore",
"=",
"false",
";",
"CSSLint",
".",
"Util",
".",
"forEach",
"(",
"this",
".",
"ignore",
",",
"function",
"(",
"range",
")",
"{",
"if",
"(",
"range",
"[",
"0",
"]",
"<=",
"line",
"&&",
"line",
"<=",
"range",
"[",
"1",
"]",
")",
"{",
"ignore",
"=",
"true",
";",
"}",
"}",
")",
";",
"if",
"(",
"ignore",
")",
"{",
"return",
";",
"}",
"var",
"t",
"=",
"\"info\"",
";",
"if",
"(",
"this",
".",
"ruleset",
"[",
"rule",
".",
"id",
"]",
"===",
"2",
")",
"{",
"t",
"=",
"\"error\"",
";",
"}",
"else",
"if",
"(",
"this",
".",
"ruleset",
"[",
"rule",
".",
"id",
"]",
"===",
"1",
")",
"{",
"t",
"=",
"\"warning\"",
";",
"}",
"var",
"err",
"=",
"{",
"type",
":",
"t",
",",
"line",
":",
"line",
",",
"col",
":",
"col",
",",
"message",
":",
"message",
",",
"evidence",
":",
"this",
".",
"lines",
"[",
"line",
"-",
"1",
"]",
",",
"rule",
":",
"rule",
"}",
";",
"if",
"(",
"data",
")",
"{",
"err",
".",
"data",
"=",
"data",
";",
"}",
"this",
".",
"messages",
".",
"push",
"(",
"err",
")",
";",
"}"
] |
Report an issue.
@param {String} message The message to store.
@param {int} line The line number.
@param {int} col The column number.
@param {Object} rule The rule this message relates to.
@param {Object} data An optional object to pass message data through
@method report
ORION Include NLS data in message, allow info severity
|
[
"Report",
"an",
"issue",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js#L8250-L8286
|
|
14,262
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js
|
function(message, rule) {
"use strict";
this.messages.push({
type : "error",
rollup : true,
message : message,
rule : rule
});
}
|
javascript
|
function(message, rule) {
"use strict";
this.messages.push({
type : "error",
rollup : true,
message : message,
rule : rule
});
}
|
[
"function",
"(",
"message",
",",
"rule",
")",
"{",
"\"use strict\"",
";",
"this",
".",
"messages",
".",
"push",
"(",
"{",
"type",
":",
"\"error\"",
",",
"rollup",
":",
"true",
",",
"message",
":",
"message",
",",
"rule",
":",
"rule",
"}",
")",
";",
"}"
] |
Report some rollup error information.
@param {String} message The message to store.
@param {Object} rule The rule this message relates to.
@method rollupError
|
[
"Report",
"some",
"rollup",
"error",
"information",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js#L8314-L8322
|
|
14,263
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js
|
function(message, rule, data) {
"use strict";
var err = {
type : "warning",
rollup : true,
message : message,
rule : rule
};
if(data) {
err.data = data;
}
this.messages.push(err);
}
|
javascript
|
function(message, rule, data) {
"use strict";
var err = {
type : "warning",
rollup : true,
message : message,
rule : rule
};
if(data) {
err.data = data;
}
this.messages.push(err);
}
|
[
"function",
"(",
"message",
",",
"rule",
",",
"data",
")",
"{",
"\"use strict\"",
";",
"var",
"err",
"=",
"{",
"type",
":",
"\"warning\"",
",",
"rollup",
":",
"true",
",",
"message",
":",
"message",
",",
"rule",
":",
"rule",
"}",
";",
"if",
"(",
"data",
")",
"{",
"err",
".",
"data",
"=",
"data",
";",
"}",
"this",
".",
"messages",
".",
"push",
"(",
"err",
")",
";",
"}"
] |
Report some rollup warning information.
@param {String} message The message to store.
@param {Object} rule The rule this message relates to.
@param {Object} data An optional object to pass message data through
@method rollupWarn
ORION Include NLS data in message
|
[
"Report",
"some",
"rollup",
"warning",
"information",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js#L8332-L8344
|
|
14,264
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js
|
function() {
"use strict";
var ret = "";
if (this.json.length > 0) {
if (this.json.length === 1) {
ret = JSON.stringify(this.json[0]);
} else {
ret = JSON.stringify(this.json);
}
}
return ret;
}
|
javascript
|
function() {
"use strict";
var ret = "";
if (this.json.length > 0) {
if (this.json.length === 1) {
ret = JSON.stringify(this.json[0]);
} else {
ret = JSON.stringify(this.json);
}
}
return ret;
}
|
[
"function",
"(",
")",
"{",
"\"use strict\"",
";",
"var",
"ret",
"=",
"\"\"",
";",
"if",
"(",
"this",
".",
"json",
".",
"length",
">",
"0",
")",
"{",
"if",
"(",
"this",
".",
"json",
".",
"length",
"===",
"1",
")",
"{",
"ret",
"=",
"JSON",
".",
"stringify",
"(",
"this",
".",
"json",
"[",
"0",
"]",
")",
";",
"}",
"else",
"{",
"ret",
"=",
"JSON",
".",
"stringify",
"(",
"this",
".",
"json",
")",
";",
"}",
"}",
"return",
"ret",
";",
"}"
] |
Return content to be printed after all file results.
@return {String} to append after all results
|
[
"Return",
"content",
"to",
"be",
"printed",
"after",
"all",
"file",
"results",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.webtools/web/csslint/csslint.js#L10865-L10876
|
|
14,265
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/compare/diffTreeNavigator.js
|
DiffTreeNavigator
|
function DiffTreeNavigator(charOrWordDiff, oldEditor, newEditor, oldDiffBlockFeeder, newDiffBlockFeeder, curveRuler) {
this._root = {type: "root", children: []}; //$NON-NLS-0$
this._initialized = false;
this.initAll(charOrWordDiff, oldEditor, newEditor, oldDiffBlockFeeder, newDiffBlockFeeder, curveRuler);
}
|
javascript
|
function DiffTreeNavigator(charOrWordDiff, oldEditor, newEditor, oldDiffBlockFeeder, newDiffBlockFeeder, curveRuler) {
this._root = {type: "root", children: []}; //$NON-NLS-0$
this._initialized = false;
this.initAll(charOrWordDiff, oldEditor, newEditor, oldDiffBlockFeeder, newDiffBlockFeeder, curveRuler);
}
|
[
"function",
"DiffTreeNavigator",
"(",
"charOrWordDiff",
",",
"oldEditor",
",",
"newEditor",
",",
"oldDiffBlockFeeder",
",",
"newDiffBlockFeeder",
",",
"curveRuler",
")",
"{",
"this",
".",
"_root",
"=",
"{",
"type",
":",
"\"root\"",
",",
"children",
":",
"[",
"]",
"}",
";",
"//$NON-NLS-0$",
"this",
".",
"_initialized",
"=",
"false",
";",
"this",
".",
"initAll",
"(",
"charOrWordDiff",
",",
"oldEditor",
",",
"newEditor",
",",
"oldDiffBlockFeeder",
",",
"newDiffBlockFeeder",
",",
"curveRuler",
")",
";",
"}"
] |
Creates a new diff tree model.
A diff tree model represents a tree structure of diffs.
The top level children represents all the diff blocks based on lines, where each diff block contains a list of word level diffs.
@name orion.DiffTreeNavigator.DiffTreeNavigator
@class A tree model based iterator component.
@param {list} firstLevelChildren The first level children of the tree root, each item has children and parent property recursively.
@param {Object} options The options object which provides iterate patterns and all call back functions when iteration happens.
|
[
"Creates",
"a",
"new",
"diff",
"tree",
"model",
".",
"A",
"diff",
"tree",
"model",
"represents",
"a",
"tree",
"structure",
"of",
"diffs",
".",
"The",
"top",
"level",
"children",
"represents",
"all",
"the",
"diff",
"blocks",
"based",
"on",
"lines",
"where",
"each",
"diff",
"block",
"contains",
"a",
"list",
"of",
"word",
"level",
"diffs",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/compare/diffTreeNavigator.js#L29-L33
|
14,266
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/compare/diffTreeNavigator.js
|
function(changeIndex) {
var count = 0;
var blockIndex = 0;
if (0 <= changeIndex) {
// iterate through blocks looking for the one that contains
// the change with the specified changeIndex
while (blockIndex < this._root.children.length) {
var numChangesInCurrentBlock = this._root.children[blockIndex].children.length;
if (((count + numChangesInCurrentBlock) - 1) < changeIndex) {
count += numChangesInCurrentBlock; //keep going
} else {
// found block, go to change in block
var changeIndexInBlock = changeIndex - count;
return this.gotoBlock(blockIndex, changeIndexInBlock);
}
blockIndex++;
}
}
}
|
javascript
|
function(changeIndex) {
var count = 0;
var blockIndex = 0;
if (0 <= changeIndex) {
// iterate through blocks looking for the one that contains
// the change with the specified changeIndex
while (blockIndex < this._root.children.length) {
var numChangesInCurrentBlock = this._root.children[blockIndex].children.length;
if (((count + numChangesInCurrentBlock) - 1) < changeIndex) {
count += numChangesInCurrentBlock; //keep going
} else {
// found block, go to change in block
var changeIndexInBlock = changeIndex - count;
return this.gotoBlock(blockIndex, changeIndexInBlock);
}
blockIndex++;
}
}
}
|
[
"function",
"(",
"changeIndex",
")",
"{",
"var",
"count",
"=",
"0",
";",
"var",
"blockIndex",
"=",
"0",
";",
"if",
"(",
"0",
"<=",
"changeIndex",
")",
"{",
"// iterate through blocks looking for the one that contains ",
"// the change with the specified changeIndex",
"while",
"(",
"blockIndex",
"<",
"this",
".",
"_root",
".",
"children",
".",
"length",
")",
"{",
"var",
"numChangesInCurrentBlock",
"=",
"this",
".",
"_root",
".",
"children",
"[",
"blockIndex",
"]",
".",
"children",
".",
"length",
";",
"if",
"(",
"(",
"(",
"count",
"+",
"numChangesInCurrentBlock",
")",
"-",
"1",
")",
"<",
"changeIndex",
")",
"{",
"count",
"+=",
"numChangesInCurrentBlock",
";",
"//keep going",
"}",
"else",
"{",
"// found block, go to change in block",
"var",
"changeIndexInBlock",
"=",
"changeIndex",
"-",
"count",
";",
"return",
"this",
".",
"gotoBlock",
"(",
"blockIndex",
",",
"changeIndexInBlock",
")",
";",
"}",
"blockIndex",
"++",
";",
"}",
"}",
"}"
] |
Goes to the change at the specified changeIndex in the current file.
@param[in] changeIndex The index of the desired change in the current file.
|
[
"Goes",
"to",
"the",
"change",
"at",
"the",
"specified",
"changeIndex",
"in",
"the",
"current",
"file",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/compare/diffTreeNavigator.js#L335-L354
|
|
14,267
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorerNavHandler.js
|
function(e) {
this.iterate(false, false, e.shiftKey, true);
if(!this._ctrlKeyOn(e) && !e.shiftKey){
this.setSelection(this.currentModel(), false, true);
}
e.preventDefault();
return false;
}
|
javascript
|
function(e) {
this.iterate(false, false, e.shiftKey, true);
if(!this._ctrlKeyOn(e) && !e.shiftKey){
this.setSelection(this.currentModel(), false, true);
}
e.preventDefault();
return false;
}
|
[
"function",
"(",
"e",
")",
"{",
"this",
".",
"iterate",
"(",
"false",
",",
"false",
",",
"e",
".",
"shiftKey",
",",
"true",
")",
";",
"if",
"(",
"!",
"this",
".",
"_ctrlKeyOn",
"(",
"e",
")",
"&&",
"!",
"e",
".",
"shiftKey",
")",
"{",
"this",
".",
"setSelection",
"(",
"this",
".",
"currentModel",
"(",
")",
",",
"false",
",",
"true",
")",
";",
"}",
"e",
".",
"preventDefault",
"(",
")",
";",
"return",
"false",
";",
"}"
] |
Up arrow key iterates the current row backward. If control key is on, browser's scroll up behavior takes over. If shift key is on, it toggles the check box and iterates backward.
|
[
"Up",
"arrow",
"key",
"iterates",
"the",
"current",
"row",
"backward",
".",
"If",
"control",
"key",
"is",
"on",
"browser",
"s",
"scroll",
"up",
"behavior",
"takes",
"over",
".",
"If",
"shift",
"key",
"is",
"on",
"it",
"toggles",
"the",
"check",
"box",
"and",
"iterates",
"backward",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorerNavHandler.js#L731-L738
|
|
14,268
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorerNavHandler.js
|
function(e) {
if(this._shouldMoveColumn(e)){
this.moveColumn(null, 1);
e.preventDefault();
return true;
}
var curModel = this._modelIterator.cursor();
if(!curModel){
return false;
}
if(this.isExpandable(curModel)){
if(!this.isExpanded(curModel)){
this.explorer.myTree.expand(curModel);
if (this.explorer.postUserExpand) {
this.explorer.postUserExpand(this.model.getId(curModel));
}
e.preventDefault();
return false;
}
}
}
|
javascript
|
function(e) {
if(this._shouldMoveColumn(e)){
this.moveColumn(null, 1);
e.preventDefault();
return true;
}
var curModel = this._modelIterator.cursor();
if(!curModel){
return false;
}
if(this.isExpandable(curModel)){
if(!this.isExpanded(curModel)){
this.explorer.myTree.expand(curModel);
if (this.explorer.postUserExpand) {
this.explorer.postUserExpand(this.model.getId(curModel));
}
e.preventDefault();
return false;
}
}
}
|
[
"function",
"(",
"e",
")",
"{",
"if",
"(",
"this",
".",
"_shouldMoveColumn",
"(",
"e",
")",
")",
"{",
"this",
".",
"moveColumn",
"(",
"null",
",",
"1",
")",
";",
"e",
".",
"preventDefault",
"(",
")",
";",
"return",
"true",
";",
"}",
"var",
"curModel",
"=",
"this",
".",
"_modelIterator",
".",
"cursor",
"(",
")",
";",
"if",
"(",
"!",
"curModel",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"this",
".",
"isExpandable",
"(",
"curModel",
")",
")",
"{",
"if",
"(",
"!",
"this",
".",
"isExpanded",
"(",
"curModel",
")",
")",
"{",
"this",
".",
"explorer",
".",
"myTree",
".",
"expand",
"(",
"curModel",
")",
";",
"if",
"(",
"this",
".",
"explorer",
".",
"postUserExpand",
")",
"{",
"this",
".",
"explorer",
".",
"postUserExpand",
"(",
"this",
".",
"model",
".",
"getId",
"(",
"curModel",
")",
")",
";",
"}",
"e",
".",
"preventDefault",
"(",
")",
";",
"return",
"false",
";",
"}",
"}",
"}"
] |
Right arrow key expands the current row if it is expandable and collapsed.
|
[
"Right",
"arrow",
"key",
"expands",
"the",
"current",
"row",
"if",
"it",
"is",
"expandable",
"and",
"collapsed",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorerNavHandler.js#L793-L813
|
|
14,269
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorerNavHandler.js
|
function(e) {
if (!e.target.classList.contains("treeTableRow")) return;
if(this.setSelection(this.currentModel(), true, true)) {
e.preventDefault();
}
}
|
javascript
|
function(e) {
if (!e.target.classList.contains("treeTableRow")) return;
if(this.setSelection(this.currentModel(), true, true)) {
e.preventDefault();
}
}
|
[
"function",
"(",
"e",
")",
"{",
"if",
"(",
"!",
"e",
".",
"target",
".",
"classList",
".",
"contains",
"(",
"\"treeTableRow\"",
")",
")",
"return",
";",
"if",
"(",
"this",
".",
"setSelection",
"(",
"this",
".",
"currentModel",
"(",
")",
",",
"true",
",",
"true",
")",
")",
"{",
"e",
".",
"preventDefault",
"(",
")",
";",
"}",
"}"
] |
Space key toggles the check box on the current row if the renderer uses check box
|
[
"Space",
"key",
"toggles",
"the",
"check",
"box",
"on",
"the",
"current",
"row",
"if",
"the",
"renderer",
"uses",
"check",
"box"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorerNavHandler.js#L820-L825
|
|
14,270
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorerNavHandler.js
|
function(e) {
var currentGrid = this.getCurrentGrid(this._modelIterator.cursor());
if(currentGrid){
if(currentGrid.widget){
if(typeof currentGrid.onClick === "function"){ //$NON-NLS-0$
currentGrid.onClick();
} else if(typeof currentGrid.widget.focus === "function"){ //$NON-NLS-0$
currentGrid.widget.focus();
}
} else {
var evt = document.createEvent("MouseEvents"); //$NON-NLS-0$
evt.initMouseEvent("click", true, true, window, //$NON-NLS-0$
0, 0, 0, 0, 0, this._ctrlKeyOn(e), false, false, false, 0, null);
currentGrid.domNode.dispatchEvent(evt);
}
return;
}
var curModel = this._modelIterator.cursor();
if(!curModel){
return;
}
if(this.explorer.renderer.getRowActionElement){
var div = this.explorer.renderer.getRowActionElement(this.model.getId(curModel));
if(div.href){
if(this._ctrlKeyOn(e)){
window.open(urlModifier(div.href));
} else {
window.location.href = urlModifier(div.href);
}
}
}
if(this.explorer.renderer.performRowAction){
this.explorer.renderer.performRowAction(e, curModel);
e.preventDefault();
return false;
}
}
|
javascript
|
function(e) {
var currentGrid = this.getCurrentGrid(this._modelIterator.cursor());
if(currentGrid){
if(currentGrid.widget){
if(typeof currentGrid.onClick === "function"){ //$NON-NLS-0$
currentGrid.onClick();
} else if(typeof currentGrid.widget.focus === "function"){ //$NON-NLS-0$
currentGrid.widget.focus();
}
} else {
var evt = document.createEvent("MouseEvents"); //$NON-NLS-0$
evt.initMouseEvent("click", true, true, window, //$NON-NLS-0$
0, 0, 0, 0, 0, this._ctrlKeyOn(e), false, false, false, 0, null);
currentGrid.domNode.dispatchEvent(evt);
}
return;
}
var curModel = this._modelIterator.cursor();
if(!curModel){
return;
}
if(this.explorer.renderer.getRowActionElement){
var div = this.explorer.renderer.getRowActionElement(this.model.getId(curModel));
if(div.href){
if(this._ctrlKeyOn(e)){
window.open(urlModifier(div.href));
} else {
window.location.href = urlModifier(div.href);
}
}
}
if(this.explorer.renderer.performRowAction){
this.explorer.renderer.performRowAction(e, curModel);
e.preventDefault();
return false;
}
}
|
[
"function",
"(",
"e",
")",
"{",
"var",
"currentGrid",
"=",
"this",
".",
"getCurrentGrid",
"(",
"this",
".",
"_modelIterator",
".",
"cursor",
"(",
")",
")",
";",
"if",
"(",
"currentGrid",
")",
"{",
"if",
"(",
"currentGrid",
".",
"widget",
")",
"{",
"if",
"(",
"typeof",
"currentGrid",
".",
"onClick",
"===",
"\"function\"",
")",
"{",
"//$NON-NLS-0$",
"currentGrid",
".",
"onClick",
"(",
")",
";",
"}",
"else",
"if",
"(",
"typeof",
"currentGrid",
".",
"widget",
".",
"focus",
"===",
"\"function\"",
")",
"{",
"//$NON-NLS-0$",
"currentGrid",
".",
"widget",
".",
"focus",
"(",
")",
";",
"}",
"}",
"else",
"{",
"var",
"evt",
"=",
"document",
".",
"createEvent",
"(",
"\"MouseEvents\"",
")",
";",
"//$NON-NLS-0$",
"evt",
".",
"initMouseEvent",
"(",
"\"click\"",
",",
"true",
",",
"true",
",",
"window",
",",
"//$NON-NLS-0$",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"this",
".",
"_ctrlKeyOn",
"(",
"e",
")",
",",
"false",
",",
"false",
",",
"false",
",",
"0",
",",
"null",
")",
";",
"currentGrid",
".",
"domNode",
".",
"dispatchEvent",
"(",
"evt",
")",
";",
"}",
"return",
";",
"}",
"var",
"curModel",
"=",
"this",
".",
"_modelIterator",
".",
"cursor",
"(",
")",
";",
"if",
"(",
"!",
"curModel",
")",
"{",
"return",
";",
"}",
"if",
"(",
"this",
".",
"explorer",
".",
"renderer",
".",
"getRowActionElement",
")",
"{",
"var",
"div",
"=",
"this",
".",
"explorer",
".",
"renderer",
".",
"getRowActionElement",
"(",
"this",
".",
"model",
".",
"getId",
"(",
"curModel",
")",
")",
";",
"if",
"(",
"div",
".",
"href",
")",
"{",
"if",
"(",
"this",
".",
"_ctrlKeyOn",
"(",
"e",
")",
")",
"{",
"window",
".",
"open",
"(",
"urlModifier",
"(",
"div",
".",
"href",
")",
")",
";",
"}",
"else",
"{",
"window",
".",
"location",
".",
"href",
"=",
"urlModifier",
"(",
"div",
".",
"href",
")",
";",
"}",
"}",
"}",
"if",
"(",
"this",
".",
"explorer",
".",
"renderer",
".",
"performRowAction",
")",
"{",
"this",
".",
"explorer",
".",
"renderer",
".",
"performRowAction",
"(",
"e",
",",
"curModel",
")",
";",
"e",
".",
"preventDefault",
"(",
")",
";",
"return",
"false",
";",
"}",
"}"
] |
Enter key simulates a href call if the current row has an href link rendered. The render has to provide the getRowActionElement function that returns the href DIV.
|
[
"Enter",
"key",
"simulates",
"a",
"href",
"call",
"if",
"the",
"current",
"row",
"has",
"an",
"href",
"link",
"rendered",
".",
"The",
"render",
"has",
"to",
"provide",
"the",
"getRowActionElement",
"function",
"that",
"returns",
"the",
"href",
"DIV",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorerNavHandler.js#L828-L866
|
|
14,271
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorerNavHandler.js
|
function(model) {
var rowDiv = this.getRowDiv(model);
if (this.isExpandable(model) && this.isExpanded(model)) {
this._modelIterator.collapse(model);
this.explorer.myTree.toggle(rowDiv.id); // collapse tree visually
}
rowDiv.classList.remove("checkedRow"); //$NON-NLS-0$
rowDiv.classList.add("disabledNavRow"); //$NON-NLS-0$
this.setIsNotSelectable(model, true);
}
|
javascript
|
function(model) {
var rowDiv = this.getRowDiv(model);
if (this.isExpandable(model) && this.isExpanded(model)) {
this._modelIterator.collapse(model);
this.explorer.myTree.toggle(rowDiv.id); // collapse tree visually
}
rowDiv.classList.remove("checkedRow"); //$NON-NLS-0$
rowDiv.classList.add("disabledNavRow"); //$NON-NLS-0$
this.setIsNotSelectable(model, true);
}
|
[
"function",
"(",
"model",
")",
"{",
"var",
"rowDiv",
"=",
"this",
".",
"getRowDiv",
"(",
"model",
")",
";",
"if",
"(",
"this",
".",
"isExpandable",
"(",
"model",
")",
"&&",
"this",
".",
"isExpanded",
"(",
"model",
")",
")",
"{",
"this",
".",
"_modelIterator",
".",
"collapse",
"(",
"model",
")",
";",
"this",
".",
"explorer",
".",
"myTree",
".",
"toggle",
"(",
"rowDiv",
".",
"id",
")",
";",
"// collapse tree visually",
"}",
"rowDiv",
".",
"classList",
".",
"remove",
"(",
"\"checkedRow\"",
")",
";",
"//$NON-NLS-0$",
"rowDiv",
".",
"classList",
".",
"add",
"(",
"\"disabledNavRow\"",
")",
";",
"//$NON-NLS-0$",
"this",
".",
"setIsNotSelectable",
"(",
"model",
",",
"true",
")",
";",
"}"
] |
Disables the specified model making it no longer respond
to user input such as mouse click or key presses. The
CSS style of corresponding row node is also modified to
reflect its disabled state.
@param {Object} model
|
[
"Disables",
"the",
"specified",
"model",
"making",
"it",
"no",
"longer",
"respond",
"to",
"user",
"input",
"such",
"as",
"mouse",
"click",
"or",
"key",
"presses",
".",
"The",
"CSS",
"style",
"of",
"corresponding",
"row",
"node",
"is",
"also",
"modified",
"to",
"reflect",
"its",
"disabled",
"state",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorerNavHandler.js#L885-L894
|
|
14,272
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorerNavHandler.js
|
function(model) {
var rowDiv = this.getRowDiv(model);
if (rowDiv) {
rowDiv.classList.remove("disabledNavRow"); //$NON-NLS-0$
this.setIsNotSelectable(model, false);
}
}
|
javascript
|
function(model) {
var rowDiv = this.getRowDiv(model);
if (rowDiv) {
rowDiv.classList.remove("disabledNavRow"); //$NON-NLS-0$
this.setIsNotSelectable(model, false);
}
}
|
[
"function",
"(",
"model",
")",
"{",
"var",
"rowDiv",
"=",
"this",
".",
"getRowDiv",
"(",
"model",
")",
";",
"if",
"(",
"rowDiv",
")",
"{",
"rowDiv",
".",
"classList",
".",
"remove",
"(",
"\"disabledNavRow\"",
")",
";",
"//$NON-NLS-0$",
"this",
".",
"setIsNotSelectable",
"(",
"model",
",",
"false",
")",
";",
"}",
"}"
] |
Enables the specified model.
@param {Object} model
|
[
"Enables",
"the",
"specified",
"model",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorerNavHandler.js#L910-L916
|
|
14,273
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorerNavHandler.js
|
function(modelItem, rowDomNode){
var modelId = this._model.getId(modelItem);
this._dict[modelId] = {model: modelItem, rowDomNode: rowDomNode};
}
|
javascript
|
function(modelItem, rowDomNode){
var modelId = this._model.getId(modelItem);
this._dict[modelId] = {model: modelItem, rowDomNode: rowDomNode};
}
|
[
"function",
"(",
"modelItem",
",",
"rowDomNode",
")",
"{",
"var",
"modelId",
"=",
"this",
".",
"_model",
".",
"getId",
"(",
"modelItem",
")",
";",
"this",
".",
"_dict",
"[",
"modelId",
"]",
"=",
"{",
"model",
":",
"modelItem",
",",
"rowDomNode",
":",
"rowDomNode",
"}",
";",
"}"
] |
Add a row to the dictionary.
@param {Object} modelItem The model item object that represent a row.
@param {domNode} rowDomNode optional The DOM node that represent a row. If
|
[
"Add",
"a",
"row",
"to",
"the",
"dictionary",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorerNavHandler.js#L942-L945
|
|
14,274
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorerNavHandler.js
|
function(modelItem, lazyCreate) {
if(!modelItem){
return null;
}
var modelId = this._model.getId(modelItem);
if(this._dict[modelId]){
if(!this._dict[modelId].gridChildren && lazyCreate){
this._dict[modelId].gridChildren = [];
}
return this._dict[modelId].gridChildren;
}
return null;
}
|
javascript
|
function(modelItem, lazyCreate) {
if(!modelItem){
return null;
}
var modelId = this._model.getId(modelItem);
if(this._dict[modelId]){
if(!this._dict[modelId].gridChildren && lazyCreate){
this._dict[modelId].gridChildren = [];
}
return this._dict[modelId].gridChildren;
}
return null;
}
|
[
"function",
"(",
"modelItem",
",",
"lazyCreate",
")",
"{",
"if",
"(",
"!",
"modelItem",
")",
"{",
"return",
"null",
";",
"}",
"var",
"modelId",
"=",
"this",
".",
"_model",
".",
"getId",
"(",
"modelItem",
")",
";",
"if",
"(",
"this",
".",
"_dict",
"[",
"modelId",
"]",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_dict",
"[",
"modelId",
"]",
".",
"gridChildren",
"&&",
"lazyCreate",
")",
"{",
"this",
".",
"_dict",
"[",
"modelId",
"]",
".",
"gridChildren",
"=",
"[",
"]",
";",
"}",
"return",
"this",
".",
"_dict",
"[",
"modelId",
"]",
".",
"gridChildren",
";",
"}",
"return",
"null",
";",
"}"
] |
Get the grid navigation holder from a row navigation model.
@param {Object} modelItem The model item object that represent a row.
@returns {Array} The .gridChildren property of the value keyed by the model id.
|
[
"Get",
"the",
"grid",
"navigation",
"holder",
"from",
"a",
"row",
"navigation",
"model",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorerNavHandler.js#L961-L973
|
|
14,275
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorerNavHandler.js
|
function(modelItem) {
if(!modelItem){
return null;
}
var modelId = this._model.getId(modelItem);
if(this._dict[modelId]){
this._dict[modelId].gridChildren = null;
}
}
|
javascript
|
function(modelItem) {
if(!modelItem){
return null;
}
var modelId = this._model.getId(modelItem);
if(this._dict[modelId]){
this._dict[modelId].gridChildren = null;
}
}
|
[
"function",
"(",
"modelItem",
")",
"{",
"if",
"(",
"!",
"modelItem",
")",
"{",
"return",
"null",
";",
"}",
"var",
"modelId",
"=",
"this",
".",
"_model",
".",
"getId",
"(",
"modelItem",
")",
";",
"if",
"(",
"this",
".",
"_dict",
"[",
"modelId",
"]",
")",
"{",
"this",
".",
"_dict",
"[",
"modelId",
"]",
".",
"gridChildren",
"=",
"null",
";",
"}",
"}"
] |
Initialize the grid navigation holder to null.
@param {Object} modelItem The model item object that represent a row.
|
[
"Initialize",
"the",
"grid",
"navigation",
"holder",
"to",
"null",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorerNavHandler.js#L979-L987
|
|
14,276
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/fields.js
|
BlankField
|
function BlankField(type, options) {
Field.call(this, type, options);
this.element = util.createElement(this.document, 'div');
this.onFieldChange = util.createEvent('BlankField.onFieldChange');
}
|
javascript
|
function BlankField(type, options) {
Field.call(this, type, options);
this.element = util.createElement(this.document, 'div');
this.onFieldChange = util.createEvent('BlankField.onFieldChange');
}
|
[
"function",
"BlankField",
"(",
"type",
",",
"options",
")",
"{",
"Field",
".",
"call",
"(",
"this",
",",
"type",
",",
"options",
")",
";",
"this",
".",
"element",
"=",
"util",
".",
"createElement",
"(",
"this",
".",
"document",
",",
"'div'",
")",
";",
"this",
".",
"onFieldChange",
"=",
"util",
".",
"createEvent",
"(",
"'BlankField.onFieldChange'",
")",
";",
"}"
] |
For use with delegate types that do not yet have anything to resolve to.
BlankFields are not for general use.
|
[
"For",
"use",
"with",
"delegate",
"types",
"that",
"do",
"not",
"yet",
"have",
"anything",
"to",
"resolve",
"to",
".",
"BlankFields",
"are",
"not",
"for",
"general",
"use",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/ui/fields.js#L226-L232
|
14,277
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/progress.js
|
ProgressService
|
function ProgressService(serviceRegistry, operationsClient, commandRegistry, progressMonitorClass, preferenceService){
this._serviceRegistry = serviceRegistry;
this._serviceRegistration = serviceRegistry.registerService("orion.page.progress", this); //$NON-NLS-0$
this._commandRegistry = commandRegistry;
this._operationsClient = operationsClient;
this._operations = {};
this._operationDeferrds = {};
this._operationsIndex = 0;
this._lastOperation = null;
this._lastIconClass = null;
this._progressMonitorClass = progressMonitorClass;
this._preferenceService = preferenceService;
}
|
javascript
|
function ProgressService(serviceRegistry, operationsClient, commandRegistry, progressMonitorClass, preferenceService){
this._serviceRegistry = serviceRegistry;
this._serviceRegistration = serviceRegistry.registerService("orion.page.progress", this); //$NON-NLS-0$
this._commandRegistry = commandRegistry;
this._operationsClient = operationsClient;
this._operations = {};
this._operationDeferrds = {};
this._operationsIndex = 0;
this._lastOperation = null;
this._lastIconClass = null;
this._progressMonitorClass = progressMonitorClass;
this._preferenceService = preferenceService;
}
|
[
"function",
"ProgressService",
"(",
"serviceRegistry",
",",
"operationsClient",
",",
"commandRegistry",
",",
"progressMonitorClass",
",",
"preferenceService",
")",
"{",
"this",
".",
"_serviceRegistry",
"=",
"serviceRegistry",
";",
"this",
".",
"_serviceRegistration",
"=",
"serviceRegistry",
".",
"registerService",
"(",
"\"orion.page.progress\"",
",",
"this",
")",
";",
"//$NON-NLS-0$ ",
"this",
".",
"_commandRegistry",
"=",
"commandRegistry",
";",
"this",
".",
"_operationsClient",
"=",
"operationsClient",
";",
"this",
".",
"_operations",
"=",
"{",
"}",
";",
"this",
".",
"_operationDeferrds",
"=",
"{",
"}",
";",
"this",
".",
"_operationsIndex",
"=",
"0",
";",
"this",
".",
"_lastOperation",
"=",
"null",
";",
"this",
".",
"_lastIconClass",
"=",
"null",
";",
"this",
".",
"_progressMonitorClass",
"=",
"progressMonitorClass",
";",
"this",
".",
"_preferenceService",
"=",
"preferenceService",
";",
"}"
] |
Service for tracking operations changes
@class Service for tracking operations changes
@name orion.progress.ProgressService
@param {orion.serviceregistry.ServiceRegistry} serviceRegistry
@param {orion.operationsclient.OperationsClient} operationsClient
|
[
"Service",
"for",
"tracking",
"operations",
"changes"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/progress.js#L155-L167
|
14,278
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/gcli/gcli/cli.js
|
isSimple
|
function isSimple(typed) {
for (var i = 0; i < typed.length; i++) {
var c = typed.charAt(i);
if (c === ' ' || c === '"' || c === '\'' ||
c === '{' || c === '}' || c === '\\') {
return false;
}
}
return true;
}
|
javascript
|
function isSimple(typed) {
for (var i = 0; i < typed.length; i++) {
var c = typed.charAt(i);
if (c === ' ' || c === '"' || c === '\'' ||
c === '{' || c === '}' || c === '\\') {
return false;
}
}
return true;
}
|
[
"function",
"isSimple",
"(",
"typed",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"typed",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"c",
"=",
"typed",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"c",
"===",
"' '",
"||",
"c",
"===",
"'\"'",
"||",
"c",
"===",
"'\\''",
"||",
"c",
"===",
"'{'",
"||",
"c",
"===",
"'}'",
"||",
"c",
"===",
"'\\\\'",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
If the input has no spaces, quotes, braces or escapes,
we can take the fast track.
|
[
"If",
"the",
"input",
"has",
"no",
"spaces",
"quotes",
"braces",
"or",
"escapes",
"we",
"can",
"take",
"the",
"fast",
"track",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/gcli/gcli/cli.js#L1519-L1528
|
14,279
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-else-return.js
|
naiveHasReturn
|
function naiveHasReturn(node) {
if (node.type === "BlockStatement") {
var body = node.body,
lastChildNode = body[body.length - 1];
return lastChildNode && checkForReturn(lastChildNode);
}
return checkForReturn(node);
}
|
javascript
|
function naiveHasReturn(node) {
if (node.type === "BlockStatement") {
var body = node.body,
lastChildNode = body[body.length - 1];
return lastChildNode && checkForReturn(lastChildNode);
}
return checkForReturn(node);
}
|
[
"function",
"naiveHasReturn",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"type",
"===",
"\"BlockStatement\"",
")",
"{",
"var",
"body",
"=",
"node",
".",
"body",
",",
"lastChildNode",
"=",
"body",
"[",
"body",
".",
"length",
"-",
"1",
"]",
";",
"return",
"lastChildNode",
"&&",
"checkForReturn",
"(",
"lastChildNode",
")",
";",
"}",
"return",
"checkForReturn",
"(",
"node",
")",
";",
"}"
] |
Naive return checking, does not iterate through the whole
BlockStatement because we make the assumption that the ReturnStatement
will be the last node in the body of the BlockStatement.
@param {Node} node The consequent/alternate node
@returns {boolean} True if it has a return
|
[
"Naive",
"return",
"checking",
"does",
"not",
"iterate",
"through",
"the",
"whole",
"BlockStatement",
"because",
"we",
"make",
"the",
"assumption",
"that",
"the",
"ReturnStatement",
"will",
"be",
"the",
"last",
"node",
"in",
"the",
"body",
"of",
"the",
"BlockStatement",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-else-return.js#L51-L59
|
14,280
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/config/rules.js
|
importPlugin
|
function importPlugin(pluginRules, pluginName) {
Object.keys(pluginRules).forEach(function(ruleId) {
var qualifiedRuleId = pluginName + "/" + ruleId,
rule = pluginRules[ruleId];
define(qualifiedRuleId, rule);
});
}
|
javascript
|
function importPlugin(pluginRules, pluginName) {
Object.keys(pluginRules).forEach(function(ruleId) {
var qualifiedRuleId = pluginName + "/" + ruleId,
rule = pluginRules[ruleId];
define(qualifiedRuleId, rule);
});
}
|
[
"function",
"importPlugin",
"(",
"pluginRules",
",",
"pluginName",
")",
"{",
"Object",
".",
"keys",
"(",
"pluginRules",
")",
".",
"forEach",
"(",
"function",
"(",
"ruleId",
")",
"{",
"var",
"qualifiedRuleId",
"=",
"pluginName",
"+",
"\"/\"",
"+",
"ruleId",
",",
"rule",
"=",
"pluginRules",
"[",
"ruleId",
"]",
";",
"define",
"(",
"qualifiedRuleId",
",",
"rule",
")",
";",
"}",
")",
";",
"}"
] |
Registers all given rules of a plugin.
@param {Object} pluginRules A key/value map of rule definitions.
@param {string} pluginName The name of the plugin without prefix (`eslint-plugin-`).
@returns {void}
|
[
"Registers",
"all",
"given",
"rules",
"of",
"a",
"plugin",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/config/rules.js#L52-L59
|
14,281
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/javascript/javascriptProject.js
|
_updateMap
|
function _updateMap(arr, state) {
if(Array.isArray(arr)) {
arr.forEach(function(file) {
var f, toQ, toN, n;
switch(state) {
case 'onCreated': {
n = file.result ? file.result.Name : undefined;
f = file.result ? file.result.Location : undefined;
break;
}
case 'onDeleted': {
f = file.deleteLocation;
n = _shortName(file.deleteLocation);
break;
}
case 'onModified': {
n = _shortName(file);
f = file;
break;
}
case 'onMoved': {
toQ = file.result ? file.result.Location : undefined;
toN = file.result ? file.result.Name : undefined;
n = _shortName(file.source);
f = file.source;
break;
}
}
delete this.map[f];
_handle.call(this, state, this, f, n, toQ, toN);
}.bind(this));
}
}
|
javascript
|
function _updateMap(arr, state) {
if(Array.isArray(arr)) {
arr.forEach(function(file) {
var f, toQ, toN, n;
switch(state) {
case 'onCreated': {
n = file.result ? file.result.Name : undefined;
f = file.result ? file.result.Location : undefined;
break;
}
case 'onDeleted': {
f = file.deleteLocation;
n = _shortName(file.deleteLocation);
break;
}
case 'onModified': {
n = _shortName(file);
f = file;
break;
}
case 'onMoved': {
toQ = file.result ? file.result.Location : undefined;
toN = file.result ? file.result.Name : undefined;
n = _shortName(file.source);
f = file.source;
break;
}
}
delete this.map[f];
_handle.call(this, state, this, f, n, toQ, toN);
}.bind(this));
}
}
|
[
"function",
"_updateMap",
"(",
"arr",
",",
"state",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"arr",
")",
")",
"{",
"arr",
".",
"forEach",
"(",
"function",
"(",
"file",
")",
"{",
"var",
"f",
",",
"toQ",
",",
"toN",
",",
"n",
";",
"switch",
"(",
"state",
")",
"{",
"case",
"'onCreated'",
":",
"{",
"n",
"=",
"file",
".",
"result",
"?",
"file",
".",
"result",
".",
"Name",
":",
"undefined",
";",
"f",
"=",
"file",
".",
"result",
"?",
"file",
".",
"result",
".",
"Location",
":",
"undefined",
";",
"break",
";",
"}",
"case",
"'onDeleted'",
":",
"{",
"f",
"=",
"file",
".",
"deleteLocation",
";",
"n",
"=",
"_shortName",
"(",
"file",
".",
"deleteLocation",
")",
";",
"break",
";",
"}",
"case",
"'onModified'",
":",
"{",
"n",
"=",
"_shortName",
"(",
"file",
")",
";",
"f",
"=",
"file",
";",
"break",
";",
"}",
"case",
"'onMoved'",
":",
"{",
"toQ",
"=",
"file",
".",
"result",
"?",
"file",
".",
"result",
".",
"Location",
":",
"undefined",
";",
"toN",
"=",
"file",
".",
"result",
"?",
"file",
".",
"result",
".",
"Name",
":",
"undefined",
";",
"n",
"=",
"_shortName",
"(",
"file",
".",
"source",
")",
";",
"f",
"=",
"file",
".",
"source",
";",
"break",
";",
"}",
"}",
"delete",
"this",
".",
"map",
"[",
"f",
"]",
";",
"_handle",
".",
"call",
"(",
"this",
",",
"state",
",",
"this",
",",
"f",
",",
"n",
",",
"toQ",
",",
"toN",
")",
";",
"}",
".",
"bind",
"(",
"this",
")",
")",
";",
"}",
"}"
] |
Update the backing map
@param {Array.<String>} arr The array to walk
@param {String} state The state, one of: onModified, onDeleted, onCreated
|
[
"Update",
"the",
"backing",
"map"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/javascript/javascriptProject.js#L862-L894
|
14,282
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/searchClient.js
|
Searcher
|
function Searcher(options) {
this._registry= options.serviceRegistry;
this._commandService = options.commandService;
this._fileClient = options.fileService;
//TODO clean up the search client API. Make any helper private
this._registry.registerService("orion.core.search.client", this); //$NON-NLS-1$
}
|
javascript
|
function Searcher(options) {
this._registry= options.serviceRegistry;
this._commandService = options.commandService;
this._fileClient = options.fileService;
//TODO clean up the search client API. Make any helper private
this._registry.registerService("orion.core.search.client", this); //$NON-NLS-1$
}
|
[
"function",
"Searcher",
"(",
"options",
")",
"{",
"this",
".",
"_registry",
"=",
"options",
".",
"serviceRegistry",
";",
"this",
".",
"_commandService",
"=",
"options",
".",
"commandService",
";",
"this",
".",
"_fileClient",
"=",
"options",
".",
"fileService",
";",
"//TODO clean up the search client API. Make any helper private",
"this",
".",
"_registry",
".",
"registerService",
"(",
"\"orion.core.search.client\"",
",",
"this",
")",
";",
"//$NON-NLS-1$",
"}"
] |
Creates a new search client.
@param {Object} options The options object
@param {orion.serviceregistry.ServiceRegistry} options.serviceRegistry The service registry
@name orion.searchClient.Searcher
@class Provides API for searching the workspace.
|
[
"Creates",
"a",
"new",
"search",
"client",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/searchClient.js#L30-L36
|
14,283
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/searchClient.js
|
function(meta, useParentLocation){
var locationName = "";
var noneRootMeta = null;
this._setLocationbyURL(meta);
this._searchRootLocation = meta.WorkspaceLocation || this._fileClient.fileServiceRootURL(meta.Location);
if(useParentLocation && meta && meta.Parents && meta.Parents.length > 0){
if(useParentLocation.index === "last"){
noneRootMeta = meta.Parents[meta.Parents.length-1];
} else {
noneRootMeta = meta.Parents[0];
}
} else {
noneRootMeta = this._getNoneRootMeta(meta);
}
if(noneRootMeta){
this.setLocationbyURL(noneRootMeta.Location);
locationName = noneRootMeta.Name;
this._childrenLocation = noneRootMeta.ChildrenLocation;
} else if(meta){
this.setLocationbyURL(this._searchRootLocation);
locationName = this._fileClient.fileServiceName(meta.Location);
this._childrenLocation = meta.ChildrenLocation;
}
var searchInputDom = lib.node("search"); //$NON-NLS-0$
if(!locationName){
locationName = "";
}
this._searchLocationName = locationName;
if(searchInputDom && searchInputDom.placeholder){
searchInputDom.value = "";
var placeHolder = i18nUtil.formatMessage(messages["Search ${0}"], locationName);
if(placeHolder.length > 30){
searchInputDom.placeholder = placeHolder.substring(0, 27) + "..."; //$NON-NLS-0$
} else {
searchInputDom.placeholder = i18nUtil.formatMessage(messages["Search ${0}"], locationName);
}
}
if(searchInputDom && searchInputDom.title){
searchInputDom.title = messages["TypeKeyOrWildCard"] + locationName;
}
}
|
javascript
|
function(meta, useParentLocation){
var locationName = "";
var noneRootMeta = null;
this._setLocationbyURL(meta);
this._searchRootLocation = meta.WorkspaceLocation || this._fileClient.fileServiceRootURL(meta.Location);
if(useParentLocation && meta && meta.Parents && meta.Parents.length > 0){
if(useParentLocation.index === "last"){
noneRootMeta = meta.Parents[meta.Parents.length-1];
} else {
noneRootMeta = meta.Parents[0];
}
} else {
noneRootMeta = this._getNoneRootMeta(meta);
}
if(noneRootMeta){
this.setLocationbyURL(noneRootMeta.Location);
locationName = noneRootMeta.Name;
this._childrenLocation = noneRootMeta.ChildrenLocation;
} else if(meta){
this.setLocationbyURL(this._searchRootLocation);
locationName = this._fileClient.fileServiceName(meta.Location);
this._childrenLocation = meta.ChildrenLocation;
}
var searchInputDom = lib.node("search"); //$NON-NLS-0$
if(!locationName){
locationName = "";
}
this._searchLocationName = locationName;
if(searchInputDom && searchInputDom.placeholder){
searchInputDom.value = "";
var placeHolder = i18nUtil.formatMessage(messages["Search ${0}"], locationName);
if(placeHolder.length > 30){
searchInputDom.placeholder = placeHolder.substring(0, 27) + "..."; //$NON-NLS-0$
} else {
searchInputDom.placeholder = i18nUtil.formatMessage(messages["Search ${0}"], locationName);
}
}
if(searchInputDom && searchInputDom.title){
searchInputDom.title = messages["TypeKeyOrWildCard"] + locationName;
}
}
|
[
"function",
"(",
"meta",
",",
"useParentLocation",
")",
"{",
"var",
"locationName",
"=",
"\"\"",
";",
"var",
"noneRootMeta",
"=",
"null",
";",
"this",
".",
"_setLocationbyURL",
"(",
"meta",
")",
";",
"this",
".",
"_searchRootLocation",
"=",
"meta",
".",
"WorkspaceLocation",
"||",
"this",
".",
"_fileClient",
".",
"fileServiceRootURL",
"(",
"meta",
".",
"Location",
")",
";",
"if",
"(",
"useParentLocation",
"&&",
"meta",
"&&",
"meta",
".",
"Parents",
"&&",
"meta",
".",
"Parents",
".",
"length",
">",
"0",
")",
"{",
"if",
"(",
"useParentLocation",
".",
"index",
"===",
"\"last\"",
")",
"{",
"noneRootMeta",
"=",
"meta",
".",
"Parents",
"[",
"meta",
".",
"Parents",
".",
"length",
"-",
"1",
"]",
";",
"}",
"else",
"{",
"noneRootMeta",
"=",
"meta",
".",
"Parents",
"[",
"0",
"]",
";",
"}",
"}",
"else",
"{",
"noneRootMeta",
"=",
"this",
".",
"_getNoneRootMeta",
"(",
"meta",
")",
";",
"}",
"if",
"(",
"noneRootMeta",
")",
"{",
"this",
".",
"setLocationbyURL",
"(",
"noneRootMeta",
".",
"Location",
")",
";",
"locationName",
"=",
"noneRootMeta",
".",
"Name",
";",
"this",
".",
"_childrenLocation",
"=",
"noneRootMeta",
".",
"ChildrenLocation",
";",
"}",
"else",
"if",
"(",
"meta",
")",
"{",
"this",
".",
"setLocationbyURL",
"(",
"this",
".",
"_searchRootLocation",
")",
";",
"locationName",
"=",
"this",
".",
"_fileClient",
".",
"fileServiceName",
"(",
"meta",
".",
"Location",
")",
";",
"this",
".",
"_childrenLocation",
"=",
"meta",
".",
"ChildrenLocation",
";",
"}",
"var",
"searchInputDom",
"=",
"lib",
".",
"node",
"(",
"\"search\"",
")",
";",
"//$NON-NLS-0$",
"if",
"(",
"!",
"locationName",
")",
"{",
"locationName",
"=",
"\"\"",
";",
"}",
"this",
".",
"_searchLocationName",
"=",
"locationName",
";",
"if",
"(",
"searchInputDom",
"&&",
"searchInputDom",
".",
"placeholder",
")",
"{",
"searchInputDom",
".",
"value",
"=",
"\"\"",
";",
"var",
"placeHolder",
"=",
"i18nUtil",
".",
"formatMessage",
"(",
"messages",
"[",
"\"Search ${0}\"",
"]",
",",
"locationName",
")",
";",
"if",
"(",
"placeHolder",
".",
"length",
">",
"30",
")",
"{",
"searchInputDom",
".",
"placeholder",
"=",
"placeHolder",
".",
"substring",
"(",
"0",
",",
"27",
")",
"+",
"\"...\"",
";",
"//$NON-NLS-0$",
"}",
"else",
"{",
"searchInputDom",
".",
"placeholder",
"=",
"i18nUtil",
".",
"formatMessage",
"(",
"messages",
"[",
"\"Search ${0}\"",
"]",
",",
"locationName",
")",
";",
"}",
"}",
"if",
"(",
"searchInputDom",
"&&",
"searchInputDom",
".",
"title",
")",
"{",
"searchInputDom",
".",
"title",
"=",
"messages",
"[",
"\"TypeKeyOrWildCard\"",
"]",
"+",
"locationName",
";",
"}",
"}"
] |
Used to update "selectd" and "project" search scope based on the file or folder selected.
|
[
"Used",
"to",
"update",
"selectd",
"and",
"project",
"search",
"scope",
"based",
"on",
"the",
"file",
"or",
"folder",
"selected",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/searchClient.js#L55-L96
|
|
14,284
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/searchClient.js
|
function(searchParams, generateMatches, generateMeta) {
try {
return this.getFileClient().search(searchParams).then(function(jsonData) {
var searchResult = this.convert(jsonData, searchParams);
return this._generateMatches(searchParams, searchResult, generateMatches).then(function() {
return this._generateMeta(searchResult, generateMeta).then(function() {
return searchResult;
});
}.bind(this));
}.bind(this));
}
catch(err){
var error = err.message || err;
if(typeof error === "string" && error.toLowerCase().indexOf("search") > -1){ //$NON-NLS-1$ //$NON-NLS-0$
if(!this._crawler) {
this._crawler = this._createCrawler(searchParams);
}
if(searchParams.nameSearch) {
return this._crawler.searchName(searchParams).then(function(jsonData) {
return this.convert(jsonData, searchParams);
}.bind(this));
}
var result;
return result = this._crawler.search(function() {
result.progress(arguments[0], arguments[1]);
}).then(function(jsonData) {
return this.convert(jsonData, searchParams);
}.bind(this));
}
throw error;
}
}
|
javascript
|
function(searchParams, generateMatches, generateMeta) {
try {
return this.getFileClient().search(searchParams).then(function(jsonData) {
var searchResult = this.convert(jsonData, searchParams);
return this._generateMatches(searchParams, searchResult, generateMatches).then(function() {
return this._generateMeta(searchResult, generateMeta).then(function() {
return searchResult;
});
}.bind(this));
}.bind(this));
}
catch(err){
var error = err.message || err;
if(typeof error === "string" && error.toLowerCase().indexOf("search") > -1){ //$NON-NLS-1$ //$NON-NLS-0$
if(!this._crawler) {
this._crawler = this._createCrawler(searchParams);
}
if(searchParams.nameSearch) {
return this._crawler.searchName(searchParams).then(function(jsonData) {
return this.convert(jsonData, searchParams);
}.bind(this));
}
var result;
return result = this._crawler.search(function() {
result.progress(arguments[0], arguments[1]);
}).then(function(jsonData) {
return this.convert(jsonData, searchParams);
}.bind(this));
}
throw error;
}
}
|
[
"function",
"(",
"searchParams",
",",
"generateMatches",
",",
"generateMeta",
")",
"{",
"try",
"{",
"return",
"this",
".",
"getFileClient",
"(",
")",
".",
"search",
"(",
"searchParams",
")",
".",
"then",
"(",
"function",
"(",
"jsonData",
")",
"{",
"var",
"searchResult",
"=",
"this",
".",
"convert",
"(",
"jsonData",
",",
"searchParams",
")",
";",
"return",
"this",
".",
"_generateMatches",
"(",
"searchParams",
",",
"searchResult",
",",
"generateMatches",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"return",
"this",
".",
"_generateMeta",
"(",
"searchResult",
",",
"generateMeta",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"return",
"searchResult",
";",
"}",
")",
";",
"}",
".",
"bind",
"(",
"this",
")",
")",
";",
"}",
".",
"bind",
"(",
"this",
")",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"var",
"error",
"=",
"err",
".",
"message",
"||",
"err",
";",
"if",
"(",
"typeof",
"error",
"===",
"\"string\"",
"&&",
"error",
".",
"toLowerCase",
"(",
")",
".",
"indexOf",
"(",
"\"search\"",
")",
">",
"-",
"1",
")",
"{",
"//$NON-NLS-1$ //$NON-NLS-0$",
"if",
"(",
"!",
"this",
".",
"_crawler",
")",
"{",
"this",
".",
"_crawler",
"=",
"this",
".",
"_createCrawler",
"(",
"searchParams",
")",
";",
"}",
"if",
"(",
"searchParams",
".",
"nameSearch",
")",
"{",
"return",
"this",
".",
"_crawler",
".",
"searchName",
"(",
"searchParams",
")",
".",
"then",
"(",
"function",
"(",
"jsonData",
")",
"{",
"return",
"this",
".",
"convert",
"(",
"jsonData",
",",
"searchParams",
")",
";",
"}",
".",
"bind",
"(",
"this",
")",
")",
";",
"}",
"var",
"result",
";",
"return",
"result",
"=",
"this",
".",
"_crawler",
".",
"search",
"(",
"function",
"(",
")",
"{",
"result",
".",
"progress",
"(",
"arguments",
"[",
"0",
"]",
",",
"arguments",
"[",
"1",
"]",
")",
";",
"}",
")",
".",
"then",
"(",
"function",
"(",
"jsonData",
")",
"{",
"return",
"this",
".",
"convert",
"(",
"jsonData",
",",
"searchParams",
")",
";",
"}",
".",
"bind",
"(",
"this",
")",
")",
";",
"}",
"throw",
"error",
";",
"}",
"}"
] |
Runs a search and displays the results under the given DOM node.
@public
@param {Object} searchParams The search parameters.
@param {Function(JSONObject)} Callback function that receives the results of the query.
|
[
"Runs",
"a",
"search",
"and",
"displays",
"the",
"results",
"under",
"the",
"given",
"DOM",
"node",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/searchClient.js#L188-L219
|
|
14,285
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/searchClient.js
|
function(keyword, nameSearch, useRoot, advancedOptions, searchScope) {
var searchOn = useRoot ? this.getSearchRootLocation(): this.getSearchLocation(searchScope);
if (nameSearch) {
//assume implicit trailing wildcard if there isn't one already
//var wildcard= (/\*$/.test(keyword) ? "" : "*"); //$NON-NLS-0$
return {
resource: searchOn,
sort: "NameLower asc", //$NON-NLS-0$
rows: 100,
start: 0,
nameSearch: true,
keyword: keyword,
exclude: (advancedOptions && advancedOptions.exclude) ? advancedOptions.exclude : undefined,
};
}
return {
resource: searchOn,
sort: advancedOptions && advancedOptions.sort ? advancedOptions.sort : "Path asc", //$NON-NLS-0$
rows: advancedOptions && advancedOptions.rows ? advancedOptions.rows : 40,
start: 0,
caseSensitive: advancedOptions ? advancedOptions.caseSensitive : undefined,
wholeWord: advancedOptions ? advancedOptions.wholeWord : undefined,
regEx: advancedOptions ? advancedOptions.regEx : undefined,
fileType: advancedOptions ? advancedOptions.fileType : undefined,
fileNamePatterns: (advancedOptions && advancedOptions.fileNamePatterns) ? advancedOptions.fileNamePatterns : undefined,
exclude: (advancedOptions && advancedOptions.exclude) ? advancedOptions.exclude : undefined,
keyword: keyword,
replace: advancedOptions ? advancedOptions.replace : undefined,
searchScope: searchScope
};
}
|
javascript
|
function(keyword, nameSearch, useRoot, advancedOptions, searchScope) {
var searchOn = useRoot ? this.getSearchRootLocation(): this.getSearchLocation(searchScope);
if (nameSearch) {
//assume implicit trailing wildcard if there isn't one already
//var wildcard= (/\*$/.test(keyword) ? "" : "*"); //$NON-NLS-0$
return {
resource: searchOn,
sort: "NameLower asc", //$NON-NLS-0$
rows: 100,
start: 0,
nameSearch: true,
keyword: keyword,
exclude: (advancedOptions && advancedOptions.exclude) ? advancedOptions.exclude : undefined,
};
}
return {
resource: searchOn,
sort: advancedOptions && advancedOptions.sort ? advancedOptions.sort : "Path asc", //$NON-NLS-0$
rows: advancedOptions && advancedOptions.rows ? advancedOptions.rows : 40,
start: 0,
caseSensitive: advancedOptions ? advancedOptions.caseSensitive : undefined,
wholeWord: advancedOptions ? advancedOptions.wholeWord : undefined,
regEx: advancedOptions ? advancedOptions.regEx : undefined,
fileType: advancedOptions ? advancedOptions.fileType : undefined,
fileNamePatterns: (advancedOptions && advancedOptions.fileNamePatterns) ? advancedOptions.fileNamePatterns : undefined,
exclude: (advancedOptions && advancedOptions.exclude) ? advancedOptions.exclude : undefined,
keyword: keyword,
replace: advancedOptions ? advancedOptions.replace : undefined,
searchScope: searchScope
};
}
|
[
"function",
"(",
"keyword",
",",
"nameSearch",
",",
"useRoot",
",",
"advancedOptions",
",",
"searchScope",
")",
"{",
"var",
"searchOn",
"=",
"useRoot",
"?",
"this",
".",
"getSearchRootLocation",
"(",
")",
":",
"this",
".",
"getSearchLocation",
"(",
"searchScope",
")",
";",
"if",
"(",
"nameSearch",
")",
"{",
"//assume implicit trailing wildcard if there isn't one already",
"//var wildcard= (/\\*$/.test(keyword) ? \"\" : \"*\"); //$NON-NLS-0$",
"return",
"{",
"resource",
":",
"searchOn",
",",
"sort",
":",
"\"NameLower asc\"",
",",
"//$NON-NLS-0$",
"rows",
":",
"100",
",",
"start",
":",
"0",
",",
"nameSearch",
":",
"true",
",",
"keyword",
":",
"keyword",
",",
"exclude",
":",
"(",
"advancedOptions",
"&&",
"advancedOptions",
".",
"exclude",
")",
"?",
"advancedOptions",
".",
"exclude",
":",
"undefined",
",",
"}",
";",
"}",
"return",
"{",
"resource",
":",
"searchOn",
",",
"sort",
":",
"advancedOptions",
"&&",
"advancedOptions",
".",
"sort",
"?",
"advancedOptions",
".",
"sort",
":",
"\"Path asc\"",
",",
"//$NON-NLS-0$",
"rows",
":",
"advancedOptions",
"&&",
"advancedOptions",
".",
"rows",
"?",
"advancedOptions",
".",
"rows",
":",
"40",
",",
"start",
":",
"0",
",",
"caseSensitive",
":",
"advancedOptions",
"?",
"advancedOptions",
".",
"caseSensitive",
":",
"undefined",
",",
"wholeWord",
":",
"advancedOptions",
"?",
"advancedOptions",
".",
"wholeWord",
":",
"undefined",
",",
"regEx",
":",
"advancedOptions",
"?",
"advancedOptions",
".",
"regEx",
":",
"undefined",
",",
"fileType",
":",
"advancedOptions",
"?",
"advancedOptions",
".",
"fileType",
":",
"undefined",
",",
"fileNamePatterns",
":",
"(",
"advancedOptions",
"&&",
"advancedOptions",
".",
"fileNamePatterns",
")",
"?",
"advancedOptions",
".",
"fileNamePatterns",
":",
"undefined",
",",
"exclude",
":",
"(",
"advancedOptions",
"&&",
"advancedOptions",
".",
"exclude",
")",
"?",
"advancedOptions",
".",
"exclude",
":",
"undefined",
",",
"keyword",
":",
"keyword",
",",
"replace",
":",
"advancedOptions",
"?",
"advancedOptions",
".",
"replace",
":",
"undefined",
",",
"searchScope",
":",
"searchScope",
"}",
";",
"}"
] |
Returns a query object for search. The return value has the propertyies of resource and parameters.
@param {String} keyword The text to search for, or null when searching purely on file name
@param {Boolean} [nameSearch] The name of a file to search for
@param {Boolean} [useRoot] If true, do not use the location property of the searcher. Use the root url of the file system instead.
|
[
"Returns",
"a",
"query",
"object",
"for",
"search",
".",
"The",
"return",
"value",
"has",
"the",
"propertyies",
"of",
"resource",
"and",
"parameters",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/searchClient.js#L293-L323
|
|
14,286
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js
|
displayErrorOnStatus
|
function displayErrorOnStatus(error) {
var display = {};
display.Severity = "Error"; //$NON-NLS-0$
display.HTML = false;
try {
var resp = JSON.parse(error.responseText);
display.Message = resp.DetailedMessage ? resp.DetailedMessage :
(resp.Message ? resp.Message : messages["Problem while performing the action"]);
} catch (Exception) {
display.Message = messages["Problem while performing the action"];
}
serviceRegistry.getService("orion.page.message").setProgressResult(display); //$NON-NLS-0$
}
|
javascript
|
function displayErrorOnStatus(error) {
var display = {};
display.Severity = "Error"; //$NON-NLS-0$
display.HTML = false;
try {
var resp = JSON.parse(error.responseText);
display.Message = resp.DetailedMessage ? resp.DetailedMessage :
(resp.Message ? resp.Message : messages["Problem while performing the action"]);
} catch (Exception) {
display.Message = messages["Problem while performing the action"];
}
serviceRegistry.getService("orion.page.message").setProgressResult(display); //$NON-NLS-0$
}
|
[
"function",
"displayErrorOnStatus",
"(",
"error",
")",
"{",
"var",
"display",
"=",
"{",
"}",
";",
"display",
".",
"Severity",
"=",
"\"Error\"",
";",
"//$NON-NLS-0$",
"display",
".",
"HTML",
"=",
"false",
";",
"try",
"{",
"var",
"resp",
"=",
"JSON",
".",
"parse",
"(",
"error",
".",
"responseText",
")",
";",
"display",
".",
"Message",
"=",
"resp",
".",
"DetailedMessage",
"?",
"resp",
".",
"DetailedMessage",
":",
"(",
"resp",
".",
"Message",
"?",
"resp",
".",
"Message",
":",
"messages",
"[",
"\"Problem while performing the action\"",
"]",
")",
";",
"}",
"catch",
"(",
"Exception",
")",
"{",
"display",
".",
"Message",
"=",
"messages",
"[",
"\"Problem while performing the action\"",
"]",
";",
"}",
"serviceRegistry",
".",
"getService",
"(",
"\"orion.page.message\"",
")",
".",
"setProgressResult",
"(",
"display",
")",
";",
"//$NON-NLS-0$",
"}"
] |
make warning go away
|
[
"make",
"warning",
"go",
"away"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js#L1438-L1452
|
14,287
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js
|
function(data) {
if (data && data.handler.changedItem) {
data.handler.changedItem();
} else {
explorer.changedItem();
}
}
|
javascript
|
function(data) {
if (data && data.handler.changedItem) {
data.handler.changedItem();
} else {
explorer.changedItem();
}
}
|
[
"function",
"(",
"data",
")",
"{",
"if",
"(",
"data",
"&&",
"data",
".",
"handler",
".",
"changedItem",
")",
"{",
"data",
".",
"handler",
".",
"changedItem",
"(",
")",
";",
"}",
"else",
"{",
"explorer",
".",
"changedItem",
"(",
")",
";",
"}",
"}"
] |
used both as confirm and remotePrompter dialogs callback
|
[
"used",
"both",
"as",
"confirm",
"and",
"remotePrompter",
"dialogs",
"callback"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js#L2371-L2377
|
|
14,288
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/plugins/languages/docker/dockerAssist.js
|
calculateTruePrefix
|
function calculateTruePrefix(buffer, offset, escapeCharacter) {
var char = buffer.charAt(offset - 1);
switch (char) {
case '\n':
var escapedPrefix = "";
for (var i = offset - 1; i >= 0; i--) {
if (buffer.charAt(i) === '\n') {
if (buffer.charAt(i - 1) === escapeCharacter) {
i--;
} else if (buffer.charAt(i - 1) === '\r' && buffer.charAt(i - 2) === escapeCharacter) {
i = i -2;
} else {
break;
}
} else if (buffer.charAt(i) === ' ' || buffer.charAt(i) === '\t') {
break;
} else {
escapedPrefix = buffer.charAt(i).toUpperCase() + escapedPrefix;
}
}
if (escapedPrefix !== "") {
return escapedPrefix;
}
break;
case '\r':
case ' ':
case '\t':
break;
default:
var truePrefix = char;
prefixCheck: for (i = offset - 2; i >= 0; i--) {
char = buffer.charAt(i);
switch (char) {
case '\r':
case '\n':
case ' ':
case '\t':
break prefixCheck;
default:
for (i = offset - 2; i >= 0; i--) {
truePrefix = char + truePrefix;
}
break;
}
}
return truePrefix;
}
return "";
}
|
javascript
|
function calculateTruePrefix(buffer, offset, escapeCharacter) {
var char = buffer.charAt(offset - 1);
switch (char) {
case '\n':
var escapedPrefix = "";
for (var i = offset - 1; i >= 0; i--) {
if (buffer.charAt(i) === '\n') {
if (buffer.charAt(i - 1) === escapeCharacter) {
i--;
} else if (buffer.charAt(i - 1) === '\r' && buffer.charAt(i - 2) === escapeCharacter) {
i = i -2;
} else {
break;
}
} else if (buffer.charAt(i) === ' ' || buffer.charAt(i) === '\t') {
break;
} else {
escapedPrefix = buffer.charAt(i).toUpperCase() + escapedPrefix;
}
}
if (escapedPrefix !== "") {
return escapedPrefix;
}
break;
case '\r':
case ' ':
case '\t':
break;
default:
var truePrefix = char;
prefixCheck: for (i = offset - 2; i >= 0; i--) {
char = buffer.charAt(i);
switch (char) {
case '\r':
case '\n':
case ' ':
case '\t':
break prefixCheck;
default:
for (i = offset - 2; i >= 0; i--) {
truePrefix = char + truePrefix;
}
break;
}
}
return truePrefix;
}
return "";
}
|
[
"function",
"calculateTruePrefix",
"(",
"buffer",
",",
"offset",
",",
"escapeCharacter",
")",
"{",
"var",
"char",
"=",
"buffer",
".",
"charAt",
"(",
"offset",
"-",
"1",
")",
";",
"switch",
"(",
"char",
")",
"{",
"case",
"'\\n'",
":",
"var",
"escapedPrefix",
"=",
"\"\"",
";",
"for",
"(",
"var",
"i",
"=",
"offset",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"buffer",
".",
"charAt",
"(",
"i",
")",
"===",
"'\\n'",
")",
"{",
"if",
"(",
"buffer",
".",
"charAt",
"(",
"i",
"-",
"1",
")",
"===",
"escapeCharacter",
")",
"{",
"i",
"--",
";",
"}",
"else",
"if",
"(",
"buffer",
".",
"charAt",
"(",
"i",
"-",
"1",
")",
"===",
"'\\r'",
"&&",
"buffer",
".",
"charAt",
"(",
"i",
"-",
"2",
")",
"===",
"escapeCharacter",
")",
"{",
"i",
"=",
"i",
"-",
"2",
";",
"}",
"else",
"{",
"break",
";",
"}",
"}",
"else",
"if",
"(",
"buffer",
".",
"charAt",
"(",
"i",
")",
"===",
"' '",
"||",
"buffer",
".",
"charAt",
"(",
"i",
")",
"===",
"'\\t'",
")",
"{",
"break",
";",
"}",
"else",
"{",
"escapedPrefix",
"=",
"buffer",
".",
"charAt",
"(",
"i",
")",
".",
"toUpperCase",
"(",
")",
"+",
"escapedPrefix",
";",
"}",
"}",
"if",
"(",
"escapedPrefix",
"!==",
"\"\"",
")",
"{",
"return",
"escapedPrefix",
";",
"}",
"break",
";",
"case",
"'\\r'",
":",
"case",
"' '",
":",
"case",
"'\\t'",
":",
"break",
";",
"default",
":",
"var",
"truePrefix",
"=",
"char",
";",
"prefixCheck",
":",
"for",
"(",
"i",
"=",
"offset",
"-",
"2",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"char",
"=",
"buffer",
".",
"charAt",
"(",
"i",
")",
";",
"switch",
"(",
"char",
")",
"{",
"case",
"'\\r'",
":",
"case",
"'\\n'",
":",
"case",
"' '",
":",
"case",
"'\\t'",
":",
"break",
"prefixCheck",
";",
"default",
":",
"for",
"(",
"i",
"=",
"offset",
"-",
"2",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"truePrefix",
"=",
"char",
"+",
"truePrefix",
";",
"}",
"break",
";",
"}",
"}",
"return",
"truePrefix",
";",
"}",
"return",
"\"\"",
";",
"}"
] |
Walks back in the text buffer to calculate the true prefix of the
current text caret offset. Orion's provided prefix does not include
symbols but we do want to consider that a prefix in Dockerfiles.
@param buffer the content of the opened file
@param offset the current text caret's offset
@param escapeCharacter the escape character defined in this Dockerfile
|
[
"Walks",
"back",
"in",
"the",
"text",
"buffer",
"to",
"calculate",
"the",
"true",
"prefix",
"of",
"the",
"current",
"text",
"caret",
"offset",
".",
"Orion",
"s",
"provided",
"prefix",
"does",
"not",
"include",
"symbols",
"but",
"we",
"do",
"want",
"to",
"consider",
"that",
"a",
"prefix",
"in",
"Dockerfiles",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/plugins/languages/docker/dockerAssist.js#L251-L300
|
14,289
|
eclipse/orion.client
|
modules/orionode/lib/sharedWorkspace.js
|
checkCollabServerToken
|
function checkCollabServerToken(authorization) {
if (authorization.substr(0, 7) !== "Bearer ") {
return false;
}
try {
var decoded = jwt.verify(authorization.substr(7), options.configParams.get("orion.jwt.secret"));
return true;
} catch (ex) {
return false;
}
}
|
javascript
|
function checkCollabServerToken(authorization) {
if (authorization.substr(0, 7) !== "Bearer ") {
return false;
}
try {
var decoded = jwt.verify(authorization.substr(7), options.configParams.get("orion.jwt.secret"));
return true;
} catch (ex) {
return false;
}
}
|
[
"function",
"checkCollabServerToken",
"(",
"authorization",
")",
"{",
"if",
"(",
"authorization",
".",
"substr",
"(",
"0",
",",
"7",
")",
"!==",
"\"Bearer \"",
")",
"{",
"return",
"false",
";",
"}",
"try",
"{",
"var",
"decoded",
"=",
"jwt",
".",
"verify",
"(",
"authorization",
".",
"substr",
"(",
"7",
")",
",",
"options",
".",
"configParams",
".",
"get",
"(",
"\"orion.jwt.secret\"",
")",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"return",
"false",
";",
"}",
"}"
] |
Check the JWT token for collab server
|
[
"Check",
"the",
"JWT",
"token",
"for",
"collab",
"server"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/modules/orionode/lib/sharedWorkspace.js#L42-L52
|
14,290
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/plugins/filePlugin/GitHubFileImpl.js
|
function(child, branchNameOrSha, asSha) {
var _this = this;
var shaValue = asSha ? branchNameOrSha : branchNameOrSha + "&path=" + child.CommitPath;
return xhr("GET", _this._repoURL.href + "/commits?sha=" + shaValue + "&per_page=1", {//https://developer.github.com/v3/#pagination
headers: this._headers,
timeout: 15000
}).then(function(result) {
var content = JSON.parse(result.response);
if(content.length > 0 && content[0].commit && content[0].commit.author && content[0].commit.author.date) {
child.LocalTimeStamp = content[0].commit.author.date;
child.LastCommit = {};
child.LastCommit.Author = {};
child.LastCommit.Author.Date = content[0].commit.author.date;
child.LastCommit.Author.Name = content[0].commit.author.name ? content[0].commit.author.name : "";
child.LastCommit.Author.Email = content[0].commit.author.email ? content[0].commit.author.email : "";
if(content[0].commit.committer) {
child.LastCommit.Committer = {};
child.LastCommit.Committer.Date = content[0].commit.committer.date ? content[0].commit.committer.date : "";
child.LastCommit.Committer.Name = content[0].commit.committer.name ? content[0].commit.committer.name : "";
child.LastCommit.Committer.Email = content[0].commit.committer.email ? content[0].commit.committer.email : "";
}
child.LastCommit.Message = content[0].commit.message ? content[0].commit.message : "";
child.LastCommit.URL = content[0].sha ? _this._commitURLBase + content[0].sha : null;
if(use_gravatar_id && content[0].author && content[0].author.gravatar_id) {
child.LastCommit.AvatarURL = "https://www.gravatar.com/avatar/" + content[0].author.gravatar_id + "?d=mm";
} else if(content[0].author && content[0].author.avatar_url) {
child.LastCommit.AvatarURL = content[0].author.avatar_url;
}
}
return child;
}, function(error) { return _this._handleError(error);});
}
|
javascript
|
function(child, branchNameOrSha, asSha) {
var _this = this;
var shaValue = asSha ? branchNameOrSha : branchNameOrSha + "&path=" + child.CommitPath;
return xhr("GET", _this._repoURL.href + "/commits?sha=" + shaValue + "&per_page=1", {//https://developer.github.com/v3/#pagination
headers: this._headers,
timeout: 15000
}).then(function(result) {
var content = JSON.parse(result.response);
if(content.length > 0 && content[0].commit && content[0].commit.author && content[0].commit.author.date) {
child.LocalTimeStamp = content[0].commit.author.date;
child.LastCommit = {};
child.LastCommit.Author = {};
child.LastCommit.Author.Date = content[0].commit.author.date;
child.LastCommit.Author.Name = content[0].commit.author.name ? content[0].commit.author.name : "";
child.LastCommit.Author.Email = content[0].commit.author.email ? content[0].commit.author.email : "";
if(content[0].commit.committer) {
child.LastCommit.Committer = {};
child.LastCommit.Committer.Date = content[0].commit.committer.date ? content[0].commit.committer.date : "";
child.LastCommit.Committer.Name = content[0].commit.committer.name ? content[0].commit.committer.name : "";
child.LastCommit.Committer.Email = content[0].commit.committer.email ? content[0].commit.committer.email : "";
}
child.LastCommit.Message = content[0].commit.message ? content[0].commit.message : "";
child.LastCommit.URL = content[0].sha ? _this._commitURLBase + content[0].sha : null;
if(use_gravatar_id && content[0].author && content[0].author.gravatar_id) {
child.LastCommit.AvatarURL = "https://www.gravatar.com/avatar/" + content[0].author.gravatar_id + "?d=mm";
} else if(content[0].author && content[0].author.avatar_url) {
child.LastCommit.AvatarURL = content[0].author.avatar_url;
}
}
return child;
}, function(error) { return _this._handleError(error);});
}
|
[
"function",
"(",
"child",
",",
"branchNameOrSha",
",",
"asSha",
")",
"{",
"var",
"_this",
"=",
"this",
";",
"var",
"shaValue",
"=",
"asSha",
"?",
"branchNameOrSha",
":",
"branchNameOrSha",
"+",
"\"&path=\"",
"+",
"child",
".",
"CommitPath",
";",
"return",
"xhr",
"(",
"\"GET\"",
",",
"_this",
".",
"_repoURL",
".",
"href",
"+",
"\"/commits?sha=\"",
"+",
"shaValue",
"+",
"\"&per_page=1\"",
",",
"{",
"//https://developer.github.com/v3/#pagination",
"headers",
":",
"this",
".",
"_headers",
",",
"timeout",
":",
"15000",
"}",
")",
".",
"then",
"(",
"function",
"(",
"result",
")",
"{",
"var",
"content",
"=",
"JSON",
".",
"parse",
"(",
"result",
".",
"response",
")",
";",
"if",
"(",
"content",
".",
"length",
">",
"0",
"&&",
"content",
"[",
"0",
"]",
".",
"commit",
"&&",
"content",
"[",
"0",
"]",
".",
"commit",
".",
"author",
"&&",
"content",
"[",
"0",
"]",
".",
"commit",
".",
"author",
".",
"date",
")",
"{",
"child",
".",
"LocalTimeStamp",
"=",
"content",
"[",
"0",
"]",
".",
"commit",
".",
"author",
".",
"date",
";",
"child",
".",
"LastCommit",
"=",
"{",
"}",
";",
"child",
".",
"LastCommit",
".",
"Author",
"=",
"{",
"}",
";",
"child",
".",
"LastCommit",
".",
"Author",
".",
"Date",
"=",
"content",
"[",
"0",
"]",
".",
"commit",
".",
"author",
".",
"date",
";",
"child",
".",
"LastCommit",
".",
"Author",
".",
"Name",
"=",
"content",
"[",
"0",
"]",
".",
"commit",
".",
"author",
".",
"name",
"?",
"content",
"[",
"0",
"]",
".",
"commit",
".",
"author",
".",
"name",
":",
"\"\"",
";",
"child",
".",
"LastCommit",
".",
"Author",
".",
"Email",
"=",
"content",
"[",
"0",
"]",
".",
"commit",
".",
"author",
".",
"email",
"?",
"content",
"[",
"0",
"]",
".",
"commit",
".",
"author",
".",
"email",
":",
"\"\"",
";",
"if",
"(",
"content",
"[",
"0",
"]",
".",
"commit",
".",
"committer",
")",
"{",
"child",
".",
"LastCommit",
".",
"Committer",
"=",
"{",
"}",
";",
"child",
".",
"LastCommit",
".",
"Committer",
".",
"Date",
"=",
"content",
"[",
"0",
"]",
".",
"commit",
".",
"committer",
".",
"date",
"?",
"content",
"[",
"0",
"]",
".",
"commit",
".",
"committer",
".",
"date",
":",
"\"\"",
";",
"child",
".",
"LastCommit",
".",
"Committer",
".",
"Name",
"=",
"content",
"[",
"0",
"]",
".",
"commit",
".",
"committer",
".",
"name",
"?",
"content",
"[",
"0",
"]",
".",
"commit",
".",
"committer",
".",
"name",
":",
"\"\"",
";",
"child",
".",
"LastCommit",
".",
"Committer",
".",
"Email",
"=",
"content",
"[",
"0",
"]",
".",
"commit",
".",
"committer",
".",
"email",
"?",
"content",
"[",
"0",
"]",
".",
"commit",
".",
"committer",
".",
"email",
":",
"\"\"",
";",
"}",
"child",
".",
"LastCommit",
".",
"Message",
"=",
"content",
"[",
"0",
"]",
".",
"commit",
".",
"message",
"?",
"content",
"[",
"0",
"]",
".",
"commit",
".",
"message",
":",
"\"\"",
";",
"child",
".",
"LastCommit",
".",
"URL",
"=",
"content",
"[",
"0",
"]",
".",
"sha",
"?",
"_this",
".",
"_commitURLBase",
"+",
"content",
"[",
"0",
"]",
".",
"sha",
":",
"null",
";",
"if",
"(",
"use_gravatar_id",
"&&",
"content",
"[",
"0",
"]",
".",
"author",
"&&",
"content",
"[",
"0",
"]",
".",
"author",
".",
"gravatar_id",
")",
"{",
"child",
".",
"LastCommit",
".",
"AvatarURL",
"=",
"\"https://www.gravatar.com/avatar/\"",
"+",
"content",
"[",
"0",
"]",
".",
"author",
".",
"gravatar_id",
"+",
"\"?d=mm\"",
";",
"}",
"else",
"if",
"(",
"content",
"[",
"0",
"]",
".",
"author",
"&&",
"content",
"[",
"0",
"]",
".",
"author",
".",
"avatar_url",
")",
"{",
"child",
".",
"LastCommit",
".",
"AvatarURL",
"=",
"content",
"[",
"0",
"]",
".",
"author",
".",
"avatar_url",
";",
"}",
"}",
"return",
"child",
";",
"}",
",",
"function",
"(",
"error",
")",
"{",
"return",
"_this",
".",
"_handleError",
"(",
"error",
")",
";",
"}",
")",
";",
"}"
] |
Inject commit information to an item. The item can be either meta data or an item form the return list of fetchChildren.
CommitInfo {
Author: {Name: "string", Email: "email@addre.ss", Date: milliseconds(integer) },
Committer: {Name: "string", Email: "email@addre.ss", Date: milliseconds(integer) },
Message: "string",
URL: "string"
}
|
[
"Inject",
"commit",
"information",
"to",
"an",
"item",
".",
"The",
"item",
"can",
"be",
"either",
"meta",
"data",
"or",
"an",
"item",
"form",
"the",
"return",
"list",
"of",
"fetchChildren",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/plugins/filePlugin/GitHubFileImpl.js#L278-L309
|
|
14,291
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-implicit-coercion.js
|
isDoubleLogicalNegating
|
function isDoubleLogicalNegating(node) {
return node.operator === "!" &&
node.argument.type === "UnaryExpression" &&
node.argument.operator === "!";
}
|
javascript
|
function isDoubleLogicalNegating(node) {
return node.operator === "!" &&
node.argument.type === "UnaryExpression" &&
node.argument.operator === "!";
}
|
[
"function",
"isDoubleLogicalNegating",
"(",
"node",
")",
"{",
"return",
"node",
".",
"operator",
"===",
"\"!\"",
"&&",
"node",
".",
"argument",
".",
"type",
"===",
"\"UnaryExpression\"",
"&&",
"node",
".",
"argument",
".",
"operator",
"===",
"\"!\"",
";",
"}"
] |
Checks whether or not a node is a double logical negating.
@param {ASTNode} node - An UnaryExpression node to check.
@returns {boolean} Whether or not the node is a double logical negating.
|
[
"Checks",
"whether",
"or",
"not",
"a",
"node",
"is",
"a",
"double",
"logical",
"negating",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-implicit-coercion.js#L40-L44
|
14,292
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-implicit-coercion.js
|
isAppendEmptyString
|
function isAppendEmptyString(node) {
return node.operator === "+=" && node.right.type === "Literal" && node.right.value === "";
}
|
javascript
|
function isAppendEmptyString(node) {
return node.operator === "+=" && node.right.type === "Literal" && node.right.value === "";
}
|
[
"function",
"isAppendEmptyString",
"(",
"node",
")",
"{",
"return",
"node",
".",
"operator",
"===",
"\"+=\"",
"&&",
"node",
".",
"right",
".",
"type",
"===",
"\"Literal\"",
"&&",
"node",
".",
"right",
".",
"value",
"===",
"\"\"",
";",
"}"
] |
Checks whether or not a node is appended with an empty string.
@param {ASTNode} node - An AssignmentExpression node to check.
@returns {boolean} Whether or not the node is appended with an empty string.
|
[
"Checks",
"whether",
"or",
"not",
"a",
"node",
"is",
"appended",
"with",
"an",
"empty",
"string",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-implicit-coercion.js#L124-L126
|
14,293
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-implicit-coercion.js
|
getOtherOperand
|
function getOtherOperand(node, value) {
if (node.left.type === "Literal" && node.left.value === value) {
return node.right;
}
return node.left;
}
|
javascript
|
function getOtherOperand(node, value) {
if (node.left.type === "Literal" && node.left.value === value) {
return node.right;
}
return node.left;
}
|
[
"function",
"getOtherOperand",
"(",
"node",
",",
"value",
")",
"{",
"if",
"(",
"node",
".",
"left",
".",
"type",
"===",
"\"Literal\"",
"&&",
"node",
".",
"left",
".",
"value",
"===",
"value",
")",
"{",
"return",
"node",
".",
"right",
";",
"}",
"return",
"node",
".",
"left",
";",
"}"
] |
Gets a node that is the left or right operand of a node, is not the specified literal.
@param {ASTNode} node - A BinaryExpression node to get.
@param {any} value - A literal value to check.
@returns {ASTNode} A node that is the left or right operand of the node, is not the specified literal.
|
[
"Gets",
"a",
"node",
"that",
"is",
"the",
"left",
"or",
"right",
"operand",
"of",
"a",
"node",
"is",
"not",
"the",
"specified",
"literal",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/rules/no-implicit-coercion.js#L134-L139
|
14,294
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.javascript/web/eslint/lib/load-rules-async.js
|
isInsideOfStorableFunction
|
function isInsideOfStorableFunction(id, rhsNode) {
var funcNode = getUpperFunction(id);
return (
funcNode &&
isInside(funcNode, rhsNode) &&
isStorableFunction(funcNode, rhsNode)
);
}
|
javascript
|
function isInsideOfStorableFunction(id, rhsNode) {
var funcNode = getUpperFunction(id);
return (
funcNode &&
isInside(funcNode, rhsNode) &&
isStorableFunction(funcNode, rhsNode)
);
}
|
[
"function",
"isInsideOfStorableFunction",
"(",
"id",
",",
"rhsNode",
")",
"{",
"var",
"funcNode",
"=",
"getUpperFunction",
"(",
"id",
")",
";",
"return",
"(",
"funcNode",
"&&",
"isInside",
"(",
"funcNode",
",",
"rhsNode",
")",
"&&",
"isStorableFunction",
"(",
"funcNode",
",",
"rhsNode",
")",
")",
";",
"}"
] |
Checks whether a given Identifier node exists inside of a function node which can be used later.
"can be used later" means:
- the function is assigned to a variable.
- the function is bound to a property and the object can be used later.
- the function is bound as an argument of a function call.
If a reference exists in a function which can be used later, the reference is read when the function is called.
@param {ASTNode} id - An Identifier node to check.
@param {ASTNode} rhsNode - The RHS node of the previous assignment.
@returns {boolean} `true` if the `id` node exists inside of a function node which can be used later.
|
[
"Checks",
"whether",
"a",
"given",
"Identifier",
"node",
"exists",
"inside",
"of",
"a",
"function",
"node",
"which",
"can",
"be",
"used",
"later",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.javascript/web/eslint/lib/load-rules-async.js#L1907-L1914
|
14,295
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.collab/web/orion/collab/collabSocket.js
|
CollabSocket
|
function CollabSocket(hubUrl, sessionId) {
var self = this;
this.socket = io.connect( hubUrl+ "?sessionId=" +sessionId, { path: "/socket.io/" });
this.socket.on('connect', function() {
self.dispatchEvent({
type: 'ready'
});
});
this.socket.on('disconnect', function() {
self.dispatchEvent({
type: 'close'
});
});
this.socket.on('error', function(e) {
self.dispatchEvent({
type: 'error',
error: e
});
console.error(e);
});
this.socket.on('message', function(data) {
self.dispatchEvent({
type: 'message',
data: data
});
if (DEBUG) {
var msgObj = JSON.parse(data);
console.log('CollabSocket In: ' + msgObj.type, msgObj);
}
});
EventTarget.attach(this);
}
|
javascript
|
function CollabSocket(hubUrl, sessionId) {
var self = this;
this.socket = io.connect( hubUrl+ "?sessionId=" +sessionId, { path: "/socket.io/" });
this.socket.on('connect', function() {
self.dispatchEvent({
type: 'ready'
});
});
this.socket.on('disconnect', function() {
self.dispatchEvent({
type: 'close'
});
});
this.socket.on('error', function(e) {
self.dispatchEvent({
type: 'error',
error: e
});
console.error(e);
});
this.socket.on('message', function(data) {
self.dispatchEvent({
type: 'message',
data: data
});
if (DEBUG) {
var msgObj = JSON.parse(data);
console.log('CollabSocket In: ' + msgObj.type, msgObj);
}
});
EventTarget.attach(this);
}
|
[
"function",
"CollabSocket",
"(",
"hubUrl",
",",
"sessionId",
")",
"{",
"var",
"self",
"=",
"this",
";",
"this",
".",
"socket",
"=",
"io",
".",
"connect",
"(",
"hubUrl",
"+",
"\"?sessionId=\"",
"+",
"sessionId",
",",
"{",
"path",
":",
"\"/socket.io/\"",
"}",
")",
";",
"this",
".",
"socket",
".",
"on",
"(",
"'connect'",
",",
"function",
"(",
")",
"{",
"self",
".",
"dispatchEvent",
"(",
"{",
"type",
":",
"'ready'",
"}",
")",
";",
"}",
")",
";",
"this",
".",
"socket",
".",
"on",
"(",
"'disconnect'",
",",
"function",
"(",
")",
"{",
"self",
".",
"dispatchEvent",
"(",
"{",
"type",
":",
"'close'",
"}",
")",
";",
"}",
")",
";",
"this",
".",
"socket",
".",
"on",
"(",
"'error'",
",",
"function",
"(",
"e",
")",
"{",
"self",
".",
"dispatchEvent",
"(",
"{",
"type",
":",
"'error'",
",",
"error",
":",
"e",
"}",
")",
";",
"console",
".",
"error",
"(",
"e",
")",
";",
"}",
")",
";",
"this",
".",
"socket",
".",
"on",
"(",
"'message'",
",",
"function",
"(",
"data",
")",
"{",
"self",
".",
"dispatchEvent",
"(",
"{",
"type",
":",
"'message'",
",",
"data",
":",
"data",
"}",
")",
";",
"if",
"(",
"DEBUG",
")",
"{",
"var",
"msgObj",
"=",
"JSON",
".",
"parse",
"(",
"data",
")",
";",
"console",
".",
"log",
"(",
"'CollabSocket In: '",
"+",
"msgObj",
".",
"type",
",",
"msgObj",
")",
";",
"}",
"}",
")",
";",
"EventTarget",
".",
"attach",
"(",
"this",
")",
";",
"}"
] |
Collab socket client
@class
@constructor
@param {string} sessionId
|
[
"Collab",
"socket",
"client"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.collab/web/orion/collab/collabSocket.js#L28-L65
|
14,296
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/outliner.js
|
OutlineRenderer
|
function OutlineRenderer (options, explorer, title, inputManager) {
this.explorer = explorer;
this._init(options);
this.title = title;
this.inputManager = inputManager;
}
|
javascript
|
function OutlineRenderer (options, explorer, title, inputManager) {
this.explorer = explorer;
this._init(options);
this.title = title;
this.inputManager = inputManager;
}
|
[
"function",
"OutlineRenderer",
"(",
"options",
",",
"explorer",
",",
"title",
",",
"inputManager",
")",
"{",
"this",
".",
"explorer",
"=",
"explorer",
";",
"this",
".",
"_init",
"(",
"options",
")",
";",
"this",
".",
"title",
"=",
"title",
";",
"this",
".",
"inputManager",
"=",
"inputManager",
";",
"}"
] |
determines how many milliseconds we will wait for the outline service to compute and return an outline before considering it timed out
|
[
"determines",
"how",
"many",
"milliseconds",
"we",
"will",
"wait",
"for",
"the",
"outline",
"service",
"to",
"compute",
"and",
"return",
"an",
"outline",
"before",
"considering",
"it",
"timed",
"out"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/outliner.js#L35-L40
|
14,297
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/outliner.js
|
function() {
if (!this._isActive()) {
return;
}
this._filterInput.value = ""; //$NON-NLS-0$
lib.empty(this._outlineNode);
// display spinner while outline is being calculated
var spinner = document.createElement("span"); //$NON-NLS-0$
spinner.classList.add("modelDecorationSprite"); //$NON-NLS-0$
spinner.classList.add("core-sprite-progress"); //$NON-NLS-0$
this._outlineNode.appendChild(spinner);
if (this._outlineTimeout) {
window.clearTimeout(this._outlineTimeout);
}
this._outlineTimeout = window.setTimeout(function() {
lib.empty(this._outlineNode);
var span = document.createElement("span"); //$NON-NLS-0$
span.appendChild(document.createTextNode(messages["outlineTimeout"])); //$NON-NLS-0$
span.classList.add("outlineTimeoutSpan"); //$NON-NLS-0$
this._outlineNode.appendChild(span);
}.bind(this), OUTLINE_TIMEOUT_MS);
// Bail we're in the process of looking up capable providers
if (this._providerLookup) {
return;
}
this._outlineService.emitOutline(this._inputManager);
}
|
javascript
|
function() {
if (!this._isActive()) {
return;
}
this._filterInput.value = ""; //$NON-NLS-0$
lib.empty(this._outlineNode);
// display spinner while outline is being calculated
var spinner = document.createElement("span"); //$NON-NLS-0$
spinner.classList.add("modelDecorationSprite"); //$NON-NLS-0$
spinner.classList.add("core-sprite-progress"); //$NON-NLS-0$
this._outlineNode.appendChild(spinner);
if (this._outlineTimeout) {
window.clearTimeout(this._outlineTimeout);
}
this._outlineTimeout = window.setTimeout(function() {
lib.empty(this._outlineNode);
var span = document.createElement("span"); //$NON-NLS-0$
span.appendChild(document.createTextNode(messages["outlineTimeout"])); //$NON-NLS-0$
span.classList.add("outlineTimeoutSpan"); //$NON-NLS-0$
this._outlineNode.appendChild(span);
}.bind(this), OUTLINE_TIMEOUT_MS);
// Bail we're in the process of looking up capable providers
if (this._providerLookup) {
return;
}
this._outlineService.emitOutline(this._inputManager);
}
|
[
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"_isActive",
"(",
")",
")",
"{",
"return",
";",
"}",
"this",
".",
"_filterInput",
".",
"value",
"=",
"\"\"",
";",
"//$NON-NLS-0$",
"lib",
".",
"empty",
"(",
"this",
".",
"_outlineNode",
")",
";",
"// display spinner while outline is being calculated",
"var",
"spinner",
"=",
"document",
".",
"createElement",
"(",
"\"span\"",
")",
";",
"//$NON-NLS-0$",
"spinner",
".",
"classList",
".",
"add",
"(",
"\"modelDecorationSprite\"",
")",
";",
"//$NON-NLS-0$",
"spinner",
".",
"classList",
".",
"add",
"(",
"\"core-sprite-progress\"",
")",
";",
"//$NON-NLS-0$",
"this",
".",
"_outlineNode",
".",
"appendChild",
"(",
"spinner",
")",
";",
"if",
"(",
"this",
".",
"_outlineTimeout",
")",
"{",
"window",
".",
"clearTimeout",
"(",
"this",
".",
"_outlineTimeout",
")",
";",
"}",
"this",
".",
"_outlineTimeout",
"=",
"window",
".",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"lib",
".",
"empty",
"(",
"this",
".",
"_outlineNode",
")",
";",
"var",
"span",
"=",
"document",
".",
"createElement",
"(",
"\"span\"",
")",
";",
"//$NON-NLS-0$",
"span",
".",
"appendChild",
"(",
"document",
".",
"createTextNode",
"(",
"messages",
"[",
"\"outlineTimeout\"",
"]",
")",
")",
";",
"//$NON-NLS-0$",
"span",
".",
"classList",
".",
"add",
"(",
"\"outlineTimeoutSpan\"",
")",
";",
"//$NON-NLS-0$",
"this",
".",
"_outlineNode",
".",
"appendChild",
"(",
"span",
")",
";",
"}",
".",
"bind",
"(",
"this",
")",
",",
"OUTLINE_TIMEOUT_MS",
")",
";",
"// Bail we're in the process of looking up capable providers",
"if",
"(",
"this",
".",
"_providerLookup",
")",
"{",
"return",
";",
"}",
"this",
".",
"_outlineService",
".",
"emitOutline",
"(",
"this",
".",
"_inputManager",
")",
";",
"}"
] |
Invokes the outline service to produce an outline
|
[
"Invokes",
"the",
"outline",
"service",
"to",
"produce",
"an",
"outline"
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/outliner.js#L447-L477
|
|
14,298
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/outliner.js
|
function(provider) {
var isActive = this._slideout.isVisible() && (this === this._slideout.getCurrentViewMode());
if (isActive && provider) {
isActive = (provider.getProperty("id") === this.providerId); //$NON-NLS-0$
if (isActive) {
isActive = (provider.getProperty("name") === this.providerName); //$NON-NLS-0$
}
}
return isActive;
}
|
javascript
|
function(provider) {
var isActive = this._slideout.isVisible() && (this === this._slideout.getCurrentViewMode());
if (isActive && provider) {
isActive = (provider.getProperty("id") === this.providerId); //$NON-NLS-0$
if (isActive) {
isActive = (provider.getProperty("name") === this.providerName); //$NON-NLS-0$
}
}
return isActive;
}
|
[
"function",
"(",
"provider",
")",
"{",
"var",
"isActive",
"=",
"this",
".",
"_slideout",
".",
"isVisible",
"(",
")",
"&&",
"(",
"this",
"===",
"this",
".",
"_slideout",
".",
"getCurrentViewMode",
"(",
")",
")",
";",
"if",
"(",
"isActive",
"&&",
"provider",
")",
"{",
"isActive",
"=",
"(",
"provider",
".",
"getProperty",
"(",
"\"id\"",
")",
"===",
"this",
".",
"providerId",
")",
";",
"//$NON-NLS-0$",
"if",
"(",
"isActive",
")",
"{",
"isActive",
"=",
"(",
"provider",
".",
"getProperty",
"(",
"\"name\"",
")",
"===",
"this",
".",
"providerName",
")",
";",
"//$NON-NLS-0$",
"}",
"}",
"return",
"isActive",
";",
"}"
] |
Returns a boolean indicating whether the outliner is visible.
@param {orion.serviceregistry.ServiceReference} provider Optional. If specified this function will only return true
if the currently selected provider matches the one passed in.
@return true if the outliner is visible, false otherwise
|
[
"Returns",
"a",
"boolean",
"indicating",
"whether",
"the",
"outliner",
"is",
"visible",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/outliner.js#L589-L598
|
|
14,299
|
eclipse/orion.client
|
bundles/org.eclipse.orion.client.ui/web/orion/outliner.js
|
function(fileContentType, title) {
if (!fileContentType) return;
var lspServer = this.languageServerRegistry.getServerByContentType(fileContentType);
var filteredProviders = null;
var _self = this;
if (lspServer) {
filteredProviders = [];
filteredProviders.push(lspServer);
} else {
var allOutlineProviders = this._serviceRegistry.getServiceReferences("orion.edit.outliner"); //$NON-NLS-0$
// Filter to capable providers
filteredProviders = this.filteredProviders = allOutlineProviders.filter(function(serviceReference) {
var contentTypeIds = serviceReference.getProperty("contentType"), //$NON-NLS-0$
pattern = serviceReference.getProperty("pattern"); // for backwards compatibility //$NON-NLS-0$
if (contentTypeIds) {
return contentTypeIds.some(function(contentTypeId) {
return _self._contentTypeRegistry.isExtensionOf(fileContentType, contentTypeId);
});
} else if (pattern && new RegExp(pattern).test(title)) {
return true;
}
return false;
});
// Load resource bundles
this._providerLookup = true;
filteredProviders.forEach(function(provider) {
provider.displayName = provider.getProperty("name") || provider.getProperty("nameKey"); //$NON-NLS-0$
});
_self._providerLookup = false;
}
_self._outlineService.setOutlineProviders(filteredProviders);
_self.setOutlineProviders(filteredProviders);
_self.generateOutline();
}
|
javascript
|
function(fileContentType, title) {
if (!fileContentType) return;
var lspServer = this.languageServerRegistry.getServerByContentType(fileContentType);
var filteredProviders = null;
var _self = this;
if (lspServer) {
filteredProviders = [];
filteredProviders.push(lspServer);
} else {
var allOutlineProviders = this._serviceRegistry.getServiceReferences("orion.edit.outliner"); //$NON-NLS-0$
// Filter to capable providers
filteredProviders = this.filteredProviders = allOutlineProviders.filter(function(serviceReference) {
var contentTypeIds = serviceReference.getProperty("contentType"), //$NON-NLS-0$
pattern = serviceReference.getProperty("pattern"); // for backwards compatibility //$NON-NLS-0$
if (contentTypeIds) {
return contentTypeIds.some(function(contentTypeId) {
return _self._contentTypeRegistry.isExtensionOf(fileContentType, contentTypeId);
});
} else if (pattern && new RegExp(pattern).test(title)) {
return true;
}
return false;
});
// Load resource bundles
this._providerLookup = true;
filteredProviders.forEach(function(provider) {
provider.displayName = provider.getProperty("name") || provider.getProperty("nameKey"); //$NON-NLS-0$
});
_self._providerLookup = false;
}
_self._outlineService.setOutlineProviders(filteredProviders);
_self.setOutlineProviders(filteredProviders);
_self.generateOutline();
}
|
[
"function",
"(",
"fileContentType",
",",
"title",
")",
"{",
"if",
"(",
"!",
"fileContentType",
")",
"return",
";",
"var",
"lspServer",
"=",
"this",
".",
"languageServerRegistry",
".",
"getServerByContentType",
"(",
"fileContentType",
")",
";",
"var",
"filteredProviders",
"=",
"null",
";",
"var",
"_self",
"=",
"this",
";",
"if",
"(",
"lspServer",
")",
"{",
"filteredProviders",
"=",
"[",
"]",
";",
"filteredProviders",
".",
"push",
"(",
"lspServer",
")",
";",
"}",
"else",
"{",
"var",
"allOutlineProviders",
"=",
"this",
".",
"_serviceRegistry",
".",
"getServiceReferences",
"(",
"\"orion.edit.outliner\"",
")",
";",
"//$NON-NLS-0$",
"// Filter to capable providers",
"filteredProviders",
"=",
"this",
".",
"filteredProviders",
"=",
"allOutlineProviders",
".",
"filter",
"(",
"function",
"(",
"serviceReference",
")",
"{",
"var",
"contentTypeIds",
"=",
"serviceReference",
".",
"getProperty",
"(",
"\"contentType\"",
")",
",",
"//$NON-NLS-0$",
"pattern",
"=",
"serviceReference",
".",
"getProperty",
"(",
"\"pattern\"",
")",
";",
"// for backwards compatibility //$NON-NLS-0$",
"if",
"(",
"contentTypeIds",
")",
"{",
"return",
"contentTypeIds",
".",
"some",
"(",
"function",
"(",
"contentTypeId",
")",
"{",
"return",
"_self",
".",
"_contentTypeRegistry",
".",
"isExtensionOf",
"(",
"fileContentType",
",",
"contentTypeId",
")",
";",
"}",
")",
";",
"}",
"else",
"if",
"(",
"pattern",
"&&",
"new",
"RegExp",
"(",
"pattern",
")",
".",
"test",
"(",
"title",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
")",
";",
"// Load resource bundles",
"this",
".",
"_providerLookup",
"=",
"true",
";",
"filteredProviders",
".",
"forEach",
"(",
"function",
"(",
"provider",
")",
"{",
"provider",
".",
"displayName",
"=",
"provider",
".",
"getProperty",
"(",
"\"name\"",
")",
"||",
"provider",
".",
"getProperty",
"(",
"\"nameKey\"",
")",
";",
"//$NON-NLS-0$",
"}",
")",
";",
"_self",
".",
"_providerLookup",
"=",
"false",
";",
"}",
"_self",
".",
"_outlineService",
".",
"setOutlineProviders",
"(",
"filteredProviders",
")",
";",
"_self",
".",
"setOutlineProviders",
"(",
"filteredProviders",
")",
";",
"_self",
".",
"generateOutline",
"(",
")",
";",
"}"
] |
Called when the inputManager's contentType has changed, so we need to look up the capable outline providers.
@param {String} fileContentType
@param {String} title TODO this is deprecated, should be removed along with "pattern" property of outliners.
|
[
"Called",
"when",
"the",
"inputManager",
"s",
"contentType",
"has",
"changed",
"so",
"we",
"need",
"to",
"look",
"up",
"the",
"capable",
"outline",
"providers",
"."
] |
eb2583100c662b5cfc1b461a978b31d3b8555ce1
|
https://github.com/eclipse/orion.client/blob/eb2583100c662b5cfc1b461a978b31d3b8555ce1/bundles/org.eclipse.orion.client.ui/web/orion/outliner.js#L680-L715
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.