问题描述
在 Netbeans 中,当我做出十几个破坏性大于修复的更改时,通常我会通过查看历史记录立即找到罪魁祸首,找到罪魁祸首,修复它,然后继续我的快乐之路.花费很少的时间.
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.
但我经常发现 Netbeans 显示了近 100 个更改.几乎所有这些都涉及如下两对历史记录行(每对中最先列出的旧行)之类的更改:
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>
绝大多数更改似乎只发生在 Swing 设计生成的语句上.
The vast majority of the changes seem to only occur on statements generated by Swing design.
为什么 //GEN-BEGIN:initComponents
和 //GEN-END:initComponents
被添加到我没有改变的行上?
Why do //GEN-BEGIN:initComponents
and //GEN-END:initComponents
get added onto lines I didn't change?
我做了什么导致这个?
我怎样才能避免这种情况?(除了停止使用 Swing 设计,我已经在其他项目中使用了这种设计,但这是一个较旧的项目,我有点受不了了.)
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?
我去了这里但它没有告诉how您还可以删除//GEN-FIRST 和//GEN-LAST 以使它们在 Netbeans 中可编辑."
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."
推荐答案
折叠代码根据 GUI 编辑器属性重新生成,每次构建;你描述的效果并不意外.更改特定属性,例如通过使用 Customize Code…
对话框,看看生成的代码是如何变化的.虽然源代码编辑器可以折叠生成的代码,但历史视图不能.
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.
一些缓解策略:
将 GUI 编辑器的使用限制为真正需要它的相对较少的封闭容器,如此处所示.
使用 History View
导航控件在可用更改之间移动.
Use the History View
navigation controls to move among available changes.
在 Diff Viewer
窗格的 Message
列中识别关键修订.
Identify critical revisions in the Message
column of the Diff Viewer
pane.
检查选项>团队 >历史记录设置以匹配您的工作流程.
Check Options > Team > History
settings to match your workflow.
在帮助对话框中搜索 History View
以获得更多指导.
Search for History View
in the help dialog for additional guidance.
这篇关于Netbeans 历史记录显示了 100 次更改,但我只做了一些更改.我如何避免这种情况?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!