use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class GradleVersionReader method getQuickFixes.
@Override
@NotNull
public List<NotificationHyperlink> getQuickFixes(@NotNull Module module, @Nullable VersionRange expectedVersion, @Nullable PositionInFile location) {
List<NotificationHyperlink> quickFixes = new ArrayList<>();
AndroidPluginInfo pluginInfo = AndroidPluginInfo.find(module.getProject());
if (pluginInfo != null) {
GradleVersion pluginVersion = GradleVersion.parse(pluginInfo.getPluginGeneration().getLatestKnownVersion());
GradleVersion gradleVersion = GradleVersion.parse(GRADLE_LATEST_VERSION);
String text = "Fix Gradle version (as part of the update, the Android plugin will be updated to version " + pluginVersion + ")";
quickFixes.add(new FixAndroidGradlePluginVersionHyperlink(text, pluginVersion, gradleVersion));
}
quickFixes.add(new OpenUrlHyperlink("https://developer.android.com/studio/releases/index.html#Revisions", "Open Documentation"));
return quickFixes;
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class AndroidGradleProjectComponent method showMigrateToGradleWarning.
private void showMigrateToGradleWarning() {
String errMsg = "This project does not use the Gradle build system. We recommend that you migrate to using the Gradle build system.";
NotificationHyperlink moreInfoHyperlink = new OpenMigrationToGradleUrlHyperlink().setCloseOnClick(true);
NotificationHyperlink doNotShowAgainHyperlink = new NotificationHyperlink("do.not.show", "Don't show this message again.") {
@Override
protected void execute(@NotNull Project project) {
PropertiesComponent.getInstance(myProject).setValue(SHOW_MIGRATE_TO_GRADLE_POPUP, Boolean.FALSE.toString());
}
};
AndroidGradleNotification notification = AndroidGradleNotification.getInstance(myProject);
notification.showBalloon("Migrate Project to Gradle?", errMsg, NotificationType.WARNING, moreInfoHyperlink, doNotShowAgainHyperlink);
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class PostProjectBuildTasksExecutor method notifyUnresolvedDependenciesInOfflineMode.
private void notifyUnresolvedDependenciesInOfflineMode() {
NotificationHyperlink disableOfflineModeHyperlink = new NotificationHyperlink("disable.gradle.offline.mode", "Disable offline mode") {
@Override
protected void execute(@NotNull Project project) {
GradleSettings.getInstance(myProject).setOfflineWork(false);
}
};
String title = "Unresolved Dependencies";
String text = "Unresolved dependencies detected while building project in offline mode. Please disable offline mode and try again.";
AndroidGradleNotification.getInstance(myProject).showBalloon(title, text, NotificationType.ERROR, disableOfflineModeHyperlink);
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class ForcedPluginPreviewVersionUpgradeStep method checkAndPerformUpgrade.
@Override
public boolean checkAndPerformUpgrade(@NotNull Project project, @NotNull AndroidPluginInfo pluginInfo) {
AndroidPluginGeneration pluginGeneration = pluginInfo.getPluginGeneration();
GradleVersion recommended = GradleVersion.parse(pluginGeneration.getLatestKnownVersion());
if (!shouldPreviewBeForcedToUpgradePluginVersion(recommended.toString(), pluginInfo.getPluginVersion())) {
return false;
}
GradleSyncState syncState = GradleSyncState.getInstance(project);
// Update the sync state before starting a new one.
syncState.syncEnded();
boolean userAcceptsForcedUpgrade = new ForcedPluginPreviewVersionUpgradeDialog(project, pluginInfo).showAndGet();
if (userAcceptsForcedUpgrade) {
AndroidPluginVersionUpdater versionUpdater = AndroidPluginVersionUpdater.getInstance(project);
versionUpdater.updatePluginVersionAndSync(recommended, GradleVersion.parse(GRADLE_LATEST_VERSION), true);
} else {
String[] text = { "The project is using an incompatible version of the " + pluginGeneration.getDescription() + ".", "Please update your project to use version " + pluginGeneration.getLatestKnownVersion() + "." };
SyncMessage msg = new SyncMessage(SyncMessage.DEFAULT_GROUP, ERROR, text);
String pluginName = AndroidPluginGeneration.getGroupId() + GRADLE_PATH_SEPARATOR + pluginGeneration.getArtifactId();
NotificationHyperlink quickFix = new SearchInBuildFilesHyperlink(pluginName);
msg.add(quickFix);
SyncMessages.getInstance(project).report(msg);
syncState.invalidateLastSync("Force plugin upgrade declined");
}
return true;
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class UnsupportedGradleReporter method report.
@Override
void report(@NotNull SyncIssue syncIssue, @NotNull Module module, @Nullable VirtualFile buildFile) {
String text = syncIssue.getMessage();
MessageType type = getMessageType(syncIssue);
SyncMessage message = new SyncMessage(DEFAULT_GROUP, type, NonNavigatable.INSTANCE, text);
String gradleVersion = syncIssue.getData();
List<NotificationHyperlink> quickFixes = getQuickFixHyperlinks(module.getProject(), gradleVersion);
message.add(quickFixes);
getSyncMessages(module).report(message);
}
Aggregations