Quaternion
Quaternion

Reputation: 10458

Netbeans 8.2 can't edit persistence.xml

If I navigate to "Other Sources" -> META-INF -> persistence.xml then I get a GUI which is very annoying as it does not list my hibernate, or C3P0 properties. I just want an xml editor.

To edit the xml, currently I need to right click the file then in the pop up menu: "tools" -> "open in terminal" (which opens a terminal in the right folder and type "gedit persistence.xml").

Editing this file in this way is really annoying.

When I right click the file there are two options "open" and "edit" both result in the same GUI.

All other xml files (I even tested putting one right beside persistence.xml in case the META-INF was magical, and they all would be editable as expected).

Because I can't find others with this issue, I have a feeling it might be something local. Using Ubuntu 17.04.

This is what my UI looks like: enter image description here

I also right-clicked the persistence.xml file to show the dialog options but none of them open the file in a way the xml can be edited, they either open design view, history does actually show the history...

Upvotes: 0

Views: 825

Answers (2)

I have just solve this issue, here drop you the solutions, it works for me.

go to: view>show editor toolbar, if non selected then select them and ready, right now i solved it.XD

Upvotes: 0

skomisa
skomisa

Reputation: 17353

Is the "GUI" you see when you Open or Edit the file persistence.xml similar to this?...

designView

If so, then the file is (incorrectly) being opened by NetBeans in Design view, and all you need to do is click the Source tab (to the immediate right of the Design tab) to be able to edit the raw XML:

sourceView

As you pointed out, this problem does not impact all XML files; it seems to be only persistence.xml which opens in Design view. That's a bug, and I have raised a bug report with NetBeans:

https://netbeans.org/bugzilla/show_bug.cgi?id=271695

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Updated based on feedback from the OP:

  • Other NetBeans users have reported a problem similar to that in the OP, where they only see the History view, but not the Source view. Presumably that was for non-XML files, so the Design view was not relevant.

  • The solution that worked for them was to delete their User directory.

  • The name of that directory is shown by selecting About from the Help menu in NetBeans.

  • Close NetBeans before deleting the directory. It will be automatically recreated when NetBeans is restarted.

  • See the following for full details:

https://forums.netbeans.org/topic59936.html

https://netbeans.org/bugzilla/show_bug.cgi?id=252111

http://wiki.netbeans.org/FaqWhatIsUserdir

Upvotes: 1

Related Questions