From 1d09e9704cfb6f42c2853f4e59842532e9b62679 Mon Sep 17 00:00:00 2001 From: Lukasz Lenart Date: Sun, 5 Apr 2026 10:15:27 +0200 Subject: [PATCH] feat: disable deprecated Graph editor tab by default The Graph editor tab uses deprecated IntelliJ Platform APIs (GraphBuilder, GraphBuilderFactory) that can cause IDE freezes on newer platform versions. Gate the feature behind a JVM system property so it is hidden by default. Users who need the graph view can opt in with -Dcom.intellij.struts2.enableGraphEditor=true via Help | Edit Custom VM Options. Made-with: Cursor --- CHANGELOG.md | 1 + README.md | 14 ++++++++++++++ .../fileEditor/Struts2GraphFileEditorProvider.java | 14 ++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e22719..73c9120 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ### Changed +- Disable the deprecated Graph editor tab by default; opt in with JVM property `-Dcom.intellij.struts2.enableGraphEditor=true` - Update `platformVersion` to `2026.1` - Change since/until build to `261-261.*` (2026.1 only) - Dependencies - upgrade `org.jetbrains.intellij.platform` to `2.13.1` diff --git a/README.md b/README.md index 5f418cc..f961cc4 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,20 @@ Provides full integration of Apache Struts 2. Questions related to the usage of the plugin should be posted to the [user mailing list](https://struts.apache.org/mail.html). Any issues should be reported using JIRA and [IDEA plugin](https://issues.apache.org/jira/issues/?jql=project%20%3D%20WW%20AND%20component%20%3D%20%22IDEA%20Plugin%22) component. +## Optional features + +### Graph editor tab (disabled by default) + +The plugin includes a visual graph view for `struts.xml` configuration files. This feature uses a deprecated IntelliJ Platform API and is disabled by default because it can cause IDE freezes on newer platform versions. + +To enable it, add the following JVM property via **Help | Edit Custom VM Options**: + +``` +-Dcom.intellij.struts2.enableGraphEditor=true +``` + +Restart the IDE after adding the property. The `Graph` tab will then appear when opening `struts.xml` files that are part of a Struts file set. + ## Testing Tests are located in `src/test/java` and use IntelliJ Platform test frameworks (`LightJavaCodeInsightFixtureTestCase` and similar). Test data fixtures are in `src/test/testData`. diff --git a/src/main/java/com/intellij/struts2/graph/fileEditor/Struts2GraphFileEditorProvider.java b/src/main/java/com/intellij/struts2/graph/fileEditor/Struts2GraphFileEditorProvider.java index a45d3f0..cb68ac9 100644 --- a/src/main/java/com/intellij/struts2/graph/fileEditor/Struts2GraphFileEditorProvider.java +++ b/src/main/java/com/intellij/struts2/graph/fileEditor/Struts2GraphFileEditorProvider.java @@ -37,8 +37,22 @@ */ public class Struts2GraphFileEditorProvider extends PerspectiveFileEditorProvider { + /** + * JVM system property to opt in to the (deprecated) Graph editor tab. + * Disabled by default; enable with {@code -Dcom.intellij.struts2.enableGraphEditor=true}. + */ + static final String GRAPH_EDITOR_ENABLED_PROPERTY = "com.intellij.struts2.enableGraphEditor"; + + static boolean isGraphEditorEnabled() { + return Boolean.getBoolean(GRAPH_EDITOR_ENABLED_PROPERTY); + } + @Override public boolean accept(@NotNull final Project project, @NotNull final VirtualFile file) { + if (!isGraphEditorEnabled()) { + return false; + } + if (!file.isValid()) { return false; }