| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 library analyzer.src.plugin.command_line_plugin; | |
| 6 | |
| 7 import 'package:analyzer/plugin/command_line.dart'; | |
| 8 import 'package:plugin/plugin.dart'; | |
| 9 | |
| 10 /** | |
| 11 * A plugin that defines the extension points and extensions that are defined by | |
| 12 * command-line applications using the analysis engine. | |
| 13 */ | |
| 14 class CommandLinePlugin implements Plugin { | |
| 15 /** | |
| 16 * The simple identifier of the extension point that allows plugins to | |
| 17 * register new parser contributors. | |
| 18 */ | |
| 19 static const String PARSER_CONTRIBUTOR_EXTENSION_POINT = 'parserContributor'; | |
| 20 | |
| 21 /** | |
| 22 * The simple identifier of the extension point that allows plugins to | |
| 23 * register new result processors. | |
| 24 */ | |
| 25 static const String RESULT_PROCESSOR_EXTENSION_POINT = 'resultProcessor'; | |
| 26 | |
| 27 /** | |
| 28 * The unique identifier of this plugin. | |
| 29 */ | |
| 30 static const String UNIQUE_IDENTIFIER = 'command_line.core'; | |
| 31 | |
| 32 /** | |
| 33 * The extension point that allows plugins to register new parser | |
| 34 * contributors. | |
| 35 */ | |
| 36 ExtensionPoint<ArgParserContributor> parserContributorExtensionPoint; | |
| 37 | |
| 38 /** | |
| 39 * The extension point that allows plugins to register new result processors. | |
| 40 */ | |
| 41 ExtensionPoint<ArgResultsProcessor> resultProcessorExtensionPoint; | |
| 42 | |
| 43 /** | |
| 44 * Initialize a newly created plugin. | |
| 45 */ | |
| 46 CommandLinePlugin(); | |
| 47 | |
| 48 /** | |
| 49 * Return a list containing all of the parser contributors that were | |
| 50 * contributed. | |
| 51 */ | |
| 52 List<ArgParserContributor> get parserContributors => | |
| 53 parserContributorExtensionPoint.extensions; | |
| 54 | |
| 55 /** | |
| 56 * Return a list containing all of the result processors that were | |
| 57 * contributed. | |
| 58 */ | |
| 59 List<ArgResultsProcessor> get resultProcessors => | |
| 60 resultProcessorExtensionPoint.extensions; | |
| 61 | |
| 62 @override | |
| 63 String get uniqueIdentifier => UNIQUE_IDENTIFIER; | |
| 64 | |
| 65 @override | |
| 66 void registerExtensionPoints(RegisterExtensionPoint registerExtensionPoint) { | |
| 67 parserContributorExtensionPoint = new ExtensionPoint<ArgParserContributor>( | |
| 68 this, PARSER_CONTRIBUTOR_EXTENSION_POINT, null); | |
| 69 registerExtensionPoint(parserContributorExtensionPoint); | |
| 70 resultProcessorExtensionPoint = new ExtensionPoint<ArgResultsProcessor>( | |
| 71 this, RESULT_PROCESSOR_EXTENSION_POINT, null); | |
| 72 registerExtensionPoint(resultProcessorExtensionPoint); | |
| 73 } | |
| 74 | |
| 75 @override | |
| 76 void registerExtensions(RegisterExtension registerExtension) { | |
| 77 // There are no default extensions. | |
| 78 } | |
| 79 } | |
| OLD | NEW |