package jetbrains.mps.ide.migration;
/*Generated by MPS */
import jetbrains.mps.project.MPSProject;
import org.jetbrains.mps.openapi.module.SModule;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.project.Project;
public class MigrationDialogUtil {
public static boolean showMigrationConfirmation(MPSProject project, Iterable<SModule> modules, MigrationManager m) {
StringBuilder text = new StringBuilder();
text.append("The project needs to be migrated.\n\n" + "This project uses older versions of languages and/or outdated project format.\n" + "To work correctly in the current environment, some migrations should be applied to the project.\n" + "If the migration is postponed, it is still possible to work with the project.\n" + "However, not migrated code may work slower or worse in some aspect, and typically will not work in next release.\n" + "It is strongly recommended to run the migrations as soon as possible and only use not-migrated project to fix any problems in it before migrating.\n\n" + "Would you like to reload project and start the migration immediately?");
int result = Messages.showYesNoDialog(project.getProject(), text.toString(), "Migration Required", "Migrate", "Postpone", null);
return result == Messages.YES;
}
public static boolean showResaveConfirmation(MPSProject project) {
StringBuilder text = new StringBuilder();
text.append("Module descriptors need to be updated. The update will change many files.\n");
text.append("If the update is postponed, migration status may be calculated with errors in future.\n\n");
text.append("Would you like to update module descriptors immediately?");
int result = Messages.showYesNoDialog(project.getProject(), text.toString(), "Modules Update Required", "Resave", "Postpone", null);
return result == Messages.YES;
}
public static void showNoMigrationMessage(Project p) {
Messages.showMessageDialog(p, "Project doesn't need to be migrated.\n" + "Migration assistant will not be started.", "Migration Not Required", null);
}
}