mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-02 20:04:37 +00:00
Tag list view - saving last selected items
Saving last selected view
This commit is contained in:
@@ -279,7 +279,10 @@ public final class Configuration {
|
||||
public static ConfigurationItem<HashMap<String, String>> fontPairingMap = null;
|
||||
|
||||
public static ConfigurationItem<HashMap<String, SwfSpecificConfiguration>> swfSpecificConfigs = null;
|
||||
|
||||
|
||||
public static ConfigurationItem<HashMap<String, SwfSpecificCustomConfiguration>> swfSpecificCustomConfigs = null;
|
||||
|
||||
|
||||
@ConfigurationDefaultCalendar(0)
|
||||
public static ConfigurationItem<Calendar> lastUpdatesCheckDate = null;
|
||||
|
||||
@@ -525,6 +528,11 @@ public final class Configuration {
|
||||
public static ConfigurationItem<String> lastSessionFileTitles = null;
|
||||
|
||||
public static ConfigurationItem<String> lastSessionSelection = null;
|
||||
|
||||
public static ConfigurationItem<String> lastSessionTagListSelection = null;
|
||||
|
||||
@ConfigurationDefaultInt(0)
|
||||
public static ConfigurationItem<Integer> lastView = null;
|
||||
|
||||
@ConfigurationDefaultBoolean(true)
|
||||
@ConfigurationCategory("ui")
|
||||
@@ -897,6 +905,26 @@ public final class Configuration {
|
||||
|
||||
return swfConf;
|
||||
}
|
||||
|
||||
public static SwfSpecificCustomConfiguration getSwfSpecificCustomConfiguration(String fileName) {
|
||||
HashMap<String, SwfSpecificCustomConfiguration> map = swfSpecificCustomConfigs.get();
|
||||
if (map == null) {
|
||||
map = new HashMap<>();
|
||||
swfSpecificCustomConfigs.set(map);
|
||||
}
|
||||
|
||||
return map.get(fileName);
|
||||
}
|
||||
|
||||
public static SwfSpecificCustomConfiguration getOrCreateSwfSpecificCustomConfiguration(String fileName) {
|
||||
SwfSpecificCustomConfiguration swfConf = getSwfSpecificCustomConfiguration(fileName);
|
||||
if (swfConf == null) {
|
||||
swfConf = new SwfSpecificCustomConfiguration();
|
||||
swfSpecificCustomConfigs.get().put(fileName, swfConf);
|
||||
}
|
||||
|
||||
return swfConf;
|
||||
}
|
||||
|
||||
private static String getConfigFile() throws IOException {
|
||||
return getFFDecHome() + CONFIG_NAME;
|
||||
@@ -933,6 +961,7 @@ public final class Configuration {
|
||||
oos.writeObject(config);
|
||||
} catch (IOException ex) {
|
||||
//TODO: move this to GUI
|
||||
ex.printStackTrace();
|
||||
JOptionPane.showMessageDialog(null, "Cannot save configuration.", "Error", JOptionPane.ERROR_MESSAGE);
|
||||
Logger.getLogger(Configuration.class.getName()).severe("Configuration directory is read only.");
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.configuration;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -27,5 +28,5 @@ public class SwfSpecificConfiguration implements Serializable {
|
||||
|
||||
public Map<String, String> fontPairingMap = new HashMap<>();
|
||||
|
||||
|
||||
public String lastSelectedPath = null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2022 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
|
||||
package com.jpexs.decompiler.flash.configuration;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class SwfSpecificCustomConfiguration implements Serializable {
|
||||
|
||||
private Map<String, String> customData = new HashMap<>();
|
||||
|
||||
public static final String KEY_LAST_SELECTED_PATH_RESOURCES = "lastSelectedPath.resources";
|
||||
public static final String KEY_LAST_SELECTED_PATH_TAGLIST = "lastSelectedPath.taglist";
|
||||
|
||||
public String getCustomData(String key, String defaultValue) {
|
||||
if (customData.containsKey(key)) {
|
||||
return customData.get(key);
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public void setCustomData(String key, String value) {
|
||||
customData.put(key, value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user