if one tries to SaveAs now and projectpatch i selected, it will op there instead of deafult

This commit is contained in:
Oystein 2021-04-07 07:11:27 +02:00
parent 06397cc6cf
commit 509f5224b5
3 changed files with 8 additions and 4 deletions

View File

@ -161,7 +161,7 @@ public class EditorController implements Initializable, Controller {
} catch (FileNotFoundException ex) {
Alert error = new Alert(AlertType.ERROR);
error.setContentText("Could not be opened!\nMust be a java or md file. Try again.");
error.setContentText("Could not be opened!\nMust be a java or md file or not null. Try again.");
error.showAndWait();
System.err.println(filePath);
@ -183,7 +183,7 @@ public class EditorController implements Initializable, Controller {
} catch (FileNotFoundException ex) {
Alert error = new Alert(AlertType.ERROR);
error.setContentText("Could not save file!\nMust be a java or md file or not null. Try again.");
error.setContentText("Could not save file!\nMust be a java or md file. Try again.");
error.showAndWait();
System.err.println(filePath);

View File

@ -142,7 +142,8 @@ public class FiletreeController implements Initializable, Controller {
/* ------------------------------------------------------------------------ */
/**
* Handles whenever a filetree item is clicked twice.
* Handles whenever a filetree item is clicked twice. A while loop to create the
* correct filepath.
*/
@FXML
private void handleMouseClick(MouseEvent event) {

View File

@ -83,7 +83,7 @@ public class MenubarController implements Initializable, Controller {
}
/* ------------------------------------------------------------------------ */
/* OPEN FILE */
/* OPEN FILE/PROJECT */
/* ------------------------------------------------------------------------ */
/**
@ -148,6 +148,9 @@ public class MenubarController implements Initializable, Controller {
private void handleSaveAsFile() {
FileChooser fc = new FileChooser();
fc.setTitle("Save as");
if (Model.getProjectPath() != null) {
fc.setInitialDirectory(Model.getProjectPath().toFile());
}
Stage stage = (Stage) menubar.getScene().getWindow();
FileChooser.ExtensionFilter extJava = new FileChooser.ExtensionFilter("Java", "*.java");