EventTests

This commit is contained in:
Oystein
2021-04-23 11:29:09 +02:00
parent 92fa16891c
commit 2e397fd971
7 changed files with 85 additions and 5 deletions

View File

@@ -103,7 +103,7 @@ public class MenubarController implements Initializable, Controller {
try {
File dir = FileOperations.openFolderWithDialog(stage);
this.eventBus.post(new OpenProjectEvent(dir.toPath()));
this.eventBus.post(new OpenProjectEvent(Optional.of(dir.toPath())));
} catch (FileNotFoundException e) {}
}

View File

@@ -10,21 +10,21 @@ import app.model.Model;
*/
public class OpenProjectEvent extends Event {
private Path path;
private Optional<Path> path;
/**
* Event signalizing that a folder is supposed to be opened in the filetree.
* @param path The path of the folder to be opened
*/
public OpenProjectEvent(Path path) {
public OpenProjectEvent(Optional<Path> path) {
this.path = path;
Model.setProjectPath(Optional.of(path));
Model.setProjectPath(path);
}
/**
* @return The path of the folder to be opened
*/
public Path getPath() {
public Optional<Path> getPath() {
return this.path;
}
}