Skip to content

Commit

Permalink
添加已经丢失导航目标的书签图标
Browse files Browse the repository at this point in the history
  • Loading branch information
Nonoas committed Jul 9, 2024
1 parent 7082776 commit cc5a7aa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/indi/bookmarkx/ui/tree/BmkTreeCellRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.intellij.openapi.util.IconLoader;
import com.intellij.util.ui.UIUtil;
import indi.bookmarkx.common.BaseColors;
import indi.bookmarkx.model.BookmarkNodeModel;

import javax.swing.Icon;
import javax.swing.JTree;
Expand Down Expand Up @@ -48,6 +49,12 @@ public Component getTreeCellRendererComponent(JTree tree,
icon = node.isBookmark()
? IconLoader.findIcon("icons/bookmark.svg")
: AllIcons.Nodes.Folder;
if (node.isBookmark()) {
BookmarkNodeModel model = (BookmarkNodeModel) node.getUserObject();
if (null == model.getOpenFileDescriptor()) {
icon = IconLoader.findIcon("icons/dissmiss.svg");
}
}
}
setIcon(icon);
return this;
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/indi/bookmarkx/ui/tree/BookmarkTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ public void mouseClicked(MouseEvent e) {
BookmarkNodeModel bookmark = (BookmarkNodeModel) selectedNode.getUserObject();

OpenFileDescriptor fileDescriptor = bookmark.getOpenFileDescriptor();
if (null == fileDescriptor) {
return;
}
fileDescriptor.navigate(true);
}
}
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/icons/dissmiss.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cc5a7aa

Please sign in to comment.