changeset 7643:bade1b511bf6

[SCENEBUILDER] Updated EditorController to avoid SIC_INNER_SHOULD_BE_STATIC_ANON reported by FindBugs.
author Eric Le Ponner <eric.le.ponner@oracle.com>
date Fri, 08 Aug 2014 14:07:33 +0200
parents 16bd9070810c
children 62363aafe7c6
files apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/EditorController.java
diffstat 1 files changed, 4 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/EditorController.java	Fri Aug 08 12:02:25 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/EditorController.java	Fri Aug 08 14:07:33 2014 +0200
@@ -277,16 +277,6 @@
      */
     public EditorController() {
         jobManager.revisionProperty().addListener((ChangeListener<Number>) (ov, t, t1) -> jobManagerRevisionDidChange());
-        fxmlLocationProperty().addListener(new ChangeListener<URL>() {
-
-            @Override
-            public void changed(ObservableValue<? extends URL> observable, URL oldValue, URL newValue) {
-                if (newValue != null) {
-                    EditorController.updateNextInitialDirectory(new File(newValue.getPath()));
-                }
-            }
-
-        });
     }
 
     /**
@@ -435,6 +425,10 @@
             getFxomDocument().setLocation(fxmlLocation);
             clearUndoRedo(); // Because FXOMDocument.setLocation() mutates the document
         }
+        if (fxmlLocation != null) {
+            final File newInitialDirectory = new File(fxmlLocation.getPath());
+            EditorController.updateNextInitialDirectory(newInitialDirectory);
+        }
     }
     
     /**