diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/ExternalUpdate.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/ExternalUpdate.java deleted file mode 100644 index 97c89796b380..000000000000 --- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/ExternalUpdate.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2000-2016 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.openapi.updateSettings.impl; - -import com.intellij.ide.externalComponents.ExternalComponentSource; -import com.intellij.ide.externalComponents.UpdatableExternalComponent; - -import java.util.Collection; - -/** - * Represents one external update request, consisting of a collection of components for which updates will be requested from one source. - */ -public class ExternalUpdate { - private final Collection myComponents; - private final ExternalComponentSource mySource; - - public ExternalUpdate(Collection components, ExternalComponentSource source) { - myComponents = components; - mySource = source; - } - - public Collection getComponents() { - return myComponents; - } - - public ExternalComponentSource getSource() { - return mySource; - } -} \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateCheckResults.kt b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateCheckResults.kt index 35b16daddca5..a0ab6145dff1 100644 --- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateCheckResults.kt +++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateCheckResults.kt @@ -1,6 +1,8 @@ // Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.updateSettings.impl +import com.intellij.ide.externalComponents.ExternalComponentSource +import com.intellij.ide.externalComponents.UpdatableExternalComponent import com.intellij.ide.plugins.IdeaPluginDescriptor import com.intellij.openapi.util.BuildNumber @@ -42,3 +44,8 @@ data class PluginUpdates( val disabled: Collection, val incompatible: Collection, ) + +data class ExternalUpdate( + val source: ExternalComponentSource, + val components: Collection +) 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 b9fa408bb410..aa8e285cb528 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,7 +1,6 @@ // Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.updateSettings.impl -import com.google.common.annotations.VisibleForTesting import com.intellij.ide.IdeBundle import com.intellij.ide.externalComponents.ExternalComponentManager import com.intellij.ide.plugins.* @@ -148,8 +147,9 @@ object UpdateChecker { return } + indicator?.text = IdeBundle.message("updates.external.progress") val externalUpdates = try { - checkExternalUpdates(showDialog, updateSettings, indicator) + findExternalUpdates(showDialog, updateSettings, indicator) } catch (e: IOException) { showErrorMessage(showDialog, IdeBundle.message("updates.error.connection.failed", e.message)) @@ -387,13 +387,10 @@ object UpdateChecker { return updateable } - @VisibleForTesting - fun checkExternalUpdates(manualCheck: Boolean, - updateSettings: UpdateSettings, - indicator: ProgressIndicator?): Collection { + @JvmStatic + fun findExternalUpdates(manualCheck: Boolean, updateSettings: UpdateSettings, indicator: ProgressIndicator?): Collection { val result = arrayListOf() val manager = ExternalComponentManager.getInstance() - indicator?.text = IdeBundle.message("updates.external.progress") for (source in ExternalComponentManager.getComponentSources()) { indicator?.checkCanceled() @@ -401,7 +398,7 @@ object UpdateChecker { val siteResult = source.getAvailableVersions(indicator, updateSettings) .filter { it.isUpdateFor(manager.findExistingComponentMatching(it, source)) } if (siteResult.isNotEmpty()) { - result += ExternalUpdate(siteResult, source) + result += ExternalUpdate(source, siteResult) } } catch (e: Exception) { @@ -491,7 +488,7 @@ object UpdateChecker { checkForUpdateResult: CheckForUpdateResult, pluginUpdates: PluginUpdates, customRepoPlugins: Collection, - externalUpdates: Collection?, + externalUpdates: Collection, showSettingsLink: Boolean, showDialog: Boolean, showNotification: Boolean) { @@ -571,7 +568,7 @@ object UpdateChecker { } } - if (externalUpdates != null && !externalUpdates.isEmpty()) { + if (externalUpdates.isNotEmpty()) { updateFound = true ourShownNotifications.remove(NotificationUniqueType.EXTERNAL)?.forEach { it.expire() }