Netbeans history shows 100 changes but I made only a few. How do I avoid this?

柔情痞子 提交于 2019-11-28 11:29:34

问题


In Netbeans when I make a dozen changes that break more than they fix, usually I find the culprit right away by looking at the history, find the culprit, fix it, and go on my merry way. Takes very little time.

But often I find that Netbeans shows nearly 100 changes. Almost all of them involve changes like the two pairs of history lines below (older line listed first in each pair):

// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
// <editor-fold defaultstate="collapsed" desc="Generated Code">                          


// </editor-fold>//GEN-END:initComponents
// </editor-fold>            

The vast majority of the changes seem to only occur on statements generated by Swing design.

Why do //GEN-BEGIN:initComponents and //GEN-END:initComponents get added onto lines I didn't change?

What did I do to cause this?

How can I avoid this? (Other than quit using Swing design, which I already have in other projects, but this is an older project that I'm sort of stuck with.)

What can I do to fix it so I can just see the lines I changed?

I went here but it doesn't tell how "You can also remove the //GEN-FIRST and //GEN-LAST to make them editable in Netbeans."


回答1:


The folded code is regenerated, based on GUI editor properties, each time you build; the effect you describe is not unexpected. Alter a specific property, e.g. by using the Customize Code… dialog, and see how the generated code changes. While the source code editor can collapse generated code, the history views cannot.

Some mitigation strategies:

  • Limit use of the GUI editor to the relatively small number of enclosing containers that really need it, as shown here.

  • Use the History View navigation controls to move among available changes.

  • Identify critical revisions in the Message column of the Diff Viewer pane.

  • Check Options > Team > History settings to match your workflow.

  • Search for History View in the help dialog for additional guidance.



来源:https://stackoverflow.com/questions/25817867/netbeans-history-shows-100-changes-but-i-made-only-a-few-how-do-i-avoid-this

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!