Line End Add/Copy Task

This commit is contained in:
林万程
2023-11-24 14:51:03 +08:00
parent ce51735271
commit fdb4c7d6b5
6 changed files with 99 additions and 50 deletions

View File

@@ -117,23 +117,22 @@ public class ConfCache {
}
static void loadAll(@NotNull Project project) {
DumbService.getInstance(project).runReadActionInSmartMode(() ->
ApplicationManager.getApplication().runReadAction(() -> {
@NotNull Collection<VirtualFile> files = FilenameIndex.getAllFilesByExt(project, TsvLoader.EXT);
@NotNull StringBuilder sb = new StringBuilder();
for (@NotNull VirtualFile file : files) {
load(file);
sb.append(file.getName()).append("\n");
}
if (files.isEmpty()) {
return;
}
LOG.info("Ext doc conf load all complete {} files\n{}", files.size(), sb);
}));
DumbService.getInstance(project).smartInvokeLater(() -> {
@NotNull Collection<VirtualFile> files = FilenameIndex.getAllFilesByExt(project, TsvLoader.EXT);
@NotNull StringBuilder sb = new StringBuilder();
for (@NotNull VirtualFile file : files) {
load(file);
sb.append(file.getName()).append("\n");
}
if (files.isEmpty()) {
return;
}
LOG.info("Ext doc conf load all complete {} files\n{}", files.size(), sb);
});
}
static void loadFile(@NotNull VirtualFile file) {
ApplicationManager.getApplication().runReadAction(() -> ConfCache.load(file));
ApplicationManager.getApplication().invokeLater(() -> ConfCache.load(file));
}
private static void load(@NotNull VirtualFile file) {

View File

@@ -1,9 +1,9 @@
package io.github.linwancen.plugin.show.ext.conf;
import com.intellij.ide.projectView.ProjectView;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import io.github.linwancen.plugin.show.settings.ShowBundle;
import org.jetbrains.annotations.NotNull;
@@ -14,7 +14,7 @@ import org.slf4j.LoggerFactory;
/**
* call ConfCache.loadAll
*/
public class ReloadExtDocAction extends AnAction {
public class ReloadExtDocAction extends DumbAwareAction {
private static final Logger LOG = LoggerFactory.getLogger(ReloadExtDocAction.class);