apache / apache/netbeans

Copy & paste options are disabled when editing XML files that use the "Object/relational mapping file schema"

Open
#4,913 5 comments 0 reactions 0 assignees View on GitHub
kind:bug needs:triage
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 15

### What happened

When you edit an XML file that uses the *Object/relational mapping file schema* (specifically, those that use the namespace `http://xmlns.jcp.org/xml/ns/persistence/orm`), the options *Cut*, *Copy* and *Paste* get disabled. This occurs in both the toolbar and also in the context menu of the editor.

Copying and pasting using the keyboard still works fine. However, sometimes, when you're using your mouse than your keyboard, it's more practical to do it using the GUI.

### How to reproduce

I've been experiencing this error at least since version 8.2, I believe. I hadn't informed about it because it has been hard to reproduce. But today I've spent time investigating the cause and I think I've found the way:

1. In a Java project based on Maven, create an XML file. For example, in `src/main/resources/META-INF/`.

2. Write this code:

```xml

```

3. Right-click on the editor and view that the options *Cut*, *Copy* and *Paste* are enabled in the context menu:

![image](https://user-images.githubusercontent.com/2098654/199925945-e629659e-118d-4fe0-a4cd-44de698a5b28.png)

4. Close the file (**very important**) and then, close NetBeans IDE. Not closing the file was the reason why I could never reproduce this error.

5. Run NetBeans IDE and open the file again. Then, right-click on the editor and open the context menu, and view that the mentioned options are disabled now:

![image](https://user-images.githubusercontent.com/2098654/199926034-63f98d0f-5593-44b9-a30f-7268269589e8.png)

6. The same happens with the toolbar. See:

![image](https://user-images.githubusercontent.com/2098654/199926627-32c982ff-fbc6-4228-910e-ebd900da4370.png)

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

Debian GNU/Linux 11.5 (Bullseye)

### JDK

OpenJDK Runtime Environment (build 17.0.4+8-Debian-1deb11u1)

### Apache NetBeans packaging

Apache NetBeans binary zip

### Anything else

I've tested this in versions 13, 14 and 15. But I believe that this *bug* dates back from version 8.2 days.

### Are you willing to submit a pull request?

No

### Code of Conduct

Yes

Contributor guide

Open the contributing guide

Research direction

No source file or test is identified in the issue. First reproduce the problem in the NetBeans XML editor using the persistence ORM namespace and the close/restart sequence; trace the editor's action enablement for the Cut, Copy, and Paste toolbar and context-menu actions. Done means those GUI actions remain enabled after reopening the file while keyboard shortcuts continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, xml
Domain
desktop, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.