From f90fa1845425bb85cea676da3db9f85bfa33d0c9 Mon Sep 17 00:00:00 2001 From: Jamie Mansfield Date: Fri, 9 Feb 2018 17:03:25 +0000 Subject: [PATCH 1/2] Bump version to 1.1.1 --- .gitignore | 3 ++- build.gradle | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index b943958..abbe156 100644 --- a/.gitignore +++ b/.gitignore @@ -261,6 +261,7 @@ gradle-app.setting !test.jar ################# -## Git submodules +## Nocturne ################# FernFlower/ +run/ diff --git a/build.gradle b/build.gradle index 9cd35b7..307243f 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ defaultTasks 'clean', 'licenseFormat', 'build' // Project information allprojects { group = 'blue.lapis.nocturne' - version = '1.1.0' + version = '1.1.1' sourceCompatibility = '1.8' targetCompatibility = '1.8' From 85c3a68770f99dd9dc34521defae8e0823e0dea2 Mon Sep 17 00:00:00 2001 From: Jamie Mansfield Date: Fri, 9 Feb 2018 18:06:28 +0000 Subject: [PATCH 2/2] #34: Set active writer type when mappings opened --- .../gui/io/mappings/MappingsOpenDialogHelper.java | 3 ++- .../nocturne/mapping/io/reader/MappingReaderType.java | 8 +++++++- .../nocturne/mapping/io/writer/MappingWriterType.java | 7 ++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/main/java/blue/lapis/nocturne/gui/io/mappings/MappingsOpenDialogHelper.java b/src/main/java/blue/lapis/nocturne/gui/io/mappings/MappingsOpenDialogHelper.java index 10c04e8..93a67ba 100644 --- a/src/main/java/blue/lapis/nocturne/gui/io/mappings/MappingsOpenDialogHelper.java +++ b/src/main/java/blue/lapis/nocturne/gui/io/mappings/MappingsOpenDialogHelper.java @@ -30,8 +30,8 @@ import blue.lapis.nocturne.mapping.MappingContext; import blue.lapis.nocturne.mapping.io.reader.MappingReaderType; import blue.lapis.nocturne.mapping.io.reader.MappingsReader; +import blue.lapis.nocturne.mapping.io.writer.MappingWriterType; import blue.lapis.nocturne.util.helper.PropertiesHelper; - import javafx.stage.FileChooser; import java.io.BufferedReader; @@ -90,6 +90,7 @@ public static void openMappings(boolean merge) throws IOException { } Main.setCurrentMappingsPath(selectedPath); + Main.setCurrentWriterType(MappingWriterType.fromFormatType(type.getFormatType())); } } diff --git a/src/main/java/blue/lapis/nocturne/mapping/io/reader/MappingReaderType.java b/src/main/java/blue/lapis/nocturne/mapping/io/reader/MappingReaderType.java index cf70b97..8158905 100644 --- a/src/main/java/blue/lapis/nocturne/mapping/io/reader/MappingReaderType.java +++ b/src/main/java/blue/lapis/nocturne/mapping/io/reader/MappingReaderType.java @@ -45,10 +45,12 @@ public enum MappingReaderType { private final MappingFormatType type; - public static final Map filterToType = Maps.newHashMap(); + private static final Map filterToType = Maps.newHashMap(); + private static final Map formatToType = Maps.newHashMap(); static { Arrays.asList(values()).forEach(t -> filterToType.put(t.getExtensionFilter(), t)); + Arrays.asList(values()).forEach(t -> formatToType.put(t.getFormatType(), t)); } private final FileChooser.ExtensionFilter extensionFilter; @@ -86,4 +88,8 @@ public MappingsReader constructReader(BufferedReader reader) { public static MappingReaderType fromExtensionFilter(FileChooser.ExtensionFilter filter) { return filterToType.get(filter); } + + public static MappingReaderType fromFormatType(final MappingFormatType formatType) { + return formatToType.get(formatType); + } } diff --git a/src/main/java/blue/lapis/nocturne/mapping/io/writer/MappingWriterType.java b/src/main/java/blue/lapis/nocturne/mapping/io/writer/MappingWriterType.java index d5a4d52..6f9b7eb 100644 --- a/src/main/java/blue/lapis/nocturne/mapping/io/writer/MappingWriterType.java +++ b/src/main/java/blue/lapis/nocturne/mapping/io/writer/MappingWriterType.java @@ -27,7 +27,6 @@ import blue.lapis.nocturne.Main; import blue.lapis.nocturne.mapping.io.MappingFormatType; - import com.google.common.collect.Maps; import javafx.stage.FileChooser; @@ -46,9 +45,11 @@ public enum MappingWriterType { private final MappingFormatType type; private static final Map filterToType = Maps.newHashMap(); + private static final Map formatToType = Maps.newHashMap(); static { Arrays.asList(values()).forEach(t -> filterToType.put(t.getExtensionFilter(), t)); + Arrays.asList(values()).forEach(t -> formatToType.put(t.getFormatType(), t)); } private final FileChooser.ExtensionFilter extensionFilter; @@ -86,4 +87,8 @@ public MappingsWriter constructWriter(PrintWriter writer) { public static MappingWriterType fromExtensionFilter(FileChooser.ExtensionFilter filter) { return filterToType.get(filter); } + + public static MappingWriterType fromFormatType(final MappingFormatType formatType) { + return formatToType.get(formatType); + } }