feat: 添加实例列表右键编辑功能 (#6000)#6038
Conversation
NWMA-FYWF
commented
May 2, 2026
- 实例列表项支持右键编辑
- 编辑页面名称唯一性验证排除自身
- 路径变化后不再自动修改名称
- 实例列表项支持右键编辑 - 编辑页面名称唯一性验证排除自身 - 路径变化后不再自动修改名称
Glavo
left a comment
There was a problem hiding this comment.
本审查建议由 GPT-5 生成
已将具体审查建议标注在对应代码行。
- 编辑时使用 profile.getName() 而非 getProfileDisplayName(),避免保留名称被翻译后保存 - locationChangeListener 只在新建设置时注册,编辑时禁用,避免路径变化自动重命名实例
相关问题已在 提交 9cf13c7 中解决 |
- 使用 WeakListenerHolder + FXUtils.onWeakChange() 替代直接注册监听器 - 避免 ProfileListItem 与 Profile 之间形成强引用循环导致无法被 GC 回收
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a context menu for profile list items and improves the profile editing page. Key changes include adding weak listeners to ProfileListItem for reactive UI updates, implementing the ProfileListPopupMenu class, and refining validation logic and listener lifecycle management in ProfilePage. Feedback suggests refactoring ProfileListPopupMenu into a utility class to eliminate redundant inheritance and using FXUtils to dynamically calculate popup positions to prevent the menu from being cut off by screen edges.
| import static org.jackhuang.hmcl.util.i18n.I18n.i18n; | ||
|
|
||
| /// Popup menu for ProfileListItem. | ||
| public final class ProfileListPopupMenu extends StackPane { |
There was a problem hiding this comment.
我完全没理解这个 ProfileListPopupMenu 类是干什么的,为什么不是定义一个辅助方法,而是要这样一个继承 StackPane 的类并且完全没用上。
| i18n("button.edit"), | ||
| () -> Controllers.navigate(new ProfilePage(profile)), | ||
| popup)); | ||
| popup.show(owner, JFXPopup.PopupVPosition.BOTTOM, JFXPopup.PopupHPosition.LEFT, 0, 0); |
