UpdateChecker.showUpdateResult()

This commit is contained in:
Dmitry Jemerov
2011-03-04 19:34:59 +01:00
parent e6b8391772
commit 231bf9b112
3 changed files with 18 additions and 25 deletions
@@ -215,12 +215,7 @@ public class IdeaApplication {
app.invokeLater(new Runnable() {
@Override
public void run() {
if (checkForUpdateResult.hasNewBuildInSelectedChannel()) {
UpdateChecker.showUpdateInfoDialog(true, checkForUpdateResult.getUpdatedChannel(), updatedPlugins);
}
else if (updatedPlugins != null) {
UpdateChecker.showNoUpdatesDialog(true, updatedPlugins, showConfirmation);
}
UpdateChecker.showUpdateResult(checkForUpdateResult, updatedPlugins, showConfirmation, true, false);
}
});
}
@@ -56,15 +56,8 @@ public class CheckForUpdateAction extends AnAction implements DumbAware {
return;
}
if (result.hasNewBuildInSelectedChannel()) {
//information about new channel could be there
UpdateSettings.getInstance().LAST_TIME_CHECKED = System.currentTimeMillis();
UpdateChecker.showUpdateInfoDialog(enableLink, result.getUpdatedChannel(), updatedPlugins);
}
else {
//information about new channel could be there
UpdateChecker.showNoUpdatesDialog(enableLink, updatedPlugins, true);
}
UpdateSettings.getInstance().LAST_TIME_CHECKED = System.currentTimeMillis();
UpdateChecker.showUpdateResult(result, updatedPlugins, true, enableLink, true);
}
});
}
@@ -307,6 +307,21 @@ public final class UpdateChecker {
return result;
}
public static void showUpdateResult(CheckForUpdateResult checkForUpdateResult,
List<PluginDownloader> updatedPlugins,
boolean showConfirmation,
boolean enableLink,
final boolean alwaysShowResults) {
if (checkForUpdateResult.hasNewBuildInSelectedChannel()) {
new UpdateInfoDialog(true, checkForUpdateResult.getUpdatedChannel(), updatedPlugins, enableLink).show();
}
else if (updatedPlugins != null || alwaysShowResults) {
NoUpdatesDialog dialog = new NoUpdatesDialog(true, updatedPlugins, enableLink);
dialog.setShowConfirmation(showConfirmation);
dialog.show();
}
}
private static Document loadVersionInfo(final String url) throws Exception {
if (LOG.isDebugEnabled()) {
LOG.debug("enter: loadVersionInfo(UPDATE_URL='" + url + "' )");
@@ -374,16 +389,6 @@ public final class UpdateChecker {
return uid;
}
public static void showNoUpdatesDialog(boolean enableLink, final List<PluginDownloader> updatePlugins, boolean showConfirmation) {
NoUpdatesDialog dialog = new NoUpdatesDialog(true, updatePlugins, enableLink);
dialog.setShowConfirmation(showConfirmation);
dialog.show();
}
public static void showUpdateInfoDialog(boolean enableLink, final UpdateChannel channel, final List<PluginDownloader> updatePlugins) {
new UpdateInfoDialog(true, channel, updatePlugins, enableLink).show();
}
public static boolean install(List<PluginDownloader> downloaders) {
boolean installed = false;
for (PluginDownloader downloader : downloaders) {