changeset 7943:a0da8fd3717c

[SCENEBUILDER] Debug menu now displays sub jobs attached to UpdateReferencesJob.
author eric.le.ponner <eric.le.ponner@oracle.com>
date Tue, 02 Sep 2014 13:04:14 +0200
parents 92121f1d5ae1
children 1e20da46a3c7
files apps/scenebuilder/SceneBuilderApp/src/com/oracle/javafx/scenebuilder/app/menubar/DebugMenuController.java
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/apps/scenebuilder/SceneBuilderApp/src/com/oracle/javafx/scenebuilder/app/menubar/DebugMenuController.java	Tue Sep 02 13:02:08 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderApp/src/com/oracle/javafx/scenebuilder/app/menubar/DebugMenuController.java	Tue Sep 02 13:04:14 2014 +0200
@@ -39,6 +39,7 @@
 import com.oracle.javafx.scenebuilder.kit.editor.job.BatchJob;
 import com.oracle.javafx.scenebuilder.kit.editor.job.CompositeJob2;
 import com.oracle.javafx.scenebuilder.kit.editor.job.Job;
+import com.oracle.javafx.scenebuilder.kit.editor.job.reference.UpdateReferencesJob;
 import com.oracle.javafx.scenebuilder.kit.editor.panel.content.ContentPanelController;
 import com.oracle.javafx.scenebuilder.kit.editor.panel.util.dialog.ErrorDialog;
 import com.oracle.javafx.scenebuilder.kit.util.MathUtils;
@@ -221,6 +222,11 @@
             final Menu newMenu = new Menu(batchJob.getClass().getSimpleName());
             addJobMenuItems(batchJob.getSubJobs(), newMenu);
             result = newMenu;
+        } else if (job instanceof UpdateReferencesJob) {
+            final UpdateReferencesJob fixReferencesJob = (UpdateReferencesJob)job;
+            final Menu newMenu = new Menu(fixReferencesJob.getClass().getSimpleName());
+            addJobMenuItems(fixReferencesJob, newMenu);
+            result = newMenu;
         } else {
             result = new MenuItem(job.getClass().getSimpleName());
         }
@@ -229,7 +235,6 @@
     }
     
     private void addJobMenuItems(List<Job> jobs, Menu targetMenu) {
-        targetMenu.getItems().clear();
         for (Job job : jobs) {
             targetMenu.getItems().add(makeJobMenuItem(job));
         }
@@ -238,4 +243,14 @@
             targetMenu.getItems().add(makeMenuItem("Empty", true)); //NOI18N
         }
     }
+    
+    
+    private void addJobMenuItems(UpdateReferencesJob j, Menu targetMenu) {
+        targetMenu.getItems().add(makeJobMenuItem(j.getSubJob()));
+        final List<Job> fixJobs = j.getFixJobs();
+        if (fixJobs.isEmpty() == false) {
+            targetMenu.getItems().add(new SeparatorMenuItem());
+            addJobMenuItems(fixJobs, targetMenu);
+        }
+    }
 }