Collection<UpdateAction> (@NotNull DataContext context) { Collection<UpdateAction> actions = new ArrayList<>(); if (myNextRunPlatformUpdateVersion != null) { actions.add(new IdeUpdateAction(myNextRunPlatformUpdateVersion) { @Override public void actionPerformed(@NotNull AnActionEvent e) { Project project = e.getProject(); Pair<PlatformUpdates, InternalPluginResults> result = ProgressManager.getInstance() .run(new Task.WithResult<>(project, IdeBundle.message("find.ide.update.title"), true) { @Override protected @NotNull Pair<@NotNull PlatformUpdates, @Nullable InternalPluginResults> compute(@NotNull ProgressIndicator indicator) { PlatformUpdates platformUpdates = UpdateChecker.getPlatformUpdates(UpdateSettings.getInstance(), indicator); InternalPluginResults pluginResults = platformUpdates instanceof PlatformUpdates.Loaded ? getInternalPluginUpdates((PlatformUpdates.Loaded)platformUpdates, indicator) : null; return Pair.create(platformUpdates, pluginResults); } private static @NotNull InternalPluginResults getInternalPluginUpdates(@NotNull PlatformUpdates.Loaded loadedResult, @NotNull ProgressIndicator indicator) { return UpdateChecker.getInternalPluginUpdates(loadedResult.getNewBuild().getApiVersion(), indicator); } }); PlatformUpdates platformUpdateInfo = result.getFirst(); InternalPluginResults pluginResults = result.getSecond(); if (platformUpdateInfo instanceof PlatformUpdates.Loaded && pluginResults != null) { setPlatformUpdateInfo((PlatformUpdates.Loaded)platformUpdateInfo); newPlatformUpdate(pluginResults.getPluginUpdates().getAll(), pluginResults.getPluginNods(), null); super.actionPerformed(e); } else { if (platformUpdateInfo instanceof PlatformUpdates.ConnectionError) { String errorMessage = ((PlatformUpdates.ConnectionError)platformUpdateInfo).getError().getMessage(); Messages.showErrorDialog(project, IdeBundle.message("updates.error.connection.failed", errorMessage), IdeBundle.message("find.ide.update.title")); } else { Messages.showInfoMessage(project, IdeBundle.message("updates.no.updates.notification"), IdeBundle.message("find.ide.update.title")); newPlatformUpdate(); } } } }); } else if (myPlatformUpdateInfo != null) { actions.add(new IdeUpdateAction(myPlatformUpdateInfo.getNewBuild().getVersion())); } // todo[AL/RS] separate action for plugins compatible with both old and new builds else if (myUpdatedPlugins != null) { int size = myUpdatedPlugins.size(); actions.add(new UpdateAction(size == 1 ? IdeBundle.message("settings.entry.point.update.plugin.action", myUpdatedPlugins.iterator().next().getPluginName()) : IdeBundle.message("settings.entry.point.update.plugins.action", size)) { @Override public boolean isNewAction() { return isAlreadyShownPluginUpdates(); } @Override public void markAsRead() { updateAlreadyShownPluginUpdates(); } @Override public void update(@NotNull AnActionEvent e) { e.getPresentation().setEnabled(myEnableUpdateAction); } @Override public @NotNull ActionUpdateThread getActionUpdateThread() { return ActionUpdateThread.BGT; } @Override public void actionPerformed(@NotNull AnActionEvent e) { PluginUpdateDialog dialog = new PluginUpdateDialog(e.getProject(), myUpdatedPlugins, myCustomRepositoryPlugins); dialog.setFinishCallback(() -> setEnableUpdateAction(true)); setEnableUpdateAction(false); if (!dialog.showAndGet()) { setEnableUpdateAction(true); } } }); } return actions; }