Skip to content

Commit

Permalink
more reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
ix0rai committed Dec 6, 2023
1 parent cd9a80d commit 6068984
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,4 @@ public enum Decompiler {
this.service = service;
this.settingsDialog = settingsDialog;
}

static {
DecompilerConfig.bootstrap();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@

public class DecompilerConfig extends ReflectiveConfig {
public DecompilerConfig() {
VineflowerPreferences.OPTIONS.putAll(this.stringValues.value());
VineflowerPreferences.OPTIONS.putAll(this.intValues.value());
VineflowerPreferences.OPTIONS.putAll(this.booleanValues.value());
VineflowerPreferences.OPTIONS.putAll(this.vineflowerSection.stringValues.value());
VineflowerPreferences.OPTIONS.putAll(this.vineflowerSection.intValues.value());
VineflowerPreferences.OPTIONS.putAll(this.vineflowerSection.booleanValues.value());
}

public final TrackedValue<Decompiler> decompiler = this.value(Decompiler.VINEFLOWER);
public final TrackedValue<ValueMap<String>> stringValues = this.map("").build();
public final TrackedValue<ValueMap<Integer>> intValues = this.map(0).build();
public final TrackedValue<ValueMap<Boolean>> booleanValues = this.map(true).build();
public final VineflowerSection vineflowerSection = new VineflowerSection();

public static final class VineflowerSection extends Section {
public final TrackedValue<ValueMap<String>> stringValues = this.map("").build();
public final TrackedValue<ValueMap<Integer>> intValues = this.map(0).build();
public final TrackedValue<ValueMap<Boolean>> booleanValues = this.map(true).build();
}

public static void updateVineflowerValues(Map<String, Object> options) {
for (Map.Entry<String, Object> entry : options.entrySet()) {
if (entry.getValue() instanceof String s) {
Config.decompiler().stringValues.value().put(entry.getKey(), s);
Config.decompiler().vineflowerSection.stringValues.value().put(entry.getKey(), s);
} else if (entry.getValue() instanceof Integer i) {
Config.decompiler().intValues.value().put(entry.getKey(), i);
Config.decompiler().vineflowerSection.intValues.value().put(entry.getKey(), i);
} else if (entry.getValue() instanceof Boolean b) {
Config.decompiler().booleanValues.value().put(entry.getKey(), b);
Config.decompiler().vineflowerSection.booleanValues.value().put(entry.getKey(), b);
}
}
}

public static void bootstrap() {
// Just run the static initialization
}
}

0 comments on commit 6068984

Please sign in to comment.