diff --git a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java index af3aa527525c..ab72edb20b6b 100644 --- a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java @@ -776,7 +776,7 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App exitCode = Restarter.scheduleRestart(beforeRestart); } catch (IOException e) { - LOG.warn("Cannot restart", e); + LOG.error("Cannot restart", e); } } System.exit(exitCode); diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateInfoDialog.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateInfoDialog.java index ffff7c93c374..0a1752574f86 100644 --- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateInfoDialog.java +++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateInfoDialog.java @@ -31,12 +31,15 @@ import com.intellij.openapi.application.impl.ApplicationImpl; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.Task; +import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.Pair; +import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.ui.BrowserHyperlinkListener; import com.intellij.ui.JBColor; import com.intellij.ui.LicensingFacade; import com.intellij.ui.components.JBLabel; +import com.intellij.util.SystemProperties; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.text.DateFormatUtil; import org.apache.http.client.utils.URIBuilder; @@ -52,6 +55,8 @@ import java.net.URISyntaxException; import java.util.Collection; import java.util.Date; import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; import static com.intellij.openapi.util.Pair.pair; @@ -130,8 +135,9 @@ class UpdateInfoDialog extends AbstractUpdateDialog { protected Action[] createActions() { List actions = ContainerUtil.newArrayList(); - if (myPatch != null && ApplicationManager.getApplication().isRestartCapable()) { - actions.add(new AbstractAction(IdeBundle.message("updates.download.and.restart.button")) { + if (myPatch != null) { + boolean canRestart = ApplicationManager.getApplication().isRestartCapable(); + actions.add(new AbstractAction(IdeBundle.message(canRestart ? "updates.download.and.restart.button" : "updates.apply.manually.button")) { { setEnabled(!myWriteProtected); } @@ -213,7 +219,12 @@ class UpdateInfoDialog extends AbstractUpdateDialog { } ApplicationEx app = ApplicationManagerEx.getApplicationEx(); - app.invokeLater(() -> ((ApplicationImpl)app).exit(false, true, true, command)); + if (ApplicationManager.getApplication().isRestartCapable()) { + app.invokeLater(() -> ((ApplicationImpl)app).exit(false, true, true, command)); + } + else { + showPatchInstructions(command); + } } }.queue(); } @@ -224,6 +235,23 @@ class UpdateInfoDialog extends AbstractUpdateDialog { BrowserUtil.browse(augmentUrl(url)); } + private static void showPatchInstructions(String[] command) { + String product = ApplicationNamesInfo.getInstance().getLowercaseProductName(); + String version = ApplicationInfo.getInstance().getFullVersion(); + File file = new File(SystemProperties.getUserHome(), product + "-" + version + "-patch.txt"); + try { + String text = Stream.of(command).map(s -> s.indexOf(' ') > 0 ? '"' + s + '"' : s).collect(Collectors.joining(" ")); + FileUtil.writeToFile(file, text); + } + catch (Exception e) { + Logger.getInstance(UpdateInstaller.class).error(e); + return; + } + + String title = IdeBundle.message("update.notifications.title"), message = IdeBundle.message("update.apply.manually.message", file); + ApplicationManager.getApplication().invokeLater(() -> Messages.showInfoMessage(message, title)); + } + private static class ButtonAction extends AbstractAction { private final String myUrl; diff --git a/platform/platform-resources-en/src/messages/IdeBundle.properties b/platform/platform-resources-en/src/messages/IdeBundle.properties index 5558ecd3a65d..7dc329625b60 100644 --- a/platform/platform-resources-en/src/messages/IdeBundle.properties +++ b/platform/platform-resources-en/src/messages/IdeBundle.properties @@ -929,6 +929,7 @@ updates.plugins.ready.header=Plugins from configured hosts are ready to updates.configure.label=To configure automatic update settings, see the Updates dialog of your IDE {0}. updates.incompatible.plugins.found={0,choice,1#Plugin|2#Plugins} incompatible with the new build found:{0,choice,1#' '|2#'
'} {1} updates.download.and.restart.button=Up&date and Restart +updates.apply.manually.button=Up&date Manually updates.more.info.button=&More Info... updates.ignore.update.button=&Ignore This Update updates.remind.later.button=&Remind Me Later @@ -966,6 +967,8 @@ update.sni.disabled.error=Secure connection is impossible with 'jsse.enableSNIEx update.sni.disabled.message=We wanted your IDE to receive upgrades over a secure connection. \ Unfortunately, this doesn't work with the 'jsse.enableSNIExtension' property set to 'false', so the option was disabled. \ You can enable it again in settings 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 invoking a command from this file:\n{0}. hierarchy.method.next.occurence.name=Go to next method hierarchy.method.prev.occurence.name=Go to previous method