|
Lines 20-28
define([
Link Here
|
| 20 |
'orion/widgets/input/SettingsSelect', |
20 |
'orion/widgets/input/SettingsSelect', |
| 21 |
'i18n!orion/settings/nls/messages', |
21 |
'i18n!orion/settings/nls/messages', |
| 22 |
'orion/i18nUtil', |
22 |
'orion/i18nUtil', |
| 23 |
'orion/commands' |
23 |
'orion/commands', |
|
|
24 |
'orion/PageUtil', |
| 25 |
'orion/webui/littlelib', |
| 26 |
'orion/URITemplate' |
| 24 |
], function(mExplorer, mSection, Deferred, objects, mConfirmDialog, SettingsCheckbox, SettingsTextfield, |
27 |
], function(mExplorer, mSection, Deferred, objects, mConfirmDialog, SettingsCheckbox, SettingsTextfield, |
| 25 |
SettingsSelect, messages, i18nUtil, Commands) { |
28 |
SettingsSelect, messages, i18nUtil, Commands, PageUtil, lib, URITemplate) { |
| 26 |
var Explorer = mExplorer.Explorer, |
29 |
var Explorer = mExplorer.Explorer, |
| 27 |
SelectionRenderer = mExplorer.SelectionRenderer, |
30 |
SelectionRenderer = mExplorer.SelectionRenderer, |
| 28 |
Section = mSection.Section, |
31 |
Section = mSection.Section, |
|
Lines 30-35
define([
Link Here
|
| 30 |
ConfirmDialog = mConfirmDialog.ConfirmDialog; |
33 |
ConfirmDialog = mConfirmDialog.ConfirmDialog; |
| 31 |
|
34 |
|
| 32 |
var SECTION_HIDE = '/settings/sectionExpand'; //$NON-NLS-1$ |
35 |
var SECTION_HIDE = '/settings/sectionExpand'; //$NON-NLS-1$ |
|
|
36 |
var editTemplate = new URITemplate("/edit/edit.html#{,resource,params*}"); //$NON-NLS-0$ |
| 33 |
|
37 |
|
| 34 |
/** |
38 |
/** |
| 35 |
* @name orion.settings.ui.PropertyWidget |
39 |
* @name orion.settings.ui.PropertyWidget |
|
Lines 380-385
define([
Link Here
|
| 380 |
var commandRegistry = this.commandRegistry = options.commandRegistry; |
384 |
var commandRegistry = this.commandRegistry = options.commandRegistry; |
| 381 |
this.settings = options.settings; |
385 |
this.settings = options.settings; |
| 382 |
this.title = options.title; |
386 |
this.title = options.title; |
|
|
387 |
this.fileClient = options.fileClient; |
| 383 |
if (!options.parent || !options.serviceRegistry || !options.settings || !options.title) { |
388 |
if (!options.parent || !options.serviceRegistry || !options.settings || !options.title) { |
| 384 |
throw new Error('Missing required option'); //$NON-NLS-0$ |
389 |
throw new Error('Missing required option'); //$NON-NLS-0$ |
| 385 |
} |
390 |
} |
|
Lines 427-432
define([
Link Here
|
| 427 |
}, |
432 |
}, |
| 428 |
destroy: function() { |
433 |
destroy: function() { |
| 429 |
this.explorer.destroy(); |
434 |
this.explorer.destroy(); |
|
|
435 |
this.destroyed = true; |
| 430 |
}, |
436 |
}, |
| 431 |
restore: function(pid) { |
437 |
restore: function(pid) { |
| 432 |
var deferreds = []; |
438 |
var deferreds = []; |
|
Lines 453-458
define([
Link Here
|
| 453 |
} |
459 |
} |
| 454 |
}, |
460 |
}, |
| 455 |
render: function(parent, serviceRegistry, settings, categoryTitle) { |
461 |
render: function(parent, serviceRegistry, settings, categoryTitle) { |
|
|
462 |
if (settings && settings.length > 2 && "javascript" === settings[0].category) { |
| 463 |
var pageParams = PageUtil.matchResourceParameters(); |
| 464 |
this.fileClient.fetchChildren(pageParams.resource + "?depth=1").then(function(children) { |
| 465 |
console.log("Render :" + this.destroyed); |
| 466 |
if (!this.destroyed) { |
| 467 |
children.some(function (child) { |
| 468 |
if (child.Name === ".eslintrc") { |
| 469 |
console.log("Creation: " + this.destroyed); |
| 470 |
var infoText = document.createElement("div"); //$NON-NLS-0$ |
| 471 |
infoText.classList.add("setting-info"); //$NON-NLS-0$ |
| 472 |
infoText.textContent = messages.JavascriptSettingWarning; |
| 473 |
var icon = document.createElement("span"); //$NON-NLS-0$ |
| 474 |
icon.classList.add("core-sprite-warning"); //$NON-NLS-0$ |
| 475 |
icon.classList.add("icon-inline"); //$NON-NLS-0$ |
| 476 |
icon.classList.add("imageSprite"); //$NON-NLS-0$ |
| 477 |
var link = document.createElement("a"); //$NON-NLS-0$ |
| 478 |
link.href = editTemplate.expand({resource: child.Location}); |
| 479 |
link.appendChild(document.createTextNode(child.Name)); |
| 480 |
lib.processDOMNodes(infoText, [icon, link]); |
| 481 |
try { |
| 482 |
if (parent.firstChild) { |
| 483 |
console.log("insert: " + this.destroyed); |
| 484 |
parent.insertBefore(infoText, parent.firstChild); |
| 485 |
} else { |
| 486 |
console.log("append: " + this.destroyed); |
| 487 |
parent.appendChild(infoText); |
| 488 |
} |
| 489 |
} catch(e) { |
| 490 |
console.log(e); |
| 491 |
} |
| 492 |
return true; |
| 493 |
} |
| 494 |
}.bind(this)); |
| 495 |
} |
| 496 |
}.bind(this)); |
| 497 |
|
| 498 |
} |
| 456 |
for (var i=0; i<settings.length; i++) { |
499 |
for (var i=0; i<settings.length; i++) { |
| 457 |
var setting = settings[i]; |
500 |
var setting = settings[i]; |
| 458 |
var sectionId = 'settings.section.'; //$NON-NLS-1$ |
501 |
var sectionId = 'settings.section.'; //$NON-NLS-1$ |