use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink 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.NotificationHyperlink in project android by JetBrains.
the class MissingDependencyErrorHandler method handleMissingDependency.
private static void handleMissingDependency(@NotNull NotificationData notification, @NotNull Project project, @NotNull String msg, @NotNull String dependency, @NotNull List<NotificationHyperlink> additionalHyperlinks) {
List<NotificationHyperlink> hyperlinks = new ArrayList<>(additionalHyperlinks);
ToggleOfflineModeHyperlink disableOfflineMode = ToggleOfflineModeHyperlink.disableOfflineMode(project);
if (disableOfflineMode != null) {
hyperlinks.add(0, disableOfflineMode);
}
hyperlinks.add(new SearchInBuildFilesHyperlink(dependency));
SyncMessages.getInstance(project).updateNotification(notification, msg, hyperlinks);
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class MissingAndroidSupportRepoErrorHandler method getQuickFixHyperlinks.
@Override
@NotNull
protected List<NotificationHyperlink> getQuickFixHyperlinks(@NotNull NotificationData notification, @NotNull Project project, @NotNull String text) {
List<NotificationHyperlink> hyperlinks = new ArrayList<>();
List<AndroidFacet> facets = ProjectFacetManager.getInstance(project).getFacets(AndroidFacet.ID);
if (!facets.isEmpty()) {
// We can only open SDK manager if the project has an Android facet. Android facet has a reference to the Android SDK manager.
hyperlinks.add(new OpenAndroidSdkManagerHyperlink());
}
return hyperlinks;
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class ObjectStreamErrorHandler method findAndAddQuickFixes.
private static void findAndAddQuickFixes(@NotNull NotificationData notification, @NotNull Project project, @NotNull String text) {
List<NotificationHyperlink> hyperlinks = new ArrayList<>();
NotificationHyperlink buildProjectHyperlink = new BuildProjectHyperlink();
NotificationHyperlink openAndroidSdkManagerHyperlink = new OpenAndroidSdkManagerHyperlink();
text += "Please try one of the following:<ul>" + "<li>" + buildProjectHyperlink.toHtml() + " to obtain the cause of the error</li>" + "<li>" + openAndroidSdkManagerHyperlink.toHtml() + " to check if there are any missing components</li></ul>";
hyperlinks.add(buildProjectHyperlink);
hyperlinks.add(openAndroidSdkManagerHyperlink);
notification.setTitle(SyncMessage.DEFAULT_GROUP);
notification.setMessage(text);
notification.setNotificationCategory(NotificationCategory.convert(DEFAULT_NOTIFICATION_TYPE));
SyncMessages.getInstance(project).addNotificationListener(notification, hyperlinks);
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class UnsupportedGradleVersionErrorHandler method getQuickFixHyperlinks.
@NotNull
public static List<NotificationHyperlink> getQuickFixHyperlinks(@NotNull Project project, @Nullable String gradleVersion) {
List<NotificationHyperlink> hyperlinks = new ArrayList<>();
GradleWrapper gradleWrapper = GradleWrapper.find(project);
if (gradleWrapper != null) {
// It is very likely that we need to fix the model version as well. Do everything in one shot.
NotificationHyperlink hyperlink = createIfProjectUsesGradleWrapper(project, gradleVersion);
if (hyperlink != null) {
hyperlinks.add(hyperlink);
}
} else {
GradleProjectSettings gradleProjectSettings = GradleProjectSettingsFinder.getInstance().findGradleProjectSettings(project);
if (gradleProjectSettings != null && gradleProjectSettings.getDistributionType() == DistributionType.LOCAL) {
hyperlinks.add(new CreateGradleWrapperHyperlink());
}
}
hyperlinks.add(new OpenGradleSettingsHyperlink());
return hyperlinks;
}
Aggregations