use of com.android.tools.idea.gradle.project.sync.hyperlink.FixAndroidGradlePluginVersionHyperlink in project android by JetBrains.
the class LayoutRenderingIssueValidationStrategy method fixAndReportFoundIssues.
@Override
void fixAndReportFoundIssues() {
if (myModelVersion != null) {
String text = String.format("Using an obsolete version of the Gradle plugin (%1$s);", myModelVersion);
text += " this can lead to layouts not rendering correctly.";
SyncMessage message = new SyncMessage(DEFAULT_GROUP, WARNING, text);
message.add(Arrays.asList(new FixAndroidGradlePluginVersionHyperlink(), new OpenUrlHyperlink("https://code.google.com/p/android/issues/detail?id=170841", "More Info...")));
SyncMessages.getInstance(getProject()).report(message);
}
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.FixAndroidGradlePluginVersionHyperlink in project android by JetBrains.
the class OldAndroidPluginErrorHandler method getQuickFixHyperlinks.
@Override
@NotNull
protected List<NotificationHyperlink> getQuickFixHyperlinks(@NotNull NotificationData notification, @NotNull Project project, @NotNull String text) {
List<NotificationHyperlink> hyperlinks = new ArrayList<>();
hyperlinks.add(new FixAndroidGradlePluginVersionHyperlink());
AndroidPluginInfo result = searchInBuildFilesOnly(project);
if (result != null && result.getPluginBuildFile() != null) {
hyperlinks.add(new OpenFileHyperlink(result.getPluginBuildFile().getPath()));
}
return hyperlinks;
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.FixAndroidGradlePluginVersionHyperlink in project android by JetBrains.
the class UnsupportedModelVersionErrorHandler method getQuickFixHyperlinks.
@Override
@NotNull
protected List<NotificationHyperlink> getQuickFixHyperlinks(@NotNull NotificationData notification, @NotNull Project project, @NotNull String text) {
List<NotificationHyperlink> hyperlinks = new ArrayList<>();
hyperlinks.add(new FixAndroidGradlePluginVersionHyperlink());
return hyperlinks;
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.FixAndroidGradlePluginVersionHyperlink in project android by JetBrains.
the class GradleDslMethodNotFoundErrorHandler method updateNotificationWithBuildFile.
private static void updateNotificationWithBuildFile(@NotNull Project project, @NotNull VirtualFile virtualFile, @NotNull NotificationData notification, @NotNull String text) {
List<NotificationHyperlink> hyperlinks = new ArrayList<>();
NotificationHyperlink gradleSettingsHyperlink = getGradleSettingsHyperlink(project);
NotificationHyperlink applyGradlePluginHyperlink = getApplyGradlePluginHyperlink(virtualFile, notification);
NotificationHyperlink upgradeAndroidPluginHyperlink = new FixAndroidGradlePluginVersionHyperlink();
String newMsg = text + "\nPossible causes:<ul>";
if (!gradleModelIsRecent(project)) {
newMsg = newMsg + String.format("<li>The project '%1$s' may be using a version of the Android Gradle plug-in that does" + " not contain the method (e.g. 'testCompile' was added in 1.1.0).\n", project.getName()) + upgradeAndroidPluginHyperlink.toHtml() + "</li>";
}
newMsg = newMsg + String.format("<li>The project '%1$s' may be using a version of Gradle that does not contain the method.\n", project.getName()) + gradleSettingsHyperlink.toHtml() + "</li>" + "<li>The build file may be missing a Gradle plugin.\n" + applyGradlePluginHyperlink.toHtml() + "</li>";
notification.setTitle(SyncMessage.DEFAULT_GROUP);
notification.setMessage(newMsg);
notification.setNotificationCategory(NotificationCategory.convert(DEFAULT_NOTIFICATION_TYPE));
hyperlinks.add(gradleSettingsHyperlink);
hyperlinks.add(applyGradlePluginHyperlink);
hyperlinks.add(upgradeAndroidPluginHyperlink);
SyncMessages.getInstance(project).addNotificationListener(notification, hyperlinks);
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.FixAndroidGradlePluginVersionHyperlink in project android by JetBrains.
the class AndroidGradlePluginVersionReaderTest method testGetQuickFixes.
public void testGetQuickFixes() throws Exception {
loadSimpleApplication();
Module appModule = myModules.getAppModule();
List<NotificationHyperlink> quickFixes = myVersionReader.getQuickFixes(appModule, VersionRange.parse("[1.2.0, +)"), null);
assertThat(quickFixes).hasSize(2);
NotificationHyperlink quickFix = quickFixes.get(0);
assertThat(quickFix).isInstanceOf(FixAndroidGradlePluginVersionHyperlink.class);
FixAndroidGradlePluginVersionHyperlink fixAndroidGradlePluginQuickFix = (FixAndroidGradlePluginVersionHyperlink) quickFix;
assertEquals(BuildEnvironment.getInstance().getGradlePluginVersion(), fixAndroidGradlePluginQuickFix.getPluginVersion().toString());
quickFix = quickFixes.get(1);
assertThat(quickFix).isInstanceOf(OpenUrlHyperlink.class);
OpenUrlHyperlink openUrlQuickFix = (OpenUrlHyperlink) quickFix;
assertEquals("https://developer.android.com/studio/releases/gradle-plugin.html#updating-gradle", openUrlQuickFix.getUrl());
}
Aggregations