2525import java .util .Locale ;
2626import java .util .Properties ;
2727
28+ import javafx .scene .control .Alert ;
2829import sporemodder .file .cnv .CnvUnit ;
2930import sporemodder .util .NameRegistry ;
3031
@@ -73,6 +74,8 @@ public static HashManager get() {
7374 private NameRegistry extraRegistry ;
7475
7576 private final HashMap <String , NameRegistry > registries = new HashMap <String , NameRegistry >();
77+
78+ private String registryError ;
7679
7780 @ Override
7881 public void initialize (Properties properties ) {
@@ -81,23 +84,28 @@ public void initialize(Properties properties) {
8184 decimalFormat = "#.#######" ;
8285 defaultDecimalFormat = new DecimalFormat (decimalFormat , decimalSymbols );
8386 defaultDecimalFormat .setNegativePrefix ("-" );
84-
85- UIManager . get (). tryAction (() -> {
87+
88+ try {
8689 fileRegistry .read (PathManager .get ().getProgramFile (fileRegistry .getFileName ()));
87- }, "The file name registry (reg_file.txt) is corrupt or missing." );
88-
89- UIManager .get ().tryAction (() -> {
90+ } catch (Exception e ) {
91+ registryError = "The file name registry (reg_file.txt) is corrupt or missing." ;
92+ }
93+ try {
9094 typeRegistry .read (PathManager .get ().getProgramFile (typeRegistry .getFileName ()));
91- }, "The types registry (reg_type.txt) is corrupt or missing." );
92-
93- UIManager .get ().tryAction (() -> {
95+ } catch (Exception e ) {
96+ registryError = "The types registry (reg_type.txt) is corrupt or missing." ;
97+ }
98+ try {
9499 propRegistry .read (PathManager .get ().getProgramFile (propRegistry .getFileName ()));
95- }, "The property registry (reg_property.txt) is corrupt or missing." );
96-
97- UIManager .get ().tryAction (() -> {
100+ } catch (Exception e ) {
101+ registryError = "The property registry (reg_property.txt) is corrupt or missing." ;
102+ }
103+ try {
98104 simulatorRegistry .read (PathManager .get ().getProgramFile (simulatorRegistry .getFileName ()));
99105 simulatorRegistry .read (PathManager .get ().getProgramFile ("reg_simulator_stub.txt" ));
100- }, "The simulator attributes registry (reg_simulator.txt) is corrupt or missing." );
106+ } catch (Exception e ) {
107+ registryError = "The simulator attributes registry (reg_simulator.txt or reg_simulator_stub.txt) is corrupt or missing." ;
108+ }
101109
102110 CnvUnit .loadNameRegistry ();
103111
@@ -107,6 +115,12 @@ public void initialize(Properties properties) {
107115 registries .put (simulatorRegistry .getFileName (), simulatorRegistry );
108116 registries .put (projectRegistry .getFileName (), projectRegistry );
109117 }
118+
119+ public void showInitializationError () {
120+ if (registryError != null ) {
121+ UIManager .get ().showDialog (Alert .AlertType .ERROR , registryError );
122+ }
123+ }
110124
111125 public void replaceRegistries (NameRegistry file , NameRegistry prop , NameRegistry type ) {
112126 fileRegistry = file == null ? originalFileRegistry : file ;
0 commit comments