Search in sources :

Example 1 with OpenMigrationToGradleUrlHyperlink

use of com.android.tools.idea.gradle.project.importing.OpenMigrationToGradleUrlHyperlink in project android by JetBrains.

the class GradleSyncInvoker method prepareProject.

private boolean prepareProject(@NotNull Project project, @NotNull Request request, @Nullable GradleSyncListener listener) throws ConfigurationException {
    if (AndroidProjectInfo.getInstance(project).requiresAndroidModel() || hasTopLevelGradleBuildFile(project)) {
        if (!request.isNewProject()) {
            myFileDocumentManager.saveAllDocuments();
        }
        // continue with sync.
        return true;
    }
    invokeLaterIfProjectAlive(project, () -> {
        String msg = String.format("The project '%s' is not a Gradle-based project", project.getName());
        AndroidGradleNotification.getInstance(project).showBalloon("Project Sync", msg, ERROR, new OpenMigrationToGradleUrlHyperlink());
        if (listener != null) {
            listener.syncFailed(project, msg);
        }
    });
    // stop sync.
    return false;
}
Also used : OpenMigrationToGradleUrlHyperlink(com.android.tools.idea.gradle.project.importing.OpenMigrationToGradleUrlHyperlink)

Example 2 with OpenMigrationToGradleUrlHyperlink

use of com.android.tools.idea.gradle.project.importing.OpenMigrationToGradleUrlHyperlink 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);
}
Also used : Project(com.intellij.openapi.project.Project) ApkProjects.isApkProject(com.android.tools.idea.apk.ApkProjects.isApkProject) OpenMigrationToGradleUrlHyperlink(com.android.tools.idea.gradle.project.importing.OpenMigrationToGradleUrlHyperlink) NotNull(org.jetbrains.annotations.NotNull) NotificationHyperlink(com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink)

Aggregations

OpenMigrationToGradleUrlHyperlink (com.android.tools.idea.gradle.project.importing.OpenMigrationToGradleUrlHyperlink)2 ApkProjects.isApkProject (com.android.tools.idea.apk.ApkProjects.isApkProject)1 NotificationHyperlink (com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink)1 Project (com.intellij.openapi.project.Project)1 NotNull (org.jetbrains.annotations.NotNull)1