[platform] backgroundable patch downloading progress (IDEA-46819)

This commit is contained in:
Roman Shevchenko
2018-02-12 12:21:56 +01:00
parent be34f017ef
commit 287051c173
2 changed files with 16 additions and 2 deletions
@@ -13,6 +13,7 @@ import com.intellij.openapi.application.ex.ApplicationEx;
import com.intellij.openapi.application.ex.ApplicationManagerEx;
import com.intellij.openapi.application.impl.ApplicationImpl;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.PerformInBackgroundOption;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.Task;
@@ -186,7 +187,7 @@ class UpdateInfoDialog extends AbstractUpdateDialog {
return; // update cancelled
}
new Task.Modal(null, IdeBundle.message("update.notifications.title"), true) {
new Task.Backgroundable(null, IdeBundle.message("update.notifications.title"), true, PerformInBackgroundOption.DEAF) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
String[] command;
@@ -217,7 +218,19 @@ class UpdateInfoDialog extends AbstractUpdateDialog {
ApplicationEx app = ApplicationManagerEx.getApplicationEx();
if (ApplicationManager.getApplication().isRestartCapable()) {
app.invokeLater(() -> ((ApplicationImpl)app).exit(true, true, true, command));
if (indicator.isShowing()) {
app.invokeLater(() -> ((ApplicationImpl)app).exit(true, true, true, command));
}
else {
String title = IdeBundle.message("update.notifications.title");
String message = IdeBundle.message("update.ready.message");
UpdateChecker.NOTIFICATIONS.createNotification(title, message, NotificationType.INFORMATION, new NotificationListener.Adapter() {
@Override
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
app.invokeLater(() -> ((ApplicationImpl)app).exit(true, true, true, command));
}
}).notify(null);
}
}
else {
showPatchInstructions(command);
@@ -988,6 +988,7 @@ update.sni.disabled.message=We wanted your IDE to receive upgrades over a secure
You can enable it again in <a href="disable">settings</a> after setting the property to 'true'.
update.apply.manually.message=Unfortunately, the IDE is not capable of an automatic update on your system.\n \
Please quit the IDE and apply the patch manually by launching this script:\n{0}.
update.ready.message=The IDE is ready for update. <a href="#">Restart</a>?
hierarchy.method.next.occurence.name=Go to next method
hierarchy.method.prev.occurence.name=Go to previous method