diff --git a/src/main/java/io/github/linwancen/plugin/show/ext/conf/ConfCache.java b/src/main/java/io/github/linwancen/plugin/show/ext/conf/ConfCache.java index e3811a6..f596299 100644 --- a/src/main/java/io/github/linwancen/plugin/show/ext/conf/ConfCache.java +++ b/src/main/java/io/github/linwancen/plugin/show/ext/conf/ConfCache.java @@ -1,8 +1,5 @@ package io.github.linwancen.plugin.show.ext.conf; -import com.intellij.notification.NotificationDisplayType; -import com.intellij.notification.NotificationGroup; -import com.intellij.notification.NotificationType; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.Project; @@ -10,6 +7,8 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.search.FilenameIndex; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.*; import java.util.concurrent.ConcurrentHashMap; @@ -20,6 +19,7 @@ import java.util.regex.Pattern; * call ConfFactory, ConfCacheGetUtils */ public class ConfCache { + private static final Logger LOG = LoggerFactory.getLogger(ConfCache.class); static final String KEY_MID_EXT = ".key"; static final String DOC_MID_EXT = ".doc"; @@ -116,9 +116,6 @@ public class ConfCache { } } - private static final NotificationGroup LOAD_ALL_LOG = - new NotificationGroup("Ext Doc Conf Load All", NotificationDisplayType.BALLOON, true); - static void loadAll(@NotNull Project project) { DumbService.getInstance(project).runReadActionInSmartMode(() -> ApplicationManager.getApplication().runReadAction(() -> { @@ -131,8 +128,7 @@ public class ConfCache { if (files.isEmpty()) { return; } - LOAD_ALL_LOG.createNotification("Ext doc conf load all complete", files.size() + " files", - sb.toString(), NotificationType.INFORMATION).notify(project); + LOG.info("Ext doc conf load all complete {} files\n{}", files.size(), sb); })); } diff --git a/src/main/java/io/github/linwancen/plugin/show/ext/conf/ConfFactory.java b/src/main/java/io/github/linwancen/plugin/show/ext/conf/ConfFactory.java index b8bf6a9..0f5edb0 100644 --- a/src/main/java/io/github/linwancen/plugin/show/ext/conf/ConfFactory.java +++ b/src/main/java/io/github/linwancen/plugin/show/ext/conf/ConfFactory.java @@ -1,13 +1,12 @@ package io.github.linwancen.plugin.show.ext.conf; -import com.intellij.notification.NotificationDisplayType; -import com.intellij.notification.NotificationGroup; -import com.intellij.notification.NotificationType; import com.intellij.openapi.project.Project; -import com.twelvemonkeys.util.LinkedSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -15,18 +14,16 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.regex.Pattern; class ConfFactory { + private static final Logger LOG = LoggerFactory.getLogger(ConfFactory.class); private static final Pattern EMPTY_PATTERN = Pattern.compile(""); private static final Map PATTERN_CACHE = new ConcurrentHashMap<>(); - private static final NotificationGroup REGEXP_LOG = - new NotificationGroup("Ext Doc Keyword Regexp Compile", NotificationDisplayType.TOOL_WINDOW, true); - private ConfFactory() {} @Nullable - static Pattern buildPattern(@Nullable Project project, @NotNull String path, + static Pattern buildPattern(@SuppressWarnings("unused") @Nullable Project project, @NotNull String path, @NotNull Map>> map) { - @NotNull Set exclude = new LinkedSet<>(); + @NotNull Set exclude = new LinkedHashSet<>(); @NotNull StringBuilder sb = new StringBuilder(); for (@NotNull Map> keyMap : map.values()) { // key() is escape @@ -53,15 +50,13 @@ class ConfFactory { try { @NotNull Pattern compile = Pattern.compile(regex); PATTERN_CACHE.put(regex, compile); - REGEXP_LOG.createNotification("Ext doc keyword regexp compile success", regex.length() + " chars", - sb.toString(), NotificationType.INFORMATION).notify(project); + LOG.info("Ext doc keyword regexp compile success {} chars\n{}", regex.length(), sb); return compile; } catch (Exception e) { sb.insert(0, "\n"); sb.insert(0, e.getLocalizedMessage()); PATTERN_CACHE.put(regex, EMPTY_PATTERN); - REGEXP_LOG.createNotification("Ext doc keyword regexp compile fail", regex.length() + " chars", - sb.toString(), NotificationType.ERROR).notify(project); + LOG.warn("Ext doc keyword regexp compile fail {} chars\n{}", regex.length(), sb); return null; } }