refresh project view
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package io.github.linwancen.plugin.show.ext.conf;
|
||||
|
||||
import com.intellij.ide.projectView.ProjectView;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -127,12 +128,18 @@ public class ConfCache {
|
||||
if (files.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
ProjectView.getInstance(project).refresh();
|
||||
LOG.info("Ext doc conf load all complete {} files\n{}", files.size(), sb);
|
||||
});
|
||||
}
|
||||
|
||||
static void loadFile(@NotNull VirtualFile file) {
|
||||
ApplicationManager.getApplication().invokeLater(() -> ConfCache.load(file));
|
||||
static void loadFile(@NotNull VirtualFile file, @Nullable Project project) {
|
||||
ApplicationManager.getApplication().invokeLater(() -> {
|
||||
ConfCache.load(file);
|
||||
if (project != null) {
|
||||
ProjectView.getInstance(project).refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void load(@NotNull VirtualFile file) {
|
||||
|
||||
@@ -23,7 +23,7 @@ public class ConfFileChangeListener implements FileEditorManagerListener {
|
||||
}
|
||||
if (file.exists()) {
|
||||
try {
|
||||
ConfCache.loadFile(file);
|
||||
ConfCache.loadFile(file, event.getManager().getProject());
|
||||
} catch (Throwable e) {
|
||||
LOG.info("ConfFileChangeListener catch Throwable but log to record.", e);
|
||||
}
|
||||
|
||||
@@ -68,6 +68,6 @@ public class ConfFileListener implements BulkFileListener {
|
||||
}
|
||||
// VFileCreateEvent
|
||||
// VFileContentChangeEvent
|
||||
ConfCache.loadFile(file);
|
||||
ConfCache.loadFile(file, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,6 @@ public class ReloadExtDocAction extends DumbAwareAction {
|
||||
return;
|
||||
}
|
||||
ConfCache.loadAll(project);
|
||||
ApplicationManager.getApplication().invokeLater(() ->
|
||||
ProjectView.getInstance(project).refresh());
|
||||
} catch (Throwable t) {
|
||||
LOG.info("ReloadExtDocAction catch Throwable but log to record.", t);
|
||||
}
|
||||
|
||||
@@ -32,8 +32,6 @@ public class ResetExtDocAction extends AnAction {
|
||||
if (project == null) {
|
||||
return;
|
||||
}
|
||||
ApplicationManager.getApplication().invokeLater(() ->
|
||||
ProjectView.getInstance(project).refresh());
|
||||
} catch (Throwable t) {
|
||||
LOG.info("ConfFileChangeListener catch Throwable but log to record.", t);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user