diff --git a/src/main/java/indi/bookmarkx/RootWindowFactory.java b/src/main/java/indi/bookmarkx/RootWindowFactory.java index f8cf128..85d5f91 100644 --- a/src/main/java/indi/bookmarkx/RootWindowFactory.java +++ b/src/main/java/indi/bookmarkx/RootWindowFactory.java @@ -1,5 +1,6 @@ package indi.bookmarkx; +import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; import com.intellij.openapi.wm.ToolWindow; import com.intellij.openapi.wm.ToolWindowFactory; @@ -13,7 +14,7 @@ import java.util.Arrays; -public class RootWindowFactory implements ToolWindowFactory { +public class RootWindowFactory implements ToolWindowFactory, DumbAware { /** * plugin.xml 文件中的 key 名 diff --git a/src/main/java/indi/bookmarkx/common/data/ArrayListTable.java b/src/main/java/indi/bookmarkx/common/data/ArrayListTable.java index 99d77f8..e1f8f98 100644 --- a/src/main/java/indi/bookmarkx/common/data/ArrayListTable.java +++ b/src/main/java/indi/bookmarkx/common/data/ArrayListTable.java @@ -29,7 +29,7 @@ protected void addColumIndex(Function function) { SimpleColumnIndex> index = new SimpleColumnIndex<>(); dataList.forEach(data -> { try { - saveHunt(data, function, (SimpleColumnIndex>) index); + saveHunt(data, function, index); }catch (Exception ignored) { } diff --git a/src/main/java/indi/bookmarkx/common/data/BookmarkArrayListTable.java b/src/main/java/indi/bookmarkx/common/data/BookmarkArrayListTable.java index 9f7e678..b433651 100644 --- a/src/main/java/indi/bookmarkx/common/data/BookmarkArrayListTable.java +++ b/src/main/java/indi/bookmarkx/common/data/BookmarkArrayListTable.java @@ -61,6 +61,7 @@ private List treeToList(BookmarkTree bookmarkTree,List list) { diff --git a/src/main/java/indi/bookmarkx/model/BookmarkConverter.java b/src/main/java/indi/bookmarkx/model/BookmarkConverter.java index 78befbe..29534aa 100644 --- a/src/main/java/indi/bookmarkx/model/BookmarkConverter.java +++ b/src/main/java/indi/bookmarkx/model/BookmarkConverter.java @@ -1,5 +1,6 @@ package indi.bookmarkx.model; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.project.Project; @@ -13,9 +14,11 @@ */ public class BookmarkConverter { + private static final Logger log = Logger.getInstance(BookmarkConverter.class); + public static BookmarkPO convertToPO(AbstractTreeNodeModel model) { - if (model instanceof BookmarkNodeModel) { + if (model instanceof BookmarkNodeModel && model.isBookmark()) { BookmarkNodeModel nodeModel = (BookmarkNodeModel) model; BookmarkPO po = new BookmarkPO(); @@ -27,8 +30,13 @@ public static BookmarkPO convertToPO(AbstractTreeNodeModel model) { po.setDesc(nodeModel.getDesc()); po.setBookmark(true); - VirtualFile file = nodeModel.getOpenFileDescriptor().getFile(); - po.setVirtualFilePath(file.getPath()); + OpenFileDescriptor fileDescriptor = nodeModel.getOpenFileDescriptor(); + if (null != fileDescriptor) { + VirtualFile file = fileDescriptor.getFile(); + po.setVirtualFilePath(file.getPath()); + } else { + log.warn(String.format("%s指向的位置已不存在", nodeModel.getName())); + } return po; } else { GroupNodeModel nodeModel = (GroupNodeModel) model; diff --git a/src/main/java/indi/bookmarkx/ui/pannel/BookmarksManagePanel.java b/src/main/java/indi/bookmarkx/ui/pannel/BookmarksManagePanel.java index 199b193..f0f7256 100644 --- a/src/main/java/indi/bookmarkx/ui/pannel/BookmarksManagePanel.java +++ b/src/main/java/indi/bookmarkx/ui/pannel/BookmarksManagePanel.java @@ -113,7 +113,7 @@ class TreeLoadTask extends Task.Backgroundable { private DefaultTreeModel treeModel; public TreeLoadTask(Project project, BookmarkTree tree) { - super(project, "Loading Tree Data"); + super(project, "Loading tree data"); this.project = project; this.tree = tree; }