private void saveFile() {
        if (isOpeningFile) { return; }
        File file;
        if (blueJInterface == null) {
            FileChooser fileChooser = new FileChooser();
            FileChooser.ExtensionFilter filter = new FileChooser.ExtensionFilter("FXML files (*.fxml)", "*.fxml");
            fileChooser.getExtensionFilters().add(filter);

            file = fileChooser.showSaveDialog(view.getStage());
        }
        else {
            file = new File(blueJInterface.getWorkingDirectory(), blueJInterface.getOpenGUIName() + ".fxml");
        }

        if (file != null) {
            if (!file.getName().toLowerCase().endsWith(".fxml")) {
                file = new File(file.getAbsoluteFile() + ".fxml");
            }

            try {
                FileWriter fileWriter = new FileWriter(file);
                fileWriter.write(CodeGenerator.generateFXMLCode(view.middleTabPane.viewPane, null));//We don't need the imports, for the minute...
                fileWriter.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        
        // Update BlueJ Java code
        if ( (blueJInterface != null) && (blueJInterface.isEditingGUI()) ) {
            // Write java code to GUI java file.
            try {
                FileWriter fileWriter = new FileWriter(blueJInterface.getOpenGUIFile());
                fileWriter.write(generateJavaCode());
                fileWriter.close();
            } catch (IOException e) {
                e.printStackTrace();
            }

            // Mark the file as dirty in BlueJ
            blueJInterface.markAsDirty();
        }
    }