From c85e235151a7a99182e17892d62783a08a9a4eff Mon Sep 17 00:00:00 2001 From: ShadelessFox Date: Mon, 4 Mar 2024 00:34:00 +0100 Subject: [PATCH] Navigator: Replace buggy application icon with a cute monitor icon --- .../src/main/java/com/shade/decima/ui/Application.java | 2 ++ .../com/shade/decima/ui/navigator/NavigatorView.java | 1 - .../decima/ui/navigator/impl/NavigatorProjectNode.java | 10 +--------- .../src/main/resources/icons/actions/monitorActive.svg | 4 ++++ .../main/resources/icons/actions/monitorInactive.svg | 3 +++ 5 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 modules/decima-ui/src/main/resources/icons/actions/monitorActive.svg create mode 100644 modules/decima-ui/src/main/resources/icons/actions/monitorInactive.svg diff --git a/modules/decima-ui/src/main/java/com/shade/decima/ui/Application.java b/modules/decima-ui/src/main/java/com/shade/decima/ui/Application.java index f70050634..43ae7ec39 100644 --- a/modules/decima-ui/src/main/java/com/shade/decima/ui/Application.java +++ b/modules/decima-ui/src/main/java/com/shade/decima/ui/Application.java @@ -322,6 +322,8 @@ private void configureUI() { } UIManager.put("Action.containsIcon", new FlatSVGIcon("icons/actions/contains.svg")); + UIManager.put("Action.monitorActiveIcon", new FlatSVGIcon("icons/actions/monitorActive.svg")); + UIManager.put("Action.monitorInactiveIcon", new FlatSVGIcon("icons/actions/monitorInactive.svg")); UIManager.put("Action.editIcon", new FlatSVGIcon("icons/actions/edit.svg")); UIManager.put("Action.editModalIcon", new FlatSVGIcon("icons/actions/edit_modal.svg")); UIManager.put("Action.exportIcon", new FlatSVGIcon("icons/actions/export.svg")); diff --git a/modules/decima-ui/src/main/java/com/shade/decima/ui/navigator/NavigatorView.java b/modules/decima-ui/src/main/java/com/shade/decima/ui/navigator/NavigatorView.java index 3cb0c820c..d7951a225 100644 --- a/modules/decima-ui/src/main/java/com/shade/decima/ui/navigator/NavigatorView.java +++ b/modules/decima-ui/src/main/java/com/shade/decima/ui/navigator/NavigatorView.java @@ -88,7 +88,6 @@ public void projectUpdated(@NotNull ProjectContainer container) { final var model = tree.getModel(); final var projectNode = model.getProjectNode(new VoidProgressMonitor(), container); - projectNode.resetIcon(); model.fireNodesChanged(projectNode); } diff --git a/modules/decima-ui/src/main/java/com/shade/decima/ui/navigator/impl/NavigatorProjectNode.java b/modules/decima-ui/src/main/java/com/shade/decima/ui/navigator/impl/NavigatorProjectNode.java index 6bc2b76b3..eafa73ba7 100644 --- a/modules/decima-ui/src/main/java/com/shade/decima/ui/navigator/impl/NavigatorProjectNode.java +++ b/modules/decima-ui/src/main/java/com/shade/decima/ui/navigator/impl/NavigatorProjectNode.java @@ -10,14 +10,12 @@ import com.shade.decima.ui.navigator.NavigatorPath; import com.shade.decima.ui.navigator.NavigatorSettings; import com.shade.decima.ui.navigator.NavigatorTreeModel; -import com.shade.platform.model.Lazy; import com.shade.platform.model.runtime.ProgressMonitor; import com.shade.platform.model.runtime.VoidProgressMonitor; import com.shade.util.NotNull; import com.shade.util.Nullable; import javax.swing.*; -import javax.swing.filechooser.FileSystemView; import java.io.IOException; import java.util.*; import java.util.stream.Collectors; @@ -25,14 +23,12 @@ public class NavigatorProjectNode extends NavigatorNode { private final ProjectContainer container; - private final Lazy icon; private final NavigatorSettings settings; private Project project; public NavigatorProjectNode(@Nullable NavigatorNode parent, @NotNull ProjectContainer container) { super(parent); this.container = container; - this.icon = Lazy.of(() -> FileSystemView.getFileSystemView().getSystemIcon(container.getExecutablePath().toFile())); this.settings = NavigatorSettings.getInstance().getState(); } @@ -123,11 +119,7 @@ protected NavigatorNode[] loadChildren(@NotNull ProgressMonitor monitor) throws @Nullable @Override public Icon getIcon() { - return icon.get(); - } - - public void resetIcon() { - icon.clear(); + return UIManager.getIcon(project != null ? "Action.monitorActiveIcon" : "Action.monitorInactiveIcon"); } @NotNull diff --git a/modules/decima-ui/src/main/resources/icons/actions/monitorActive.svg b/modules/decima-ui/src/main/resources/icons/actions/monitorActive.svg new file mode 100644 index 000000000..83d991f4e --- /dev/null +++ b/modules/decima-ui/src/main/resources/icons/actions/monitorActive.svg @@ -0,0 +1,4 @@ + + + + diff --git a/modules/decima-ui/src/main/resources/icons/actions/monitorInactive.svg b/modules/decima-ui/src/main/resources/icons/actions/monitorInactive.svg new file mode 100644 index 000000000..0327e0a16 --- /dev/null +++ b/modules/decima-ui/src/main/resources/icons/actions/monitorInactive.svg @@ -0,0 +1,3 @@ + + +