/*
Search and inject ActionPluginSender inside ActionPluginListener
975792
private void injectActionPluginSender(String actionPlugin, ActionPluginListener pluginInstance) throws Exception {
        if (pluginInstance == null) {
            throw new IllegalArgumentException("pluginInstance must be not null");
        }
        Field[] fields = pluginInstance.getClass().getDeclaredFields();
        Field sender = null;
        for (Field field : fields) {
            if (field.isAnnotationPresent(Sender.class) &&
                    field.getType().isAssignableFrom(ActionPluginSender.class)) {
                sender = field;
                break;
            }
        }
        if (sender != null) {
            ActionPluginSender standaloneSender = new StandaloneActionPluginSender(actions);
            sender.setAccessible(true);
            sender.set(pluginInstance, standaloneSender);
            senders.put(actionPlugin, standaloneSender);
        }
    }
716776
private static void injectComponent(final Component<?> component, final boolean inner) {

        // Retrieve all fields annotated with Link
        for (final Field field : ClassUtility.getAnnotatedFields(component.getClass(), Link.class)) {
            final String keyPart = field.getAnnotation(Link.class).value();
            if (inner) {
                if (InnerComponent.class.isAssignableFrom(field.getType())) {
                    if (keyPart.isEmpty()) {
                        injectInnerComponent(component, field);
                    } else {
                        injectInnerComponent(component, field, keyPart);
                    }
                }
            } else {
                if (Component.class.isAssignableFrom(field.getType())) {
                    if (keyPart.isEmpty()) {
                        injectComponent(component, field);
                    } else {
                        injectComponent(component, field, keyPart);
                    }
                }
            }
        }

    }
736068
protected void fireActionPerformed ()
    {
        // guaranteed to return a non-null array
        Object[] listeners = listenerList.getListenerList();
        // process the listeners last to first, notifying those that are
        // interested in this event
        for (int i = listeners.length-2; i >= 0; i -= 2) {
            if (listeners[i] == ActionListener.class) {
                // lazily create the event:
                if (_actionEvent == null) {
                    _actionEvent = new ActionEvent(
                        this, ActionEvent.ACTION_PERFORMED, _actionCommand);
                }
                ((ActionListener)listeners[i+1]).actionPerformed(_actionEvent);
            }
        }
    }
499268
@Override
    public PagedSearchResult search(SearchParams searchParams) {
        PagedSearchResult result = searchOperations.search(searchParams);
        if(result!=null && enableAutoSolutionActionTrack) {
            String reqId = result.getReqId();
            this.sendSolutionActions("search", reqId);
        }
        return result;
    }
1340207
private void initializeSearchTextListener() {
    searchText.addListener((observable, oldText, newText) -> {
      if (newText.equals("")) { // empty search -> doesn't match anything!
        resetSearch();
      } else {
        updateSearch(newText);
      }
    });
  }
1072817
protected void firePluginAddedEvent(PluginEvent event) {
        PluginListener[] listeners = new PluginListener[mPluginListeners.size()];
        listeners = mPluginListeners.toArray(listeners);
        for (int i=0; i < listeners.length; i++) {			
            listeners[i].pluginAdded(event);
        }
    }
1253742
function resolvePlugin(item) {
    /**
     * Handle when string was given, such as plugins: ['bs-html-injector']
     */
    if (typeof item === "string") {
        return getFromString(item);
    }

    if (!isMap(item)) {
        return new Plugin().mergeDeep({
            errors: [new Error("Plugin not supported in this format")]
        });
    }

    if (item.has("module")) {
        var nameOrObj = item.get("module");
        var options = item.get("options");

        /**
         * The 'module' key can be a string, this allows
         * inline plugin references, but with options
         * eg:
         *
         * bs.init({
         *     plugins: [
         *         {
         *             module: './myjs-file.js'
         *             options: {
         *                 files: "*.html"
         *             }
         *         }
         *     ]
         * });
         */
        if (typeof nameOrObj === "string") {
            return getFromString(nameOrObj).mergeDeep({
                options: options
            });
        }

        /**
         * If the plugin was given completely inline (because it needs options)
         * eg:
         *
         * bs.init({
         *     plugins: [
         *         {
         *             module: {
         *                 plugin: function() {
         *                     console.log('My plugin code')
         *                 }
         *             },
         *             options: {
         *                 files: "*.html"
         *             }
         *         }
         *     ]
         * })
         */
        if (Immutable.Map.isMap(nameOrObj)) {
            return new Plugin({
                module: nameOrObj,
                options: options
            });
        }
    }

    /**
     * If a module was given directly. For example, ater calling require.
     *
     * eg:
     *    var myplugin = require('./some-js');
     *    bs.init({plugins: [myplugin]});
     */
    if (item.has("plugin")) {
        return new Plugin({
            module: item
        });
    }

    /**
     * If we reach here, the plugin option was used incorrectly
     */
    return new Plugin().mergeDeep({
        errors: [new Error("Plugin was not configured correctly")]
    });
}
580406
public <R> R doInContext(SearchContext context, Supplier<R> action) {
        R result;
        if (context == null) {
            result = action.get();
        } else {
            // store current context (without triggering exception if it was stale)
            SearchContext currentSearchContext = currentContext;
            boolean contextIsStale = currentContextIsStale;

            setCurrentContext(context);
            try {
                result = action.get();
            } finally {
                // make original current context active again
                currentContext = currentSearchContext;
                currentContextIsStale = contextIsStale;
            }
        }
        return result;
    }
650857
public void actionPurgeJspRepository() throws JspException {

        OpenCms.fireCmsEvent(
            new CmsEvent(I_CmsEventListener.EVENT_FLEX_PURGE_JSP_REPOSITORY, Collections.<String, Object> emptyMap()));
        OpenCms.fireCmsEvent(
            new CmsEvent(
                I_CmsEventListener.EVENT_FLEX_CACHE_CLEAR,
                Collections.<String, Object> singletonMap("action", new Integer(CmsFlexCache.CLEAR_ENTRIES))));

        setAction(CmsDialog.ACTION_CANCEL);
        actionCloseDialog();
    }
1127787
function injectPathComponentIntoIntentFilter(intentFilter, pathName) {
  if (pathName == null || pathName === '*') {
    return;
  }

  var attrKey = 'android:path';
  if (pathName.indexOf('*') >= 0) {
    attrKey = 'android:pathPattern';
    pathName = pathName.replace(/\*/g, '.*');
  }

  if (pathName.indexOf('/') != 0) {
    pathName = '/' + pathName;
  }

  intentFilter['data'][0]['$'][attrKey] = pathName;
}
885554
function _localBinders()
        {
          this._attrListeners = {};
          this._attrUpdateListeners = {};
          this._styleListeners = {};
          this._styleUpdateListeners = {};
          this._parentStyleListeners = {};
          this._parentStyleUpdateListeners = {};
          this._parentAttrListeners = {};
          this._parentAttrUpdateListeners = {};
          this._injectedStyle = {};
        }
364088
public function initializeSearchComponent()
    {
        if ($this->seachRequest->getContextTypoScriptConfiguration()->getEnabledDebugMode()) {
            $this->queryBuilder->startFrom($this->query)->useDebug(true);
        }
    }
411618
@SuppressWarnings("unchecked")
    <T> T loadPlugin(final Class<T> pluginType) {
        return (T) loadPlugin(pluginType, null);
    }
64533
function(event) {
  if (event) {
    var executeDispatch = EventPluginUtils.executeDispatch;
    // Plugins can provide custom behavior when dispatching events.
    var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event);
    if (PluginModule && PluginModule.executeDispatch) {
      executeDispatch = PluginModule.executeDispatch;
    }
    EventPluginUtils.executeDispatchesInOrder(event, executeDispatch);

    if (!event.isPersistent()) {
      event.constructor.release(event);
    }
  }
}
1064718
function(action, channel, imports, sysImports, contentParts, next, invokeOverride) {
    var self = this,
    errStr,
    parsingError = false,
    schemePtr,
    mixedTypes = [ 'mixed', 'array', 'object' ]

    if (this.actions[action].invoke) {

      if (!channel.config) {
        channel.config = {};
      }

      if (!contentParts) {
        contentParts = {
          _files : []
        }
      }

      try {

        // apply channel config defaults into imports, if required
        // fields don't already exist
        var actionSchema = this.getAction(action),
          missingFields = (actionSchema.imports && actionSchema.imports.required && actionSchema.imports.required.length) ? actionSchema.imports.required : [];

        // apply config defaults
        var configDefaults = this.getActionConfigDefaults(action),
          configSchema = this.getActionConfig(action).properties,
          importSchema = this.getActionImports(action).properties;

        _.each(configDefaults, function(value, key) {
          if (!channel.config[key]) {
            channel.config[key] = value;
          }
        });

        // transpose from config to imports (no need to reference channel.config in pods)
        _.each(channel.config, function(value, key) {
          // convert to boolean if not already
          if (configSchema[key] && 'boolean' === configSchema[key].type) {
            channel.config[key] = helper.isTruthy(value) ? true : false;
          }

          if (!imports[key]) {
            imports[key] = channel.config[key];
          }
        });

        // derive import defaults
        var importDefaults = this.getActionImportDefaults(action);
        _.each(importDefaults, function(value, key) {
          if (!imports[key]) {
            imports[key] = value;
          }
        });

        for (var k in imports) {
          // trim empty import
          if (imports.hasOwnProperty(k) && '' === imports[k]) {
            delete imports[k];
            continue;
          }

          if (missingFields.length && missingFields.indexOf(k) > -1  ){
        	   missingFields.splice(missingFields.indexOf(k) ,1);
          }

        var mixed;
		    if(
          importSchema[k] && importSchema[k].type
          || configSchema[k] && configSchema[k].type
          ) {
			  	p_errStr = null;
			  	value = imports[k];

          if (importSchema[k]) {
            schemePtr = importSchema[k];
          } else if (configSchema[k]) {
            schemePtr = configSchema[k];
          }

          type = schemePtr.type.toLowerCase();

          //
          if ('number' === type) {
            pValue = helper.stringToFloat(value);
            if (0 !== pValue && !pValue) {
              p_errStr = k + ': String cannot be converted to Number';
            } else {
              imports[k] = pValue;
            }

          } else if ('integer' === type) {
            pValue = helper.stringToInt(value);
            if (0 !== pValue && !pValue) {
              p_errStr = k + ': String cannot be converted to Integer';
            } else {
              imports[k] = pValue;
            }

          } else if ('boolean' === type) {

            var pValue = helper.stringToBoolean(value);

            if (pValue == null) {
              p_errStr = k + ': String cannot be converted to Boolean';
            } else {
              imports[k] = pValue;
            }

          } else if (-1 !== mixedTypes.indexOf(type) ) {
            if ('object' === type && helper.isObject(value)) {
              imports[k] = value;

            } else if ('array' === type && helper.isArray(value)) {
              imports[k] = value;

            } else {
              pValue = helper.stringToJson(value);

              if (pValue) {
                imports[k] = pValue;

              } else if(!pValue){
                imports[k] = value;

              } else {
                p_errStr = k + ': String cannot be converted to '
                  + (('mixed' === type || 'object' === type) ? 'Object' : 'Array') ;
              }
            }
          }

        	if(p_errStr){
        		parsingError = true;
        		self.log(p_errStr, channel, 'error');
        		next.call(self, p_errStr);
        	}
			  }
      }

      if(missingFields.length){
        errStr = 'Missing Required Field(s):' + missingFields.join();
        self.log(errStr, channel, 'error');
        next.call(self, errStr)
      }

      if (!missingFields.length && !parsingError) {
        var invokeMethod = 'invoke' === this.getTriggerType() ? 'invoke' : 'trigger';

        // @deprecate -- when all trigger actions support 'trigger' method
        if (invokeOverride || !this.actions[action][invokeMethod]) {
          invokeMethod = 'invoke';
        }

        //
        this.actions[action][invokeMethod](imports, channel, sysImports, contentParts, function(err, exports) {
          if (err) {
            self.log(err, channel, 'error');
          }
          next.apply(self, arguments);
        });
      }
     } catch (e) {
       errStr = 'EXCEPT ' + e.toString();
       self.log(errStr, channel, 'error');
 	  	 next.call(self, errStr);
     }
    }
  }
128922
public void search(AjaxRequestTarget ajaxRequestTarget, String value)
	{
		ajaxRequestTarget.appendJavaScript(this.search(value).render().toString());
	}
913194
private void registerEventListeners(final Properties props, final URLClassLoader classLoader, final AbstractPlugin plugin)
            throws Exception {
        final String eventListenerClasses = props.getProperty(Plugin.PLUGIN_EVENT_LISTENER_CLASSES);
        final String[] eventListenerClassArray = eventListenerClasses.split(",");

        for (final String eventListenerClassName : eventListenerClassArray) {
            if (StringUtils.isBlank(eventListenerClassName)) {
                LOGGER.log(Level.INFO, "No event listener to load for plugin[name={0}]", plugin.getName());
                return;
            }

            LOGGER.log(Level.DEBUG, "Loading event listener[className={0}]", eventListenerClassName);

            final Class<?> eventListenerClass = classLoader.loadClass(eventListenerClassName);
            final AbstractEventListener<?> eventListener = (AbstractEventListener) eventListenerClass.newInstance();

            plugin.addEventListener(eventListener);

            LOGGER.log(Level.DEBUG, "Registered event listener[class={0}, eventType={1}] for plugin[name={2}]",
                    eventListener.getClass(), eventListener.getEventType(), plugin.getName());
        }
    }