Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.3k views
in Technique[技术] by (71.8m points)

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

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."

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...