[platform] TestDialogManager.setTestDialog with disposable argument

GitOrigin-RevId: 3f0ce6adc31aa7f4cd160c8d0cd299b0e64d0c27
This commit is contained in:
Tagir Valeev
2024-10-11 08:10:27 +00:00
committed by intellij-monorepo-bot
parent f4531f9795
commit ce73510eb1
2 changed files with 10 additions and 0 deletions
@@ -4447,6 +4447,7 @@ f:com.intellij.openapi.ui.TestDialogManager
- s:getTestImplementation():com.intellij.openapi.ui.TestDialog
- s:getTestInputImplementation():com.intellij.openapi.ui.TestInputDialog
- s:setTestDialog(com.intellij.openapi.ui.TestDialog):com.intellij.openapi.ui.TestDialog
- s:setTestDialog(com.intellij.openapi.ui.TestDialog,com.intellij.openapi.Disposable):com.intellij.openapi.ui.TestDialog
- s:setTestInputDialog(com.intellij.openapi.ui.TestInputDialog):com.intellij.openapi.ui.TestInputDialog
com.intellij.openapi.ui.TestInputDialog
- sf:DEFAULT:com.intellij.openapi.ui.TestInputDialog
@@ -1,9 +1,11 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.ui;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Disposer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
@@ -20,6 +22,13 @@ public final class TestDialogManager {
return oldValue;
}
@TestOnly
public static TestDialog setTestDialog(@Nullable TestDialog newValue, @NotNull Disposable disposable) {
TestDialog oldValue = setTestDialog(newValue);
Disposer.register(disposable, () -> implementation = oldValue);
return oldValue;
}
public static @NotNull TestDialog getTestImplementation() {
TestDialog result = implementation;
return result == null ? TestDialog.DEFAULT : result;