Search in sources :

Example 1 with OpenUrlHyperlink

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

the class EncodingValidationStrategy method fixAndReportFoundIssues.

@Override
void fixAndReportFoundIssues() {
    if (myMismatchingEncoding != null) {
        Project project = getProject();
        // Fix encoding mismatch.
        myEncodings.setDefaultCharsetName(myMismatchingEncoding);
        // Report encoding mismatch.
        String line = String.format("The project encoding (%1$s) has been reset to the encoding specified in the Gradle build files (%2$s).", myEncodings.getDefaultCharset().displayName(), myMismatchingEncoding);
        String[] text = { line, "Mismatching encodings can lead to serious bugs." };
        SyncMessage message = new SyncMessage(SyncMessage.DEFAULT_GROUP, INFO, text);
        message.add(new OpenUrlHyperlink("http://tools.android.com/knownissues/encoding", "More Info..."));
        SyncMessages.getInstance(project).report(message);
    }
}
Also used : SyncMessage(com.android.tools.idea.gradle.project.sync.messages.SyncMessage) AndroidProject(com.android.builder.model.AndroidProject) Project(com.intellij.openapi.project.Project) OpenUrlHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.OpenUrlHyperlink)

Example 2 with OpenUrlHyperlink

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

Example 3 with OpenUrlHyperlink

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

the class JavaHeapSpaceErrorHandler 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("http://www.gradle.org/docs/current/userguide/build_environment.html", "Read Gradle's configuration guide"));
    hyperlinks.add(new OpenUrlHyperlink("http://docs.oracle.com/javase/7/docs/technotes/guides/vm/gc-ergonomics.html", "Read about Java's heap size"));
    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 4 with OpenUrlHyperlink

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

the class GradleVersionReaderTest method testGetQuickFixes.

public void testGetQuickFixes() throws Exception {
    loadSimpleApplication();
    Module appModule = myModules.getAppModule();
    List<NotificationHyperlink> quickFixes = myVersionReader.getQuickFixes(appModule, null, null);
    assertThat(quickFixes).hasSize(2);
    NotificationHyperlink quickFix = quickFixes.get(0);
    assertThat(quickFix).isInstanceOf(FixAndroidGradlePluginVersionHyperlink.class);
    FixAndroidGradlePluginVersionHyperlink fixAndroidGradlePluginQuickFix = (FixAndroidGradlePluginVersionHyperlink) quickFix;
    assertEquals(BuildEnvironment.getInstance().getGradlePluginVersion(), fixAndroidGradlePluginQuickFix.getPluginVersion().toString());
    GradleVersion gradleVersion = fixAndroidGradlePluginQuickFix.getGradleVersion();
    assertNotNull(gradleVersion);
    assertEquals(GRADLE_LATEST_VERSION, gradleVersion.toString());
    quickFix = quickFixes.get(1);
    assertThat(quickFix).isInstanceOf(OpenUrlHyperlink.class);
    OpenUrlHyperlink openUrlQuickFix = (OpenUrlHyperlink) quickFix;
    assertEquals("https://developer.android.com/studio/releases/index.html#Revisions", openUrlQuickFix.getUrl());
}
Also used : FixAndroidGradlePluginVersionHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.FixAndroidGradlePluginVersionHyperlink) OpenUrlHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.OpenUrlHyperlink) Module(com.intellij.openapi.module.Module) GradleVersion(com.android.ide.common.repository.GradleVersion) NotificationHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink)

Example 5 with OpenUrlHyperlink

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

the class AndroidGradleExperimentalPluginVersionReaderTest method testGetQuickFixesWithExperimentalPlugin.

public void testGetQuickFixesWithExperimentalPlugin() throws Exception {
    loadProject(EXPERIMENTAL_PLUGIN);
    Module appModule = myModules.getAppModule();
    List<NotificationHyperlink> quickFixes = myVersionReader.getQuickFixes(appModule, VersionRange.parse("[0.7.0, +)"), null);
    assertThat(quickFixes).hasSize(2);
    NotificationHyperlink quickFix = quickFixes.get(0);
    assertThat(quickFix).isInstanceOf(FixAndroidGradlePluginVersionHyperlink.class);
    FixAndroidGradlePluginVersionHyperlink fixAndroidGradlePluginQuickFix = (FixAndroidGradlePluginVersionHyperlink) quickFix;
    assertEquals(BuildEnvironment.getInstance().getExperimentalPluginVersion(), fixAndroidGradlePluginQuickFix.getPluginVersion().toString());
    quickFix = quickFixes.get(1);
    assertThat(quickFix).isInstanceOf(OpenUrlHyperlink.class);
    OpenUrlHyperlink openUrlQuickFix = (OpenUrlHyperlink) quickFix;
    assertEquals("https://developer.android.com/studio/releases/gradle-plugin.html#updating-gradle", openUrlQuickFix.getUrl());
}
Also used : FixAndroidGradlePluginVersionHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.FixAndroidGradlePluginVersionHyperlink) OpenUrlHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.OpenUrlHyperlink) Module(com.intellij.openapi.module.Module) NotificationHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink)

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