From 83343fe8a4605629de928cd020803687717e8fe4 Mon Sep 17 00:00:00 2001 From: ShadelessFox Date: Sat, 29 Jun 2024 15:27:20 +0300 Subject: [PATCH] Application: Rename "Packfile view mode" -> "Archive view mode" --- .../decima/ui/navigator/NavigatorSettings.java | 10 ++++++---- .../decima/ui/navigator/NavigatorSettingsPage.java | 14 +++++++------- .../ui/navigator/impl/NavigatorProjectNode.java | 6 +++--- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/modules/decima-ui/src/main/java/com/shade/decima/ui/navigator/NavigatorSettings.java b/modules/decima-ui/src/main/java/com/shade/decima/ui/navigator/NavigatorSettings.java index 1d054ad02..2ecf085f8 100644 --- a/modules/decima-ui/src/main/java/com/shade/decima/ui/navigator/NavigatorSettings.java +++ b/modules/decima-ui/src/main/java/com/shade/decima/ui/navigator/NavigatorSettings.java @@ -1,5 +1,6 @@ package com.shade.decima.ui.navigator; +import com.google.gson.annotations.SerializedName; import com.shade.platform.model.Service; import com.shade.platform.model.app.ApplicationManager; import com.shade.platform.model.persistence.PersistableComponent; @@ -11,14 +12,14 @@ @Service(NavigatorSettings.class) @Persistent("NavigatorSettings") public class NavigatorSettings implements PersistableComponent { - public enum PackfileView { + public enum ArchiveView { DEFAULT("Default"), GROUPED("Grouped"), MERGED("Merged"); private final String label; - PackfileView(@NotNull String label) { + ArchiveView(@NotNull String label) { this.label = label; } @@ -45,7 +46,8 @@ public String toString() { } } - public PackfileView packfileView = PackfileView.DEFAULT; + @SerializedName(value = "archiveView", alternate = "packfileView") + public ArchiveView archiveView = ArchiveView.DEFAULT; public DirectoryView directoryView = DirectoryView.COMPACT; @NotNull @@ -61,7 +63,7 @@ public NavigatorSettings getState() { @Override public void loadState(@NotNull NavigatorSettings state) { - packfileView = state.packfileView; + archiveView = state.archiveView; directoryView = state.directoryView; } } diff --git a/modules/decima-ui/src/main/java/com/shade/decima/ui/navigator/NavigatorSettingsPage.java b/modules/decima-ui/src/main/java/com/shade/decima/ui/navigator/NavigatorSettingsPage.java index e1d507337..5c14859b6 100644 --- a/modules/decima-ui/src/main/java/com/shade/decima/ui/navigator/NavigatorSettingsPage.java +++ b/modules/decima-ui/src/main/java/com/shade/decima/ui/navigator/NavigatorSettingsPage.java @@ -15,7 +15,7 @@ @SettingsPageRegistration(id = "navigator", name = "Navigator") public class NavigatorSettingsPage implements SettingsPage { - private JComboBox packfileViewCombo; + private JComboBox archiveViewCombo; private JComboBox directoryViewCombo; @NotNull @@ -25,8 +25,8 @@ public JComponent createComponent(@NotNull PropertyChangeListener listener) { panel.setBorder(new LabeledBorder("Structure")); panel.setLayout(new MigLayout("ins panel,wrap", "[fill][]")); - panel.add(new JLabel("Packfile view mode:")); - panel.add(packfileViewCombo = new JComboBox<>(NavigatorSettings.PackfileView.values()), "split 2"); + panel.add(new JLabel("Archive view mode:")); + panel.add(archiveViewCombo = new JComboBox<>(NavigatorSettings.ArchiveView.values()), "split 2"); panel.add(UIUtils.createHelpToolTip(""" Depending on the choice, archives will be shown differently:
@@ -49,7 +49,7 @@ public JComponent createComponent(@NotNull PropertyChangeListener listener) { // FIXME Not fancy final ItemListener adapter = e -> listener.propertyChange(new PropertyChangeEvent(this, InputValidator.PROPERTY_VALIDATION, null, null)); - packfileViewCombo.addItemListener(adapter); + archiveViewCombo.addItemListener(adapter); directoryViewCombo.addItemListener(adapter); return panel; @@ -58,21 +58,21 @@ public JComponent createComponent(@NotNull PropertyChangeListener listener) { @Override public void apply() { final NavigatorSettings settings = NavigatorSettings.getInstance(); - settings.packfileView = packfileViewCombo.getItemAt(packfileViewCombo.getSelectedIndex()); + settings.archiveView = archiveViewCombo.getItemAt(archiveViewCombo.getSelectedIndex()); settings.directoryView = directoryViewCombo.getItemAt(directoryViewCombo.getSelectedIndex()); } @Override public void reset() { final NavigatorSettings settings = NavigatorSettings.getInstance(); - packfileViewCombo.setSelectedItem(settings.packfileView); + archiveViewCombo.setSelectedItem(settings.archiveView); directoryViewCombo.setSelectedItem(settings.directoryView); } @Override public boolean isModified() { final NavigatorSettings settings = NavigatorSettings.getInstance(); - return settings.packfileView != packfileViewCombo.getItemAt(packfileViewCombo.getSelectedIndex()) + return settings.archiveView != archiveViewCombo.getItemAt(archiveViewCombo.getSelectedIndex()) || settings.directoryView != directoryViewCombo.getItemAt(directoryViewCombo.getSelectedIndex()); } 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 8871568d8..6dc9d7f3f 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 @@ -69,7 +69,7 @@ public String getDescription() { protected NavigatorNode[] loadChildren(@NotNull ProgressMonitor monitor) throws Exception { open(); - return switch (getPackfileView()) { + return switch (getArchiveView()) { case GROUPED -> loadGroupedChildren(monitor); case MERGED -> loadMergedChildren(monitor); case DEFAULT -> loadDefaultChildren(monitor); @@ -149,8 +149,8 @@ public Icon getIcon() { } @NotNull - public NavigatorSettings.PackfileView getPackfileView() { - return settings.packfileView; + public NavigatorSettings.ArchiveView getArchiveView() { + return settings.archiveView; } @NotNull