use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class AndroidGradlePluginVersionReader method getQuickFixes.
@Override
@NotNull
public List<NotificationHyperlink> getQuickFixes(@NotNull Module module, @Nullable VersionRange expectedVersion, @Nullable PositionInFile location) {
AndroidPluginInfo pluginInfo = AndroidPluginInfo.find(module.getProject());
if (isSupportedGeneration(pluginInfo)) {
String version = pluginInfo.getPluginGeneration().getLatestKnownVersion();
List<NotificationHyperlink> quickFixes = new ArrayList<>();
quickFixes.add(new FixAndroidGradlePluginVersionHyperlink(GradleVersion.parse(version), GradleVersion.parse(GRADLE_LATEST_VERSION)));
quickFixes.add(new OpenUrlHyperlink("https://developer.android.com/studio/releases/gradle-plugin.html#updating-gradle", "Open Documentation"));
return quickFixes;
}
return emptyList();
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class CachedDependencyNotFoundErrorHandler method getQuickFixHyperlinks.
@Override
@NotNull
protected List<NotificationHyperlink> getQuickFixHyperlinks(@NotNull NotificationData notification, @NotNull Project project, @NotNull String text) {
List<NotificationHyperlink> hyperlinks = new ArrayList<>();
NotificationHyperlink disableOfflineMode = ToggleOfflineModeHyperlink.disableOfflineMode(project);
if (disableOfflineMode != null) {
hyperlinks.add(disableOfflineMode);
}
return hyperlinks;
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class ErrorOpeningZipFileErrorHandler method handleError.
@Override
public boolean handleError(@NotNull ExternalSystemException error, @NotNull NotificationData notification, @NotNull Project project) {
String text = findErrorMessage(getRootCause(error));
if (text != null) {
List<NotificationHyperlink> hyperlinks = new ArrayList<>();
NotificationHyperlink syncProjectHyperlink = SyncProjectWithExtraCommandLineOptionsHyperlink.syncProjectRefreshingDependencies();
hyperlinks.add(syncProjectHyperlink);
String newText = text + syncProjectHyperlink.toHtml();
SyncMessages.getInstance(project).updateNotification(notification, newText, hyperlinks);
return true;
}
return false;
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class GradleDslMethodNotFoundErrorHandler method getApplyGradlePluginHyperlink.
@NotNull
private static NotificationHyperlink getApplyGradlePluginHyperlink(@NotNull final VirtualFile virtualFile, @NotNull final NotificationData notification) {
return new NotificationHyperlink("apply.gradle.plugin", "Apply Gradle plugin") {
@Override
protected void execute(@NotNull Project project) {
openFile(virtualFile, notification, project);
ActionManager actionManager = ActionManager.getInstance();
String actionId = AddGradleDslPluginAction.ID;
AnAction action = actionManager.getAction(actionId);
assert action instanceof AddGradleDslPluginAction;
AddGradleDslPluginAction addPluginAction = (AddGradleDslPluginAction) action;
actionManager.tryToExecute(addPluginAction, ActionCommand.getInputEvent(actionId), null, ActionPlaces.UNKNOWN, true);
}
};
}
use of com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink in project android by JetBrains.
the class GradleDslMethodNotFoundErrorHandler method getGradleSettingsHyperlink.
@NotNull
private static NotificationHyperlink getGradleSettingsHyperlink(@NotNull Project project) {
if (isUsingWrapper(project)) {
GradleWrapper gradleWrapper = GradleWrapper.find(project);
if (gradleWrapper != null) {
VirtualFile propertiesFile = gradleWrapper.getPropertiesFile();
if (propertiesFile != null) {
return new NotificationHyperlink("open.wrapper.file", "Open Gradle wrapper file") {
@Override
protected void execute(@NotNull Project project) {
OpenFileDescriptor descriptor = new OpenFileDescriptor(project, propertiesFile);
FileEditorManager.getInstance(project).openTextEditor(descriptor, true);
}
};
}
}
}
return new OpenGradleSettingsHyperlink();
}
Aggregations