Widget showing list of Plugin Settings.
Requires the 'orion.cm.configadmin' service.
@param {DomNode|String} options.parent
@param {orion.serviceregistry.ServiceRegistry} options.serviceRegistry
@param {orion.settings.Settings[]} options.settings
961019
function SettingsList(options) {
		this.serviceRegistry = options.serviceRegistry;
		this.prefService = this.serviceRegistry.getService('orion.core.preference'); //$NON-NLS-1$
		var commandRegistry = this.commandRegistry = options.commandRegistry;
		this.settings = options.settings;
		this.title = options.title;
		this.fileClient = options.fileClient;
		if (!options.parent || !options.serviceRegistry || !options.settings || !options.title) {
			throw new Error('Missing required option'); //$NON-NLS-0$
		}
		this.parent = typeof options.parent === 'string' ? document.getElementById('parent') : options.parent; //$NON-NLS-0$ //$NON-NLS-1$

		var restoreCommand = new Command({
			id: "orion.pluginsettings.restore", //$NON-NLS-0$
			name: messages["Restore"],
			callback: function(data) {
				var dialog = new ConfirmDialog({
					confirmMessage: messages["ConfirmRestore"],
					title: messages["Restore"]
				});
				dialog.show();
				var _self = this;
				dialog.addEventListener("dismiss", function(event) {
					if (event.value) {
					    if(data.items) {
						    _self.restore(data.items.pid);
						} else {
						    _self.restore();
						}
					}
				});
			}.bind(this)
		});
		commandRegistry.addCommand(restoreCommand);
		commandRegistry.registerCommandContribution("restoreDefaults", "orion.pluginsettings.restore", 2); //$NON-NLS-1$ //$NON-NLS-2$

		this.render(this.parent, this.serviceRegistry, this.settings, this.title);
	}
1364101
function mergeOptions (
  parent,
  child,
  vm
) {
  {
    checkComponents(child);
  }

  if (typeof child === 'function') {
    child = child.options;
  }

  normalizeProps(child, vm);
  normalizeInject(child, vm);
  normalizeDirectives(child);

  // Apply extends and mixins on the child options,
  // but only if it is a raw options object that isn't
  // the result of another mergeOptions call.
  // Only merged options has the _base property.
  if (!child._base) {
    if (child.extends) {
      parent = mergeOptions(parent, child.extends, vm);
    }
    if (child.mixins) {
      for (let i = 0, l = child.mixins.length; i < l; i++) {
        parent = mergeOptions(parent, child.mixins[i], vm);
      }
    }
  }

  const options = {};
  let key;
  for (key in parent) {
    mergeField(key);
  }
  for (key in child) {
    if (!hasOwn(parent, key)) {
      mergeField(key);
    }
  }
  function mergeField (key) {
    const strat = strats[key] || defaultStrat;
    options[key] = strat(parent[key], child[key], vm, key);
  }
  return options
}
678567
function(options) {
            var settings = $.extend({}, this.treegrid.defaults, options);
            return this.each(function() {
                var $this = $(this);
                $this.treegrid('setTreeContainer', $(this));
                $this.treegrid('setSettings', settings);
                settings.getRootNodes.apply(this, [$(this)]).treegrid('initNode', settings);
                $this.treegrid('getRootNodes').treegrid('render');
            });
        }
616492
function setupConfig(options) {
    if (options.resetConfig) {
        // Reset your environment variables for resetting node-config module. node-config is a singleton.
        // For testing it's necessary to reset and this is a workaround from node-config support.
        global.NODE_CONFIG = null;
        delete require.cache[require.resolve('config')];
        config = require('config');
        delete options.resetConfig;
    }

    var customConfigFile, customConfig,
        defaultConfig       = require('../config/default.js');

    options = options || {};

    if (options.config) {
        customConfigFile    = options.config.charAt(0) === '/' || options.config.charAt(0) === '\\' ? options.config : path.join(process.cwd(), options.config); // Absolute or relative
        customConfig        = require(customConfigFile);
    }

    delete options.config;

    // Combine configs and override lower priority configs.
    config.util.extendDeep(config, defaultConfig, customConfig || {}, { "sequelize-pg-generator": options });
}
385151
function(settings) {
		"use strict";

		var parent = this;

		var options = parent.options = mergeRecursive(parent.options, settings);

		// Fatal errors
		// Stop script execution on error
		validateDomainType();
		validateSelector(options.itemSelector, false, "itemSelector");

		if (parent.allowedDataType.indexOf(options.dataType) === -1) {
			throw new Error("The data type '" + options.dataType + "' is not valid data type");
		}

		if (d3.select(options.itemSelector)[0][0] === null) {
			throw new Error("The node '" + options.itemSelector + "' specified in itemSelector does not exists");
		}

		try {
			validateSelector(options.nextSelector, true, "nextSelector");
			validateSelector(options.previousSelector, true, "previousSelector");
		} catch(error) {
			console.log(error.message);
			return false;
		}

		// If other settings contains error, will fallback to default

		if (!settings.hasOwnProperty("subDomain")) {
			this.options.subDomain = getOptimalSubDomain(settings.domain);
		}

		if (typeof options.itemNamespace !== "string" || options.itemNamespace === "") {
			console.log("itemNamespace can not be empty, falling back to cal-heatmap");
			options.itemNamespace = "cal-heatmap";
		}

		// Don't touch these settings
		var s = ["data", "onComplete", "onClick", "afterLoad", "afterLoadData", "afterLoadPreviousDomain", "afterLoadNextDomain"];

		for (var k in s) {
			if (settings.hasOwnProperty(s[k])) {
				options[s[k]] = settings[s[k]];
			}
		}

		options.subDomainDateFormat = (typeof options.subDomainDateFormat === "string" || typeof options.subDomainDateFormat === "function" ? options.subDomainDateFormat : this._domainType[options.subDomain].format.date);
		options.domainLabelFormat = (typeof options.domainLabelFormat === "string" || typeof options.domainLabelFormat === "function" ? options.domainLabelFormat : this._domainType[options.domain].format.legend);
		options.subDomainTextFormat = ((typeof options.subDomainTextFormat === "string" && options.subDomainTextFormat !== "") || typeof options.subDomainTextFormat === "function" ? options.subDomainTextFormat : null);
		options.domainMargin = expandMarginSetting(options.domainMargin);
		options.legendMargin = expandMarginSetting(options.legendMargin);
		options.highlight = parent.expandDateSetting(options.highlight);
		options.itemName = expandItemName(options.itemName);
		options.colLimit = parseColLimit(options.colLimit);
		options.rowLimit = parseRowLimit(options.rowLimit);
		if (!settings.hasOwnProperty("legendMargin")) {
			autoAddLegendMargin();
		}
		autoAlignLabel();

		/**
		 * Validate that a queryString is valid
		 *
		 * @param  {Element|string|bool} selector   The queryString to test
		 * @param  {bool}	canBeFalse	Whether false is an accepted and valid value
		 * @param  {string} name		Name of the tested selector
		 * @throws {Error}				If the selector is not valid
		 * @return {bool}				True if the selector is a valid queryString
		 */
		function validateSelector(selector, canBeFalse, name) {
			if (((canBeFalse && selector === false) || selector instanceof Element || typeof selector === "string") && selector !== "") {
				return true;
			}
			throw new Error("The " + name + " is not valid");
		}

		/**
		 * Return the optimal subDomain for the specified domain
		 *
		 * @param  {string} domain a domain name
		 * @return {string}        the subDomain name
		 */
		function getOptimalSubDomain(domain) {
			switch(domain) {
			case "year":
				return "month";
			case "month":
				return "day";
			case "week":
				return "day";
			case "day":
				return "hour";
			default:
				return "min";
			}
		}

		/**
		 * Ensure that the domain and subdomain are valid
		 *
		 * @throw {Error} when domain or subdomain are not valid
		 * @return {bool} True if domain and subdomain are valid and compatible
		 */
		function validateDomainType() {
			if (!parent._domainType.hasOwnProperty(options.domain) || options.domain === "min" || options.domain.substring(0, 2) === "x_") {
				throw new Error("The domain '" + options.domain + "' is not valid");
			}

			if (!parent._domainType.hasOwnProperty(options.subDomain) || options.subDomain === "year") {
				throw new Error("The subDomain '" + options.subDomain + "' is not valid");
			}

			if (parent._domainType[options.domain].level <= parent._domainType[options.subDomain].level) {
				throw new Error("'" + options.subDomain + "' is not a valid subDomain to '" + options.domain +  "'");
			}

			return true;
		}

		/**
		 * Fine-tune the label alignement depending on its position
		 *
		 * @return void
		 */
		function autoAlignLabel() {
			// Auto-align label, depending on it's position
			if (!settings.hasOwnProperty("label") || (settings.hasOwnProperty("label") && !settings.label.hasOwnProperty("align"))) {
				switch(options.label.position) {
				case "left":
					options.label.align = "right";
					break;
				case "right":
					options.label.align = "left";
					break;
				default:
					options.label.align = "center";
				}

				if (options.label.rotate === "left") {
					options.label.align = "right";
				} else if (options.label.rotate === "right") {
					options.label.align = "left";
				}
			}

			if (!settings.hasOwnProperty("label") || (settings.hasOwnProperty("label") && !settings.label.hasOwnProperty("offset"))) {
				if (options.label.position === "left" || options.label.position === "right") {
					options.label.offset = {
						x: 10,
						y: 15
					};
				}
			}
		}

		/**
		 * If not specified, add some margin around the legend depending on its position
		 *
		 * @return void
		 */
		function autoAddLegendMargin() {
			switch(options.legendVerticalPosition) {
			case "top":
				options.legendMargin[2] = parent.DEFAULT_LEGEND_MARGIN;
				break;
			case "bottom":
				options.legendMargin[0] = parent.DEFAULT_LEGEND_MARGIN;
				break;
			case "middle":
			case "center":
				options.legendMargin[options.legendHorizontalPosition === "right" ? 3 : 1] = parent.DEFAULT_LEGEND_MARGIN;
			}
		}

		/**
		 * Expand a number of an array of numbers to an usable 4 values array
		 *
		 * @param  {integer|array} value
		 * @return {array}        array
		 */
		function expandMarginSetting(value) {
			if (typeof value === "number") {
				value = [value];
			}

			if (!Array.isArray(value)) {
				console.log("Margin only takes an integer or an array of integers");
				value = [0];
			}

			switch(value.length) {
			case 1:
				return [value[0], value[0], value[0], value[0]];
			case 2:
				return [value[0], value[1], value[0], value[1]];
			case 3:
				return [value[0], value[1], value[2], value[1]];
			case 4:
				return value;
			default:
				return value.slice(0, 4);
			}
		}

		/**
		 * Convert a string to an array like [singular-form, plural-form]
		 *
		 * @param  {string|array} value Date to convert
		 * @return {array}       An array like [singular-form, plural-form]
		 */
		function expandItemName(value) {
			if (typeof value === "string") {
				return [value, value + (value !== "" ? "s" : "")];
			}

			if (Array.isArray(value)) {
				if (value.length === 1) {
					return [value[0], value[0] + "s"];
				} else if (value.length > 2) {
					return value.slice(0, 2);
				}

				return value;
			}

			return ["item", "items"];
		}

		function parseColLimit(value) {
			return value > 0 ? value : null;
		}

		function parseRowLimit(value) {
			if (value > 0 && options.colLimit > 0) {
				console.log("colLimit and rowLimit are mutually exclusive, rowLimit will be ignored");
				return null;
			}
			return value > 0 ? value : null;
		}

		return this._init();

	}
1002263
private function parsePluginsSettings(\DOMNode $plugins) {

		if(is_null($this->services)) {
			$this->services = [];
		}

		foreach($plugins->getElementsByTagName('plugin') as $plugin) {

			if(!($id = $plugin->getAttribute('id'))) {
				throw new ConfigException('Plugin without id found.');
			}

			if(isset($this->plugins[$id])) {
				throw new ConfigException(sprintf("Plugin '%s' has already been defined.", $id));
			}

			if(!($class = $plugin->getAttribute('class'))) {
				throw new ConfigException(sprintf("No class for plugin '%s' configured.", $id));
			}

			// clean path delimiters, prepend leading backslash, and replace slashes with backslashes

			$class = '\\' . ltrim(str_replace('/', '\\', $class), '/\\');

			// store parsed information

			$this->plugins[$id] = [
				'class'			=> $class,
				'parameters'	=> []
			];

			foreach($plugin->getElementsByTagName('parameter') as $parameter) {

				$name = $parameter->getAttribute('name');
				$value = $parameter->getAttribute('value');

				if(!$name) {
					throw new ConfigException(sprintf("A parameter for plugin '%s' has no name.", $id));
				}

				$this->plugins[$id]['parameters'][$name] = $value;

			}

		}

	}
1140346
private void doCustomOption(final CustomOptionContext ctx, final ParserRuleContext parentCtx) {
    locationBuilder.addLocation().setAllSpan(parentCtx);


    locationBuilder.addOptionLocation().setAllSpan(parentCtx).comments(parentCtx)

    .addOptionNameLocation().setAllSpan(ctx.customOptionName());

    for (final CustomOptionNamePartContext namePart : ctx.customOptionName().customOptionNamePart()) {
      locationBuilder
          .addLocationForPrimitive(UninterpretedOption.NAME_FIELD_NUMBER)
          .setAllSpan(namePart)

          .addLocationForPrimitive(UninterpretedOption.NamePart.NAME_PART_FIELD_NUMBER)
          .setAllSpan(
              namePart.customOptionNamePartId() == null ? namePart.identifier() : namePart
                  .customOptionNamePartId());
    }

    // exit OptionName scope
    locationBuilder.popScope();

    // customOption value locations: can be scalar or aggregate!

    final CustomOptionValueContext customOptionValue = ctx.customOptionValue();
    int valuePath;

    if (customOptionValue.optionAggregateValue() != null) {
      valuePath = UninterpretedOption.AGGREGATE_VALUE_FIELD_NUMBER;
    } else {
      final OptionScalarValueContext optionScalarValue = customOptionValue.optionScalarValue();

      if (optionScalarValue.doubleValue() != null) {
        valuePath = UninterpretedOption.DOUBLE_VALUE_FIELD_NUMBER;
      } else if (optionScalarValue.identifier() != null) {
        valuePath = UninterpretedOption.IDENTIFIER_VALUE_FIELD_NUMBER;
      } else if (optionScalarValue.StringLiteral() != null
          || optionScalarValue.BooleanLiteral() != null) {
        valuePath = UninterpretedOption.STRING_VALUE_FIELD_NUMBER;
      } else if (optionScalarValue.NegativeIntegerLiteral() != null) {
        valuePath = UninterpretedOption.NEGATIVE_INT_VALUE_FIELD_NUMBER;
      } else if (optionScalarValue.IntegerLiteral() != null) {
        valuePath = UninterpretedOption.POSITIVE_INT_VALUE_FIELD_NUMBER;
      } else { // we shouldn't arrive here!
        throw new RuntimeException("custom option value has unidentified type!");
      }
    }

    locationBuilder.addLocationForPrimitive(valuePath).setAllSpan(customOptionValue)

    // exit Option scope
        .popScope();

    // should the aggregate locations be added here? BTW, protoc fails on
    // aggregates!
  }
978453
function Plugin(element, options) {
    this.element = element;
    this.settings = $.extend({}, defaults, options);
    this.periodOptions = {
      title: this.settings.periodTitle,
      backgroundColor: this.settings.periodBackgroundColor,
      borderColor: this.settings.periodBorderColor,
      textColor: this.settings.periodTextColor
    };
    this.init();
  }
292647
private function registerPluginAssets()
    {
        $view = $this->getView();
        NestableAsset::register($view);

        $pluginOptions = Json::encode($this->pluginOptions);
        $name = $this->hasModel() ? Html::getInputName($this->model, $this->attribute) : $this->name;
        $js = <<<JS
    $('.dd').nestable({$pluginOptions}).on('change', function () {
        var obj = $(this).parents('.nestable-box'),
            nestable = new Array();
        obj.find('.nestable-lists').each(function (index, element) {
            if ($(element).data('group')) {
                nestable[index] = new Object();
                nestable[index]['group'] = $(element).data('group');
                nestable[index]['title'] = $(element).data('title');
                nestable[index]['items'] = $(element).find('.dd').nestable('serialize');
            }
        });

        $("[name=\"{$name}\"]").val(JSON.stringify(nestable));
    });
JS;
        if ($this->collapsed) {
            $js .= "\n$('.dd').nestable('collapseAll')";
        }
        $view->registerJs($js);
    }
821442
function(options){
			var children  = (docMap[config.parent].children || []);
			for(var i = 0 ; i < children.length; i++){
				if(children[i].name == this.name){
					return options.fn(this);
				}
			}
			return "";
		}
1002058
function(serviceRegistry, setup) {
	this._setup = setup;
	this._projectClient = serviceRegistry.getService("orion.project.client");
	serviceRegistry.registerService("orion.edit.hover", this, {
		name: 'Hover Evaluation',
		contentType: ["application/javascript", "text/x-c++src", "text/x-python"] // TODO: get by sub-services
	});
}
443318
function checkOptions(
  { jdlObject, applicationSettings, applicationsPerEntityName } = {
    applicationSettings: {},
    applicationsPerEntityName: {}
  }
) {
  if (!jdlObject) {
    throw new Error('A JDL object has to be passed to check its options.');
  }
  configuration = {
    jdlObject,
    applicationSettings,
    applicationsPerEntityName
  };
  jdlObject.getOptions().forEach(option => {
    checkOption(option);
  });
}
419896
function(settings, scope) {
        var
          scopeOptions = angular.extend({}, scope),
          htOptions, i, length;

        settings = settings || {};
        angular.extend(scopeOptions, scope.settings || {});
        htOptions = this.getAvailableSettings();

        for (i = 0, length = htOptions.length; i < length; i++) {
          if (typeof scopeOptions[htOptions[i]] !== 'undefined') {
            settings[htOptions[i]] = scopeOptions[htOptions[i]];
          }
        }

        return settings;
      }
376449
function configureEvents(dispatch, options){
                        if (dispatch && options){
                            angular.forEach(dispatch, function(value, key){
                                if (options[key] === undefined || options[key] === null){
                                    if (scope._config.extended) options[key] = value.on;
                                }
                                else dispatch.on(key + '._', options[key]);
                            });
                        }
                    }
715694
function (config) {
  this.globals = config.globals || {};
  this.templates = {};
  this.config = _.extend({}, defaults, config);
  this.config.optionsRegex = new RegExp("^" + this.config.optionsDelimiter + "([\\S\\s]+)" + this.config.optionsDelimiter + "([\\S\\s]+)");
}
777825
function extendConfig(defaults, config) {

        var key;

        // plugins
        if (config.plugins) {

            config.plugins.forEach(function(item) {

                // {}
                if (typeof item === 'object') {

                    key = Object.keys(item)[0];

                    // custom
                    if (typeof item[key] === 'object' && item[key].fn && typeof item[key].fn === 'function') {
                        defaults.plugins.push(setupCustomPlugin(key, item[key]));

                    } else {
                        defaults.plugins.forEach(function(plugin) {

                            if (plugin.name === key) {
                                // name: {}
                                if (typeof item[key] === 'object') {
                                    plugin.params = EXTEND({}, plugin.params || {}, item[key]);
                                    plugin.active = true;

                                // name: false
                                } else if (item[key] === false) {
                                   plugin.active = false;

                                // name: true
                                } else if (item[key] === true) {
                                   plugin.active = true;
                                }
                            }
                        });
                    }

                }

            });

        }

        defaults.multipass = config.multipass;

        // svg2js
        if (config.svg2js) {
            defaults.svg2js = config.svg2js;
        }

        // js2svg
        if (config.js2svg) {
            defaults.js2svg = config.js2svg;
        }

        return defaults;

    }
4294
function config(name, options) {
    if (isObject(name)) {
      extend(global, name);
      return;
    }
    var previous = (registry[name] && registry[name].$config) ? registry[name].$config() : null,
        base = extend({}, previous ? extend({}, previous) : extend({}, DEFAULTS, DEFAULT_METHODS));

    options = deepExtend(copy(base), options);

    if (!options.url) {
      options.url = global.base.replace(/\/$/, '') + '/' + hyphenate(name);
    }
    registry[name] = new ModelClass(options);
  }