Eclipse plugin can be disabled ONLY by user, so it must NOT be in the
list of loaded plugins
322090
static boolean isEclipsePluginDisabled(String pluginId, Map<URI, Plugin> allPlugins) {
        for (Plugin plugin : allPlugins.values()) {
            if(pluginId.equals(plugin.getPluginId())) {
                return false;
            }
        }
        return true;
    }
624072
private void configurePlugins(final File fDir) throws PluginConfigurationException {
        LOG.trace("READING PLUGIN CONFIGURATION FROM DIRECTORY {}", fDir.getName());
        StreamManager streamMgr = new StreamManager();

        File[] vfJars = fDir.listFiles(JAR_FILE_FILTER);

        if (vfJars == null || vfJars.length == 0) {
            return;
        }

        // Initializing classloader
        List<URL> vUrls = new ArrayList<URL>(vfJars.length);

        ClassLoader ul = null;

        for (int j = 0; j < vfJars.length; j++) {
            try {
                vUrls.add(vfJars[j].toURI().toURL());
            } catch (MalformedURLException e) {
                // should never happen
                throw new IllegalStateException(e.getMessage(), e);
            }
        }

        ul = new JNRPEClassLoader(vUrls);

        try {
            for (File file : vfJars) {
                JarFile jarFile = null;
                try {
                    jarFile = new JarFile(file);
                    JarEntry entry = jarFile.getJarEntry("plugin.xml");
                    if (entry == null) {
                        entry = jarFile.getJarEntry("jnrpe_plugins.xml");
                    }

                    if (entry == null) {
                        // The jar do not contain a jnrpe_plugins.xml nor a
                        // plugin.xml file...
                        continue;
                    }

                    InputStream in = streamMgr.handle(jarFile.getInputStream(entry));
                    PluginRepositoryUtil.loadFromXmlPluginPackageDefinitions(this, ul, in);
                    in.close();

                } catch (Exception e) {
                    LOG.error("Skipping plugin package contained in file '{}' because of the following error : {}",
                            new String[] { file.getName(), e.getMessage() }, e);
                } finally {
                    try {
                        jarFile.close();
                    } catch (Exception e) {
                        // Intentionally ignored...
                        LOG.warn("An error has occurred closing jar file '{}'",file.getName(), e);
                    }
                }
            }

        } finally {
            streamMgr.closeAll();
        }
    }
881198
function setPlugin (plugin) {
          if (plugin) {
            api._ = plugin;
            api.parentElement = plugin.parentElement;
            api.$ = $(plugin);
          }
          else {
            api._ = null;
            api.parentElement = null;
            api.$ = $();
          }
        }
348276
@Override
    @PreAuthorize("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#plugin, 'DELETE')")
    public void delete(E plugin) {
        if (applicationService == null) {
            LOG.error("Plugin cannot be deleted, failed to autowire application service");
            return;
        }

        List<Application> apps = applicationService.findAllWithCollectionContaining("plugins", plugin);
        Integer pluginId = plugin.getId();
        for (Application app : apps) {
            List<Plugin> plugins = app.getPlugins();
            if (plugins != null && plugins.contains(plugin)) {
                String msg = String.format(
                    "Remove plugin (id=%s) from application (id=%s)",
                    pluginId, app.getId()
                );
                LOG.debug(msg);
                plugins.remove(plugin);
                // TODO will this use the the PreAuthorize annotations of AbstractCrudService wrt WRITE on the app?
                applicationService.saveOrUpdate(app);
            }
        }
        LOG.debug(String.format("Delete plugin (id=%s)", pluginId));
        // call overridden parent to actually delete the entity itself
        super.delete(plugin);
    }
794831
def __deactivate_shared_objects(self, plugin, *args, **kwargs):
        
        shared_objects = self.get()
        for shared_object in shared_objects.keys():
            self.unregister(shared_object)
710511
public void pluginDisappears( PluginInterface pi ) {

		// May happen if a plug-in could not be instantiated
		// (iPojo uses proxies). In this case, it results in a NPE here.
		if( pi == null ) {
			this.logger.info( "An invalid plugin is removed." );
		} else {
			this.plugins.remove( pi );
			this.logger.info( "Plugin '" + pi.getPluginName() + "' is not available anymore in Roboconf's agent." );
		}

		listPlugins();
	}
578748
function (name, type) {
                logger.debug("Attempting to remove plugin: " + name);
                var index, plug, plugs = this.config.plugins;
                for (index = 0; index < plugs.length; index += 1) {
                    plug = plugs[index];
                    if (plug.name === name && plug.type === type) {
                        plugs.splice(index, 1);
                        logger.debug("Plugin: " + name + " has been removed");
                        break;
                    }
                }
            }
1024815
public static synchronized void disable() {
        if (!enabled) {
            return;
        }
        RxJavaPlugins.setOnObservableAssembly(oldOnObservableAssembly);
        oldOnObservableAssembly = null;
        RxJavaPlugins.setOnConnectableObservableAssembly(oldOnConnectableObservableAssembly);
        oldOnConnectableObservableAssembly = null;
        RxJavaPlugins.setOnCompletableAssembly(oldOnCompletableAssembly);
        oldOnCompletableAssembly = null;
        RxJavaPlugins.setOnSingleAssembly(oldOnSingleAssembly);
        oldOnSingleAssembly = null;
        RxJavaPlugins.setOnMaybeAssembly(oldOnMaybeAssembly);
        oldOnMaybeAssembly = null;
        RxJavaPlugins.setOnFlowableAssembly(oldOnFlowableAssembly);
        oldOnFlowableAssembly = null;
        RxJavaPlugins.setOnConnectableFlowableAssembly(oldOnConnectableFlowableAssembly);
        oldOnConnectableFlowableAssembly = null;
        RxJavaPlugins.setOnParallelAssembly(oldOnParallelAssembly);
        oldOnParallelAssembly = null;
        enabled = false;
    }
822879
void setPluginPassiveScannerEnabled(int pluginId, boolean enabled) {
        PluginPassiveScanner scanner = getPluginPassiveScanner(pluginId);
        if (scanner != null) {
            scanner.setEnabled(enabled);
            scanner.save();
        }
    }
392391
def get_enabled_hook_plugins(self, hook, args, **kwargs):
        
        manager = self.hook_managers[hook]
        if len(list(manager)) == 0:
            return []
        return [
            plugin for plugin in manager.map(
                self._create_hook_plugin, args, **kwargs)
            if plugin is not None
        ]
519905
def plugins(cls, enabled=True):
        
        cls.loadPlugins()
        plugs = getattr(cls, '_%s__plugins' % cls.__name__, {}).values()
        if enabled is None:
            return plugs

        return filter(lambda x: x.isEnabled() == enabled, plugs)
711748
def disabled?(visitor)
      visitor.is_a?(HamlLint::Linter) &&
        comment_configuration.disabled?(visitor.name)
    end
1004313
private void unloadIncompatiblePlugins() {
    // loop as long as the previous loop ignored some plugins. That allows to support dependencies
    // on many levels, for example D extends C, which extends B, which requires A. If A is not installed,
    // then B, C and D must be ignored. That's not possible to achieve this algorithm with a single
    // iteration over plugins.
    Set<String> removedKeys = new HashSet<>();
    do {
      removedKeys.clear();
      for (PluginInfo plugin : pluginInfosByKeys.values()) {
        if (!isCompatible(plugin, runtime, pluginInfosByKeys)) {
          removedKeys.add(plugin.getKey());
        }
      }
      for (String removedKey : removedKeys) {
        pluginInfosByKeys.remove(removedKey);
      }
    } while (!removedKeys.isEmpty());
  }
683236
synchronized Plugin nextPlugin() {
    	if (!init) {
    		this.reset();
    	}
    	
        Plugin plugin = probeNextPlugin();
        if (plugin == null) {
            return null;
        }
        
        listPending.remove(plugin);
        plugin.setTimeStarted();
        listRunning.add(plugin);

        return plugin;
    }
1256672
def destroy_plugin(plugin_name, conn=None):
    
    results = {}
    if plugin_exists(plugin_name, conn=conn):
        results = RPX.table_drop(plugin_name).run(conn)
    return results
45922
private boolean isForkDisabled(Plugin plugin) throws MojoExecutionException {
        String forkCountValue = extractParamValue(plugin, FORK_COUNT_PARAM_NAME);
        String forkModeValue = extractParamValue(plugin, FORK_MODE_PARAM_NAME);
        return (forkCountValue != null && forkCountValue.equals("0")) ||
            (forkModeValue != null && forkModeValue.equals("never"));
    }
598522
private void loadDelayedPlugins() {
        while (!delayedLoadPlugins.isEmpty()) {
            GrailsPlugin plugin = delayedLoadPlugins.remove(0);
            if (areDependenciesResolved(plugin)) {
                if (!hasValidPluginsToLoadBefore(plugin)) {
                    registerPlugin(plugin);
                }
                else {
                    delayedLoadPlugins.add(plugin);
                }
            }
            else {
                // ok, it still hasn't resolved the dependency after the initial
                // load of all plugins. All hope is not lost, however, so lets first
                // look inside the remaining delayed loads before giving up
                boolean foundInDelayed = false;
                for (GrailsPlugin remainingPlugin : delayedLoadPlugins) {
                    if (isDependentOn(plugin, remainingPlugin)) {
                        foundInDelayed = true;
                        break;
                    }
                }
                if (foundInDelayed) {
                    delayedLoadPlugins.add(plugin);
                }
                else {
                    failedPlugins.put(plugin.getName(), plugin);
                    LOG.error("ERROR: Plugin [" + plugin.getName() + "] cannot be loaded because its dependencies [" +
                            DefaultGroovyMethods.inspect(plugin.getDependencyNames()) + "] cannot be resolved");
                }
            }
        }
    }