From 80730d79ca6070e50b167e6efaa9160d0e4ff6c7 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 26 Apr 2021 21:41:11 +0200 Subject: [PATCH] Change all "Folder" to "Directory" --- .../app/controllers/FiletreeController.java | 6 ++--- .../java/app/events/OpenProjectEvent.java | 8 +++--- src/main/java/app/service/DialogBoxes.java | 25 +++++++++++++++++++ .../java/app/service/FiletreeOperations.java | 2 +- .../app/service/FileTreeOperationsTest.java | 4 +-- 5 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/main/java/app/controllers/FiletreeController.java b/src/main/java/app/controllers/FiletreeController.java index 475663c..379815d 100644 --- a/src/main/java/app/controllers/FiletreeController.java +++ b/src/main/java/app/controllers/FiletreeController.java @@ -62,9 +62,9 @@ public class FiletreeController implements Initializable, Controller { } catch (Exception e) { Model.setProjectPath(Optional.empty()); DialogBoxes.showErrorMessage( - "Could not open folder.\n\n" - + "Do you have the right permissions for this folder?\n" - + "Or does the folder contain any shortcut to somewhere within itself?" + "Could not open directory.\n\n" + + "Do you have the right permissions for this directory?\n" + + "Or does the directory contain any shortcut to somewhere within itself?" ); } } diff --git a/src/main/java/app/events/OpenProjectEvent.java b/src/main/java/app/events/OpenProjectEvent.java index 51e857d..7076b56 100644 --- a/src/main/java/app/events/OpenProjectEvent.java +++ b/src/main/java/app/events/OpenProjectEvent.java @@ -6,15 +6,15 @@ import java.util.Optional; import app.model.Model; /** - * Event signalizing that a folder is supposed to be opened in the filetree. + * Event signalizing that a directory is supposed to be opened in the filetree. */ public class OpenProjectEvent extends Event { private Optional path; /** - * Event signalizing that a folder is supposed to be opened in the filetree. - * @param path The path of the folder to be opened + * Event signalizing that a directory is supposed to be opened in the filetree. + * @param path The path of the directory to be opened */ public OpenProjectEvent(Optional path) { this.path = path; @@ -22,7 +22,7 @@ public class OpenProjectEvent extends Event { } /** - * @return The path of the folder to be opened + * @return The path of the directory to be opened */ public Optional getPath() { return this.path; diff --git a/src/main/java/app/service/DialogBoxes.java b/src/main/java/app/service/DialogBoxes.java index f438db4..b57b7ba 100644 --- a/src/main/java/app/service/DialogBoxes.java +++ b/src/main/java/app/service/DialogBoxes.java @@ -9,6 +9,10 @@ import javafx.stage.DirectoryChooser; import javafx.stage.FileChooser; import javafx.stage.Stage; +/** + * Class containing static methods for different kinds of popup window interactions + * with the user. + */ public class DialogBoxes { private DialogBoxes() {} @@ -16,11 +20,24 @@ public class DialogBoxes { private static DirectoryChooser dc = new DirectoryChooser(); private static Alert error = new Alert(AlertType.ERROR); + /** + * Shows a specified message to the user with an error icon. + * + * @param errorMessage The message to show the user + */ public static void showErrorMessage(String errorMessage) { error.setContentText(errorMessage); error.showAndWait(); } + /** + * Shows an OS specific file chooser to choose a file on the disk + * + * @param stage The JavaFX stage to connect to the dialog box. This is needed + * for the window to be able to run on the JavaFX thread. + * + * @return The file chosen through the dialog window + */ public static File showopenFileWithDialog(Stage stage) { fc.setTitle("Open File"); File chosenFile = fc.showOpenDialog(stage); @@ -28,6 +45,14 @@ public class DialogBoxes { return chosenFile; } + /** + * Shows an OS specific directory chooser to choose a directory on the disk + * + * @param stage The JavaFX stage to connect to the dialog box. This is needed + * for the window to be able to run on the JavaFX thread. + * + * @return The file chosen through the dialog window + */ public static File showOpenFolderWithDialog(Stage stage) { dc.setTitle("Open Project"); File dir = dc.showDialog(stage); diff --git a/src/main/java/app/service/FiletreeOperations.java b/src/main/java/app/service/FiletreeOperations.java index b3fd749..75b68ef 100644 --- a/src/main/java/app/service/FiletreeOperations.java +++ b/src/main/java/app/service/FiletreeOperations.java @@ -71,7 +71,7 @@ public class FiletreeOperations { } /** - * A helping function to sort the files/folders in the fileTree so that it shows + * A helping function to sort the files/directories in the fileTree so that it shows * in the correct order. */ private static void sortFiles(List dirList, List fileList, File file) { diff --git a/src/test/java/app/service/FileTreeOperationsTest.java b/src/test/java/app/service/FileTreeOperationsTest.java index 6782fc9..bbc4013 100644 --- a/src/test/java/app/service/FileTreeOperationsTest.java +++ b/src/test/java/app/service/FileTreeOperationsTest.java @@ -41,8 +41,8 @@ public class FileTreeOperationsTest { } private void createRecursiveSymlink() throws IOException { - File folders = new File(tmp, "test/innerFolder/"); - folders.mkdirs(); + File dirs = new File(tmp, "test/innerFolder/"); + dirs.mkdirs(); Path target = Paths.get(tmp.toPath().toString(), "test"); Path link = Paths.get(tmp.toPath().toString(), "test/innerFolder/test");