🐛 修复 BUG 重命名标签页改为相同名称标签页卡死问题
This commit is contained in:
parent
a619406005
commit
12b3959d5a
@ -54,7 +54,8 @@ public class RenameFile implements EventHandler<ActionEvent> {
|
|||||||
private void handleRenameTab(CenterTab centerTab) {
|
private void handleRenameTab(CenterTab centerTab) {
|
||||||
TextField textField = new TextField(centerTab.getText());
|
TextField textField = new TextField(centerTab.getText());
|
||||||
textField.getStyleClass().add("tab-title-editable");
|
textField.getStyleClass().add("tab-title-editable");
|
||||||
|
// 临时记录标签页名称
|
||||||
|
String tempName = centerTab.getText();
|
||||||
// 清空标签页名称
|
// 清空标签页名称
|
||||||
centerTab.setText("");
|
centerTab.setText("");
|
||||||
|
|
||||||
@ -69,7 +70,7 @@ public class RenameFile implements EventHandler<ActionEvent> {
|
|||||||
showDuplicateNameAlert(newTabName);
|
showDuplicateNameAlert(newTabName);
|
||||||
|
|
||||||
// 恢复原始名称
|
// 恢复原始名称
|
||||||
centerTab.setText(centerTab.getUserData().toString());
|
centerTab.setText(tempName);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
centerTab.setText(newTabName);
|
centerTab.setText(newTabName);
|
||||||
@ -87,7 +88,7 @@ public class RenameFile implements EventHandler<ActionEvent> {
|
|||||||
// 检查是否存在相同名称的标签页
|
// 检查是否存在相同名称的标签页
|
||||||
if (isTabNameExists(newTabName)) {
|
if (isTabNameExists(newTabName)) {
|
||||||
// 恢复原始名称
|
// 恢复原始名称
|
||||||
centerTab.setText(centerTab.getUserData().toString());
|
centerTab.setText(tempName);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (Boolean.FALSE.equals(newValue)) {
|
if (Boolean.FALSE.equals(newValue)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user