mirror of
https://github.com/rememberber/MooTool.git
synced 2026-09-19 10:46:38 +08:00
尝试优化随手记撤销大量批量替换时卡顿的问题
This commit is contained in:
@@ -32,9 +32,9 @@
|
||||
<guava.version>32.1.2-jre</guava.version>
|
||||
<okhttp.version>4.11.0</okhttp.version>
|
||||
<google.zxing.core.version>3.5.1</google.zxing.core.version>
|
||||
<flatlaf.version>3.2.1</flatlaf.version>
|
||||
<flatlaf-extras.version>3.2.1</flatlaf-extras.version>
|
||||
<flatlaf-intellij-themes.version>3.2.1</flatlaf-intellij-themes.version>
|
||||
<flatlaf.version>3.2.5</flatlaf.version>
|
||||
<flatlaf-extras.version>3.2.5</flatlaf-extras.version>
|
||||
<flatlaf-intellij-themes.version>3.2.5</flatlaf-intellij-themes.version>
|
||||
<flatlaf-fonts-jetbrains-mono.version>2.242</flatlaf-fonts-jetbrains-mono.version>
|
||||
<rsyntaxtextarea.version>3.3.4</rsyntaxtextarea.version>
|
||||
<sql-formatter.version>2.0.4</sql-formatter.version>
|
||||
|
||||
@@ -36,6 +36,8 @@ import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@@ -52,6 +54,9 @@ public class QuickNoteListener {
|
||||
|
||||
public static String selectedName;
|
||||
|
||||
// 创建一个单线程的ExecutorService
|
||||
public static ExecutorService executorService = Executors.newSingleThreadExecutor();
|
||||
|
||||
public static void addListeners() {
|
||||
QuickNoteForm quickNoteForm = QuickNoteForm.getInstance();
|
||||
QuickNoteSyntaxTextViewerManager quickNoteSyntaxTextViewerManager = QuickNoteForm.quickNoteSyntaxTextViewerManager;
|
||||
@@ -613,24 +618,28 @@ public class QuickNoteListener {
|
||||
* @param refreshModifiedTime
|
||||
*/
|
||||
public static void quickSave(boolean refreshModifiedTime, boolean writeLog) {
|
||||
String now = SqliteUtil.nowDateForSqlite();
|
||||
if (selectedName != null) {
|
||||
TQuickNote tQuickNote = new TQuickNote();
|
||||
tQuickNote.setName(selectedName);
|
||||
|
||||
String text = QuickNoteForm.quickNoteSyntaxTextViewerManager.getTextByName(selectedName);
|
||||
if (writeLog) {
|
||||
log.info("save note: " + selectedName + ", content: " + text);
|
||||
}
|
||||
tQuickNote.setContent(text);
|
||||
if (refreshModifiedTime) {
|
||||
tQuickNote.setModifiedTime(now);
|
||||
executorService.submit(() -> {
|
||||
String now = SqliteUtil.nowDateForSqlite();
|
||||
if (selectedName != null) {
|
||||
TQuickNote tQuickNote = new TQuickNote();
|
||||
tQuickNote.setName(selectedName);
|
||||
|
||||
String text = QuickNoteForm.quickNoteSyntaxTextViewerManager.getTextByName(selectedName);
|
||||
if (writeLog) {
|
||||
log.info("save note: " + selectedName + ", content: " + text);
|
||||
}
|
||||
tQuickNote.setContent(text);
|
||||
if (refreshModifiedTime) {
|
||||
tQuickNote.setModifiedTime(now);
|
||||
}
|
||||
|
||||
quickNoteMapper.updateByName(tQuickNote);
|
||||
}
|
||||
|
||||
quickNoteMapper.updateByName(tQuickNote);
|
||||
}
|
||||
QuickNoteIndicatorTools.showTips("已保存:" + selectedName, QuickNoteIndicatorTools.TipsLevel.SUCCESS);
|
||||
});
|
||||
|
||||
QuickNoteIndicatorTools.showTips("已保存:" + selectedName, QuickNoteIndicatorTools.TipsLevel.SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user