use of com.android.tools.idea.gradle.project.sync.hyperlink.InstallBuildToolsHyperlink in project android by JetBrains.
the class MissingBuildToolsErrorHandler method getQuickFixHyperlinks.
@Override
@NotNull
protected List<NotificationHyperlink> getQuickFixHyperlinks(@NotNull NotificationData notification, @NotNull Project project, @NotNull String text) {
List<NotificationHyperlink> hyperlinks = new ArrayList<>();
//If get to this point, the message matches patter
Matcher matcher = MISSING_BUILD_TOOLS_PATTERN.matcher(getFirstLineMessage(text));
if (matcher.matches()) {
String version = matcher.group(3);
hyperlinks.add(new InstallBuildToolsHyperlink(version, null));
}
return hyperlinks;
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.InstallBuildToolsHyperlink in project android by JetBrains.
the class SdkBuildToolsTooLowErrorHandler method getQuickFixHyperlinks.
@NotNull
public List<NotificationHyperlink> getQuickFixHyperlinks(@NotNull String minimumVersion, @NotNull Project project, @Nullable Module module) {
List<NotificationHyperlink> hyperlinks = new ArrayList<>();
boolean buildToolInstalled = false;
AndroidSdkHandler sdkHandler = null;
AndroidSdkData androidSdkData = AndroidSdks.getInstance().tryToChooseAndroidSdk();
if (androidSdkData != null) {
sdkHandler = androidSdkData.getSdkHandler();
}
if (sdkHandler != null) {
ProgressIndicator progress = new StudioLoggerProgressIndicator(SdkBuildToolsTooLowErrorHandler.class);
RepositoryPackages packages = sdkHandler.getSdkManager(progress).getPackages();
LocalPackage buildTool = packages.getLocalPackages().get(getBuildToolsPath(parseRevision(minimumVersion)));
buildToolInstalled = buildTool != null;
}
if (module != null) {
VirtualFile buildFile = getGradleBuildFile(module);
AndroidPluginInfo androidPluginInfo = AndroidPluginInfo.find(project);
if (!buildToolInstalled) {
if (androidPluginInfo != null && androidPluginInfo.isExperimental()) {
hyperlinks.add(new InstallBuildToolsHyperlink(minimumVersion, null));
} else {
hyperlinks.add(new InstallBuildToolsHyperlink(minimumVersion, buildFile));
}
} else if (buildFile != null && androidPluginInfo != null && !androidPluginInfo.isExperimental()) {
hyperlinks.add(new FixBuildToolsVersionHyperlink(buildFile, minimumVersion));
}
if (buildFile != null) {
hyperlinks.add(new OpenFileHyperlink(buildFile.getPath()));
}
}
return hyperlinks;
}
Aggregations