Sfoglia il codice sorgente

code simplification

Sebastian Stenzel 8 anni fa
parent
commit
d6c6f177e8

+ 6 - 8
main/ui/src/main/java/org/cryptomator/ui/controllers/AbstractFXMLViewController.java

@@ -72,14 +72,12 @@ abstract class AbstractFXMLViewController implements Initializable {
 	 * @return Parent view element.
 	 */
 	protected final Parent loadFxml() {
-		return LazyInitializer.initializeLazily(fxmlRoot, () -> {
-			final FXMLLoader loader = createFxmlLoader();
-			try {
-				return loader.load();
-			} catch (IOException e) {
-				throw new IllegalStateException("Could not load FXML file from location: " + loader.getLocation(), e);
-			}
-		});
+		final FXMLLoader loader = createFxmlLoader();
+		try {
+			return LazyInitializer.initializeLazily(fxmlRoot, loader::load, IOException.class);
+		} catch (IOException e) {
+			throw new IllegalStateException("Could not load FXML file from location: " + loader.getLocation(), e);
+		}
 	}
 
 	/**