use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class UnknownHostErrorHandler method getQuickFixHyperlinks.
@Override
@NotNull
protected List<NotificationHyperlink> getQuickFixHyperlinks(@NotNull NotificationData notification, @NotNull Project project, @NotNull String text) {
List<NotificationHyperlink> hyperlinks = new ArrayList<>();
NotificationHyperlink enableOfflineMode = ToggleOfflineModeHyperlink.enableOfflineMode(project);
if (enableOfflineMode != null) {
hyperlinks.add(enableOfflineMode);
}
hyperlinks.add(new OpenUrlHyperlink("https://docs.gradle.org/current/userguide/userguide_single.html#sec:accessing_the_web_via_a_proxy", "Learn about configuring HTTP proxies in Gradle"));
return hyperlinks;
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink 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.NotificationHyperlink in project android by JetBrains.
the class GradleBrokenPipeErrorHandler 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 OpenUrlHyperlink("https://sites.google.com/a/android.com/tools/knownissues?pli=1#TOC-Gradle-Sync-Failed:-Broken-Pipe", "More info (including workarounds)"));
return hyperlinks;
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class GradleDslMethodNotFoundErrorHandler method getQuickFixHyperlinks.
private static void getQuickFixHyperlinks(@NotNull NotificationData notification, @NotNull Project project, @NotNull String text) {
List<NotificationHyperlink> hyperlinks = new ArrayList<>();
String filePath = notification.getFilePath();
VirtualFile file = filePath != null ? LocalFileSystem.getInstance().refreshAndFindFileByPath(filePath) : null;
if (file != null && FN_BUILD_GRADLE.equals(file.getName())) {
updateNotificationWithBuildFile(project, file, notification, text);
return;
}
if (file != null && notification.getLine() > 0 && notification.getNavigatable() == null) {
OpenFileHyperlink hyperlink = new OpenFileHyperlink(filePath, notification.getLine() - 1);
hyperlinks.add(hyperlink);
}
SyncMessages.getInstance(project).updateNotification(notification, text, hyperlinks);
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink 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);
}
Aggregations