mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-12 14:10:29 +00:00
feat: display notification on plugin updates
This commit is contained in:
parent
10b090e2d2
commit
1392775940
8 changed files with 125 additions and 4 deletions
|
|
@ -5,11 +5,15 @@ import static java.util.Objects.requireNonNull;
|
|||
import com.intellij.ide.plugins.PluginManagerCore;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.extensions.PluginId;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import ee.carlrobert.codegpt.telemetry.core.util.Directories;
|
||||
import com.intellij.openapi.updateSettings.impl.PluginDownloader;
|
||||
import com.intellij.openapi.updateSettings.impl.UpdateChecker;
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public final class CodeGPTPlugin {
|
||||
|
|
@ -46,4 +50,18 @@ public final class CodeGPTPlugin {
|
|||
public static @NotNull String getProjectIndexStorePath(@NotNull Project project) {
|
||||
return getIndexStorePath() + File.separator + project.getName();
|
||||
}
|
||||
|
||||
public static Optional<PluginDownloader> tryFindAvailableUpdate(
|
||||
@NotNull ProgressIndicator indicator) {
|
||||
return findAvailableUpdates(indicator).stream()
|
||||
.filter((update) -> CODEGPT_ID.equals(update.getId()))
|
||||
.findFirst();
|
||||
}
|
||||
|
||||
private static @NotNull Collection<PluginDownloader> findAvailableUpdates(
|
||||
@NotNull ProgressIndicator indicator) {
|
||||
return UpdateChecker.getInternalPluginUpdates(null, indicator)
|
||||
.getPluginUpdates()
|
||||
.getAllEnabled();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue