From 78c3efe60870e1f9c8d1c9b055fa566ee56eb576 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Tue, 13 Oct 2026 22:21:41 +0200 Subject: [PATCH] Fixed more maven related editor kits on JDK 27 this should cover all editor kits of the maven modules kits are no longer injected and can't be set via Strings (apache#9523) --- .../modules/maven/grammar/BasicPomMD.java | 32 +++++++++---------- .../maven/grammar/ShowEffPomDiffPanel.java | 3 +- .../configurations/NewConfigurationPanel.form | 4 ++- .../configurations/NewConfigurationPanel.java | 3 +- .../maven/customizer/ActionMappings.form | 4 ++- .../maven/customizer/ActionMappings.java | 3 +- .../maven/execute/ui/RunGoalsPanel.form | 4 ++- .../maven/execute/ui/RunGoalsPanel.java | 3 +- 8 files changed, 33 insertions(+), 23 deletions(-) diff --git a/java/maven.grammar/src/org/netbeans/modules/maven/grammar/BasicPomMD.java b/java/maven.grammar/src/org/netbeans/modules/maven/grammar/BasicPomMD.java index 447609f34eb3..7a2bd4fa2156 100644 --- a/java/maven.grammar/src/org/netbeans/modules/maven/grammar/BasicPomMD.java +++ b/java/maven.grammar/src/org/netbeans/modules/maven/grammar/BasicPomMD.java @@ -43,7 +43,6 @@ import org.netbeans.core.spi.multiview.MultiViewDescription; import org.netbeans.core.spi.multiview.MultiViewElement; import org.netbeans.core.spi.multiview.MultiViewElementCallback; -import static org.netbeans.modules.maven.grammar.Bundle.*; import org.netbeans.modules.maven.indexer.api.NBVersionInfo; import org.netbeans.modules.maven.indexer.api.RepositoryUtil; import org.netbeans.modules.maven.indexer.spi.ui.ArtifactViewerPanelProvider; @@ -51,6 +50,7 @@ import org.openide.awt.UndoRedo; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; +import org.openide.text.CloneableEditorSupport; import org.openide.util.HelpCtx; import org.openide.util.ImageUtilities; import org.openide.util.Lookup; @@ -59,6 +59,8 @@ import org.openide.util.lookup.ServiceProvider; import org.openide.windows.TopComponent; +import static org.netbeans.modules.maven.grammar.Bundle.*; + public class BasicPomMD implements MultiViewDescription, Serializable { private static final RequestProcessor RP = new RequestProcessor(BasicPomMD.class); @@ -202,23 +204,21 @@ private static class POMView implements MultiViewElement, Runnable { throw new FileNotFoundException(pom.getAbsolutePath()); } final String text = FileEncodingQuery.getEncoding(pomFO).decode(ByteBuffer.wrap(pomFO.asBytes())).toString(); - EventQueue.invokeLater(new Runnable() { - @Override public void run() { - JEditorPane pane = new JEditorPane("text/xml", text); - pane.setEditable(false); - pane.setCaretPosition(0); - panel.removeAll(); - panel.add(new JScrollPane(pane), BorderLayout.CENTER); - panel.revalidate(); - } + EventQueue.invokeLater(() -> { + JEditorPane pane = new JEditorPane(); + pane.setEditorKit(CloneableEditorSupport.getEditorKit("text/xml")); + pane.setText(text); + pane.setEditable(false); + pane.setCaretPosition(0); + panel.removeAll(); + panel.add(new JScrollPane(pane), BorderLayout.CENTER); + panel.revalidate(); }); } catch (final Exception x) { - EventQueue.invokeLater(new Runnable() { - @Override public void run() { - panel.removeAll(); - panel.add(new JLabel(LBL_failed_to_load(x.getLocalizedMessage()), SwingConstants.CENTER), BorderLayout.CENTER); - panel.revalidate(); - } + EventQueue.invokeLater(() -> { + panel.removeAll(); + panel.add(new JLabel(LBL_failed_to_load(x.getLocalizedMessage()), SwingConstants.CENTER), BorderLayout.CENTER); + panel.revalidate(); }); } } diff --git a/java/maven.grammar/src/org/netbeans/modules/maven/grammar/ShowEffPomDiffPanel.java b/java/maven.grammar/src/org/netbeans/modules/maven/grammar/ShowEffPomDiffPanel.java index d3c22abb73f1..487a59b943f3 100644 --- a/java/maven.grammar/src/org/netbeans/modules/maven/grammar/ShowEffPomDiffPanel.java +++ b/java/maven.grammar/src/org/netbeans/modules/maven/grammar/ShowEffPomDiffPanel.java @@ -32,6 +32,7 @@ import org.netbeans.modules.maven.spi.customizer.TextToValueConversions; import org.netbeans.spi.project.ProjectConfiguration; import org.netbeans.spi.project.ProjectConfigurationProvider; +import org.openide.text.CloneableEditorSupport; /** * @@ -56,7 +57,7 @@ public Component getListCellRendererComponent(JList list, Object value, int inde }); comConfiguration.setSelectedItem(configs.getActiveConfiguration()); enableFields(); - epProperties.setContentType("text/x-properties"); + epProperties.setEditorKit(CloneableEditorSupport.getEditorKit("text/x-properties")); } MavenConfiguration getSelectedConfig() { diff --git a/java/maven/src/org/netbeans/modules/maven/configurations/NewConfigurationPanel.form b/java/maven/src/org/netbeans/modules/maven/configurations/NewConfigurationPanel.form index 3091fc9b9216..2f33450ebc2b 100644 --- a/java/maven/src/org/netbeans/modules/maven/configurations/NewConfigurationPanel.form +++ b/java/maven/src/org/netbeans/modules/maven/configurations/NewConfigurationPanel.form @@ -178,7 +178,9 @@ - + + + diff --git a/java/maven/src/org/netbeans/modules/maven/configurations/NewConfigurationPanel.java b/java/maven/src/org/netbeans/modules/maven/configurations/NewConfigurationPanel.java index 09428e155fc7..2bc811732b53 100644 --- a/java/maven/src/org/netbeans/modules/maven/configurations/NewConfigurationPanel.java +++ b/java/maven/src/org/netbeans/modules/maven/configurations/NewConfigurationPanel.java @@ -24,6 +24,7 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import org.openide.DialogDescriptor; +import org.openide.text.CloneableEditorSupport; /** * @@ -137,7 +138,7 @@ private void initComponents() { lblProperties.setLabelFor(epProperties); org.openide.awt.Mnemonics.setLocalizedText(lblProperties, org.openide.util.NbBundle.getMessage(NewConfigurationPanel.class, "NewConfigurationPanel.lblProperties.text")); // NOI18N - epProperties.setContentType("text/x-properties"); // NOI18N + epProperties.setEditorKit(CloneableEditorSupport.getEditorKit("text/x-properties")); jScrollPane1.setViewportView(epProperties); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); diff --git a/java/maven/src/org/netbeans/modules/maven/customizer/ActionMappings.form b/java/maven/src/org/netbeans/modules/maven/customizer/ActionMappings.form index 47bcf471408f..1704c8a132c9 100644 --- a/java/maven/src/org/netbeans/modules/maven/customizer/ActionMappings.form +++ b/java/maven/src/org/netbeans/modules/maven/customizer/ActionMappings.form @@ -310,7 +310,9 @@ - + + + diff --git a/java/maven/src/org/netbeans/modules/maven/customizer/ActionMappings.java b/java/maven/src/org/netbeans/modules/maven/customizer/ActionMappings.java index 6359a3e4b80c..100af9fd074b 100644 --- a/java/maven/src/org/netbeans/modules/maven/customizer/ActionMappings.java +++ b/java/maven/src/org/netbeans/modules/maven/customizer/ActionMappings.java @@ -89,6 +89,7 @@ import org.openide.awt.Mnemonics; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; +import org.openide.text.CloneableEditorSupport; import org.openide.util.Exceptions; import org.openide.util.HelpCtx; import org.openide.util.ImageUtilities; @@ -508,7 +509,7 @@ private void initComponents() { add(cbBuildWithDeps, gridBagConstraints); cbBuildWithDeps.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(ActionMappings.class, "ActionMappings.cbBuildWithDeps.AccessibleContext.accessibleDescription")); // NOI18N - epProperties.setContentType("text/x-properties"); // NOI18N + epProperties.setEditorKit(CloneableEditorSupport.getEditorKit("text/x-properties")); jScrollPane5.setViewportView(epProperties); gridBagConstraints = new java.awt.GridBagConstraints(); diff --git a/java/maven/src/org/netbeans/modules/maven/execute/ui/RunGoalsPanel.form b/java/maven/src/org/netbeans/modules/maven/execute/ui/RunGoalsPanel.form index 2e0ec8bd94d6..942db3b3cc81 100644 --- a/java/maven/src/org/netbeans/modules/maven/execute/ui/RunGoalsPanel.form +++ b/java/maven/src/org/netbeans/modules/maven/execute/ui/RunGoalsPanel.form @@ -289,7 +289,9 @@ - + + + diff --git a/java/maven/src/org/netbeans/modules/maven/execute/ui/RunGoalsPanel.java b/java/maven/src/org/netbeans/modules/maven/execute/ui/RunGoalsPanel.java index 5feeb97800b4..66b27582f316 100644 --- a/java/maven/src/org/netbeans/modules/maven/execute/ui/RunGoalsPanel.java +++ b/java/maven/src/org/netbeans/modules/maven/execute/ui/RunGoalsPanel.java @@ -37,6 +37,7 @@ import org.netbeans.modules.maven.execute.model.ActionToGoalMapping; import org.netbeans.modules.maven.execute.model.NetbeansActionMapping; import org.netbeans.modules.maven.spi.grammar.GoalsProvider; +import org.openide.text.CloneableEditorSupport; import org.openide.util.ImageUtilities; import org.openide.util.Lookup; import org.openide.util.RequestProcessor; @@ -288,7 +289,7 @@ private void initComponents() { org.openide.awt.Mnemonics.setLocalizedText(btnAddProps, "&Add >"); btnAddProps.addActionListener(this::btnAddPropsActionPerformed); - epProperties.setContentType("text/x-properties"); // NOI18N + epProperties.setEditorKit(CloneableEditorSupport.getEditorKit("text/x-properties")); jScrollPane2.setViewportView(epProperties); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);