Gil Costa - 2014-04-22

The code you shown doesn't take in account that a plugin can supply more than one provider.

You can load plugins individually, you can tell the application to load some files and not others.

If you want to disable specific providers you can select the type of providers to load, or if they are all of the same type, use custom provider methods to decide what objects to instantiate (see here).

For example, add a method on the provider returning something that identifies it uniquely (a description for instance). Then a settings menu can get all descriptions from available providers and let user enable/disable them. Finally when populating objects from providers you can check if the description corresponds to an enabled option, and decide to populate it or not.