11package edu .wpi .grip .ui ;
22
3+ import edu .wpi .grip .core .GripFileManager ;
34import edu .wpi .grip .core .Palette ;
45import edu .wpi .grip .core .Pipeline ;
56import edu .wpi .grip .core .PipelineRunner ;
3334import java .io .IOException ;
3435import java .util .Optional ;
3536import java .util .Set ;
36- import java .util .logging .Level ;
37- import java .util .logging .Logger ;
3837
3938import javafx .application .Platform ;
4039import javafx .fxml .FXML ;
6362 */
6463public class MainWindowController {
6564
66- private static final Logger logger = Logger .getLogger (MainWindowController .class .getName ());
67-
6865 @ FXML
6966 private Parent root ;
7067 @ FXML
@@ -154,11 +151,7 @@ private boolean showConfirmationDialogAndWait() {
154151 } else if (dialog .getResult ().equals (save )) {
155152 // If the user chose "Save", automatically show a save dialog and block until the user
156153 // has had a chance to save the project.
157- try {
158- return saveProject ();
159- } catch (IOException e ) {
160- logger .log (Level .SEVERE , e .getMessage (), e .getCause ());
161- }
154+ return saveProject ();
162155 }
163156 }
164157 return true ;
@@ -219,11 +212,10 @@ public void openProject() {
219212 * @return true if the user does not cancel the save
220213 */
221214 @ FXML
222- public boolean saveProject () throws IOException {
215+ public boolean saveProject () {
223216 if (project .getFile ().isPresent ()) {
224217 // Immediately save the project to whatever file it was loaded from or last saved to.
225- project .save (project .getFile ().get ());
226- return true ;
218+ return project .trySave (project .getFile ().get ());
227219 } else {
228220 return saveProjectAs ();
229221 }
@@ -237,10 +229,11 @@ public boolean saveProject() throws IOException {
237229 * @return true if the user does not cancel the save
238230 */
239231 @ FXML
240- public boolean saveProjectAs () throws IOException {
232+ public boolean saveProjectAs () {
241233 final FileChooser fileChooser = new FileChooser ();
242234 fileChooser .setTitle ("Save Project As" );
243235 fileChooser .getExtensionFilters ().add (new ExtensionFilter ("GRIP File" , "*.grip" ));
236+ fileChooser .setInitialDirectory (GripFileManager .GRIP_DIRECTORY );
244237
245238 project .getFile ().ifPresent (file -> fileChooser .setInitialDirectory (file .getParentFile ()));
246239
@@ -249,8 +242,7 @@ public boolean saveProjectAs() throws IOException {
249242 return false ;
250243 }
251244
252- project .save (file );
253- return true ;
245+ return project .trySave (file );
254246 }
255247
256248 @ FXML
0 commit comments