fix deprecation JBCefJSQuery#create warning

GitOrigin-RevId: 2ab8a2f02a8b1734adca17e4bf5dbfa7eafbcd45
This commit is contained in:
Vladimir Kharitonov
2024-03-04 15:05:54 +01:00
committed by intellij-monorepo-bot
parent b97991b4e5
commit 6a26cd0e03
6 changed files with 9 additions and 8 deletions

View File

@@ -236,8 +236,7 @@ class JCefImageViewer(private val myFile: VirtualFile,
Disposer.register(this, myUIComponent)
Disposer.register(this, myBrowser)
@Suppress("DEPRECATION")
myViewerStateJSQuery = JBCefJSQuery.create(myBrowser)
myViewerStateJSQuery = JBCefJSQuery.create(myBrowser as JBCefBrowserBase)
myViewerStateJSQuery.addHandler { s: String ->
val oldState = myState
try {

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.util.Disposer
import com.intellij.openapi.util.Key
import com.intellij.ui.IdeBorderFactory
import com.intellij.ui.jcef.JBCefBrowser
import com.intellij.ui.jcef.JBCefBrowserBase
import com.intellij.ui.jcef.JBCefJSQuery
import com.intellij.util.ui.JBUI
import org.cef.browser.CefBrowser
@@ -362,8 +363,8 @@ fun updateOutputTextConsoleUI(consoleEditor: EditorEx, editor: Editor) {
class InlayOutputHtml(parent: Disposable, editor: Editor, clearAction: () -> Unit) : InlayOutput(parent, editor, clearAction) {
private val jbBrowser: JBCefBrowser = JBCefBrowser().also { Disposer.register(parent, it) }
private val heightJsCallback = JBCefJSQuery.create(jbBrowser)
private val saveJsCallback = JBCefJSQuery.create(jbBrowser)
private val heightJsCallback = JBCefJSQuery.create(jbBrowser as JBCefBrowserBase)
private val saveJsCallback = JBCefJSQuery.create(jbBrowser as JBCefBrowserBase)
private var height: Int = 0
init {

View File

@@ -44,7 +44,7 @@ public class IDEA232594Test {
public void test() {
JBCefBrowser browser = new JBCefBrowser("chrome:version");
JBCefJSQuery jsQuery = JBCefJSQuery.create(browser);
JBCefJSQuery jsQuery = JBCefJSQuery.create((JBCefBrowserBase)browser);
jsQuery.addHandler(result -> {
CALLBACL_COUNT.incrementAndGet();
String str = "JBCefJSQuery result: " + result;

View File

@@ -96,7 +96,7 @@ public class JBCefInputMethodTest {
SwingUtilities.invokeAndWait(() -> {
browser = new JBCefBrowser();
browser.getJBCefClient().addLoadHandler(startupWaiter, browser.myCefBrowser);
JBCefJSQuery jsQuery = JBCefJSQuery.create(browser);
JBCefJSQuery jsQuery = JBCefJSQuery.create((JBCefBrowserBase)browser);
jsQuery.addHandler(result -> {
stringWaiter.setValue(result);
System.out.println("Text changed: '" + result + "'");

View File

@@ -88,7 +88,7 @@ public class JBCefLoadHtmlTest {
}
}, browser.getCefBrowser());
JBCefJSQuery jsQuery = JBCefJSQuery.create(browser);
JBCefJSQuery jsQuery = JBCefJSQuery.create((JBCefBrowserBase)browser);
jsQuery.addHandler(result -> {
System.out.println("JS callback result: " + result);

View File

@@ -7,6 +7,7 @@ import com.intellij.ide.ui.LafManagerListener;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.ui.jcef.JBCefBrowserBase;
import com.intellij.ui.jcef.JBCefJSQuery;
import com.intellij.ui.jcef.JCEFHtmlPanel;
import com.intellij.util.ui.UIUtil;
@@ -60,7 +61,7 @@ public final class RestJcefHtmlPanel extends JCEFHtmlPanel implements RestPrevie
private static final EnumMap<Style, String> ourLoadedStylesCache = new EnumMap<>(Style.class);
private final JBCefJSQuery myJSQueryOpenInBrowser = JBCefJSQuery.create(this);
private final JBCefJSQuery myJSQueryOpenInBrowser = JBCefJSQuery.create((JBCefBrowserBase)this);
private static final @Nullable String ourJSCodeToInject;