mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-12 05:51:28 +00:00
fix: JetBrains internal API usage warnings
This commit is contained in:
parent
624180a626
commit
06ad159adf
2 changed files with 16 additions and 31 deletions
|
|
@ -5,15 +5,10 @@ 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 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 {
|
||||
|
|
@ -50,18 +45,4 @@ 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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package ee.carlrobert.codegpt;
|
||||
|
||||
import static ee.carlrobert.codegpt.CodeGPTPlugin.CODEGPT_ID;
|
||||
|
||||
import com.intellij.ide.plugins.InstalledPluginsState;
|
||||
import com.intellij.notification.NotificationAction;
|
||||
import com.intellij.notification.NotificationType;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
|
|
@ -50,18 +53,19 @@ public class CodeGPTUpdateStartupActivity implements StartupActivity.Background
|
|||
|
||||
public void run(@NotNull ProgressIndicator indicator) {
|
||||
if (!myProject.isDisposed()) {
|
||||
CodeGPTPlugin.tryFindAvailableUpdate(indicator)
|
||||
.ifPresent((update) -> OverlayUtil.getDefaultNotification(
|
||||
CodeGPTBundle.get("checkForUpdatesTask.notification.message"),
|
||||
NotificationType.IDE_UPDATE)
|
||||
.addAction(NotificationAction.createSimpleExpiring(
|
||||
CodeGPTBundle.get("checkForUpdatesTask.notification.installButton"),
|
||||
() -> ApplicationManager.getApplication()
|
||||
.executeOnPooledThread(() -> installCodeGPTUpdate(myProject))))
|
||||
.addAction(NotificationAction.createSimpleExpiring(
|
||||
CodeGPTBundle.get("checkForUpdatesTask.notification.hideButton"),
|
||||
() -> ConfigurationState.getInstance().setCheckForPluginUpdates(false)))
|
||||
.notify(myProject));
|
||||
if (InstalledPluginsState.getInstance().hasNewerVersion(CODEGPT_ID)) {
|
||||
OverlayUtil.getDefaultNotification(
|
||||
CodeGPTBundle.get("checkForUpdatesTask.notification.message"),
|
||||
NotificationType.IDE_UPDATE)
|
||||
.addAction(NotificationAction.createSimpleExpiring(
|
||||
CodeGPTBundle.get("checkForUpdatesTask.notification.installButton"),
|
||||
() -> ApplicationManager.getApplication()
|
||||
.executeOnPooledThread(() -> installCodeGPTUpdate(myProject))))
|
||||
.addAction(NotificationAction.createSimpleExpiring(
|
||||
CodeGPTBundle.get("checkForUpdatesTask.notification.hideButton"),
|
||||
() -> ConfigurationState.getInstance().setCheckForPluginUpdates(false)))
|
||||
.notify(myProject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue