Register a new plugin with the PluginManager.

        `plugin` is a subclass of scruffy's Plugin class.

        This is called by __init__(), but may also be called by the debugger
        host to load a specific plugin at runtime.
194868
def register_plugin(self, plugin):
        
        if hasattr(plugin, 'initialise'):
            plugin.initialise()
        if self.valid_api_plugin(plugin):
            log.debug("Registering API plugin: {}".format(plugin))
            self._api_plugins[plugin.request] = plugin()
        elif self.valid_debugger_plugin(plugin):
            log.debug("Registering debugger plugin: {}".format(plugin))
            self._debugger_plugins[plugin.host] = plugin()
        elif self.valid_view_plugin(plugin):
            log.debug("Registering view plugin: {}".format(plugin))
            self._view_plugins[plugin.name] = plugin()
        elif self.valid_web_plugin(plugin):
            log.debug("Registering web plugin: {}".format(plugin))
            self._web_plugins[plugin.name] = plugin()
        elif self.valid_command_plugin(plugin):
            log.debug("Registering command plugin: {}".format(plugin))
            self._command_plugins[plugin.name] = plugin()
            if voltron.debugger:
                voltron.debugger.register_command_plugin(plugin.name, plugin.command_class)
        else:
            log.debug("Ignoring invalid plugin: {}".format(plugin))
119736
def register_tc_plugins(self, plugin_name, plugin_class):
        
        if plugin_name in self.registered_plugins:
            raise PluginException("Plugin {} already registered! Duplicate "
                                  "plugins?".format(plugin_name))
        self.logger.debug("Registering plugin %s", plugin_name)
        plugin_class.init(bench=self.bench)
        if plugin_class.get_bench_api() is not None:
            register_func = self.plugin_types[PluginTypes.BENCH]
            register_func(plugin_name, plugin_class)
        if plugin_class.get_parsers() is not None:
            register_func = self.plugin_types[PluginTypes.PARSER]
            register_func(plugin_name, plugin_class)
        if plugin_class.get_external_services() is not None:
            register_func = self.plugin_types[PluginTypes.EXTSERVICE]
            register_func(plugin_name, plugin_class)

        self.registered_plugins.append(plugin_name)
887942
def register_plugin(self):
        """"""
        self.focus_changed.connect(self.main.plugin_focus_changed)
        self.main.add_dockwidget(self)
        # Connecting the following signal once the dockwidget has been created:
        self.shell.exception_occurred.connect(self.exception_occurred)
1215578
def register_plugins(cls, plugins):
        '''
        
        '''
        for model in plugins:
            cls.register_plugin(model, plugins[model])
639879
def _load_plugins(self):
        '''
        
        '''
        plugins = self.settings['PLUGINS']

        self.plugins_dict = {}
        for key in plugins:
            # skip loading the plugin if its value is None
            if plugins[key] is None:
                continue
            # valid plugin, import and setup
            self.logger.debug("Trying to load plugin {cls}".format(cls=key))
            the_class = self._import_class(key)
            instance = the_class()
            instance._set_logger(self.logger)
            if not self.unit_test:
                instance.setup(self.settings)
            the_schema = None
            with open(self.settings['PLUGIN_DIR'] + instance.schema) as the_file:
                the_schema = json.load(the_file)

            mini = {}
            mini['instance'] = instance
            mini['schema'] = the_schema
            self.logger.debug("Successfully loaded plugin {cls}".format(cls=key))
            self.plugins_dict[plugins[key]] = mini

        self.plugins_dict = OrderedDict(sorted(list(self.plugins_dict.items()),
                                               key=lambda t: t[0]))
716889
def initialize_plugin(self):
        
        self.create_toggle_view_action()

        self.plugin_actions = self.get_plugin_actions() + [MENU_SEPARATOR,
                                                           self.undock_action]
        add_actions(self.options_menu, self.plugin_actions)
        self.options_button.setMenu(self.options_menu)
        self.options_menu.aboutToShow.connect(self.refresh_actions)

        self.sig_show_message.connect(self.show_message)
        self.sig_update_plugin_title.connect(self.update_plugin_title)
        self.sig_option_changed.connect(self.set_option)
        self.setWindowTitle(self.get_plugin_title())
269839
def register(self, value):
        
        if self.env is None:
            raise PluginException('The plugin must be installed to application.')

        def wrapper(func):
            name = func.__name__
            if isinstance(value, str):
                name = value
            if callable(func):
                self.env.globals[name] = func
            return func

        if callable(value):
            return wrapper(value)

        return wrapper
436644
def _initialize_plugins(self):
        
        logger.debug('Initializing plugins')
        plugins = self._pm.hook.plugins(loop=self._loop)
        if plugins:
            for plugin in plugins:
                name = plugin.__name__
                registry_name = plugin.__registry__ or plugin.__name__
                config = self.config.get(name, {})

                priority = config.get('priority', 50)

                if priority:
                    self._plugins[name] = {
                        'plugin': plugin,
                        'config': config,
                        'priority': priority,
                        'factory': registry_name
                    }

                    self._start_priority[priority].append(name)
        else:
            logger.error('No plugins found')
363070
function initPlugins(router, site) {
  return bluebird.all(module.exports.plugins.map(plugin => {
    return bluebird.try(() => {
      if (typeof plugin === 'function') {
        return plugin(router, pluginDBAdapter, publish, sites, site);
      } else {
        log('warn', 'Plugin is not a function');
        return bluebird.resolve();
      }
    });
  }));
}
136454
def register(self, plugin, name=None):
        
        plugin_name = name or self.get_canonical_name(plugin)

        if plugin_name in self._name2plugin or plugin in self._plugin2hookcallers:
            if self._name2plugin.get(plugin_name, -1) is None:
                return  # blocked plugin, return None to indicate no registration
            raise ValueError(
                "Plugin already registered: %s=%s\n%s"
                % (plugin_name, plugin, self._name2plugin)
            )

        # XXX if an error happens we should make sure no state has been
        # changed at point of return
        self._name2plugin[plugin_name] = plugin

        # register matching hook implementations of the plugin
        self._plugin2hookcallers[plugin] = hookcallers = []
        for name in dir(plugin):
            hookimpl_opts = self.parse_hookimpl_opts(plugin, name)
            if hookimpl_opts is not None:
                normalize_hookimpl_opts(hookimpl_opts)
                method = getattr(plugin, name)
                hookimpl = HookImpl(plugin, plugin_name, method, hookimpl_opts)
                hook = getattr(self.hook, name, None)
                if hook is None:
                    hook = _HookCaller(name, self._hookexec)
                    setattr(self.hook, name, hook)
                elif hook.has_spec():
                    self._verify_hook(hook, hookimpl)
                    hook._maybe_apply_history(hookimpl)
                hook._add_hookimpl(hookimpl)
                hookcallers.append(hook)
        return plugin_name
268995
static function plugins()
    {
        if (! self::isEnabledPlugins() )
            throw new \Exception('Using Plugins depends on Poirot/Ioc; that not exists currently.');


        if (! self::$pluginManager )
            self::$pluginManager = new PluginsHttpHeader;

        return self::$pluginManager;
    }
825410
def add_plugin(self, plugin_type, plugin_name, args_dict):
        

        plugin_modified = False

        for plugin in self.dock_json[plugin_type]:
            if plugin['name'] == plugin_name:
                plugin['args'] = args_dict
                plugin_modified = True

        if not plugin_modified:
            self.dock_json[plugin_type].append({"name": plugin_name, "args": args_dict})
401682
public function plugin($plugin, array $pluginConfig = [], $init = true)
        {
            // Module plugin
            //   ex: 'Module\User'
            if (false !== strpos($plugin, 'Module\\')) {
                $sPluginClass = $plugin . '\Plugin';

            // Named plugin
            //   ex: 'Spot'
            } else {
                // Upper-case beginning of each word
                $sPlugin = str_replace(' ', '\\', ucwords(str_replace('_', ' ', $plugin)));
                $sPluginClass = 'Plugin\\' . $sPlugin . '\Plugin';
            }

            // Ensure class exists / can be loaded
            if (!class_exists($sPluginClass, (boolean) $init)) {
                if ($init) {
                    throw new \InvalidArgumentException("Unable to load plugin '" . $sPluginClass . "'. Remove from app configuration file or ensure plugin files exist in 'app' or 'Thin' load paths.");
                }

                return false;
            }

            // Instantiate plugin class with params
            return $this->factory($sPluginClass, [$this, $pluginConfig]);
        }
149068
def load_default_run_plugins(self):
        
        for plugin_name, plugin_class in default_plugins.items():
            if issubclass(plugin_class, RunPluginBase):
                try:
                    self.register_run_plugins(plugin_name, plugin_class())
                except PluginException as error:
                    self.logger.debug(error)
                    continue
821823
public void addPlugin(SimonConsolePlugin plugin) {
		SimonConsolePlugin existingPlugin = getPluginById(plugin.getId());
		if (existingPlugin != null) {
			throw new IllegalArgumentException("Plugin " + plugin.getId() + " already registered");
		}
		plugins.add(plugin);
	}
521262
def register_plugin(self):
        """"""
        self.focus_changed.connect(self.main.plugin_focus_changed)
        self.main.add_dockwidget(self)
        self.ipyconsole = self.main.ipyconsole
        self.create_new_client(give_focus=False)
        icon_path = os.path.join(PACKAGE_PATH, 'images', 'icon.svg')
        self.main.add_to_fileswitcher(self, self.tabwidget, self.clients,
                                      QIcon(icon_path))
        self.recent_notebook_menu.aboutToShow.connect(self.setup_menu_actions)
926404
def initialize_plugin(self):
        
        if not self.patterns:
            self.patterns = [
                re.compile(pattern_string)
                for pattern_string in self.PRERELEASE_PATTERNS
            ]
            logger.info(f"Initialized prerelease plugin with {self.patterns}")