mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[terminal] IJPL-249368 Do not abort application termination if user canceled terminal processes check
This exception actually prevented the application closing - let's catch it and interpret as "do not perform any checks and proceed to project closing". Also, let's give this progress a meaningful title since there are reports that users cancel it (and they actually see it). (cherry picked from commit 72b1d5d5f70be839c5aa463a02028f9883b20ff2) IJ-CR-212635 GitOrigin-RevId: 709be7b5bcbf66e6395d7bd4a2951af284536561
This commit is contained in:
committed by
intellij-monorepo-bot
parent
21268dbbc7
commit
a7c7ae0081
+16
-2
@@ -8,6 +8,7 @@ import com.intellij.openapi.application.ApplicationListener
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.components.serviceIfCreated
|
||||
import com.intellij.openapi.extensions.ExtensionNotApplicableException
|
||||
import com.intellij.openapi.progress.ProgressManager
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.project.ProjectManager
|
||||
import com.intellij.openapi.project.VetoableProjectManagerListener
|
||||
@@ -19,12 +20,14 @@ import com.intellij.terminal.frontend.toolwindow.TerminalToolWindowTabsManager
|
||||
import com.intellij.terminal.frontend.view.TerminalView
|
||||
import com.intellij.terminal.ui.TerminalWidget
|
||||
import com.intellij.util.asDisposable
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Deferred
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.awaitAll
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import org.jetbrains.plugins.terminal.TerminalBundle
|
||||
import org.jetbrains.plugins.terminal.TerminalToolWindowManager
|
||||
import java.time.LocalDateTime
|
||||
|
||||
@@ -78,9 +81,20 @@ internal object TerminalProcessesClosingNotifier : VetoableProjectManagerListene
|
||||
return true
|
||||
}
|
||||
|
||||
val tabTitlesToConfirm = runWithModalProgressBlocking(project, "") {
|
||||
collectTabTitlesToConfirm(reworkedViews, classicWidgets)
|
||||
val tabTitlesToConfirm = try {
|
||||
runWithModalProgressBlocking(project, TerminalBundle.message("checking.running.terminal.processes.progress")) {
|
||||
collectTabTitlesToConfirm(reworkedViews, classicWidgets)
|
||||
}
|
||||
}
|
||||
catch (_: CancellationException) {
|
||||
ProgressManager.checkCanceled()
|
||||
// User pressed "cancel" in the progress dialog.
|
||||
// Since the user's intention is to close the project,
|
||||
// consider that the user wants to skip any additional checks and finally close the project.
|
||||
project.putUserData(PROCESSES_TERMINATION_CONFIRMED_TIME_KEY, LocalDateTime.now())
|
||||
return true
|
||||
}
|
||||
|
||||
if (tabTitlesToConfirm.isEmpty()) {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -187,6 +187,7 @@ progress.text.running.terminal=Running the terminal\u2026
|
||||
session.terminated.text=Session completed
|
||||
see.ide.log.error.description=See IDE log (Help | {0}) for the details.
|
||||
local.environment.name=Host
|
||||
checking.running.terminal.processes.progress=Checking Running Terminal Processes
|
||||
closing.terminal.processes.progress=Closing Terminal Processes
|
||||
|
||||
group.advanced.settings.terminal=Terminal
|
||||
|
||||
Reference in New Issue
Block a user