Search in sources :

Example 6 with OpenUrlHyperlink

use of com.android.tools.idea.gradle.project.sync.hyperlink.OpenUrlHyperlink 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;
}
Also used : FixAndroidGradlePluginVersionHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.FixAndroidGradlePluginVersionHyperlink) AndroidPluginInfo(com.android.tools.idea.gradle.plugin.AndroidPluginInfo) ArrayList(java.util.ArrayList) OpenUrlHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.OpenUrlHyperlink) GradleVersion(com.android.ide.common.repository.GradleVersion) NotificationHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink) NotNull(org.jetbrains.annotations.NotNull)

Example 7 with OpenUrlHyperlink

use of com.android.tools.idea.gradle.project.sync.hyperlink.OpenUrlHyperlink in project android by JetBrains.

the class ExpiredPreviewBuildSetupStep method setUpProject.

@Override
public void setUpProject(@NotNull Project project, @Nullable ProgressIndicator indicator) {
    if (myExpirationChecked) {
        return;
    }
    String ideVersion = myApplicationInfo.getFullVersion();
    if (isPreview(ideVersion)) {
        // Expire preview builds two months after their build date (which is going to be roughly six weeks after release; by
        // then will definitely have updated the build
        Calendar expirationDate = (Calendar) myApplicationInfo.getBuildDate().clone();
        expirationDate.add(MONTH, 2);
        Calendar now = Calendar.getInstance();
        if (now.after(expirationDate)) {
            String message = String.format("This preview build (%1$s) is old; please update to a newer preview or a stable version.", ideVersion);
            OpenUrlHyperlink hyperlink = new OpenUrlHyperlink("http://tools.android.com/download/studio/", "Show Available Versions");
            AndroidGradleNotification.getInstance(project).showBalloon("Old Preview Build", message, INFORMATION, hyperlink);
            // If we show an expiration message, don't also show a second balloon.
            myExpirationChecked = true;
        }
    }
}
Also used : Calendar(java.util.Calendar) OpenUrlHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.OpenUrlHyperlink)

Example 8 with OpenUrlHyperlink

use of com.android.tools.idea.gradle.project.sync.hyperlink.OpenUrlHyperlink 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);
    }
}
Also used : SyncMessage(com.android.tools.idea.gradle.project.sync.messages.SyncMessage) FixAndroidGradlePluginVersionHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.FixAndroidGradlePluginVersionHyperlink) OpenUrlHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.OpenUrlHyperlink)

Example 9 with OpenUrlHyperlink

use of com.android.tools.idea.gradle.project.sync.hyperlink.OpenUrlHyperlink in project android by JetBrains.

the class NdkIntegrationDeprecatedErrorHandler 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://developer.android.com/studio/build/experimental-plugin.html", "Consider trying the new experimental plugin"));
    hyperlinks.add(new SetUseDeprecatedNdkHyperlink());
    return hyperlinks;
}
Also used : ArrayList(java.util.ArrayList) OpenUrlHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.OpenUrlHyperlink) NotificationHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink) NotNull(org.jetbrains.annotations.NotNull)

Example 10 with OpenUrlHyperlink

use of com.android.tools.idea.gradle.project.sync.hyperlink.OpenUrlHyperlink 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;
}
Also used : ArrayList(java.util.ArrayList) OpenUrlHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.OpenUrlHyperlink) NotificationHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

OpenUrlHyperlink (com.android.tools.idea.gradle.project.sync.hyperlink.OpenUrlHyperlink)13 NotificationHyperlink (com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink)10 ArrayList (java.util.ArrayList)7 NotNull (org.jetbrains.annotations.NotNull)7 FixAndroidGradlePluginVersionHyperlink (com.android.tools.idea.gradle.project.sync.hyperlink.FixAndroidGradlePluginVersionHyperlink)6 Module (com.intellij.openapi.module.Module)3 GradleVersion (com.android.ide.common.repository.GradleVersion)2 AndroidPluginInfo (com.android.tools.idea.gradle.plugin.AndroidPluginInfo)2 SyncMessage (com.android.tools.idea.gradle.project.sync.messages.SyncMessage)2 AndroidProject (com.android.builder.model.AndroidProject)1 Project (com.intellij.openapi.project.Project)1 Calendar (java.util.Calendar)1