Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jcef message processing #2164

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ tasks {
"idea.log.limit" to "999999999",
"idea.trace.stub.index.update" to "true",
"org.digma.plugin.enable.devtools" to "true",
"kotlinx.coroutines.debug" to "",

// "idea.ProcessCanceledException" to "disabled"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public DashboardFileEditor(Project project, VirtualFile file) {

var jbCefClient = jbCefBrowser.getJBCefClient();
cefMessageRouter = CefMessageRouter.create();
cefMessageRouter.addHandler(new DashboardMessageRouterHandler(project), true);
cefMessageRouter.addHandler(new DashboardMessageRouterHandler(project, this), true);
jbCefClient.getCefClient().addMessageRouter(cefMessageRouter);

var lifeSpanHandler = new CefLifeSpanHandlerAdapter() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import org.cef.browser.*;
Expand All @@ -25,14 +26,14 @@ public class DashboardMessageRouterHandler extends BaseMessageRouterHandler {

private final Logger logger = Logger.getInstance(this.getClass());

public DashboardMessageRouterHandler(Project project) {
super(project);
public DashboardMessageRouterHandler(Project project, Disposable parentDisposable) {
super(project, parentDisposable);
}


@NotNull
@Override
public String getOriginForTroubleshootingEvent() {
public String getName() {
return "dashboard";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private JCefComponent createJcefComponent(Project project, DocumentationVirtualF
if (JBCefApp.isSupported()) {
return new JCefComponent.JCefComponentBuilder(project, "Documentation", DocumentationService.getInstance(project))
.url(DocumentationConstants.DOCUMENTATION_URL)
.addMessageRouterHandler(new DocumentationMessageRouterHandler(project))
.addMessageRouterHandler(new DocumentationMessageRouterHandler(project, this))
.schemeHandlerFactory(new DocumentationSchemeHandlerFactory(project, file))
.withDownloadAdapter(new DownloadHandlerAdapter())
.build();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.digma.intellij.plugin.documentation;

import com.fasterxml.jackson.databind.JsonNode;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.project.Project;
import org.cef.browser.CefBrowser;
import org.digma.intellij.plugin.ui.jcef.BaseMessageRouterHandler;
Expand All @@ -9,14 +10,14 @@
public class DocumentationMessageRouterHandler extends BaseMessageRouterHandler {


public DocumentationMessageRouterHandler(Project project) {
super(project);
public DocumentationMessageRouterHandler(Project project, Disposable parentDisposable) {
super(project, parentDisposable);
}


@NotNull
@Override
public String getOriginForTroubleshootingEvent() {
public String getName() {
return "documentation";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private JCefComponent createJcefComponent(Project project, JaegerUIVirtualFile f
if (JBCefApp.isSupported()) {
return new JCefComponent.JCefComponentBuilder(project, "JaegerUI", JaegerUIService.getInstance(project))
.url(JaegerUIConstants.JAEGER_UI_URL)
.addMessageRouterHandler(new JaegerUIMessageRouterHandler(project))
.addMessageRouterHandler(new JaegerUIMessageRouterHandler(project, this))
.schemeHandlerFactory(new JaegerUiSchemeHandlerFactory(project, file))
.withDownloadAdapter(new DownloadHandlerAdapter())
.build();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.digma.intellij.plugin.jaegerui;

import com.fasterxml.jackson.databind.JsonNode;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import org.cef.browser.CefBrowser;
Expand All @@ -19,14 +20,14 @@ public class JaegerUIMessageRouterHandler extends BaseMessageRouterHandler {
private final Logger logger = Logger.getInstance(JaegerUIMessageRouterHandler.class);


public JaegerUIMessageRouterHandler(Project project) {
super(project);
public JaegerUIMessageRouterHandler(Project project, Disposable parentDisposable) {
super(project, parentDisposable);
}


@NotNull
@Override
public String getOriginForTroubleshootingEvent() {
public String getName() {
return "jaegerui";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ class AssetsMessageRouterHandler(project: Project) : BaseCommonMessageRouterHand

override fun doOnQuery(project: Project, browser: CefBrowser, requestJsonNode: JsonNode, rawRequest: String, action: String): Boolean {

Log.log(logger::trace, project, "got action '$action' with message $requestJsonNode")

when (action) {

"ASSETS/GET_CATEGORIES_DATA" -> pushAssetCategories(browser, requestJsonNode)
Expand Down
Loading
Loading