♻️ 重构代码 移除Ui单例于Ui工具类
This commit is contained in:
parent
2ffefb6c7b
commit
29c3a59b34
@ -23,11 +23,6 @@ module org.jcnc.jnotepad {
|
||||
exports org.jcnc.jnotepad.controller.event.handler.menuBar;
|
||||
exports org.jcnc.jnotepad.tool;
|
||||
exports org.jcnc.jnotepad.Interface;
|
||||
exports org.jcnc.jnotepad.ui.module;
|
||||
exports org.jcnc.jnotepad.ui.setStage;
|
||||
exports org.jcnc.jnotepad.root.center.main.center.tab;
|
||||
exports org.jcnc.jnotepad.root.top.menu;
|
||||
exports org.jcnc.jnotepad.view.manager;
|
||||
opens org.jcnc.jnotepad.app.config;
|
||||
exports org.jcnc.jnotepad.root.center.main.bottom.status;
|
||||
|
||||
|
||||
@ -27,10 +27,6 @@ import java.util.concurrent.ExecutorService;
|
||||
* @author 许轲
|
||||
*/
|
||||
public class LunchApp extends Application {
|
||||
/**
|
||||
* 线程池
|
||||
*/
|
||||
private final ExecutorService threadPool = ThreadPoolManager.getThreadPool();
|
||||
private static final Pane ROOT = new Pane();
|
||||
private static final Scene SCENE;
|
||||
|
||||
@ -40,6 +36,10 @@ public class LunchApp extends Application {
|
||||
SCENE = new Scene(ROOT, width, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* 线程池
|
||||
*/
|
||||
private final ExecutorService threadPool = ThreadPoolManager.getThreadPool();
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
@ -48,6 +48,7 @@ public class LunchApp extends Application {
|
||||
public static Window getWindow() {
|
||||
return SCENE.getWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) {
|
||||
Application.setUserAgentStylesheet(new PrimerLight().getUserAgentStylesheet());
|
||||
|
||||
@ -30,6 +30,7 @@ public class AppConfigController {
|
||||
private static final AppConfigController INSTANCE = new AppConfigController();
|
||||
private AppConfig appConfig;
|
||||
private String dir;
|
||||
|
||||
private AppConfigController() {
|
||||
setDir(Paths.get(System.getProperty("user.home"), ".jnotepad").toString());
|
||||
loadConfig();
|
||||
|
||||
@ -4,8 +4,9 @@ import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import org.jcnc.jnotepad.app.i18n.UiResourceBundle;
|
||||
import org.jcnc.jnotepad.constants.TextConstants;
|
||||
import org.jcnc.jnotepad.root.center.main.bottom.status.JNotepadStatusBox;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTab;
|
||||
import org.jcnc.jnotepad.tool.UiUtil;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTabPane;
|
||||
import org.jcnc.jnotepad.ui.module.LineNumberTextArea;
|
||||
import org.jcnc.jnotepad.view.manager.ViewManager;
|
||||
|
||||
@ -33,7 +34,7 @@ public class NewFile implements EventHandler<ActionEvent> {
|
||||
// 创建一个新的文本编辑区
|
||||
LineNumberTextArea textArea = new LineNumberTextArea();
|
||||
// TODO: refactor:统一TextArea新建、绑定监听器入口
|
||||
ViewManager viewManager = UiUtil.getViewManager();
|
||||
ViewManager viewManager = ViewManager.getInstance();
|
||||
// 创建标签页
|
||||
JNotepadTab jNotepadTab = new JNotepadTab(
|
||||
UiResourceBundle.getContent(TextConstants.NEW_FILE)
|
||||
@ -42,8 +43,8 @@ public class NewFile implements EventHandler<ActionEvent> {
|
||||
// 设置当前标签页与本地文件无关联
|
||||
jNotepadTab.setRelevance(false);
|
||||
// 将Tab页添加到TabPane中
|
||||
UiUtil.getJnotepadTabPane().addNewTab(jNotepadTab);
|
||||
JNotepadTabPane.getInstance().addNewTab(jNotepadTab);
|
||||
// 更新编码信息
|
||||
UiUtil.getStatusBox().updateEncodingLabel();
|
||||
JNotepadStatusBox.getInstance().updateEncodingLabel();
|
||||
}
|
||||
}
|
||||
@ -84,7 +84,7 @@ public class OpenFile implements EventHandler<ActionEvent> {
|
||||
*/
|
||||
public void openFile(File file) {
|
||||
// 获取标签页集合
|
||||
JNotepadTabPane jnotepadTabPane = UiUtil.getJnotepadTabPane();
|
||||
JNotepadTabPane jnotepadTabPane = JNotepadTabPane.getInstance();
|
||||
// 遍历标签页,查找匹配的标签页
|
||||
for (Tab tab : jnotepadTabPane.getTabs()) {
|
||||
// 获取绑定的文件
|
||||
@ -124,7 +124,7 @@ public class OpenFile implements EventHandler<ActionEvent> {
|
||||
// 设置当前标签页关联本地文件
|
||||
tab.setRelevance(true);
|
||||
tab.setUserData(file);
|
||||
UiUtil.getJnotepadTabPane().addNewTab(tab);
|
||||
JNotepadTabPane.getInstance().addNewTab(tab);
|
||||
});
|
||||
} catch (IOException ignored) {
|
||||
LogUtil.getLogger(this.getClass()).info("已忽视IO异常!");
|
||||
|
||||
@ -8,6 +8,7 @@ import javafx.stage.FileChooser;
|
||||
import org.jcnc.jnotepad.app.i18n.UiResourceBundle;
|
||||
import org.jcnc.jnotepad.constants.TextConstants;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTab;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTabPane;
|
||||
import org.jcnc.jnotepad.tool.LogUtil;
|
||||
import org.jcnc.jnotepad.tool.UiUtil;
|
||||
import org.jcnc.jnotepad.ui.dialog.factory.impl.TextFileChooserFactory;
|
||||
@ -26,7 +27,7 @@ public class RenameFile implements EventHandler<ActionEvent> {
|
||||
@Override
|
||||
public void handle(ActionEvent actionEvent) {
|
||||
// 获取当前标签页
|
||||
JNotepadTab jnotepadtab = UiUtil.getJnotepadtab();
|
||||
JNotepadTab jnotepadtab = JNotepadTabPane.getInstance().getSelected();
|
||||
if (jnotepadtab == null || jnotepadtab.getText().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@ -90,7 +91,7 @@ public class RenameFile implements EventHandler<ActionEvent> {
|
||||
// 获取原始文件对象
|
||||
File file = (File) jnotepadtab.getUserData();
|
||||
// 获取应用窗口并绑定
|
||||
File newFile = TextFileChooserFactory.getInstance()
|
||||
File newFile = TextFileChooserFactory.getInstance()
|
||||
.createFileChooser(
|
||||
UiResourceBundle.getContent(TextConstants.RENAME),
|
||||
jnotepadtab.getText(),
|
||||
|
||||
@ -7,6 +7,8 @@ import org.jcnc.jnotepad.app.i18n.UiResourceBundle;
|
||||
import org.jcnc.jnotepad.constants.TextConstants;
|
||||
import org.jcnc.jnotepad.controller.i18n.LocalizationController;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTab;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTabPane;
|
||||
import org.jcnc.jnotepad.root.top.menu.JNotepadMenuBar;
|
||||
import org.jcnc.jnotepad.tool.LogUtil;
|
||||
import org.jcnc.jnotepad.tool.SingletonUtil;
|
||||
import org.jcnc.jnotepad.tool.UiUtil;
|
||||
@ -34,7 +36,7 @@ public class SaveFile implements EventHandler<ActionEvent> {
|
||||
@Override
|
||||
public void handle(ActionEvent actionEvent) {
|
||||
// 获取当前tab页
|
||||
JNotepadTab selectedTab = UiUtil.getJnotepadtab();
|
||||
JNotepadTab selectedTab = JNotepadTabPane.getInstance().getSelected();
|
||||
if (selectedTab == null) {
|
||||
return;
|
||||
}
|
||||
@ -50,7 +52,7 @@ public class SaveFile implements EventHandler<ActionEvent> {
|
||||
if (CONFIG_NAME.equals(selectedTab.getText())) {
|
||||
// 重新加载语言包和快捷键
|
||||
SingletonUtil.getAppConfigController().loadConfig();
|
||||
UiUtil.getMenuBar().initShortcutKeys();
|
||||
JNotepadMenuBar.getInstance().initShortcutKeys();
|
||||
LocalizationController.initLocal();
|
||||
logger.info("已刷新语言包!");
|
||||
logger.info("已刷新快捷键!");
|
||||
@ -66,7 +68,7 @@ public class SaveFile implements EventHandler<ActionEvent> {
|
||||
* @see LogUtil
|
||||
*/
|
||||
protected void saveTab(Class<?> currentClass) {
|
||||
JNotepadTab selectedTab = UiUtil.getJnotepadtab();
|
||||
JNotepadTab selectedTab = JNotepadTabPane.getInstance().getSelected();
|
||||
if (selectedTab == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ package org.jcnc.jnotepad.controller.event.handler.tool;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import org.jcnc.jnotepad.tool.UiUtil;
|
||||
import org.jcnc.jnotepad.ui.setStage.SetStage;
|
||||
|
||||
|
||||
/**
|
||||
@ -21,7 +21,7 @@ public class SetBtn implements EventHandler<ActionEvent> {
|
||||
*/
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
UiUtil.getSetStage().openSetStage();
|
||||
SetStage.getInstance().openSetStage();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ import org.jcnc.jnotepad.ui.module.AbstractBorderPane;
|
||||
|
||||
/**
|
||||
* 根舞台下的Root主布局
|
||||
*
|
||||
* @author 许轲
|
||||
*/
|
||||
public class RootBorderPane extends AbstractBorderPane {
|
||||
@ -19,6 +20,10 @@ public class RootBorderPane extends AbstractBorderPane {
|
||||
initRootBorderPane();
|
||||
}
|
||||
|
||||
public static RootBorderPane getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private void initRootBorderPane() {
|
||||
//中间,用于显示Main主布局
|
||||
setCenterComponent(MainBorderPane.getInstance());
|
||||
@ -31,10 +36,6 @@ public class RootBorderPane extends AbstractBorderPane {
|
||||
//主布局的下面
|
||||
setBottomComponent(RootBottomSideBarVBox.getInstance());
|
||||
}
|
||||
|
||||
public static RootBorderPane getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -11,11 +11,11 @@ public class RootBottomSideBarVBox extends AbstractVBox {
|
||||
initSidebarVBox();
|
||||
}
|
||||
|
||||
private void initSidebarVBox() {
|
||||
getChildren().addAll(JNotepadStatusBox.getInstance());
|
||||
}
|
||||
|
||||
public static RootBottomSideBarVBox getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private void initSidebarVBox() {
|
||||
getChildren().addAll(JNotepadStatusBox.getInstance());
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,15 +16,15 @@ public class MainBorderPane extends AbstractBorderPane {
|
||||
initRootBorderPane();
|
||||
}
|
||||
|
||||
public static MainBorderPane getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private void initRootBorderPane() {
|
||||
//文本框
|
||||
setCenterComponent(JNotepadTabPane.getInstance());
|
||||
|
||||
}
|
||||
|
||||
public static MainBorderPane getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -80,6 +80,7 @@ public class JNotepadTab extends Tab {
|
||||
|
||||
/**
|
||||
* 保存为指定文件
|
||||
*
|
||||
* @param file 新文件
|
||||
*/
|
||||
public void save(File file) {
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
package org.jcnc.jnotepad.root.center.main.center.tab;
|
||||
|
||||
import javafx.scene.control.TabPane;
|
||||
import org.jcnc.jnotepad.root.center.main.bottom.status.JNotepadStatusBox;
|
||||
import org.jcnc.jnotepad.root.top.menu.JNotepadMenuBar;
|
||||
import org.jcnc.jnotepad.tool.SingletonUtil;
|
||||
import org.jcnc.jnotepad.tool.UiUtil;
|
||||
|
||||
/**
|
||||
* 标签页布局组件封装。
|
||||
@ -30,10 +31,10 @@ public class JNotepadTabPane extends TabPane {
|
||||
(ov, from, to) -> {
|
||||
if (to != null) {
|
||||
// 更新菜单栏中与tab相关设置
|
||||
UiUtil.getMenuBar().updateMenuStatusBySelectedTab();
|
||||
JNotepadMenuBar.getInstance().updateMenuStatusBySelectedTab();
|
||||
}
|
||||
// 更新状态标签
|
||||
UiUtil.getStatusBox().updateWhenTabSelected();
|
||||
JNotepadStatusBox.getInstance().updateWhenTabSelected();
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -71,6 +72,6 @@ public class JNotepadTabPane extends TabPane {
|
||||
public void fireTabSelected() {
|
||||
JNotepadTab selectedTab = getSelected();
|
||||
selectedTab.setAutoLine(SingletonUtil.getAppConfigController().getAutoLineConfig());
|
||||
UiUtil.getStatusBox().updateWhenTabSelected();
|
||||
JNotepadStatusBox.getInstance().updateWhenTabSelected();
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,11 +10,11 @@ public class RootRightSideBarVBox extends AbstractVBox {
|
||||
initSidebarVBox();
|
||||
}
|
||||
|
||||
private void initSidebarVBox() {
|
||||
|
||||
}
|
||||
|
||||
public static RootRightSideBarVBox getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private void initSidebarVBox() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,14 +17,14 @@ public class RootTopBorderPane extends AbstractBorderPane {
|
||||
initRootBorderPane();
|
||||
}
|
||||
|
||||
public static RootTopBorderPane getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private void initRootBorderPane() {
|
||||
//文本框上面
|
||||
setTopComponent(JNotepadMenuBar.getInstance());
|
||||
}
|
||||
|
||||
public static RootTopBorderPane getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ public class SingletonUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取UI资源绑定组件I
|
||||
* 获取UI资源绑定组件
|
||||
*
|
||||
* @return org.jcnc.jnotepad.app.i18n.UiResourceBundle
|
||||
* @since 2023/8/30 12:45
|
||||
|
||||
@ -2,61 +2,25 @@ package org.jcnc.jnotepad.tool;
|
||||
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.stage.Window;
|
||||
import org.jcnc.jnotepad.LunchApp;
|
||||
import org.jcnc.jnotepad.constants.AppConstants;
|
||||
import org.jcnc.jnotepad.root.center.main.bottom.status.JNotepadStatusBox;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTab;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTabPane;
|
||||
import org.jcnc.jnotepad.root.top.menu.JNotepadMenuBar;
|
||||
import org.jcnc.jnotepad.ui.setStage.SetStage;
|
||||
import org.jcnc.jnotepad.view.manager.ViewManager;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* UI工具<br>
|
||||
* 封装了项目所有的UI组件,以减少组件单例模式造成代码的复杂性
|
||||
* UI工具
|
||||
*
|
||||
* @author gewuyou
|
||||
*/
|
||||
public class UiUtil {
|
||||
/**
|
||||
* 标签页布局组件
|
||||
*/
|
||||
private static final JNotepadTabPane TAB_PANE = JNotepadTabPane.getInstance();
|
||||
/**
|
||||
* 视图管理组件
|
||||
*/
|
||||
private static final ViewManager VIEW_MANAGER = ViewManager.getInstance();
|
||||
/**
|
||||
* 状态栏组件
|
||||
*/
|
||||
private static final JNotepadStatusBox STATUS_BOX = JNotepadStatusBox.getInstance();
|
||||
/**
|
||||
* 菜单栏组件
|
||||
*/
|
||||
private static final JNotepadMenuBar MENU_BAR = JNotepadMenuBar.getInstance();
|
||||
/**
|
||||
* 应用程序图标
|
||||
*/
|
||||
private static final Image ICON = new Image(Objects.requireNonNull(UiUtil.class.getResource(AppConstants.APP_ICON)).toString());
|
||||
/**
|
||||
* 设置窗口
|
||||
*/
|
||||
private static final SetStage SET_STAGE = SetStage.getInstance();
|
||||
|
||||
private UiUtil() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设置窗口
|
||||
*
|
||||
* @return org.jcnc.jnotepad.ui.setStage.SetStage
|
||||
* @since 2023/8/30 12:39
|
||||
*/
|
||||
public static SetStage getSetStage() {
|
||||
return SET_STAGE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取应用程序图标
|
||||
*
|
||||
@ -67,30 +31,6 @@ public class UiUtil {
|
||||
return ICON;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取标签页布局组件
|
||||
*
|
||||
* @return org.jcnc.jnotepad.ui.root.center.tab.JNotepadTabPane
|
||||
* @apiNote JNotepadTabPane.getInstance()
|
||||
* @see JNotepadTabPane
|
||||
*/
|
||||
|
||||
public static JNotepadTabPane getJnotepadTabPane() {
|
||||
return TAB_PANE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取标签页组件
|
||||
*
|
||||
* @return org.jcnc.jnotepad.ui.root.center.tab.JNotepadTab
|
||||
* @apiNote JNotepadTabPane.getInstance().getSelected()<br>获取当前选中的标签页
|
||||
* @see JNotepadTabPane
|
||||
*/
|
||||
|
||||
public static JNotepadTab getJnotepadtab() {
|
||||
return TAB_PANE.getSelected();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取应用窗口
|
||||
*
|
||||
@ -99,37 +39,6 @@ public class UiUtil {
|
||||
* @since 2023/8/29 14:12
|
||||
*/
|
||||
public static Window getAppWindow() {
|
||||
return TAB_PANE.getSelected().getTabPane().getScene().getWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取视图管理组件
|
||||
*
|
||||
* @return org.jcnc.jnotepad.view.manager.ViewManager
|
||||
* @apiNote ViewManager.getInstance()
|
||||
* @since 2023/8/29 14:13
|
||||
*/
|
||||
public static ViewManager getViewManager() {
|
||||
return VIEW_MANAGER;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取状态栏组件
|
||||
*
|
||||
* @return org.jcnc.jnotepad.ui.root.bottom.status.JNotepadStatusBox
|
||||
* @since 2023/8/29 14:14
|
||||
*/
|
||||
public static JNotepadStatusBox getStatusBox() {
|
||||
return STATUS_BOX;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单栏组件
|
||||
*
|
||||
* @return org.jcnc.jnotepad.ui.root.top.menu.JNotepadMenuBar
|
||||
* @since 2023/8/29 14:15
|
||||
*/
|
||||
public static JNotepadMenuBar getMenuBar() {
|
||||
return MENU_BAR;
|
||||
return LunchApp.getWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,12 +13,12 @@ import java.io.File;
|
||||
*/
|
||||
public class TextFileChooserFactory implements FileChooserFactory {
|
||||
|
||||
private static final TextFileChooserFactory INSTANCE = new TextFileChooserFactory();
|
||||
|
||||
private TextFileChooserFactory() {
|
||||
|
||||
}
|
||||
|
||||
private static final TextFileChooserFactory INSTANCE = new TextFileChooserFactory();
|
||||
|
||||
public static TextFileChooserFactory getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@ -3,10 +3,11 @@ package org.jcnc.jnotepad.ui.module;
|
||||
import javafx.beans.property.StringProperty;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import org.jcnc.jnotepad.root.center.main.bottom.status.JNotepadStatusBox;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTab;
|
||||
import org.jcnc.jnotepad.root.center.main.center.tab.JNotepadTabPane;
|
||||
import org.jcnc.jnotepad.tool.LogUtil;
|
||||
import org.jcnc.jnotepad.tool.SingletonUtil;
|
||||
import org.jcnc.jnotepad.tool.UiUtil;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
@ -19,9 +20,9 @@ import java.io.IOException;
|
||||
*/
|
||||
public class LineNumberTextArea extends BorderPane {
|
||||
|
||||
private static final Logger logger=LogUtil.getLogger(LineNumberTextArea.class);
|
||||
static final int[] SIZE_TABLE = {9, 99, 999, 9999, 99999, 999999, 9999999,
|
||||
99999999, 999999999, Integer.MAX_VALUE};
|
||||
private static final Logger logger = LogUtil.getLogger(LineNumberTextArea.class);
|
||||
private static final int MIN_LINE_NUMBER_WIDTH = 30;
|
||||
private final TextArea mainTextArea;
|
||||
private final TextArea lineNumberArea;
|
||||
@ -59,12 +60,12 @@ public class LineNumberTextArea extends BorderPane {
|
||||
|
||||
lineNumberArea.textProperty().addListener((observable, oldValue, newValue) -> updateLineNumberWidth());
|
||||
|
||||
this.mainTextArea.caretPositionProperty().addListener((caretObservable, oldPosition, newPosition) -> UiUtil.getStatusBox().updateWordCountStatusLabel());
|
||||
this.mainTextArea.caretPositionProperty().addListener((caretObservable, oldPosition, newPosition) -> JNotepadStatusBox.getInstance().updateWordCountStatusLabel());
|
||||
this.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||
// 更新行号
|
||||
updateLineNumberArea();
|
||||
// 更新状态栏
|
||||
UiUtil.getStatusBox().updateWordCountStatusLabel();
|
||||
JNotepadStatusBox.getInstance().updateWordCountStatusLabel();
|
||||
// 自动保存
|
||||
save();
|
||||
});
|
||||
@ -74,7 +75,7 @@ public class LineNumberTextArea extends BorderPane {
|
||||
* 以原文件编码格式写回文件
|
||||
*/
|
||||
public void save() {
|
||||
JNotepadTab tab = UiUtil.getJnotepadtab();
|
||||
JNotepadTab tab = JNotepadTabPane.getInstance().getSelected();
|
||||
if (tab == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user