Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analysis_server.plugin.plugin; | 5 library analysis_server.plugin.plugin; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A function used by a plugin to validate an [extension] to a extension point. | |
| 9 * | |
| 10 * An [ExtensionError] should be thrown if the [extension] is not valid for the | |
| 11 * extension point, such as an [extension] that does not implement the required | |
| 12 * interface. | |
| 13 */ | |
| 14 typedef void ExtensionValidator(Object extension); | |
| 15 | |
| 16 /** | |
| 17 * A function used to register the given [extension] to the extension point with | 8 * A function used to register the given [extension] to the extension point with |
| 18 * the given unique [identifier]. | 9 * the given unique [identifier]. |
| 19 * | 10 * |
| 20 * An [ExtensionError] will be thrown if the [extension] is not appropriate | 11 * An [ExtensionError] will be thrown if the [extension] is not appropriate |
| 21 * for the extension point, such as an [extension] that does not implement the | 12 * for the extension point, such as an [extension] that does not implement the |
| 22 * required interface. | 13 * required interface. |
| 23 */ | 14 */ |
| 24 typedef void RegisterExtension(String identifier, Object extension); | 15 typedef void RegisterExtension(String identifier, Object extension); |
| 25 | 16 |
| 26 /** | 17 /** |
| 27 * A function used to register an extension point with the given simple | 18 * A function used to register an extension point with the given simple |
| 28 * [identifier]. If given, the [validator] will be used to validate extensions | 19 * [identifier]. If given, the [validator] will be used to validate extensions |
| 29 * to the extension point. | 20 * to the extension point. |
| 30 * | 21 * |
| 31 * An [ExtensionError] will be thrown if the extension point cannot be | 22 * An [ExtensionError] will be thrown if the extension point cannot be |
| 32 * registered, such as when a plugin attempts to define two extension points | 23 * registered, such as when a plugin attempts to define two extension points |
| 33 * with the same simple identifier. | 24 * with the same simple identifier. |
| 34 */ | 25 */ |
| 35 typedef ExtensionPoint RegisterExtensionPoint(String identifier, | 26 typedef ExtensionPoint RegisterExtensionPoint(String identifier, |
| 36 [ExtensionValidator validator]); | 27 [ValidateExtension validator]); |
|
scheglov
2015/01/12 16:17:50
Just a question: Should this parameter also be ren
Brian Wilkerson
2015/01/12 16:35:03
Good catch. Done.
| |
| 28 | |
| 29 /** | |
| 30 * A function used by a plugin to validate an [extension] to a extension point. | |
| 31 * | |
| 32 * An [ExtensionError] should be thrown if the [extension] is not valid for the | |
| 33 * extension point, such as an [extension] that does not implement the required | |
| 34 * interface. | |
| 35 */ | |
| 36 typedef void ValidateExtension(Object extension); | |
| 37 | 37 |
| 38 /** | 38 /** |
| 39 * An exception indicating that an error occurred while attempting to register | 39 * An exception indicating that an error occurred while attempting to register |
| 40 * either an extension or an extension point. | 40 * either an extension or an extension point. |
| 41 * | 41 * |
| 42 * Clients are not expected to subtype this class. | 42 * Clients are not expected to subtype this class. |
| 43 */ | 43 */ |
| 44 class ExtensionError implements Exception { | 44 class ExtensionError implements Exception { |
| 45 /** | 45 /** |
| 46 * The message describing the error that occurred. | 46 * The message describing the error that occurred. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 static String buildUniqueIdentifier(Plugin plugin, String simpleIdentifier) => | 121 static String buildUniqueIdentifier(Plugin plugin, String simpleIdentifier) => |
| 122 join(plugin.uniqueIdentifier, simpleIdentifier); | 122 join(plugin.uniqueIdentifier, simpleIdentifier); |
| 123 | 123 |
| 124 /** | 124 /** |
| 125 * Return an identifier created by joining the [pluginIdentifier] and the | 125 * Return an identifier created by joining the [pluginIdentifier] and the |
| 126 * [simpleIdentifier]. | 126 * [simpleIdentifier]. |
| 127 */ | 127 */ |
| 128 static String join(String pluginIdentifier, String simpleIdentifier) => | 128 static String join(String pluginIdentifier, String simpleIdentifier) => |
| 129 '$pluginIdentifier.$simpleIdentifier'; | 129 '$pluginIdentifier.$simpleIdentifier'; |
| 130 } | 130 } |
| OLD | NEW |