mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-20 17:52:23 +00:00
fix: find referenced files outside of edt
This commit is contained in:
parent
db9b8d177c
commit
d19dd4bb23
2 changed files with 20 additions and 10 deletions
|
|
@ -5,7 +5,7 @@ import static java.lang.String.format;
|
|||
import com.intellij.icons.AllIcons.General;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.components.ActionLink;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import java.awt.BorderLayout;
|
||||
|
|
@ -24,24 +24,22 @@ public class SelectedFilesAccordion extends JPanel {
|
|||
|
||||
public SelectedFilesAccordion(
|
||||
@NotNull Project project,
|
||||
@NotNull List<String> referencedFilePaths) {
|
||||
@NotNull List<VirtualFile> referencedFiles) {
|
||||
super(new BorderLayout());
|
||||
setOpaque(false);
|
||||
|
||||
var contentPanel = createContentPanel(project, referencedFilePaths);
|
||||
add(createToggleButton(contentPanel, referencedFilePaths.size()), BorderLayout.NORTH);
|
||||
var contentPanel = createContentPanel(project, referencedFiles);
|
||||
add(createToggleButton(contentPanel, referencedFiles.size()), BorderLayout.NORTH);
|
||||
add(contentPanel, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
private JPanel createContentPanel(Project project, List<String> referencedFilePaths) {
|
||||
private JPanel createContentPanel(Project project, List<VirtualFile> referencedFiles) {
|
||||
var panel = new JPanel();
|
||||
panel.setOpaque(false);
|
||||
panel.setVisible(true);
|
||||
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
|
||||
panel.setBorder(JBUI.Borders.empty(4, 0));
|
||||
referencedFilePaths.stream()
|
||||
.map(filePath -> LocalFileSystem.getInstance().findFileByPath(filePath))
|
||||
.filter(Objects::nonNull)
|
||||
referencedFiles.stream()
|
||||
.map(virtualFile -> {
|
||||
var actionLink = new ActionLink(
|
||||
Paths.get(virtualFile.getPath()).getFileName().toString(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue