From 5c556d9db0733b1cd56bfc88e9f7747c8e390ec6 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 6 Apr 2017 15:53:42 +0200 Subject: [PATCH] [ui] exact check for update timestamp in tooltip --- .../openapi/updateSettings/impl/UpdateChecker.kt | 10 ++++------ .../impl/UpdateSettingsConfigurable.java | 10 ++++++++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.kt b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.kt index 6c7c8cfac8eb..5f2d4b8ff499 100644 --- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.kt +++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.kt @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -120,11 +120,7 @@ object UpdateChecker { indicator?.text = IdeBundle.message("updates.checking.platform") val result = checkPlatformUpdate(updateSettings) - - if (manualCheck && result.state == UpdateStrategy.State.LOADED) { - UpdateSettings.getInstance().saveLastCheckedInfo() - } - else if (result.state == UpdateStrategy.State.CONNECTION_ERROR) { + if (result.state == UpdateStrategy.State.CONNECTION_ERROR) { val e = result.error if (e != null) LOG.debug(e) showErrorMessage(manualCheck, IdeBundle.message("updates.error.connection.failed", e?.message ?: "internal error")) @@ -151,6 +147,8 @@ object UpdateChecker { // show result + UpdateSettings.getInstance().saveLastCheckedInfo() + ApplicationManager.getApplication().invokeLater({ showUpdateResult(project, result, updateSettings, updatedPlugins, incompatiblePlugins, externalUpdates, !fromSettings, manualCheck) callback?.setDone() diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateSettingsConfigurable.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateSettingsConfigurable.java index 379079825f10..38874f25e088 100644 --- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateSettingsConfigurable.java +++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateSettingsConfigurable.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -210,7 +210,13 @@ public class UpdateSettingsConfigurable extends BaseConfigurable implements Sear private void updateLastCheckedLabel() { long time = mySettings.getLastTimeChecked(); - myLastCheckedDate.setText(time == 0 ? IdeBundle.message("updates.last.check.never") : DateFormatUtil.formatPrettyDateTime(time)); + if (time <= 0) { + myLastCheckedDate.setText(IdeBundle.message("updates.last.check.never")); + } + else { + myLastCheckedDate.setText(DateFormatUtil.formatPrettyDateTime(time)); + myLastCheckedDate.setToolTipText(DateFormatUtil.formatDate(time) + ' ' + DateFormatUtil.formatTimeWithSeconds(time)); + } } public ChannelStatus getSelectedChannelType() {