Skip to content

Commit 499f960

Browse files
committed
show jcef workaround message
(cherry picked from commit c41b170) # Conflicts: # src/main/java/org/digma/intellij/plugin/toolwindow/DigmaSidePaneToolWindowFactory.java # src/main/kotlin/org/digma/intellij/plugin/ui/common/JcefRemoteUtils.kt
1 parent e2aa8a5 commit 499f960

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,46 @@ fun sendPosthogEvent(appName:String) {
3939

4040
}
4141

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

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)