|
22 | 22 | import org.jetbrains.annotations.Nullable;
|
23 | 23 |
|
24 | 24 | import java.util.Collection;
|
| 25 | +import java.util.Objects; |
25 | 26 |
|
26 | 27 | /**
|
27 |
| - * Provides access to the Dart Plugin. |
| 28 | + * Provides access to the Dart Plugin for IntelliJ. |
28 | 29 | */
|
29 | 30 | public class DartPlugin {
|
30 | 31 |
|
31 | 32 | /**
|
32 | 33 | * Tracks the minimum required Dart Plugin version.
|
33 | 34 | */
|
34 |
| - private static final Version MINIMUM_VERSION = Version.parseVersion("171.3780.79"); |
| 35 | + @NotNull |
| 36 | + private static final Version MINIMUM_VERSION = Objects.requireNonNull(Version.parseVersion("171.3780.79")); |
35 | 37 |
|
| 38 | + @NotNull |
36 | 39 | private static final DartPlugin INSTANCE = new DartPlugin();
|
37 | 40 |
|
38 | 41 | private Version myVersion;
|
39 | 42 |
|
| 43 | + @NotNull |
40 | 44 | public static DartPlugin getInstance() {
|
41 | 45 | return INSTANCE;
|
42 | 46 | }
|
@@ -74,43 +78,44 @@ public static void setPubActionInProgress(boolean inProgress) {
|
74 | 78 | DartPubActionBase.setIsInProgress(inProgress);
|
75 | 79 | }
|
76 | 80 |
|
77 |
| - public static boolean isDartRunConfiguration(ConfigurationType type) { |
| 81 | + public static boolean isDartRunConfiguration(@NotNull ConfigurationType type) { |
78 | 82 | return type.getId().equals("DartCommandLineRunConfigurationType");
|
79 | 83 | }
|
80 | 84 |
|
81 |
| - public static boolean isDartTestConfiguration(ConfigurationType type) { |
| 85 | + public static boolean isDartTestConfiguration(@NotNull ConfigurationType type) { |
82 | 86 | return type.getId().equals("DartTestRunConfigurationType");
|
83 | 87 | }
|
84 | 88 |
|
85 | 89 | public static DartSdkUpdateOption doCheckForUpdates() {
|
86 | 90 | return DartSdkUpdateOption.getDartSdkUpdateOption();
|
87 | 91 | }
|
88 | 92 |
|
89 |
| - public static void setCheckForUpdates(DartSdkUpdateOption sdkUpdateOption) { |
| 93 | + public static void setCheckForUpdates(@NotNull DartSdkUpdateOption sdkUpdateOption) { |
90 | 94 | DartSdkUpdateOption.setDartSdkUpdateOption(sdkUpdateOption);
|
91 | 95 | }
|
92 | 96 |
|
93 | 97 | /**
|
94 |
| - * @return the minimum required version of the Dart Plugin |
| 98 | + * Return the minimum required {@link Version} of the Dart Plugin. |
95 | 99 | */
|
| 100 | + @NotNull |
96 | 101 | public Version getMinimumVersion() {
|
97 | 102 | return MINIMUM_VERSION;
|
98 | 103 | }
|
99 | 104 |
|
100 | 105 | /**
|
101 |
| - * @return the version of the currently installed Dart Plugin |
| 106 | + * Return the {@link Version} of the currently installed Dart Plugin. |
102 | 107 | */
|
103 | 108 | public Version getVersion() {
|
104 | 109 | if (myVersion == null) {
|
105 | 110 | final IdeaPluginDescriptor descriptor = PluginManagerCore.getPlugin(PluginId.getId("Dart"));
|
106 | 111 | assert (descriptor != null);
|
107 |
| - myVersion = Version.parseVersion(descriptor.getVersion()); |
| 112 | + myVersion = Objects.requireNonNull(Version.parseVersion(Objects.requireNonNull(descriptor.getVersion()))); |
108 | 113 | }
|
109 | 114 | return myVersion;
|
110 | 115 | }
|
111 | 116 |
|
112 | 117 | /**
|
113 |
| - * Return the DartAnalysisServerService instance. |
| 118 | + * Return the {@link DartAnalysisServerService} instance for the passed {@link Project}. |
114 | 119 | */
|
115 | 120 | @Nullable
|
116 | 121 | public DartAnalysisServerService getAnalysisService(@NotNull final Project project) {
|
|
0 commit comments