| Index: packages/plugin/notes.txt
|
| diff --git a/packages/plugin/notes.txt b/packages/plugin/notes.txt
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..fd9ab65c90b8a60590856203e0164dfa433a93fb
|
| --- /dev/null
|
| +++ b/packages/plugin/notes.txt
|
| @@ -0,0 +1,63 @@
|
| +--------------------------------------------------------------------------------
|
| +
|
| +To provide a psuedo backward compatible layer.
|
| +
|
| +In plugin.dart:
|
| +
|
| +/**
|
| + * A function used to register an extension point with the given simple
|
| + * [identifier]. If given, the [validator] will be used to validate extensions
|
| + * to the extension point.
|
| + *
|
| + * An [ExtensionError] will be thrown if the extension point cannot be
|
| + * registered, such as when a plugin attempts to define two extension points
|
| + * with the same simple identifier.
|
| + */
|
| +typedef ExtensionPoint RegisterExtensionPoint(String identifier,
|
| + [ValidateExtension validateExtension]);
|
| +
|
| +class Plugin {
|
| + /**
|
| + * Use the [register] function to register all of the extension points
|
| + * contributed by this plugin.
|
| + *
|
| + * Clients should not invoke the [register] function after this method has
|
| + * returned.
|
| + *
|
| + * This method is deprecated and will be removed in the next breaking release.
|
| + * Plugins should migrate to using [registerExtensionPoints2].
|
| + */
|
| + void registerExtensionPoints(RegisterExtensionPoint register);
|
| +}
|
| +
|
| +In plugin_impl.dart:
|
| +
|
| +class ExtensionManager {
|
| +
|
| + In processPlugins:
|
| +
|
| + for (Plugin plugin in plugins) {
|
| + plugin.registerExtensionPoints((String identifier,
|
| + [ValidateExtension validateExtension]) =>
|
| + registerExtensionPoint(plugin, identifier, validateExtension));
|
| + }
|
| +
|
| + /**
|
| + * Register an extension point being defined by the given [plugin] with the
|
| + * given simple [identifier] and [validateExtension].
|
| + */
|
| + ExtensionPoint registerExtensionPoint(
|
| + Plugin plugin, String identifier, ValidateExtension validateExtension) {
|
| + String uniqueIdentifier = Plugin.buildUniqueIdentifier(plugin, identifier);
|
| + if (extensionPoints.containsKey(uniqueIdentifier)) {
|
| + throw new ExtensionError(
|
| + 'There is already an extension point with the id "$identifier"');
|
| + }
|
| + ExtensionPointImpl extensionPoint =
|
| + new ExtensionPointImpl(plugin, identifier, validateExtension);
|
| + extensionPoints[uniqueIdentifier] = extensionPoint;
|
| + return extensionPoint;
|
| + }
|
| +}
|
| +
|
| +--------------------------------------------------------------------------------
|
|
|