Skip to content

Commit b925c1f

Browse files
authored
Merge pull request #2705 from digma-ai/jcef-workaround
show jcef workaround message
2 parents e2aa8a5 + 0a67ece commit b925c1f

File tree

3 files changed

+74
-1
lines changed

3 files changed

+74
-1
lines changed

src/main/java/org/digma/intellij/plugin/toolwindow/DigmaSidePaneToolWindowFactory.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.util.Collections;
2727
import java.util.function.*;
2828

29+
import static org.digma.intellij.plugin.ui.common.JcefRemoteUtilsKt.*;
2930
import static org.digma.intellij.plugin.ui.common.MainToolWindowPanelKt.createMainToolWindowPanel;
3031

3132

@@ -49,6 +50,20 @@ public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindo
4950

5051
Log.log(LOGGER::info, project, "creating main tool window for project {}", project);
5152

53+
//patch for jcef issue:
54+
//https://github.com/digma-ai/digma-intellij-plugin/issues/2668
55+
//https://github.com/digma-ai/digma-intellij-plugin/issues/2669
56+
//https://youtrack.jetbrains.com/issue/IDEA-367610/jcef-initialization-crash-in-latest-2025.1-EAP-NullPointerException-Cannot-read-field-jsQueryFunction-because-config-is-null
57+
if (is2025EAPWithJCEFRemoteEnabled()){
58+
Log.log(LOGGER::info, project, "Jcef remote enabled for EAP , creating user message panel", project);
59+
sendPosthogEvent("Main");
60+
var messagePanel = create2025EAPMessagePanel(project);
61+
var content = ContentFactory.getInstance().createContent(messagePanel, null, false);
62+
toolWindow.getContentManager().addContent(content);
63+
return;
64+
}
65+
66+
5267
//initialize AnalyticsService early so the UI can detect the connection status when created
5368
AnalyticsService.getInstance(project);
5469
//initialize BackendInfoHolder early so it will populate its info soon

src/main/kotlin/org/digma/intellij/plugin/ui/common/JcefRemoteUtils.kt

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import javax.swing.JPanel
1515

1616

1717
fun is2025EAPWithJCEFRemoteEnabled(): Boolean {
18-
1918
return if (ApplicationInfo.getInstance().build.baselineVersion == 251){
2019
//just touch it so it will initialize static variables
2120
val isJcefSupported = JBCefApp.isSupported()
@@ -39,3 +38,46 @@ fun sendPosthogEvent(appName:String) {
3938

4039
}
4140

41+
42+
fun create2025EAPMessagePanel(project:Project): JPanel {
43+
44+
val mainPanel = JPanel(BorderLayout())
45+
mainPanel.isOpaque = false
46+
mainPanel.border = empty()
47+
mainPanel.background = listBackground()
48+
49+
val htmlText = getMessageHtml()
50+
val textPane = createTextPaneWithHtml(htmlText)
51+
52+
mainPanel.add(textPane, BorderLayout.CENTER)
53+
54+
val slackPanel = createSlackLinkPanel(project)
55+
mainPanel.add(slackPanel,BorderLayout.SOUTH)
56+
57+
return wrapWithScrollable(mainPanel)
58+
}
59+
60+
61+
fun getMessageHtml(): String {
62+
63+
val title = "Digma 2025.* workaround"
64+
val paragraph = "The latest Jetbrains 2025.* has an issue with JCEF that prevents Digma from working," +
65+
"Please add the following system properties to fix, and restart your IDE:"
66+
val paragraph2 = "Open the Idea help menu, search for 'Edit Custom Properties', add 'jcef.remote.enabled=false' and restart your IDE"
67+
68+
return "<html>" +
69+
"<head>" +
70+
"<style>" +
71+
"h3 {text-align: center;}" +
72+
"p {text-align: center;}" +
73+
"div {text-align: center;}" +
74+
"</style>" +
75+
"</head>" +
76+
"<body>" +
77+
"<h3>$title</h3>" +
78+
"<p>$paragraph</p>" +
79+
"<p>$paragraph2</p>" +
80+
"</body>" +
81+
"</html>"
82+
}
83+

src/main/kotlin/org/digma/intellij/plugin/ui/recentactivity/RecentActivityToolWindowFactory.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import org.digma.intellij.plugin.analytics.AnalyticsService
1212
import org.digma.intellij.plugin.log.Log
1313
import org.digma.intellij.plugin.recentactivity.RecentActivityToolWindowShower
1414
import org.digma.intellij.plugin.ui.RecentActivityToolWindowCardsController
15+
import org.digma.intellij.plugin.ui.common.create2025EAPMessagePanel
16+
import org.digma.intellij.plugin.ui.common.is2025EAPWithJCEFRemoteEnabled
17+
import org.digma.intellij.plugin.ui.common.sendPosthogEvent
1518
import org.digma.intellij.plugin.ui.common.statuspanels.createAggressiveUpdatePanel
1619
import org.digma.intellij.plugin.ui.common.statuspanels.createNoConnectionPanel
1720
import java.awt.CardLayout
@@ -25,6 +28,19 @@ class RecentActivityToolWindowFactory : ToolWindowFactory {
2528

2629
Log.log(logger::info, project, "creating recent activity tool window for project {}", project)
2730

31+
//patch for jcef issue:
32+
//https://github.com/digma-ai/digma-intellij-plugin/issues/2668
33+
//https://github.com/digma-ai/digma-intellij-plugin/issues/2669
34+
//https://youtrack.jetbrains.com/issue/IDEA-367610/jcef-initialization-crash-in-latest-2025.1-EAP-NullPointerException-Cannot-read-field-jsQueryFunction-because-config-is-null
35+
if (is2025EAPWithJCEFRemoteEnabled()){
36+
Log.log(logger::info, project, "Jcef remote enabled for EAP , creating user message panel", project)
37+
sendPosthogEvent("Recent Activity")
38+
val messagePanel = create2025EAPMessagePanel(project)
39+
val content = ContentFactory.getInstance().createContent(messagePanel, null, false)
40+
toolWindow.contentManager.addContent(content)
41+
return
42+
}
43+
2844
//initialize AnalyticsService early so the UI can detect the connection status when created
2945
AnalyticsService.getInstance(project)
3046

0 commit comments

Comments
 (0)