[platform] suppresses channel switch notification for the first launch (IDEA-149673)

This commit is contained in:
Roman Shevchenko
2015-12-29 11:02:17 +01:00
parent 99ebd030c1
commit 9c7309fff6
2 changed files with 15 additions and 3 deletions
@@ -38,6 +38,7 @@ import java.util.PropertyResourceBundle;
* @author max
*/
public class ConfigImportHelper {
private static final String FIRST_SESSION_KEY = "intellij.first.ide.session";
private static final String CONFIG_IMPORTED_IN_CURRENT_SESSION_KEY = "intellij.config.imported.in.current.session";
private static final String BUILD_NUMBER_FILE = SystemInfo.isMac ? "/Resources/build.txt" : "build.txt";
@@ -49,6 +50,8 @@ public class ConfigImportHelper {
private ConfigImportHelper() { }
public static void importConfigsTo(@NotNull String newConfigPath) {
System.setProperty(FIRST_SESSION_KEY, Boolean.TRUE.toString());
ConfigImportSettings settings = getConfigImportSettings();
File newConfigDir = new File(newConfigPath);
@@ -80,6 +83,13 @@ public class ConfigImportHelper {
}
}
/**
* Returns {@code true} when the IDE is launched for the first time (i.e. there was no config directory).
*/
public static boolean isFirstSession() {
return Boolean.getBoolean(FIRST_SESSION_KEY);
}
/**
* Returns {@code true} when the IDE is launched for the first time, and configs were imported from another installation.
*/
@@ -77,9 +77,11 @@ public class UpdateCheckerComponent implements ApplicationComponent {
if (eap && current != ChannelStatus.EAP && UpdateStrategyCustomization.getInstance().forceEapUpdateChannelForEapBuilds()) {
mySettings.setSelectedChannelStatus(ChannelStatus.EAP);
LOG.info("channel forced to 'eap'");
String title = IdeBundle.message("update.notifications.title");
String message = IdeBundle.message("update.channel.enforced", ChannelStatus.EAP);
notify(app, UpdateChecker.NOTIFICATIONS.createNotification(title, message, NotificationType.INFORMATION, null));
if (!ConfigImportHelper.isFirstSession()) {
String title = IdeBundle.message("update.notifications.title");
String message = IdeBundle.message("update.channel.enforced", ChannelStatus.EAP);
notify(app, UpdateChecker.NOTIFICATIONS.createNotification(title, message, NotificationType.INFORMATION, null));
}
}
if (!eap && current == ChannelStatus.EAP && ConfigImportHelper.isConfigImported()) {