👔 完善标签页右键菜单

This commit is contained in:
gewuyou 2023-10-08 22:12:25 +08:00
parent 0e3b7dcaab
commit e58ab2e3dc

View File

@ -92,7 +92,7 @@ public class CenterTabPaneManager {
if (lastModifiedTimeOfFile.equals(lastModifiedTime)) { if (lastModifiedTimeOfFile.equals(lastModifiedTime)) {
return; return;
} }
//fixme 这行代码不能直接放到绑定的方法中,猜测匿名内部类的延迟执行特性可能会导致在获取 FileUtil.getFileText(file) 的返回值时文件内容还没有被正确读取导致空串暂无解决办法 // 这行代码不能直接放到绑定的方法中,猜测匿名内部类的延迟执行特性可能会导致在获取 FileUtil.getFileText(file) 的返回值时文件内容还没有被正确读取导致空串暂无解决办法
String fileText = FileUtil.getFileText(file); String fileText = FileUtil.getFileText(file);
// 当前文件已被外部修改 // 当前文件已被外部修改
PopUpUtil.questionAlert( PopUpUtil.questionAlert(
@ -240,6 +240,23 @@ public class CenterTabPaneManager {
* 判断是否有左侧标签页 * 判断是否有左侧标签页
* *
* @param centerTab 标签页 * @param centerTab 标签页
* @apiNote 由于不知道怎么监听固定状态因此还是使用简单的判断如果能够监听固定状态时可以把代码修改为
* <blockquote><pre>
* public boolean hasLeftTabs(CenterTab centerTab) {
* ObservableList<Tab> tabs = centerTabPane.getTabs();
* int edge = tabs.indexOf(centerTab);
* if (edge == 0) {
* return false;
* }
* for (int i = 0; i < edge; i++) {
* CenterTab tab = (CenterTab) tabs.get(i);
* if (!tab.isFixed()) {
* return true;
* }
* }
* return false;
* }
* <blockquote><pre>
* @return 是否有左侧标签页 * @return 是否有左侧标签页
*/ */
public boolean hasLeftTabs(CenterTab centerTab) { public boolean hasLeftTabs(CenterTab centerTab) {
@ -252,6 +269,19 @@ public class CenterTabPaneManager {
* *
* @param centerTab 标签页 * @param centerTab 标签页
* @return 是否有右侧标签页 * @return 是否有右侧标签页
* @apiNote 由于不知道怎么监听固定状态因此还是使用简单的判断如果能够监听固定状态时可以把代码修改为
* <blockquote><pre>
* public boolean hasRightTabs(CenterTab centerTab) {
* ObservableList<Tab> tabs = centerTabPane.getTabs();
* for (int i = tabs.indexOf(centerTab); i < tabs.size(); i++) {
* CenterTab tab = (CenterTab) tabs.get(i);
* if (!tab.isFixed()) {
* return true;
* }
* }
* return false;
* }
* </pre></blockquote>
*/ */
public boolean hasRightTabs(CenterTab centerTab) { public boolean hasRightTabs(CenterTab centerTab) {
ObservableList<Tab> tabs = centerTabPane.getTabs(); ObservableList<Tab> tabs = centerTabPane.getTabs();